Browse Source

Ported velocity factor and exposure clear value from FSR 3.1.1 code

fsr3.1.1
Nico de Poel 1 year ago
parent
commit
f5ad170590
  1. 2
      Runtime/FSR3/Fsr3Upscaler.cs
  2. 8
      Runtime/FSR3/Fsr3UpscalerContext.cs

2
Runtime/FSR3/Fsr3Upscaler.cs

@ -265,6 +265,8 @@ namespace FidelityFX.FSR3
public float deltaPreExposure; public float deltaPreExposure;
public float viewSpaceToMetersFactor; public float viewSpaceToMetersFactor;
public float frameIndex; public float frameIndex;
public float velocityFactor;
} }
[Serializable, StructLayout(LayoutKind.Sequential)] [Serializable, StructLayout(LayoutKind.Sequential)]

8
Runtime/FSR3/Fsr3UpscalerContext.cs

@ -35,6 +35,11 @@ namespace FidelityFX.FSR3
{ {
private const int MaxQueuedFrames = 16; private const int MaxQueuedFrames = 16;
public float VelocityFactor
{
set => UpscalerConsts.velocityFactor = Mathf.Clamp01(value);
}
private Fsr3Upscaler.ContextDescription _contextDescription; private Fsr3Upscaler.ContextDescription _contextDescription;
private CommandBuffer _commandBuffer; private CommandBuffer _commandBuffer;
@ -96,6 +101,7 @@ namespace FidelityFX.FSR3
_resourceFrameIndex = 0; _resourceFrameIndex = 0;
UpscalerConsts.maxUpscaleSize = _contextDescription.MaxUpscaleSize; UpscalerConsts.maxUpscaleSize = _contextDescription.MaxUpscaleSize;
UpscalerConsts.velocityFactor = 1.0f;
_resources.Create(_contextDescription); _resources.Create(_contextDescription);
CreatePasses(); CreatePasses();
@ -232,7 +238,7 @@ namespace FidelityFX.FSR3
// Auto exposure always used to track luma changes in locking logic // Auto exposure always used to track luma changes in locking logic
commandBuffer.SetRenderTarget(_resources.FrameInfo); commandBuffer.SetRenderTarget(_resources.FrameInfo);
commandBuffer.ClearRenderTarget(false, true, new Color(0f, 1e8f, 0f, 0f));
commandBuffer.ClearRenderTarget(false, true, new Color(0f, 1f, 0f, 0f));
// Reset atomic counter to 0 // Reset atomic counter to 0
commandBuffer.SetRenderTarget(_resources.SpdAtomicCounter); commandBuffer.SetRenderTarget(_resources.SpdAtomicCounter);

Loading…
Cancel
Save