diff --git a/Assets/Scripts/Core/Fsr3UpscalerShaders.cs b/Assets/Scripts/Core/Fsr3UpscalerShaders.cs
index 8b67a27..6e85b95 100644
--- a/Assets/Scripts/Core/Fsr3UpscalerShaders.cs
+++ b/Assets/Scripts/Core/Fsr3UpscalerShaders.cs
@@ -56,6 +56,41 @@ namespace FidelityFX
{
return (Fsr3UpscalerShaders)MemberwiseClone();
}
+
+ ///
+ /// Returns a copy of this class with clones of all its shaders.
+ /// This can be useful if you're running multiple FSR3 Upscaler instances with different shader configurations.
+ /// Be sure to clean up these clones through Dispose once you're done with them.
+ ///
+ public Fsr3UpscalerShaders DeepCopy()
+ {
+ Fsr3UpscalerShaders copy = CreateInstance();
+ copy.computeLuminancePyramidPass = Instantiate(computeLuminancePyramidPass);
+ copy.reconstructPreviousDepthPass = Instantiate(reconstructPreviousDepthPass);
+ copy.depthClipPass = Instantiate(depthClipPass);
+ copy.lockPass = Instantiate(lockPass);
+ copy.accumulatePass = Instantiate(accumulatePass);
+ copy.sharpenPass = Instantiate(sharpenPass);
+ copy.autoGenReactivePass = Instantiate(autoGenReactivePass);
+ copy.tcrAutoGenPass = Instantiate(tcrAutoGenPass);
+ return copy;
+ }
+
+ ///
+ /// Destroy all the shaders within this instance.
+ /// Use this only on clones created through DeepCopy.
+ ///
+ public void Dispose()
+ {
+ Destroy(computeLuminancePyramidPass);
+ Destroy(reconstructPreviousDepthPass);
+ Destroy(depthClipPass);
+ Destroy(lockPass);
+ Destroy(accumulatePass);
+ Destroy(sharpenPass);
+ Destroy(autoGenReactivePass);
+ Destroy(tcrAutoGenPass);
+ }
#if UNITY_EDITOR
private void Reset()