|
|
|
@ -164,7 +164,7 @@ namespace FidelityFX.FSR3 |
|
|
|
commandBuffer.ClearRenderTarget(false, true, Color.clear); |
|
|
|
} |
|
|
|
|
|
|
|
int frameIndex = _resourceFrameIndex % 2; |
|
|
|
int bufferIndex = _resourceFrameIndex % 2; |
|
|
|
bool resetAccumulation = dispatchParams.Reset || _firstExecution; |
|
|
|
_firstExecution = false; |
|
|
|
|
|
|
|
@ -183,7 +183,7 @@ namespace FidelityFX.FSR3 |
|
|
|
if (resetAccumulation) |
|
|
|
{ |
|
|
|
RenderTargetIdentifier opaqueOnly = dispatchParams.ColorOpaqueOnly.IsValid ? dispatchParams.ColorOpaqueOnly.RenderTarget : Fsr3ShaderIDs.SrvOpaqueOnly; |
|
|
|
commandBuffer.Blit(_resources.PrevPreAlpha[frameIndex ^ 1], opaqueOnly); |
|
|
|
commandBuffer.Blit(_resources.PrevPreAlpha[bufferIndex ^ 1], opaqueOnly); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (_resources.AutoReactive != null) |
|
|
|
@ -212,7 +212,7 @@ namespace FidelityFX.FSR3 |
|
|
|
// Clear reconstructed depth for max depth store
|
|
|
|
if (resetAccumulation) |
|
|
|
{ |
|
|
|
commandBuffer.SetRenderTarget(_resources.Accumulation[frameIndex ^ 1]); |
|
|
|
commandBuffer.SetRenderTarget(_resources.Accumulation[bufferIndex ^ 1]); |
|
|
|
commandBuffer.ClearRenderTarget(false, true, Color.clear); |
|
|
|
|
|
|
|
commandBuffer.SetRenderTarget(_resources.SpdMips); |
|
|
|
@ -242,19 +242,19 @@ namespace FidelityFX.FSR3 |
|
|
|
// Auto reactive
|
|
|
|
if (dispatchParams.EnableAutoReactive) |
|
|
|
{ |
|
|
|
GenerateTransparencyCompositionReactive(dispatchParams, commandBuffer, frameIndex); |
|
|
|
GenerateTransparencyCompositionReactive(dispatchParams, commandBuffer, bufferIndex); |
|
|
|
dispatchParams.Reactive = new ResourceView(_resources.AutoReactive); |
|
|
|
dispatchParams.TransparencyAndComposition = new ResourceView(_resources.AutoComposition); |
|
|
|
} |
|
|
|
|
|
|
|
_prepareInputsPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
_lumaPyramidPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
|
_shadingChangePyramidPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
|
_shadingChangePass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchShadingChangePassX, dispatchShadingChangePassY); |
|
|
|
_prepareReactivityPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
_lumaInstabilityPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
_prepareInputsPass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
_lumaPyramidPass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
|
_shadingChangePyramidPass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
|
_shadingChangePass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchShadingChangePassX, dispatchShadingChangePassY); |
|
|
|
_prepareReactivityPass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
_lumaInstabilityPass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
|
|
|
|
_accumulatePass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchDstX, dispatchDstY); |
|
|
|
_accumulatePass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchDstX, dispatchDstY); |
|
|
|
|
|
|
|
if (dispatchParams.EnableSharpening) |
|
|
|
{ |
|
|
|
@ -266,13 +266,13 @@ namespace FidelityFX.FSR3 |
|
|
|
const int threadGroupWorkRegionDimRcas = 16; |
|
|
|
int threadGroupsX = (upscaleSize.x + threadGroupWorkRegionDimRcas - 1) / threadGroupWorkRegionDimRcas; |
|
|
|
int threadGroupsY = (upscaleSize.y + threadGroupWorkRegionDimRcas - 1) / threadGroupWorkRegionDimRcas; |
|
|
|
_sharpenPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, threadGroupsX, threadGroupsY); |
|
|
|
_sharpenPass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, threadGroupsX, threadGroupsY); |
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
|
|
|
if ((dispatchParams.Flags & Fsr3Upscaler.DispatchFlags.DrawDebugView) != 0) |
|
|
|
{ |
|
|
|
_debugViewPass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchDstX, dispatchDstY); |
|
|
|
_debugViewPass.ScheduleDispatch(commandBuffer, dispatchParams, bufferIndex, dispatchDstX, dispatchDstY); |
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|
|