Browse Source

Fixed incorrect scaled render size during FSR dispatch because of course, global variables and side-effects are bad m'kay.

At least dynamic scaling works now, so we can go from here.
fsr2
Nico de Poel 3 years ago
parent
commit
2bbb4f3a1f
  1. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs
  2. 7
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs

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

@ -294,7 +294,7 @@ namespace UnityEngine.Rendering.PostProcessing
_dispatchDescription.MotionVectorScale.x = -scaledRenderSize.x;
_dispatchDescription.MotionVectorScale.y = -scaledRenderSize.y;
_dispatchDescription.RenderSize = scaledRenderSize;
_dispatchDescription.InputResourceSize = scaledRenderSize;
_dispatchDescription.InputResourceSize = _maxRenderSize;
_dispatchDescription.FrameTimeDelta = Time.unscaledDeltaTime;
_dispatchDescription.CameraNear = camera.nearClipPlane;
_dispatchDescription.CameraFar = camera.farClipPlane;

7
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs

@ -1188,17 +1188,20 @@ namespace UnityEngine.Rendering.PostProcessing
// Set the upscaler's output to full display resolution, as well as for all following post-processing effects
context.SetRenderSize(superResolution.displaySize);
RuntimeUtilities.EnableDynamicResolution = false;
var fsrTarget = m_TargetPool.Get();
var finalDestination = context.destination;
RuntimeUtilities.EnableDynamicResolution = false;
context.GetScreenSpaceTemporaryRT(cmd, fsrTarget, 0, context.sourceFormat, enableRandomWrite: true);
context.destination = fsrTarget;
superResolution.colorOpaqueOnly = m_opaqueOnly;
RuntimeUtilities.EnableDynamicResolution = true;
superResolution.Render(context);
context.source = fsrTarget;
context.destination = finalDestination;
RuntimeUtilities.EnableDynamicResolution = false;
if (lastTarget > -1)
cmd.ReleaseTemporaryRT(lastTarget);

Loading…
Cancel
Save