Browse Source

Replaced allocating lambda expression with a regular method.

fsr3framegen
Nico de Poel 2 years ago
parent
commit
4e29c3dfb4
  1. 19
      Runtime/FrameInterpolation/FrameInterpolationContext.cs

19
Runtime/FrameInterpolation/FrameInterpolationContext.cs

@ -196,14 +196,6 @@ namespace FidelityFX.FrameGen
// Schedule work for the interpolation command list
_setupPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, renderDispatchSizeX, renderDispatchSizeY);
// TODO delegates are reference types, i.e. this allocates some memory every frame
Action dispatchGameVectorFieldInpaintingPyramid = () =>
{
SetupSpdConstants(dispatchDescription.renderSize, out var dispatchThreadGroupCount);
commandBuffer.SetBufferData(_spdConstantsBuffer, _spdConstantsArray);
_gameVectorFieldInpaintingPyramidPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y);
};
// Only execute FG data preparation passes when reset wasn't triggered
if (executePreparationPasses)
{
@ -214,7 +206,7 @@ namespace FidelityFX.FrameGen
_reconstructPreviousDepthPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, renderDispatchSizeX, renderDispatchSizeY);
_gameMotionVectorFieldPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, renderDispatchSizeX, renderDispatchSizeY);
dispatchGameVectorFieldInpaintingPyramid();
DispatchGameVectorFieldInpaintingPyramid(commandBuffer, dispatchDescription, doubleBufferId);
_opticalFlowVectorFieldPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, opticalFlowDispatchSizeX, opticalFlowDispatchSizeY);
_disocclusionMaskPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, renderDispatchSizeX, renderDispatchSizeY);
}
@ -230,7 +222,7 @@ namespace FidelityFX.FrameGen
if ((dispatchDescription.flags & FrameInterpolation.DispatchFlags.DrawDebugView) != 0)
{
dispatchGameVectorFieldInpaintingPyramid();
DispatchGameVectorFieldInpaintingPyramid(commandBuffer, dispatchDescription, doubleBufferId);
_debugViewPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, displayDispatchSizeX, displayDispatchSizeY);
}
@ -241,6 +233,13 @@ namespace FidelityFX.FrameGen
commandBuffer.EndSample(_sampler);
}
private void DispatchGameVectorFieldInpaintingPyramid(CommandBuffer commandBuffer, FrameInterpolation.DispatchDescription dispatchDescription, int doubleBufferId)
{
SetupSpdConstants(dispatchDescription.renderSize, out var dispatchThreadGroupCount);
commandBuffer.SetBufferData(_spdConstantsBuffer, _spdConstantsArray);
_gameVectorFieldInpaintingPyramidPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y);
}
private Vector4 SetupDeviceDepthToViewSpaceDepthParams(FrameInterpolation.DispatchDescription dispatchParams)
{

Loading…
Cancel
Save