diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs
index 7c29eda..1148403 100644
--- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs
+++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs
@@ -211,7 +211,7 @@ namespace UnityEngine.Rendering.PostProcessing
if (RuntimeUtilities.IsDynamicResolutionEnabled(context.camera)) flags |= Fsr3Upscaler.InitializationFlags.EnableDynamicResolution;
_callbacks = callbacksFactory(context);
- _fsrContext = Fsr3Upscaler.CreateContext(_displaySize, _maxRenderSize, context.resources.computeShaders.superResolution, _callbacks, flags);
+ _fsrContext = Fsr3Upscaler.CreateContext(_displaySize, _maxRenderSize, context.resources.computeShaders.superResolution, flags);
// Apply a mipmap bias so that textures retain their sharpness
float biasOffset = Fsr3Upscaler.GetMipmapBiasOffset(_maxRenderSize.x, _displaySize.x);
diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs
index 90036d4..c636c93 100644
--- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs
+++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs
@@ -33,7 +33,7 @@ namespace FidelityFX
///
/// Creates a new FSR3 Upscaler context with standard parameters that are appropriate for the current platform.
///
- public static Fsr3UpscalerContext CreateContext(Vector2Int displaySize, Vector2Int maxRenderSize, Fsr3UpscalerShaders shaders, IFsr3UpscalerCallbacks callbacks, InitializationFlags flags = 0)
+ public static Fsr3UpscalerContext CreateContext(Vector2Int displaySize, Vector2Int maxRenderSize, Fsr3UpscalerShaders shaders, InitializationFlags flags = 0)
{
if (SystemInfo.usesReversedZBuffer)
flags |= InitializationFlags.EnableDepthInverted;
@@ -52,7 +52,6 @@ namespace FidelityFX
DisplaySize = displaySize,
MaxRenderSize = maxRenderSize,
Shaders = shaders,
- Callbacks = callbacks,
};
var context = new Fsr3UpscalerContext();
@@ -168,7 +167,6 @@ namespace FidelityFX
public Vector2Int MaxRenderSize;
public Vector2Int DisplaySize;
public Fsr3UpscalerShaders Shaders;
- public IFsr3UpscalerCallbacks Callbacks;
}
///
diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerAssets.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerAssets.cs
new file mode 100644
index 0000000..3e4e24f
--- /dev/null
+++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerAssets.cs
@@ -0,0 +1,151 @@
+// Copyright (c) 2023 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
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using UnityEngine;
+
+namespace FidelityFX
+{
+ ///
+ /// Scriptable object containing all shader resources required by FidelityFX Super Resolution 3 (FSR3) Upscaler.
+ /// These can be stored in an asset file and referenced from a scene or prefab, avoiding the need to load the shaders from a Resources folder.
+ ///
+ public class Fsr3UpscalerAssets : ScriptableObject
+ {
+ public Fsr3UpscalerShaders shaders;
+
+#if UNITY_EDITOR
+ private void Reset()
+ {
+ 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"),
+ accumulatePass = FindComputeShader("ffx_fsr3upscaler_accumulate_pass"),
+ sharpenPass = FindComputeShader("ffx_fsr3upscaler_rcas_pass"),
+ autoGenReactivePass = FindComputeShader("ffx_fsr3upscaler_autogen_reactive_pass"),
+ tcrAutoGenPass = FindComputeShader("ffx_fsr3upscaler_tcr_autogen_pass"),
+ };
+ }
+
+ private static ComputeShader FindComputeShader(string name)
+ {
+ string[] assetGuids = UnityEditor.AssetDatabase.FindAssets($"t:ComputeShader {name}");
+ if (assetGuids == null || assetGuids.Length == 0)
+ return null;
+
+ string assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(assetGuids[0]);
+ return UnityEditor.AssetDatabase.LoadAssetAtPath(assetPath);
+ }
+#endif
+ }
+
+ ///
+ /// All the compute shaders used by the FSR3 Upscaler.
+ ///
+ [System.Serializable]
+ public class Fsr3UpscalerShaders
+ {
+ ///
+ /// The compute shader used by the luminance pyramid computation pass.
+ ///
+ public ComputeShader computeLuminancePyramidPass;
+
+ ///
+ /// The compute shader used by the previous depth reconstruction pass.
+ ///
+ public ComputeShader reconstructPreviousDepthPass;
+
+ ///
+ /// The compute shader used by the depth clip pass.
+ ///
+ public ComputeShader depthClipPass;
+
+ ///
+ /// The compute shader used by the lock pass.
+ ///
+ public ComputeShader lockPass;
+
+ ///
+ /// The compute shader used by the accumulation pass.
+ ///
+ public ComputeShader accumulatePass;
+
+ ///
+ /// The compute shader used by the RCAS sharpening pass.
+ ///
+ public ComputeShader sharpenPass;
+
+ ///
+ /// The compute shader used to auto-generate a reactive mask.
+ ///
+ public ComputeShader autoGenReactivePass;
+
+ ///
+ /// The compute shader used to auto-generate a transparency & composition mask.
+ ///
+ public ComputeShader tcrAutoGenPass;
+
+ ///
+ /// Returns a copy of this class and its contents.
+ ///
+ public Fsr3UpscalerShaders Clone()
+ {
+ 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()
+ {
+ return new Fsr3UpscalerShaders
+ {
+ computeLuminancePyramidPass = Object.Instantiate(computeLuminancePyramidPass),
+ reconstructPreviousDepthPass = Object.Instantiate(reconstructPreviousDepthPass),
+ depthClipPass = Object.Instantiate(depthClipPass),
+ lockPass = Object.Instantiate(lockPass),
+ accumulatePass = Object.Instantiate(accumulatePass),
+ sharpenPass = Object.Instantiate(sharpenPass),
+ autoGenReactivePass = Object.Instantiate(autoGenReactivePass),
+ tcrAutoGenPass = Object.Instantiate(tcrAutoGenPass),
+ };
+ }
+
+ ///
+ /// Destroy all the shaders within this instance.
+ /// Use this only on clones created through DeepCopy.
+ ///
+ public void Dispose()
+ {
+ Object.Destroy(computeLuminancePyramidPass);
+ Object.Destroy(reconstructPreviousDepthPass);
+ Object.Destroy(depthClipPass);
+ Object.Destroy(lockPass);
+ Object.Destroy(accumulatePass);
+ Object.Destroy(sharpenPass);
+ Object.Destroy(autoGenReactivePass);
+ Object.Destroy(tcrAutoGenPass);
+ }
+ }
+}
diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerShaders.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerAssets.cs.meta
similarity index 83%
rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerShaders.cs.meta
rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerAssets.cs.meta
index d5531c2..de48032 100644
--- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerShaders.cs.meta
+++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerAssets.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: cec8f68d6b0d9be4986fac65d3a2e1a6
+guid: aaeb3d821f826d44b84289a2dd23f90e
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerShaders.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerShaders.cs
deleted file mode 100644
index 9d9fa4d..0000000
--- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerShaders.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System;
-using UnityEngine;
-
-namespace FidelityFX
-{
- ///
- /// All the compute shaders used by the FidelityFX Super Resolution 3 (FSR3) Upscaler.
- ///
- [Serializable]
- public class Fsr3UpscalerShaders
- {
- ///
- /// The compute shader used by the luminance pyramid computation pass.
- ///
- public ComputeShader computeLuminancePyramidPass;
-
- ///
- /// The compute shader used by the previous depth reconstruction pass.
- ///
- public ComputeShader reconstructPreviousDepthPass;
-
- ///
- /// The compute shader used by the depth clip pass.
- ///
- public ComputeShader depthClipPass;
-
- ///
- /// The compute shader used by the lock pass.
- ///
- public ComputeShader lockPass;
-
- ///
- /// The compute shader used by the accumulation pass.
- ///
- public ComputeShader accumulatePass;
-
- ///
- /// The compute shader used by the RCAS sharpening pass.
- ///
- public ComputeShader sharpenPass;
-
- ///
- /// The compute shader used to auto-generate a reactive mask.
- ///
- public ComputeShader autoGenReactivePass;
-
- ///
- /// The compute shader used to auto-generate a transparency & composition mask.
- ///
- public ComputeShader tcrAutoGenPass;
-
- ///
- /// Returns a copy of this class and its contents.
- ///
- public Fsr3UpscalerShaders Clone()
- {
- return (Fsr3UpscalerShaders)MemberwiseClone();
- }
- }
-}