@ -50,14 +50,6 @@ namespace FidelityFX
public readonly RenderTexture [ ] LumaHistory = new RenderTexture [ 2 ] ;
public readonly RenderTexture [ ] PrevPreAlpha = new RenderTexture [ 2 ] ;
public readonly RenderTexture [ ] PrevPostAlpha = new RenderTexture [ 2 ] ;
// OLD
public Texture2D MaximumBiasLut ;
public RenderTexture AutoExposure ;
public RenderTexture SceneLuminance ;
public readonly RenderTexture [ ] DilatedMotionVectors = new RenderTexture [ 2 ] ;
public readonly RenderTexture [ ] LockStatus = new RenderTexture [ 2 ] ;
public void Create ( Fsr3Upscaler . ContextDescription contextDescription )
{
@ -128,26 +120,6 @@ namespace FidelityFX
// Resources FSR3UPSCALER_LumaHistory1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, FFX_RESOURCE_FLAGS_NONE
CreateDoubleBufferedResource ( LumaHistory , "FSR3UPSCALER_LumaHistory" , contextDescription . MaxUpscaleSize , GraphicsFormat . R16G16B16A16_SFloat ) ;
//
// OLD
//
// Resource FSR3UPSCALER_AutoExposure: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32G32_FLOAT, FFX_RESOURCE_FLAGS_NONE
AutoExposure = new RenderTexture ( 1 , 1 , 0 , GraphicsFormat . R32G32_SFloat ) { name = "FSR3UPSCALER_AutoExposure" , enableRandomWrite = true } ;
AutoExposure . Create ( ) ;
// Resource FSR3UPSCALER_ExposureMips: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE
// This is a rather special case: it's an aliasable resource, but because we require a mipmap chain and bind specific mip levels per shader, we can't easily use temporary RTs for this.
mipCount = 1 + Mathf . FloorToInt ( Mathf . Log ( Math . Max ( maxRenderSizeDiv2 . x , maxRenderSizeDiv2 . y ) , 2.0f ) ) ;
SceneLuminance = new RenderTexture ( maxRenderSizeDiv2 . x , maxRenderSizeDiv2 . y , 0 , GraphicsFormat . R16_SFloat , mipCount ) { name = "FSR3UPSCALER_ExposureMips" , enableRandomWrite = true , useMipMap = true , autoGenerateMips = false } ;
SceneLuminance . Create ( ) ;
// Resources FSR3UPSCALER_InternalDilatedVelocity1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_FLOAT, FFX_RESOURCE_FLAGS_NONE
CreateDoubleBufferedResource ( DilatedMotionVectors , "FSR3UPSCALER_InternalDilatedVelocity" , contextDescription . MaxRenderSize , GraphicsFormat . R16G16_SFloat ) ;
// Resources FSR3UPSCALER_LockStatus1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_FLOAT, FFX_RESOURCE_FLAGS_NONE
CreateDoubleBufferedResource ( LockStatus , "FSR3UPSCALER_LockStatus" , contextDescription . MaxUpscaleSize , GraphicsFormat . R16G16_SFloat ) ;
}
public void CreateTcrAutogenResources ( Fsr3Upscaler . ContextDescription contextDescription )
@ -190,32 +162,11 @@ namespace FidelityFX
// FSR3UPSCALER_DilatedReactiveMasks: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8G8B8A8_UNORM, FFX_RESOURCE_FLAGS_ALIASABLE
commandBuffer . GetTemporaryRT ( Fsr3ShaderIDs . UavDilatedReactiveMasks , maxRenderSize . x , maxRenderSize . y , 0 , default , GraphicsFormat . R8G8B8A8_UNorm , 1 , true ) ;
//
// OLD
//
// FSR3UPSCALER_ReconstructedPrevNearestDepth: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_ALIASABLE
commandBuffer . GetTemporaryRT ( Fsr3ShaderIDs . UavReconstructedPrevNearestDepth , maxRenderSize . x , maxRenderSize . y , 0 , default , GraphicsFormat . R32_UInt , 1 , true ) ;
// FSR3UPSCALER_DilatedDepth: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE
commandBuffer . GetTemporaryRT ( Fsr3ShaderIDs . UavDilatedDepth , maxRenderSize . x , maxRenderSize . y , 0 , default , GraphicsFormat . R32_SFloat , 1 , true ) ;
// FSR3UPSCALER_LockInputLuma: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE
commandBuffer . GetTemporaryRT ( Fsr3ShaderIDs . UavLockInputLuma , maxRenderSize . x , maxRenderSize . y , 0 , default , GraphicsFormat . R16_SFloat , 1 , true ) ;
// FSR3UPSCALER_PreparedInputColor: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE
commandBuffer . GetTemporaryRT ( Fsr3ShaderIDs . UavPreparedInputColor , maxRenderSize . x , maxRenderSize . y , 0 , default , GraphicsFormat . R16G16B16A16_SFloat , 1 , true ) ;
}
public static void DestroyAliasableResources ( CommandBuffer commandBuffer )
{
// Release all of the aliasable resources used this frame
commandBuffer . ReleaseTemporaryRT ( Fsr3ShaderIDs . UavReconstructedPrevNearestDepth ) ;
commandBuffer . ReleaseTemporaryRT ( Fsr3ShaderIDs . UavDilatedDepth ) ;
commandBuffer . ReleaseTemporaryRT ( Fsr3ShaderIDs . UavLockInputLuma ) ;
commandBuffer . ReleaseTemporaryRT ( Fsr3ShaderIDs . UavPreparedInputColor ) ;
commandBuffer . ReleaseTemporaryRT ( Fsr3ShaderIDs . UavDilatedReactiveMasks ) ;
commandBuffer . ReleaseTemporaryRT ( Fsr3ShaderIDs . UavFarthestDepthMip1 ) ;
commandBuffer . ReleaseTemporaryRT ( Fsr3ShaderIDs . UavNewLocks ) ;
@ -237,14 +188,6 @@ namespace FidelityFX
{
DestroyTcrAutogenResources ( ) ;
// OLD
DestroyResource ( LockStatus ) ;
DestroyResource ( DilatedMotionVectors ) ;
DestroyResource ( ref SceneLuminance ) ;
DestroyResource ( ref AutoExposure ) ;
DestroyResource ( ref MaximumBiasLut ) ;
// NEW
DestroyResource ( LumaHistory ) ;
DestroyResource ( InternalUpscaled ) ;
DestroyResource ( Luma ) ;