Browse Source

Removed unused resource definitions

fsr3.1
Nico de Poel 2 years ago
parent
commit
d6bb123157
  1. 13
      Assets/Scripts/Core/Fsr3ShaderIDs.cs
  2. 57
      Assets/Scripts/Core/Fsr3UpscalerResources.cs

13
Assets/Scripts/Core/Fsr3ShaderIDs.cs

@ -31,24 +31,17 @@ namespace FidelityFX
internal static readonly int SrvInputDepth = Shader.PropertyToID("r_input_depth");
internal static readonly int SrvInputExposure = Shader.PropertyToID("r_input_exposure");
internal static readonly int SrvFrameInfo = Shader.PropertyToID("r_frame_info");
internal static readonly int SrvAutoExposure = Shader.PropertyToID("r_auto_exposure"); // obsolete
internal static readonly int SrvReactiveMask = Shader.PropertyToID("r_reactive_mask");
internal static readonly int SrvTransparencyAndCompositionMask = Shader.PropertyToID("r_transparency_and_composition_mask");
internal static readonly int SrvReconstructedPrevNearestDepth = Shader.PropertyToID("r_reconstructed_previous_nearest_depth");
internal static readonly int SrvDilatedMotionVectors = Shader.PropertyToID("r_dilated_motion_vectors");
internal static readonly int SrvPrevDilatedMotionVectors = Shader.PropertyToID("r_previous_dilated_motion_vectors"); // obsolete
internal static readonly int SrvDilatedDepth = Shader.PropertyToID("r_dilated_depth");
internal static readonly int SrvInternalUpscaled = Shader.PropertyToID("r_internal_upscaled_color");
internal static readonly int SrvAccumulation = Shader.PropertyToID("r_accumulation");
internal static readonly int SrvLockStatus = Shader.PropertyToID("r_lock_status"); // obsolete
internal static readonly int SrvLockInputLuma = Shader.PropertyToID("r_lock_input_luma"); // obsolete
internal static readonly int SrvPreparedInputColor = Shader.PropertyToID("r_prepared_input_color"); // obsolete
internal static readonly int SrvLumaHistory = Shader.PropertyToID("r_luma_history");
internal static readonly int SrvRcasInput = Shader.PropertyToID("r_rcas_input");
internal static readonly int SrvLanczosLut = Shader.PropertyToID("r_lanczos_lut");
internal static readonly int SrvSpdMips = Shader.PropertyToID("r_spd_mips");
internal static readonly int SrvSceneLuminanceMips = Shader.PropertyToID("r_imgMips"); // obsolete
internal static readonly int SrvUpscaleMaximumBiasLut = Shader.PropertyToID("r_upsample_maximum_bias_lut"); // obsolete
internal static readonly int SrvDilatedReactiveMasks = Shader.PropertyToID("r_dilated_reactive_masks");
internal static readonly int SrvNewLocks = Shader.PropertyToID("r_new_locks");
internal static readonly int SrvFarthestDepth = Shader.PropertyToID("r_farthest_depth");
@ -66,16 +59,10 @@ namespace FidelityFX
internal static readonly int UavDilatedDepth = Shader.PropertyToID("rw_dilated_depth");
internal static readonly int UavInternalUpscaled = Shader.PropertyToID("rw_internal_upscaled_color");
internal static readonly int UavAccumulation = Shader.PropertyToID("rw_accumulation");
internal static readonly int UavLockStatus = Shader.PropertyToID("rw_lock_status"); // obsolete
internal static readonly int UavLockInputLuma = Shader.PropertyToID("rw_lock_input_luma"); // obsolete
internal static readonly int UavPreparedInputColor = Shader.PropertyToID("rw_prepared_input_color"); // obsolete
internal static readonly int UavLumaHistory = Shader.PropertyToID("rw_luma_history");
internal static readonly int UavUpscaledOutput = Shader.PropertyToID("rw_upscaled_output");
internal static readonly int UavExposureMipLumaChange = Shader.PropertyToID("rw_img_mip_shading_change"); // obsolete
internal static readonly int UavExposureMip5 = Shader.PropertyToID("rw_img_mip_5"); // obsolete
internal static readonly int UavDilatedReactiveMasks = Shader.PropertyToID("rw_dilated_reactive_masks");
internal static readonly int UavFrameInfo = Shader.PropertyToID("rw_frame_info");
internal static readonly int UavAutoExposure = Shader.PropertyToID("rw_auto_exposure"); // obsolete
internal static readonly int UavSpdAtomicCount = Shader.PropertyToID("rw_spd_global_atomic");
internal static readonly int UavNewLocks = Shader.PropertyToID("rw_new_locks");
internal static readonly int UavAutoReactive = Shader.PropertyToID("rw_output_autoreactive");

57
Assets/Scripts/Core/Fsr3UpscalerResources.cs

@ -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);

Loading…
Cancel
Save