@ -84,30 +84,23 @@ namespace FidelityFX.FSR3
// Resource FSR3UPSCALER_SpdAtomicCounter: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_ALIASABLE
// Despite what the original FSR3 codebase says, this resource really isn't aliasable. Resetting this counter to 0 every frame breaks auto-exposure on MacOS Metal.
SpdAtomicCounter = new RenderTexture ( 1 , 1 , 0 , GraphicsFormat . R32_UInt ) { name = "FSR3UPSCALER_SpdAtomicCounter" , enableRandomWrite = true } ;
SpdAtomicCounter . Create ( ) ;
SpdAtomicCounter = CreateResource ( "FSR3UPSCALER_SpdAtomicCounter" , Vector2Int . one , GraphicsFormat . R32_UInt ) ;
// Resource FSR3UPSCALER_SpdMips: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_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.
int mipCount = 1 + Mathf . FloorToInt ( Mathf . Log ( Math . Max ( maxRenderSizeDiv2 . x , maxRenderSizeDiv2 . y ) , 2.0f ) ) ;
SpdMips = new RenderTexture ( maxRenderSizeDiv2 . x , maxRenderSizeDiv2 . y , 0 , GraphicsFormat . R16G16_SFloat , mipCount ) { name = "FSR3UPSCALER_SpdMips" , enableRandomWrite = true , useMipMap = true , autoGenerateMips = false } ;
SpdMips . Create ( ) ;
SpdMips = CreateResourceMips ( "FSR3UPSCALER_SpdMips" , maxRenderSizeDiv2 , GraphicsFormat . R16G16_SFloat ) ;
// Resource FSR3UPSCALER_DilatedVelocity: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_FLOAT, FFX_RESOURCE_FLAGS_NONE
DilatedVelocity = new RenderTexture ( maxRenderSize . x , maxRenderSize . y , 0 , GraphicsFormat . R16G16_SFloat ) { name = "FSR3UPSCALER_DilatedVelocity" , enableRandomWrite = true } ;
DilatedVelocity . Create ( ) ;
DilatedVelocity = CreateResource ( "FSR3UPSCALER_DilatedVelocity" , maxRenderSize , GraphicsFormat . R16G16_SFloat ) ;
// Resource FSR3UPSCALER_DilatedDepth: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_FLOAT, FFX_RESOURCE_FLAGS_NONE
DilatedDepth = new RenderTexture ( maxRenderSize . x , maxRenderSize . y , 0 , GraphicsFormat . R32_SFloat ) { name = "FSR3UPSCALER_DilatedDepth" , enableRandomWrite = true } ;
DilatedDepth . Create ( ) ;
DilatedDepth = CreateResource ( "FSR3UPSCALER_DilatedDepth" , maxRenderSize , GraphicsFormat . R32_SFloat ) ;
// Resource FSR3UPSCALER_ReconstructedPrevNearestDepth: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_NONE
ReconstructedPrevNearestDepth = new RenderTexture ( maxRenderSize . x , maxRenderSize . y , 0 , GraphicsFormat . R32_UInt ) { name = "FSR3UPSCALER_ReconstructedPrevNearestDepth" , enableRandomWrite = true } ;
ReconstructedPrevNearestDepth . Create ( ) ;
ReconstructedPrevNearestDepth = CreateResource ( "FSR3UPSCALER_ReconstructedPrevNearestDepth" , maxRenderSize , GraphicsFormat . R32_UInt ) ;
// Resource FSR3UPSCALER_FrameInfo: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT, FFX_RESOURCE_FLAGS_NONE
FrameInfo = new RenderTexture ( 1 , 1 , 0 , GraphicsFormat . R32G32B32A32_SFloat ) { name = "FSR3UPSCALER_FrameInfo" , enableRandomWrite = true } ;
FrameInfo . Create ( ) ;
FrameInfo = CreateResource ( "FSR3UPSCALER_FrameInfo" , Vector2Int . one , GraphicsFormat . R32G32B32A32_SFloat ) ;
// Resources FSR3UPSCALER_Accumulation1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE
CreateDoubleBufferedResource ( Accumulation , "FSR3UPSCALER_Accumulation" , maxRenderSize , GraphicsFormat . R8_UNorm ) ;
@ -125,12 +118,10 @@ namespace FidelityFX.FSR3
public void CreateTcrAutogenResources ( Fsr3Upscaler . ContextDescription contextDescription )
{
// Resource FSR3UPSCALER_AutoReactive: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE
AutoReactive = new RenderTexture ( contextDescription . MaxRenderSize . x , contextDescription . MaxRenderSize . y , 0 , GraphicsFormat . R8_UNorm ) { name = "FSR3UPSCALER_AutoReactive" , enableRandomWrite = true } ;
AutoReactive . Create ( ) ;
AutoReactive = CreateResource ( "FSR3UPSCALER_AutoReactive" , contextDescription . MaxRenderSize , GraphicsFormat . R8_UNorm ) ;
// Resource FSR3UPSCALER_AutoComposition: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE
AutoComposition = new RenderTexture ( contextDescription . MaxRenderSize . x , contextDescription . MaxRenderSize . y , 0 , GraphicsFormat . R8_UNorm ) { name = "FSR3UPSCALER_AutoComposition" , enableRandomWrite = true } ;
AutoComposition . Create ( ) ;
AutoComposition = CreateResource ( "FSR3UPSCALER_AutoComposition" , contextDescription . MaxRenderSize , GraphicsFormat . R8_UNorm ) ;
// Resources FSR3UPSCALER_PrevPreAlpha0/1: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R11G11B10_FLOAT, FFX_RESOURCE_FLAGS_NONE
CreateDoubleBufferedResource ( PrevPreAlpha , "FSR3UPSCALER_PrevPreAlpha" , contextDescription . MaxRenderSize , GraphicsFormat . B10G11R11_UFloatPack32 ) ;