|
|
|
@ -24,6 +24,8 @@ namespace FidelityFX |
|
|
|
private Fsr2Pipeline _generateReactivePipeline; |
|
|
|
private Fsr2Pipeline _tcrAutogeneratePipeline; |
|
|
|
|
|
|
|
private Texture2D _defaultExposureResource; |
|
|
|
private Texture2D _defaultReactiveResource; |
|
|
|
private Texture2D _lanczosLutResource; |
|
|
|
private RenderTexture _autoExposureResource; |
|
|
|
private readonly RenderTexture[] _dilatedMotionVectorResources = new RenderTexture[2]; |
|
|
|
@ -91,6 +93,14 @@ namespace FidelityFX |
|
|
|
_lanczosLutResource.SetPixelData(lanczos2Weights, 0); |
|
|
|
_lanczosLutResource.Apply(); |
|
|
|
|
|
|
|
_defaultExposureResource = new Texture2D(1, 1, GraphicsFormat.R32G32_SFloat, TextureCreationFlags.None) { name = "FSR2_DefaultExposure" }; |
|
|
|
_defaultExposureResource.SetPixel(0, 0, Color.black); |
|
|
|
_defaultExposureResource.Apply(); |
|
|
|
|
|
|
|
_defaultReactiveResource = new Texture2D(1, 1, GraphicsFormat.R8_UNorm, TextureCreationFlags.None) { name = "FSR2_DefaultReactivityMask" }; |
|
|
|
_defaultReactiveResource.SetPixel(0, 0, Color.black); |
|
|
|
_defaultReactiveResource.Apply(); |
|
|
|
|
|
|
|
// Resource FSR2_AutoExposure: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32G32_FLOAT, FFX_RESOURCE_FLAGS_NONE
|
|
|
|
_autoExposureResource = new RenderTexture(1, 1, 1, GraphicsFormat.R32G32_SFloat) { name = "FSR2_AutoExposure", enableRandomWrite = true }; |
|
|
|
_autoExposureResource.Create(); |
|
|
|
@ -142,6 +152,8 @@ namespace FidelityFX |
|
|
|
DestroyResource(ref _dilatedMotionVectorResources[1]); |
|
|
|
DestroyResource(ref _dilatedMotionVectorResources[0]); |
|
|
|
DestroyResource(ref _autoExposureResource); |
|
|
|
DestroyResource(ref _defaultReactiveResource); |
|
|
|
DestroyResource(ref _defaultExposureResource); |
|
|
|
DestroyResource(ref _lanczosLutResource); |
|
|
|
|
|
|
|
DestroyConstantBuffer(ref _rcasConstantsBuffer); |
|
|
|
@ -173,6 +185,8 @@ namespace FidelityFX |
|
|
|
bool resetAccumulation = dispatchParams.Reset || _firstExecution; |
|
|
|
_firstExecution = false; |
|
|
|
|
|
|
|
if (dispatchParams.Exposure == null) dispatchParams.Exposure = _defaultExposureResource; |
|
|
|
if (dispatchParams.Reactive == null) dispatchParams.Reactive = _defaultReactiveResource; |
|
|
|
Fsr2Pipeline.RegisterResources(_commandBuffer, _contextDescription, dispatchParams); |
|
|
|
|
|
|
|
SetupConstants(dispatchParams, resetAccumulation); |
|
|
|
|