Skip to content

Commit 41e94e6

Browse files
committed
Bugfix to DepthBufferMipChainInfo - previously the calculated offset, and more importantly, size and limit values would be incorrect if render target scaling was occuring - it would use the unscaled size.
1 parent 0fde80a commit 41e94e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest,
3939

4040
// We need to initalize the MipChainInfo here, so it will be available to any render graph pass that wants to use it during setup
4141
// Be careful, ComputePackedMipChainInfo needs the render texture size and not the viewport size. Otherwise it would compute the wrong size.
42-
m_DepthBufferMipChainInfo.ComputePackedMipChainInfo(RTHandles.rtHandleProperties.currentRenderTargetSize);
42+
Vector2Int viewportSize = new Vector2Int(
43+
Mathf.RoundToInt(RTHandles.rtHandleProperties.currentRenderTargetSize.x * RTHandles.rtHandleProperties.rtHandleScale.x),
44+
Mathf.RoundToInt(RTHandles.rtHandleProperties.currentRenderTargetSize.y * RTHandles.rtHandleProperties.rtHandleScale.y)
45+
);
46+
m_DepthBufferMipChainInfo.ComputePackedMipChainInfo(viewportSize);
4347

4448
#if UNITY_EDITOR
4549
var showGizmos = camera.cameraType == CameraType.Game

0 commit comments

Comments
 (0)