|
|
@ -7,7 +7,7 @@ using UnityEngine.Rendering; |
|
|
|
|
|
|
|
|
namespace FidelityFX.FrameGen |
|
|
namespace FidelityFX.FrameGen |
|
|
{ |
|
|
{ |
|
|
public class FrameInterpolationContext |
|
|
|
|
|
|
|
|
public class FrameInterpolationContext: FfxContextBase |
|
|
{ |
|
|
{ |
|
|
private FrameInterpolation.ContextDescription _contextDescription; |
|
|
private FrameInterpolation.ContextDescription _contextDescription; |
|
|
|
|
|
|
|
|
@ -24,14 +24,9 @@ namespace FidelityFX.FrameGen |
|
|
private FrameInterpolationPass _debugViewPass; |
|
|
private FrameInterpolationPass _debugViewPass; |
|
|
|
|
|
|
|
|
private readonly FrameInterpolationResources _resources = new FrameInterpolationResources(); |
|
|
private readonly FrameInterpolationResources _resources = new FrameInterpolationResources(); |
|
|
|
|
|
|
|
|
private ComputeBuffer _frameInterpolationConstantsBuffer; |
|
|
|
|
|
private readonly FrameInterpolation.Constants[] _frameInterpolationConstantsArray = { new FrameInterpolation.Constants() }; |
|
|
|
|
|
private ref FrameInterpolation.Constants Constants => ref _frameInterpolationConstantsArray[0]; |
|
|
|
|
|
|
|
|
|
|
|
private ComputeBuffer _spdConstantsBuffer; |
|
|
|
|
|
private readonly FrameInterpolation.InpaintingPyramidConstants[] _spdConstantsArray = { new FrameInterpolation.InpaintingPyramidConstants() }; |
|
|
|
|
|
private ref FrameInterpolation.InpaintingPyramidConstants SpdConstants => ref _spdConstantsArray[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ConstantsBuffer<FrameInterpolation.Constants> _frameInterpolationConstants = new ConstantsBuffer<FrameInterpolation.Constants>(); |
|
|
|
|
|
private readonly ConstantsBuffer<FrameInterpolation.InpaintingPyramidConstants> _spdConstants = new ConstantsBuffer<FrameInterpolation.InpaintingPyramidConstants>(); |
|
|
|
|
|
|
|
|
private readonly CustomSampler _sampler = CustomSampler.Create("Frame Interpolation"); |
|
|
private readonly CustomSampler _sampler = CustomSampler.Create("Frame Interpolation"); |
|
|
private readonly CustomSampler _prepareSampler = CustomSampler.Create("Frame Interpolation - Prepare"); |
|
|
private readonly CustomSampler _prepareSampler = CustomSampler.Create("Frame Interpolation - Prepare"); |
|
|
@ -44,19 +39,20 @@ namespace FidelityFX.FrameGen |
|
|
{ |
|
|
{ |
|
|
_contextDescription = contextDescription; |
|
|
_contextDescription = contextDescription; |
|
|
|
|
|
|
|
|
_frameInterpolationConstantsBuffer = CreateConstantBuffer<FrameInterpolation.Constants>(); |
|
|
|
|
|
_spdConstantsBuffer = CreateConstantBuffer<FrameInterpolation.InpaintingPyramidConstants>(); |
|
|
|
|
|
|
|
|
_frameInterpolationConstants.Create(); |
|
|
|
|
|
_spdConstants.Create(); |
|
|
|
|
|
|
|
|
_firstExecution = true; |
|
|
_firstExecution = true; |
|
|
_previousFrameID = 0; |
|
|
_previousFrameID = 0; |
|
|
_asyncSupported = (_contextDescription.flags & FrameInterpolation.InitializationFlags.EnableAsyncSupport) == FrameInterpolation.InitializationFlags.EnableAsyncSupport; |
|
|
_asyncSupported = (_contextDescription.flags & FrameInterpolation.InitializationFlags.EnableAsyncSupport) == FrameInterpolation.InitializationFlags.EnableAsyncSupport; |
|
|
|
|
|
|
|
|
Constants.maxRenderSize = _contextDescription.maxRenderSize; |
|
|
|
|
|
Constants.displaySize = _contextDescription.displaySize; |
|
|
|
|
|
Constants.displaySizeRcp.x = 1.0f / _contextDescription.displaySize.x; |
|
|
|
|
|
Constants.displaySizeRcp.y = 1.0f / _contextDescription.displaySize.y; |
|
|
|
|
|
Constants.interpolationRectBase = Vector2Int.zero; |
|
|
|
|
|
Constants.interpolationRectSize = _contextDescription.displaySize; |
|
|
|
|
|
|
|
|
ref var constants = ref _frameInterpolationConstants.Value; |
|
|
|
|
|
constants.maxRenderSize = _contextDescription.maxRenderSize; |
|
|
|
|
|
constants.displaySize = _contextDescription.displaySize; |
|
|
|
|
|
constants.displaySizeRcp.x = 1.0f / _contextDescription.displaySize.x; |
|
|
|
|
|
constants.displaySizeRcp.y = 1.0f / _contextDescription.displaySize.y; |
|
|
|
|
|
constants.interpolationRectBase = Vector2Int.zero; |
|
|
|
|
|
constants.interpolationRectSize = _contextDescription.displaySize; |
|
|
|
|
|
|
|
|
_resources.Create(_contextDescription); |
|
|
_resources.Create(_contextDescription); |
|
|
CreatePasses(); |
|
|
CreatePasses(); |
|
|
@ -64,17 +60,17 @@ namespace FidelityFX.FrameGen |
|
|
|
|
|
|
|
|
private void CreatePasses() |
|
|
private void CreatePasses() |
|
|
{ |
|
|
{ |
|
|
_reconstructAndDilatePass = new FrameInterpolationReconstructAndDilatePass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_setupPass = new FrameInterpolationSetupPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_reconstructPreviousDepthPass = new FrameInterpolationReconstructPreviousDepthPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_gameMotionVectorFieldPass = new FrameInterpolationGameMotionVectorFieldPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_opticalFlowVectorFieldPass = new FrameInterpolationOpticalFlowVectorFieldPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_disocclusionMaskPass = new FrameInterpolationDisocclusionMaskPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_interpolationPass = new FrameInterpolationInterpolationPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_inpaintingPyramidPass = new FrameInterpolationInpaintingPyramidPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer, _spdConstantsBuffer); |
|
|
|
|
|
_inpaintingPass = new FrameInterpolationInpaintingPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
_gameVectorFieldInpaintingPyramidPass = new FrameInterpolationGameVectorFieldInpaintingPyramidPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer, _spdConstantsBuffer); |
|
|
|
|
|
_debugViewPass = new FrameInterpolationDebugViewPass(_contextDescription, _resources, _frameInterpolationConstantsBuffer); |
|
|
|
|
|
|
|
|
_reconstructAndDilatePass = new FrameInterpolationReconstructAndDilatePass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_setupPass = new FrameInterpolationSetupPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_reconstructPreviousDepthPass = new FrameInterpolationReconstructPreviousDepthPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_gameMotionVectorFieldPass = new FrameInterpolationGameMotionVectorFieldPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_opticalFlowVectorFieldPass = new FrameInterpolationOpticalFlowVectorFieldPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_disocclusionMaskPass = new FrameInterpolationDisocclusionMaskPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_interpolationPass = new FrameInterpolationInterpolationPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_inpaintingPyramidPass = new FrameInterpolationInpaintingPyramidPass(_contextDescription, _resources, _frameInterpolationConstants, _spdConstants); |
|
|
|
|
|
_inpaintingPass = new FrameInterpolationInpaintingPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
|
|
|
_gameVectorFieldInpaintingPyramidPass = new FrameInterpolationGameVectorFieldInpaintingPyramidPass(_contextDescription, _resources, _frameInterpolationConstants, _spdConstants); |
|
|
|
|
|
_debugViewPass = new FrameInterpolationDebugViewPass(_contextDescription, _resources, _frameInterpolationConstants); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Destroy() |
|
|
public void Destroy() |
|
|
@ -93,8 +89,8 @@ namespace FidelityFX.FrameGen |
|
|
|
|
|
|
|
|
_resources.Destroy(); |
|
|
_resources.Destroy(); |
|
|
|
|
|
|
|
|
DestroyConstantBuffer(ref _spdConstantsBuffer); |
|
|
|
|
|
DestroyConstantBuffer(ref _frameInterpolationConstantsBuffer); |
|
|
|
|
|
|
|
|
_spdConstants.Destroy(); |
|
|
|
|
|
_frameInterpolationConstants.Destroy(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Prepare(CommandBuffer commandBuffer, FrameInterpolation.PrepareDescription prepareDescription) |
|
|
public void Prepare(CommandBuffer commandBuffer, FrameInterpolation.PrepareDescription prepareDescription) |
|
|
@ -103,13 +99,14 @@ namespace FidelityFX.FrameGen |
|
|
|
|
|
|
|
|
int doubleBufferId = _asyncSupported ? (int)(prepareDescription.frameID & 1) : 0; |
|
|
int doubleBufferId = _asyncSupported ? (int)(prepareDescription.frameID & 1) : 0; |
|
|
|
|
|
|
|
|
Constants.renderSize = prepareDescription.renderSize; |
|
|
|
|
|
Constants.jitter = prepareDescription.jitterOffset; |
|
|
|
|
|
Vector2Int motionVectorsTargetSize = (_contextDescription.flags & FrameInterpolation.InitializationFlags.EnableDisplayResolutionMotionVectors) != 0 ? Constants.displaySize : Constants.renderSize; |
|
|
|
|
|
Constants.motionVectorScale.x = prepareDescription.motionVectorScale.x / motionVectorsTargetSize.x; |
|
|
|
|
|
Constants.motionVectorScale.y = prepareDescription.motionVectorScale.y / motionVectorsTargetSize.y; |
|
|
|
|
|
|
|
|
ref var constants = ref _frameInterpolationConstants.Value; |
|
|
|
|
|
constants.renderSize = prepareDescription.renderSize; |
|
|
|
|
|
constants.jitter = prepareDescription.jitterOffset; |
|
|
|
|
|
Vector2Int motionVectorsTargetSize = (_contextDescription.flags & FrameInterpolation.InitializationFlags.EnableDisplayResolutionMotionVectors) != 0 ? constants.displaySize : constants.renderSize; |
|
|
|
|
|
constants.motionVectorScale.x = prepareDescription.motionVectorScale.x / motionVectorsTargetSize.x; |
|
|
|
|
|
constants.motionVectorScale.y = prepareDescription.motionVectorScale.y / motionVectorsTargetSize.y; |
|
|
|
|
|
|
|
|
commandBuffer.SetBufferData(_frameInterpolationConstantsBuffer, _frameInterpolationConstantsArray); |
|
|
|
|
|
|
|
|
_frameInterpolationConstants.UpdateBufferData(commandBuffer); |
|
|
|
|
|
|
|
|
Assert.IsTrue(prepareDescription.depth.IsValid); |
|
|
Assert.IsTrue(prepareDescription.depth.IsValid); |
|
|
Assert.IsTrue(prepareDescription.motionVectors.IsValid); |
|
|
Assert.IsTrue(prepareDescription.motionVectors.IsValid); |
|
|
@ -142,41 +139,42 @@ namespace FidelityFX.FrameGen |
|
|
bool disjointFrameId = frameIdDecreased || frameIdSkipped; |
|
|
bool disjointFrameId = frameIdDecreased || frameIdSkipped; |
|
|
_previousFrameID = dispatchDescription.frameID; |
|
|
_previousFrameID = dispatchDescription.frameID; |
|
|
|
|
|
|
|
|
Constants.renderSize = dispatchDescription.renderSize; |
|
|
|
|
|
Constants.displaySize = dispatchDescription.displaySize; |
|
|
|
|
|
Constants.displaySizeRcp.x = 1.0f / dispatchDescription.displaySize.x; |
|
|
|
|
|
Constants.displaySizeRcp.y = 1.0f / dispatchDescription.displaySize.y; |
|
|
|
|
|
Constants.upscalerTargetSize = dispatchDescription.interpolationRect.size; |
|
|
|
|
|
Constants.mode = 0; |
|
|
|
|
|
Constants.reset = (reset || disjointFrameId) ? 1 : 0; |
|
|
|
|
|
Constants.deltaTime = dispatchDescription.frameTimeDelta; |
|
|
|
|
|
Constants.HUDLessAttachedFactor = dispatchDescription.currentBackBuffer_HUDLess.IsValid ? 1 : 0; |
|
|
|
|
|
|
|
|
ref var constants = ref _frameInterpolationConstants.Value; |
|
|
|
|
|
constants.renderSize = dispatchDescription.renderSize; |
|
|
|
|
|
constants.displaySize = dispatchDescription.displaySize; |
|
|
|
|
|
constants.displaySizeRcp.x = 1.0f / dispatchDescription.displaySize.x; |
|
|
|
|
|
constants.displaySizeRcp.y = 1.0f / dispatchDescription.displaySize.y; |
|
|
|
|
|
constants.upscalerTargetSize = dispatchDescription.interpolationRect.size; |
|
|
|
|
|
constants.mode = 0; |
|
|
|
|
|
constants.reset = (reset || disjointFrameId) ? 1 : 0; |
|
|
|
|
|
constants.deltaTime = dispatchDescription.frameTimeDelta; |
|
|
|
|
|
constants.HUDLessAttachedFactor = dispatchDescription.currentBackBuffer_HUDLess.IsValid ? 1 : 0; |
|
|
|
|
|
|
|
|
Constants.opticalFlowScale = dispatchDescription.opticalFlowScale; |
|
|
|
|
|
Constants.opticalFlowBlockSize = dispatchDescription.opticalFlowBlockSize; |
|
|
|
|
|
Constants.dispatchFlags = (uint)dispatchDescription.flags; |
|
|
|
|
|
|
|
|
constants.opticalFlowScale = dispatchDescription.opticalFlowScale; |
|
|
|
|
|
constants.opticalFlowBlockSize = dispatchDescription.opticalFlowBlockSize; |
|
|
|
|
|
constants.dispatchFlags = (uint)dispatchDescription.flags; |
|
|
|
|
|
|
|
|
Constants.cameraNear = dispatchDescription.cameraNear; |
|
|
|
|
|
Constants.cameraFar = dispatchDescription.cameraFar; |
|
|
|
|
|
|
|
|
constants.cameraNear = dispatchDescription.cameraNear; |
|
|
|
|
|
constants.cameraFar = dispatchDescription.cameraFar; |
|
|
|
|
|
|
|
|
Constants.interpolationRectBase = dispatchDescription.interpolationRect.position; |
|
|
|
|
|
Constants.interpolationRectSize = dispatchDescription.interpolationRect.size; |
|
|
|
|
|
|
|
|
constants.interpolationRectBase = dispatchDescription.interpolationRect.position; |
|
|
|
|
|
constants.interpolationRectSize = dispatchDescription.interpolationRect.size; |
|
|
|
|
|
|
|
|
// Debug bar
|
|
|
// Debug bar
|
|
|
Constants.debugBarColor.x = DebugBarColorSequence[_debugIndex * 3 + 0]; |
|
|
|
|
|
Constants.debugBarColor.y = DebugBarColorSequence[_debugIndex * 3 + 1]; |
|
|
|
|
|
Constants.debugBarColor.z = DebugBarColorSequence[_debugIndex * 3 + 2]; |
|
|
|
|
|
|
|
|
constants.debugBarColor.x = DebugBarColorSequence[_debugIndex * 3 + 0]; |
|
|
|
|
|
constants.debugBarColor.y = DebugBarColorSequence[_debugIndex * 3 + 1]; |
|
|
|
|
|
constants.debugBarColor.z = DebugBarColorSequence[_debugIndex * 3 + 2]; |
|
|
_debugIndex = (_debugIndex + 1) % (DebugBarColorSequence.Length / 3); |
|
|
_debugIndex = (_debugIndex + 1) % (DebugBarColorSequence.Length / 3); |
|
|
|
|
|
|
|
|
Constants.backBufferTransferFunction = (uint)dispatchDescription.backbufferTransferFunction; |
|
|
|
|
|
Constants.minMaxLuminance = dispatchDescription.minMaxLuminance; |
|
|
|
|
|
|
|
|
constants.backBufferTransferFunction = (uint)dispatchDescription.backbufferTransferFunction; |
|
|
|
|
|
constants.minMaxLuminance = dispatchDescription.minMaxLuminance; |
|
|
|
|
|
|
|
|
float aspectRatio = dispatchDescription.renderSize.x / (float)dispatchDescription.renderSize.y; |
|
|
float aspectRatio = dispatchDescription.renderSize.x / (float)dispatchDescription.renderSize.y; |
|
|
float cameraAngleHorizontal = Mathf.Atan(Mathf.Tan(dispatchDescription.cameraFovAngleVertical / 2) * aspectRatio) * 2; |
|
|
float cameraAngleHorizontal = Mathf.Atan(Mathf.Tan(dispatchDescription.cameraFovAngleVertical / 2) * aspectRatio) * 2; |
|
|
Constants.tanHalfFOV = Mathf.Tan(cameraAngleHorizontal * 0.5f); |
|
|
|
|
|
Constants.deviceToViewDepth = SetupDeviceDepthToViewSpaceDepthParams(dispatchDescription); |
|
|
|
|
|
|
|
|
constants.tanHalfFOV = Mathf.Tan(cameraAngleHorizontal * 0.5f); |
|
|
|
|
|
constants.deviceToViewDepth = SetupDeviceDepthToViewSpaceDepthParams(dispatchDescription); |
|
|
|
|
|
|
|
|
commandBuffer.SetBufferData(_frameInterpolationConstantsBuffer, _frameInterpolationConstantsArray); |
|
|
|
|
|
|
|
|
_frameInterpolationConstants.UpdateBufferData(commandBuffer); |
|
|
|
|
|
|
|
|
int doubleBufferId = _asyncSupported ? (int)(dispatchDescription.frameID & 1) : 0; |
|
|
int doubleBufferId = _asyncSupported ? (int)(dispatchDescription.frameID & 1) : 0; |
|
|
|
|
|
|
|
|
@ -189,7 +187,7 @@ namespace FidelityFX.FrameGen |
|
|
int opticalFlowDispatchSizeX = (int)(dispatchDescription.displaySize.x / (float)dispatchDescription.opticalFlowBlockSize + 7) / 8; |
|
|
int opticalFlowDispatchSizeX = (int)(dispatchDescription.displaySize.x / (float)dispatchDescription.opticalFlowBlockSize + 7) / 8; |
|
|
int opticalFlowDispatchSizeY = (int)(dispatchDescription.displaySize.y / (float)dispatchDescription.opticalFlowBlockSize + 7) / 8; |
|
|
int opticalFlowDispatchSizeY = (int)(dispatchDescription.displaySize.y / (float)dispatchDescription.opticalFlowBlockSize + 7) / 8; |
|
|
|
|
|
|
|
|
bool executePreparationPasses = (Constants.reset == 0); |
|
|
|
|
|
|
|
|
bool executePreparationPasses = (constants.reset == 0); |
|
|
|
|
|
|
|
|
// Schedule work for the interpolation command list
|
|
|
// Schedule work for the interpolation command list
|
|
|
_setupPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, renderDispatchSizeX, renderDispatchSizeY); |
|
|
_setupPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, renderDispatchSizeX, renderDispatchSizeY); |
|
|
@ -213,7 +211,7 @@ namespace FidelityFX.FrameGen |
|
|
|
|
|
|
|
|
// Inpainting pyramid
|
|
|
// Inpainting pyramid
|
|
|
SetupSpdConstants(dispatchDescription.displaySize, out var dispatchThreadGroupCount); |
|
|
SetupSpdConstants(dispatchDescription.displaySize, out var dispatchThreadGroupCount); |
|
|
commandBuffer.SetBufferData(_spdConstantsBuffer, _spdConstantsArray); |
|
|
|
|
|
|
|
|
_spdConstants.UpdateBufferData(commandBuffer); |
|
|
_inpaintingPyramidPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
_inpaintingPyramidPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
|
|
|
|
|
|
_inpaintingPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, displayDispatchSizeX, displayDispatchSizeY); |
|
|
_inpaintingPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, displayDispatchSizeX, displayDispatchSizeY); |
|
|
@ -234,7 +232,7 @@ namespace FidelityFX.FrameGen |
|
|
private void DispatchGameVectorFieldInpaintingPyramid(CommandBuffer commandBuffer, FrameInterpolation.DispatchDescription dispatchDescription, int doubleBufferId) |
|
|
private void DispatchGameVectorFieldInpaintingPyramid(CommandBuffer commandBuffer, FrameInterpolation.DispatchDescription dispatchDescription, int doubleBufferId) |
|
|
{ |
|
|
{ |
|
|
SetupSpdConstants(dispatchDescription.renderSize, out var dispatchThreadGroupCount); |
|
|
SetupSpdConstants(dispatchDescription.renderSize, out var dispatchThreadGroupCount); |
|
|
commandBuffer.SetBufferData(_spdConstantsBuffer, _spdConstantsArray); |
|
|
|
|
|
|
|
|
_spdConstants.UpdateBufferData(commandBuffer); |
|
|
_gameVectorFieldInpaintingPyramidPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
_gameVectorFieldInpaintingPyramidPass.ScheduleDispatch(commandBuffer, dispatchDescription, doubleBufferId, dispatchThreadGroupCount.x, dispatchThreadGroupCount.y); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -276,7 +274,7 @@ namespace FidelityFX.FrameGen |
|
|
RectInt rectInfo = new RectInt(0, 0, resolution.x, resolution.y); |
|
|
RectInt rectInfo = new RectInt(0, 0, resolution.x, resolution.y); |
|
|
SpdSetup(rectInfo, out dispatchThreadGroupCount, out var workGroupOffset, out var numWorkGroupsAndMips); |
|
|
SpdSetup(rectInfo, out dispatchThreadGroupCount, out var workGroupOffset, out var numWorkGroupsAndMips); |
|
|
|
|
|
|
|
|
ref FrameInterpolation.InpaintingPyramidConstants spdConstants = ref SpdConstants; |
|
|
|
|
|
|
|
|
ref FrameInterpolation.InpaintingPyramidConstants spdConstants = ref _spdConstants.Value; |
|
|
spdConstants.numWorkGroups = (uint)numWorkGroupsAndMips.x; |
|
|
spdConstants.numWorkGroups = (uint)numWorkGroupsAndMips.x; |
|
|
spdConstants.mips = (uint)Math.Min(numWorkGroupsAndMips.y, 7); |
|
|
spdConstants.mips = (uint)Math.Min(numWorkGroupsAndMips.y, 7); |
|
|
spdConstants.workGroupOffsetX = (uint)workGroupOffset.x; |
|
|
spdConstants.workGroupOffsetX = (uint)workGroupOffset.x; |
|
|
@ -311,20 +309,6 @@ namespace FidelityFX.FrameGen |
|
|
0.0f, 1.0f, 0.1f, // green
|
|
|
0.0f, 1.0f, 0.1f, // green
|
|
|
1.0f, 1.0f, 0.48f // bright yellow
|
|
|
1.0f, 1.0f, 0.48f // bright yellow
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
private static ComputeBuffer CreateConstantBuffer<TConstants>() where TConstants: struct |
|
|
|
|
|
{ |
|
|
|
|
|
return new ComputeBuffer(1, Marshal.SizeOf<TConstants>(), ComputeBufferType.Constant); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void DestroyConstantBuffer(ref ComputeBuffer bufferRef) |
|
|
|
|
|
{ |
|
|
|
|
|
if (bufferRef == null) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
bufferRef.Release(); |
|
|
|
|
|
bufferRef = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void DestroyPass(ref FrameInterpolationPass pass) |
|
|
private static void DestroyPass(ref FrameInterpolationPass pass) |
|
|
{ |
|
|
{ |
|
|
|