Browse Source

Re-added transparency & composition parameter, even though we never use it and just fall back to the default reactivity mask, we officially support it as an input now.

mac-autoexp
Nico de Poel 3 years ago
parent
commit
8f1be6d3e6
  1. 1
      Assets/Scripts/Fsr2.cs
  2. 1
      Assets/Scripts/Fsr2Context.cs
  3. 6
      Assets/Scripts/Fsr2Controller.cs
  4. 4
      Assets/Scripts/Fsr2Pipeline.cs

1
Assets/Scripts/Fsr2.cs

@ -152,6 +152,7 @@ namespace FidelityFX
public RenderTargetIdentifier? MotionVectors; public RenderTargetIdentifier? MotionVectors;
public RenderTargetIdentifier? Exposure; public RenderTargetIdentifier? Exposure;
public RenderTargetIdentifier? Reactive; public RenderTargetIdentifier? Reactive;
public RenderTargetIdentifier? TransparencyAndComposition;
public RenderTargetIdentifier? Output; public RenderTargetIdentifier? Output;
public Vector2 JitterOffset; public Vector2 JitterOffset;
public Vector2 MotionVectorScale; public Vector2 MotionVectorScale;

1
Assets/Scripts/Fsr2Context.cs

@ -130,6 +130,7 @@ namespace FidelityFX
// TODO: auto-exposure flag // TODO: auto-exposure flag
if (dispatchParams.Exposure == null) dispatchParams.Exposure = _resources.DefaultExposure; if (dispatchParams.Exposure == null) dispatchParams.Exposure = _resources.DefaultExposure;
if (dispatchParams.Reactive == null) dispatchParams.Reactive = _resources.DefaultReactive; if (dispatchParams.Reactive == null) dispatchParams.Reactive = _resources.DefaultReactive;
if (dispatchParams.TransparencyAndComposition == null) dispatchParams.TransparencyAndComposition = _resources.DefaultReactive;
Fsr2Pipeline.RegisterResources(commandBuffer, _contextDescription, dispatchParams); Fsr2Pipeline.RegisterResources(commandBuffer, _contextDescription, dispatchParams);
SetupConstants(dispatchParams, resetAccumulation); SetupConstants(dispatchParams, resetAccumulation);

6
Assets/Scripts/Fsr2Controller.cs

@ -165,6 +165,7 @@ namespace FidelityFX
_renderCamera.aspect = (Screen.width * _originalRect.width) / (Screen.height * _originalRect.height); _renderCamera.aspect = (Screen.width * _originalRect.width) / (Screen.height * _originalRect.height);
_renderCamera.rect = new Rect(0, 0, _originalRect.width * _renderSize.x / _displaySize.x, _originalRect.height * _renderSize.y / _displaySize.y); _renderCamera.rect = new Rect(0, 0, _originalRect.width * _renderSize.x / _displaySize.x, _originalRect.height * _renderSize.y / _displaySize.y);
// Set up the parameters to auto-generate a reactive mask
if (generateReactiveMask) if (generateReactiveMask)
{ {
_genReactiveDescription.ColorOpaqueOnly = null; _genReactiveDescription.ColorOpaqueOnly = null;
@ -177,12 +178,15 @@ namespace FidelityFX
_genReactiveDescription.Flags = generateReactiveParameters.flags; _genReactiveDescription.Flags = generateReactiveParameters.flags;
} }
// Set up the main FSR2 dispatch parameters
// The input and output textures are left blank here, as they are already being bound elsewhere in this source file
_dispatchDescription.Color = null; _dispatchDescription.Color = null;
_dispatchDescription.Depth = null; _dispatchDescription.Depth = null;
_dispatchDescription.MotionVectors = null; _dispatchDescription.MotionVectors = null;
_dispatchDescription.Output = null;
_dispatchDescription.Exposure = null; _dispatchDescription.Exposure = null;
_dispatchDescription.Reactive = null; _dispatchDescription.Reactive = null;
_dispatchDescription.TransparencyAndComposition = null;
_dispatchDescription.Output = null;
_dispatchDescription.PreExposure = 0; _dispatchDescription.PreExposure = 0;
_dispatchDescription.EnableSharpening = performSharpenPass; _dispatchDescription.EnableSharpening = performSharpenPass;
_dispatchDescription.Sharpness = sharpness; _dispatchDescription.Sharpness = sharpness;

4
Assets/Scripts/Fsr2Pipeline.cs

@ -260,10 +260,12 @@ namespace FidelityFX
if (dispatchParams.Reactive.HasValue) if (dispatchParams.Reactive.HasValue)
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvReactiveMask, dispatchParams.Reactive.Value); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvReactiveMask, dispatchParams.Reactive.Value);
if (dispatchParams.TransparencyAndComposition.HasValue)
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvTransparencyAndCompositionMask, dispatchParams.TransparencyAndComposition.Value);
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvReconstructedPrevNearestDepth, UavReconstructedPrevNearestDepth); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvReconstructedPrevNearestDepth, UavReconstructedPrevNearestDepth);
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]);
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvDilatedDepth, UavDilatedDepth); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvDilatedDepth, UavDilatedDepth);
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvTransparencyAndCompositionMask, Resources.DefaultReactive); // Default reactive mask, as we don't support TCR (yet)
commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvPrevDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex ^ 1]); commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, SrvPrevDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex ^ 1]);
commandBuffer.SetComputeConstantBufferParam(ComputeShader, CbFsr2, Constants, 0, Marshal.SizeOf<Fsr2.Fsr2Constants>()); commandBuffer.SetComputeConstantBufferParam(ComputeShader, CbFsr2, Constants, 0, Marshal.SizeOf<Fsr2.Fsr2Constants>());

Loading…
Cancel
Save