|
|
|
@ -93,10 +93,12 @@ namespace FidelityFX |
|
|
|
_lanczosLutResource.SetPixelData(lanczos2Weights, 0); |
|
|
|
_lanczosLutResource.Apply(); |
|
|
|
|
|
|
|
// Resource FSR2_DefaultExposure: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R32G32_FLOAT, FFX_RESOURCE_FLAGS_NONE
|
|
|
|
_defaultExposureResource = new Texture2D(1, 1, GraphicsFormat.R32G32_SFloat, TextureCreationFlags.None) { name = "FSR2_DefaultExposure" }; |
|
|
|
_defaultExposureResource.SetPixel(0, 0, Color.black); |
|
|
|
_defaultExposureResource.Apply(); |
|
|
|
|
|
|
|
// Resource FSR2_DefaultReactiviyMask: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE
|
|
|
|
_defaultReactiveResource = new Texture2D(1, 1, GraphicsFormat.R8_UNorm, TextureCreationFlags.None) { name = "FSR2_DefaultReactivityMask" }; |
|
|
|
_defaultReactiveResource.SetPixel(0, 0, Color.black); |
|
|
|
_defaultReactiveResource.Apply(); |
|
|
|
@ -132,6 +134,7 @@ namespace FidelityFX |
|
|
|
_computeLuminancePyramidPipeline = new Fsr2ComputeLuminancePyramidPipeline(_contextDescription, _fsr2ConstantsBuffer, _spdConstantsBuffer, _autoExposureResource); |
|
|
|
_reconstructPreviousDepthPipeline = new Fsr2ReconstructPreviousDepthPipeline(_contextDescription, _fsr2ConstantsBuffer, _dilatedMotionVectorResources); |
|
|
|
_depthClipPipeline = new Fsr2DepthClipPipeline(_contextDescription, _fsr2ConstantsBuffer, _dilatedMotionVectorResources); |
|
|
|
_lockPipeline = new Fsr2LockPipeline(_contextDescription, _fsr2ConstantsBuffer); |
|
|
|
_accumulatePipeline = new Fsr2AccumulatePipeline(_contextDescription, _fsr2ConstantsBuffer); |
|
|
|
_accumulateSharpenPipeline = new Fsr2AccumulateSharpenPipeline(_contextDescription, _fsr2ConstantsBuffer); |
|
|
|
_rcasPipeline = new Fsr2RcasPipeline(_contextDescription, _fsr2ConstantsBuffer, _rcasConstantsBuffer); |
|
|
|
@ -149,8 +152,7 @@ namespace FidelityFX |
|
|
|
DestroyPipeline(ref _reconstructPreviousDepthPipeline); |
|
|
|
DestroyPipeline(ref _depthClipPipeline); |
|
|
|
|
|
|
|
DestroyResource(ref _dilatedMotionVectorResources[1]); |
|
|
|
DestroyResource(ref _dilatedMotionVectorResources[0]); |
|
|
|
DestroyResources(_dilatedMotionVectorResources); |
|
|
|
DestroyResource(ref _autoExposureResource); |
|
|
|
DestroyResource(ref _defaultReactiveResource); |
|
|
|
DestroyResource(ref _defaultExposureResource); |
|
|
|
@ -223,7 +225,7 @@ namespace FidelityFX |
|
|
|
_depthClipPipeline.ScheduleDispatch(_commandBuffer, dispatchParams, frameIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
|
|
|
|
// Create locks
|
|
|
|
// _commandBuffer.DispatchCompute(_lockShader, _lockKernel, dispatchSrcX, dispatchSrcY, 1);
|
|
|
|
_lockPipeline.ScheduleDispatch(_commandBuffer, dispatchParams, frameIndex, dispatchSrcX, dispatchSrcY); |
|
|
|
|
|
|
|
bool sharpenEnabled = dispatchParams.EnableSharpening; |
|
|
|
|
|
|
|
@ -463,6 +465,12 @@ namespace FidelityFX |
|
|
|
resource = null; |
|
|
|
} |
|
|
|
|
|
|
|
private static void DestroyResources(RenderTexture[] resources) |
|
|
|
{ |
|
|
|
for (int i = 0; i < resources.Length; ++i) |
|
|
|
DestroyResource(ref resources[i]); |
|
|
|
} |
|
|
|
|
|
|
|
private static void DestroyPipeline(ref Fsr2Pipeline pipeline) |
|
|
|
{ |
|
|
|
if (pipeline == null) |
|
|
|
|