Browse Source

Fixed an issue that would cause the wrong depth buffer to be passed to FSR when using forward rendering on newer Unity versions.

dec2024update
Nico de Poel 2 years ago
parent
commit
31eb875b79
  1. 1
      Assets/Scenes/SampleScenePPV2.unity
  2. 8
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs
  3. 2
      Packages/fidelityfx.fsr

1
Assets/Scenes/SampleScenePPV2.unity

@ -354,6 +354,7 @@ MonoBehaviour:
exposureSource: 1 exposureSource: 1
preExposure: 1 preExposure: 1
exposure: {fileID: 0} exposure: {fileID: 0}
enableDebugView: 0
reactiveMask: {fileID: 0} reactiveMask: {fileID: 0}
transparencyAndCompositionMask: {fileID: 0} transparencyAndCompositionMask: {fileID: 0}
autoGenerateReactiveMask: 1 autoGenerateReactiveMask: 1

8
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs

@ -268,7 +268,7 @@ namespace UnityEngine.Rendering.PostProcessing
// Set up the main FSR3 Upscaler dispatch parameters // Set up the main FSR3 Upscaler dispatch parameters
_dispatchDescription.Color = new ResourceView(context.source); _dispatchDescription.Color = new ResourceView(context.source);
_dispatchDescription.Depth = new ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
_dispatchDescription.Depth = new ResourceView(GetDepthTexture(context.camera), RenderTextureSubElement.Depth);
_dispatchDescription.MotionVectors = new ResourceView(BuiltinRenderTextureType.MotionVectors); _dispatchDescription.MotionVectors = new ResourceView(BuiltinRenderTextureType.MotionVectors);
_dispatchDescription.Exposure = ResourceView.Unassigned; _dispatchDescription.Exposure = ResourceView.Unassigned;
_dispatchDescription.Reactive = ResourceView.Unassigned; _dispatchDescription.Reactive = ResourceView.Unassigned;
@ -335,5 +335,11 @@ namespace UnityEngine.Rendering.PostProcessing
return new Vector2Int(Mathf.CeilToInt(_maxRenderSize.x * ScalableBufferManager.widthScaleFactor), Mathf.CeilToInt(_maxRenderSize.y * ScalableBufferManager.heightScaleFactor)); return new Vector2Int(Mathf.CeilToInt(_maxRenderSize.x * ScalableBufferManager.widthScaleFactor), Mathf.CeilToInt(_maxRenderSize.y * ScalableBufferManager.heightScaleFactor));
} }
private static BuiltinRenderTextureType GetDepthTexture(Camera cam)
{
RenderingPath renderingPath = cam.renderingPath;
return renderingPath == RenderingPath.Forward || renderingPath == RenderingPath.VertexLit ? BuiltinRenderTextureType.Depth : BuiltinRenderTextureType.CameraTarget;
}
} }
} }

2
Packages/fidelityfx.fsr

@ -1 +1 @@
Subproject commit bbe7290356ad95c08851b7b39074eb34d9291ab3
Subproject commit 66da324538217441ce3c486441108976abb7ab8d
Loading…
Cancel
Save