From 0e481544bf136ad1405eb3d331a92d60fe27386a Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Tue, 9 Jul 2024 18:51:59 +0200 Subject: [PATCH] Updated shader assets names and references for the new collection of passes. --- Assets/Fsr3UpscalerAssets.asset | 10 ++-- Assets/Scripts/Core/Fsr3UpscalerAssets.cs | 61 +++++++++++++++-------- Assets/Scripts/Core/Fsr3UpscalerPass.cs | 8 +-- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/Assets/Fsr3UpscalerAssets.asset b/Assets/Fsr3UpscalerAssets.asset index f3f30ea..abc0b6d 100644 --- a/Assets/Fsr3UpscalerAssets.asset +++ b/Assets/Fsr3UpscalerAssets.asset @@ -13,10 +13,12 @@ MonoBehaviour: m_Name: Fsr3UpscalerAssets m_EditorClassIdentifier: shaders: - computeLuminancePyramidPass: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3} - reconstructPreviousDepthPass: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3} - depthClipPass: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3} - lockPass: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3} + prepareInputsPass: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3} + lumaPyramidPass: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3} + shadingChangePyramidPass: {fileID: 7200000, guid: 251e663738905fa4d8817001682d802f, type: 3} + shadingChangePass: {fileID: 7200000, guid: 9a2bff2f97619ed4989d9b0577ba0641, type: 3} + prepareReactivityPass: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3} + lumaInstabilityPass: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3} accumulatePass: {fileID: 7200000, guid: c9b45f0ae7673694ba57a4aadfe212e9, type: 3} sharpenPass: {fileID: 7200000, guid: 7aaf5cfff022de2499e9b0412f947f6c, type: 3} autoGenReactivePass: {fileID: 7200000, guid: 5716b91fdaa4e9e439df6b96a796fe6e, type: 3} diff --git a/Assets/Scripts/Core/Fsr3UpscalerAssets.cs b/Assets/Scripts/Core/Fsr3UpscalerAssets.cs index 3e4e24f..1167481 100644 --- a/Assets/Scripts/Core/Fsr3UpscalerAssets.cs +++ b/Assets/Scripts/Core/Fsr3UpscalerAssets.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2023 Nico de Poel +// Copyright (c) 2024 Nico de Poel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -19,6 +19,7 @@ // THE SOFTWARE. using UnityEngine; +using UnityEngine.Serialization; namespace FidelityFX { @@ -35,10 +36,12 @@ namespace FidelityFX { shaders = new Fsr3UpscalerShaders { - computeLuminancePyramidPass = FindComputeShader("ffx_fsr3upscaler_compute_luminance_pyramid_pass"), - reconstructPreviousDepthPass = FindComputeShader("ffx_fsr3upscaler_reconstruct_previous_depth_pass"), - depthClipPass = FindComputeShader("ffx_fsr3upscaler_depth_clip_pass"), - lockPass = FindComputeShader("ffx_fsr3upscaler_lock_pass"), + prepareInputsPass = FindComputeShader("ffx_fsr3upscaler_prepare_inputs_pass"), + lumaPyramidPass = FindComputeShader("ffx_fsr3upscaler_luma_pyramid_pass"), + shadingChangePyramidPass = FindComputeShader("ffx_fsr3upscaler_shading_change_pyramid_pass"), + shadingChangePass = FindComputeShader("ffx_fsr3upscaler_shading_change_pass"), + prepareReactivityPass = FindComputeShader("ffx_fsr3upscaler_prepare_reactivity_pass"), + lumaInstabilityPass = FindComputeShader("ffx_fsr3upscaler_luma_instability_pass"), accumulatePass = FindComputeShader("ffx_fsr3upscaler_accumulate_pass"), sharpenPass = FindComputeShader("ffx_fsr3upscaler_rcas_pass"), autoGenReactivePass = FindComputeShader("ffx_fsr3upscaler_autogen_reactive_pass"), @@ -64,25 +67,39 @@ namespace FidelityFX [System.Serializable] public class Fsr3UpscalerShaders { + /// + /// The compute shader used by the prepare inputs pass. + /// + [FormerlySerializedAs("reconstructPreviousDepthPass")] + public ComputeShader prepareInputsPass; + /// /// The compute shader used by the luminance pyramid computation pass. /// - public ComputeShader computeLuminancePyramidPass; + [FormerlySerializedAs("computeLuminancePyramidPass")] + public ComputeShader lumaPyramidPass; /// - /// The compute shader used by the previous depth reconstruction pass. + /// The compute shader used by the shading change pyramid pass. /// - public ComputeShader reconstructPreviousDepthPass; + public ComputeShader shadingChangePyramidPass; /// - /// The compute shader used by the depth clip pass. + /// The compute shader used by the shading change pass. /// - public ComputeShader depthClipPass; + public ComputeShader shadingChangePass; /// - /// The compute shader used by the lock pass. + /// The compute shader used by the prepare reactivity pass. + /// + [FormerlySerializedAs("depthClipPass")] + public ComputeShader prepareReactivityPass; + + /// + /// The compute shader used by the luma instability pass. /// - public ComputeShader lockPass; + [FormerlySerializedAs("lockPass")] + public ComputeShader lumaInstabilityPass; /// /// The compute shader used by the accumulation pass. @@ -121,10 +138,12 @@ namespace FidelityFX { return new Fsr3UpscalerShaders { - computeLuminancePyramidPass = Object.Instantiate(computeLuminancePyramidPass), - reconstructPreviousDepthPass = Object.Instantiate(reconstructPreviousDepthPass), - depthClipPass = Object.Instantiate(depthClipPass), - lockPass = Object.Instantiate(lockPass), + prepareInputsPass = Object.Instantiate(prepareInputsPass), + lumaPyramidPass = Object.Instantiate(lumaPyramidPass), + shadingChangePyramidPass = Object.Instantiate(shadingChangePyramidPass), + shadingChangePass = Object.Instantiate(shadingChangePass), + prepareReactivityPass = Object.Instantiate(prepareReactivityPass), + lumaInstabilityPass = Object.Instantiate(lumaInstabilityPass), accumulatePass = Object.Instantiate(accumulatePass), sharpenPass = Object.Instantiate(sharpenPass), autoGenReactivePass = Object.Instantiate(autoGenReactivePass), @@ -138,10 +157,12 @@ namespace FidelityFX /// public void Dispose() { - Object.Destroy(computeLuminancePyramidPass); - Object.Destroy(reconstructPreviousDepthPass); - Object.Destroy(depthClipPass); - Object.Destroy(lockPass); + Object.Destroy(prepareInputsPass); + Object.Destroy(lumaPyramidPass); + Object.Destroy(shadingChangePyramidPass); + Object.Destroy(shadingChangePass); + Object.Destroy(prepareReactivityPass); + Object.Destroy(lumaInstabilityPass); Object.Destroy(accumulatePass); Object.Destroy(sharpenPass); Object.Destroy(autoGenReactivePass); diff --git a/Assets/Scripts/Core/Fsr3UpscalerPass.cs b/Assets/Scripts/Core/Fsr3UpscalerPass.cs index e1dc225..3e90dbe 100644 --- a/Assets/Scripts/Core/Fsr3UpscalerPass.cs +++ b/Assets/Scripts/Core/Fsr3UpscalerPass.cs @@ -103,7 +103,7 @@ namespace FidelityFX { _spdConstants = spdConstants; - InitComputeShader("compute_luminance_pyramid_pass", contextDescription.Shaders.computeLuminancePyramidPass); + InitComputeShader("compute_luminance_pyramid_pass", contextDescription.Shaders.lumaPyramidPass); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -128,7 +128,7 @@ namespace FidelityFX public Fsr3UpscalerReconstructPreviousDepthPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - InitComputeShader("reconstruct_previous_depth_pass", contextDescription.Shaders.reconstructPreviousDepthPass); + InitComputeShader("reconstruct_previous_depth_pass", contextDescription.Shaders.prepareInputsPass); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -156,7 +156,7 @@ namespace FidelityFX public Fsr3UpscalerDepthClipPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - InitComputeShader("depth_clip_pass", contextDescription.Shaders.depthClipPass); + InitComputeShader("depth_clip_pass", contextDescription.Shaders.prepareReactivityPass); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) @@ -191,7 +191,7 @@ namespace FidelityFX public Fsr3UpscalerLockPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - InitComputeShader("lock_pass", contextDescription.Shaders.lockPass); + InitComputeShader("lock_pass", contextDescription.Shaders.lumaInstabilityPass); } public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY)