Browse Source

Merge branch 'master' into fsr3.1

fsr3.1
Nico de Poel 2 years ago
parent
commit
ca3acef3eb
  1. 10
      Assets/Scripts/Fsr3UpscalerImageEffect.cs
  2. 8
      Packages/com.unity.postprocessing/PostProcessing/Runtime/Effects/SuperResolution.cs

10
Assets/Scripts/Fsr3UpscalerImageEffect.cs

@ -312,7 +312,7 @@ namespace FidelityFX
{
// Set up the main FSR3 Upscaler dispatch parameters
_dispatchDescription.Color = new ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color);
_dispatchDescription.Depth = new ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
_dispatchDescription.Depth = new ResourceView(GetDepthTexture(), RenderTextureSubElement.Depth);
_dispatchDescription.MotionVectors = new ResourceView(BuiltinRenderTextureType.MotionVectors);
_dispatchDescription.Exposure = ResourceView.Unassigned;
_dispatchDescription.Reactive = ResourceView.Unassigned;
@ -417,7 +417,7 @@ namespace FidelityFX
if (_originalRenderTarget != null)
{
// Output to the camera target texture, passing through depth as well
_dispatchCommandBuffer.SetGlobalTexture("_DepthTex", BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
_dispatchCommandBuffer.SetGlobalTexture("_DepthTex", GetDepthTexture(), RenderTextureSubElement.Depth);
_dispatchCommandBuffer.Blit(Fsr3ShaderIDs.UavUpscaledOutput, _originalRenderTarget, _copyWithDepthMaterial);
}
else
@ -449,6 +449,12 @@ namespace FidelityFX
return _renderCamera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
}
private BuiltinRenderTextureType GetDepthTexture()
{
RenderingPath renderingPath = _renderCamera.renderingPath;
return renderingPath == RenderingPath.Forward || renderingPath == RenderingPath.VertexLit ? BuiltinRenderTextureType.Depth : BuiltinRenderTextureType.CameraTarget;
}
private Vector2Int GetDisplaySize()
{
if (_originalRenderTarget != null)

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

@ -268,7 +268,7 @@ namespace UnityEngine.Rendering.PostProcessing
// Set up the main FSR3 Upscaler dispatch parameters
_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.Exposure = 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));
}
private static BuiltinRenderTextureType GetDepthTexture(Camera cam)
{
RenderingPath renderingPath = cam.renderingPath;
return renderingPath == RenderingPath.Forward || renderingPath == RenderingPath.VertexLit ? BuiltinRenderTextureType.Depth : BuiltinRenderTextureType.CameraTarget;
}
}
}
Loading…
Cancel
Save