diff --git a/Assets/Scripts/Core/Fsr3Upscaler.cs b/Assets/Scripts/Core/Fsr3Upscaler.cs
index d31a82e..4c5dc51 100644
--- a/Assets/Scripts/Core/Fsr3Upscaler.cs
+++ b/Assets/Scripts/Core/Fsr3Upscaler.cs
@@ -158,6 +158,9 @@ namespace FidelityFX
EnableDebugChecking = 1 << 8,
}
+ ///
+ /// A structure encapsulating the parameters required to initialize FidelityFX Super Resolution 3 upscaling.
+ ///
public struct ContextDescription
{
public InitializationFlags Flags;
@@ -165,40 +168,9 @@ namespace FidelityFX
public Vector2Int DisplaySize;
public IFsr3UpscalerCallbacks Callbacks;
}
-
- ///
- /// An immutable structure wrapping all of the necessary information to bind a specific buffer or attachment of a render target to a compute shader.
- ///
- public readonly struct ResourceView
- {
- ///
- /// This value is the equivalent of not setting any value at all; all struct fields will have their default values.
- /// It does not refer to a valid texture, therefore any variable set to this value should be checked for IsValid and reassigned before being bound to a shader.
- ///
- public static readonly ResourceView Unassigned = new ResourceView(default);
-
- ///
- /// This value contains a valid texture reference that can be bound to a shader, however it is just an empty placeholder texture.
- /// Binding this to a shader can be seen as setting the texture variable inside the shader to null.
- ///
- public static readonly ResourceView None = new ResourceView(BuiltinRenderTextureType.None);
-
- public ResourceView(in RenderTargetIdentifier renderTarget, RenderTextureSubElement subElement = RenderTextureSubElement.Default, int mipLevel = 0)
- {
- RenderTarget = renderTarget;
- SubElement = subElement;
- MipLevel = mipLevel;
- }
-
- public bool IsValid => !RenderTarget.Equals(default);
-
- public readonly RenderTargetIdentifier RenderTarget;
- public readonly RenderTextureSubElement SubElement;
- public readonly int MipLevel;
- }
///
- /// A structure encapsulating the parameters for dispatching the various passes of FidelityFX Super Resolution 2.
+ /// A structure encapsulating the parameters for dispatching the various passes of FidelityFX Super Resolution 3.
///
public class DispatchDescription
{
@@ -327,4 +299,35 @@ namespace FidelityFX
public readonly uint dummy1;
}
}
+
+ ///
+ /// An immutable structure wrapping all of the necessary information to bind a specific buffer or attachment of a render target to a compute shader.
+ ///
+ public readonly struct ResourceView
+ {
+ ///
+ /// This value is the equivalent of not setting any value at all; all struct fields will have their default values.
+ /// It does not refer to a valid texture, therefore any variable set to this value should be checked for IsValid and reassigned before being bound to a shader.
+ ///
+ public static readonly ResourceView Unassigned = new ResourceView(default);
+
+ ///
+ /// This value contains a valid texture reference that can be bound to a shader, however it is just an empty placeholder texture.
+ /// Binding this to a shader can be seen as setting the texture variable inside the shader to null.
+ ///
+ public static readonly ResourceView None = new ResourceView(BuiltinRenderTextureType.None);
+
+ public ResourceView(in RenderTargetIdentifier renderTarget, RenderTextureSubElement subElement = RenderTextureSubElement.Default, int mipLevel = 0)
+ {
+ RenderTarget = renderTarget;
+ SubElement = subElement;
+ MipLevel = mipLevel;
+ }
+
+ public bool IsValid => !RenderTarget.Equals(default);
+
+ public readonly RenderTargetIdentifier RenderTarget;
+ public readonly RenderTextureSubElement SubElement;
+ public readonly int MipLevel;
+ }
}
diff --git a/Assets/Scripts/Core/Fsr3UpscalerContext.cs b/Assets/Scripts/Core/Fsr3UpscalerContext.cs
index 0f3b99d..61722d5 100644
--- a/Assets/Scripts/Core/Fsr3UpscalerContext.cs
+++ b/Assets/Scripts/Core/Fsr3UpscalerContext.cs
@@ -157,9 +157,9 @@ namespace FidelityFX
// If auto exposure is enabled use the auto exposure SRV, otherwise what the app sends
if ((_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableAutoExposure) != 0)
- dispatchParams.Exposure = new Fsr3Upscaler.ResourceView(_resources.AutoExposure);
+ dispatchParams.Exposure = new ResourceView(_resources.AutoExposure);
else if (!dispatchParams.Exposure.IsValid)
- dispatchParams.Exposure = new Fsr3Upscaler.ResourceView(_resources.DefaultExposure);
+ dispatchParams.Exposure = new ResourceView(_resources.DefaultExposure);
if (dispatchParams.EnableAutoReactive)
{
@@ -179,8 +179,8 @@ namespace FidelityFX
_resources.DestroyTcrAutogenResources();
}
- if (!dispatchParams.Reactive.IsValid) dispatchParams.Reactive = new Fsr3Upscaler.ResourceView(_resources.DefaultReactive);
- if (!dispatchParams.TransparencyAndComposition.IsValid) dispatchParams.TransparencyAndComposition = new Fsr3Upscaler.ResourceView(_resources.DefaultReactive);
+ if (!dispatchParams.Reactive.IsValid) dispatchParams.Reactive = new ResourceView(_resources.DefaultReactive);
+ if (!dispatchParams.TransparencyAndComposition.IsValid) dispatchParams.TransparencyAndComposition = new ResourceView(_resources.DefaultReactive);
Fsr3UpscalerResources.CreateAliasableResources(commandBuffer, _contextDescription, dispatchParams);
SetupConstants(dispatchParams, resetAccumulation);
@@ -229,8 +229,8 @@ namespace FidelityFX
if (dispatchParams.EnableAutoReactive)
{
GenerateTransparencyCompositionReactive(dispatchParams, commandBuffer, frameIndex);
- dispatchParams.Reactive = new Fsr3Upscaler.ResourceView(_resources.AutoReactive);
- dispatchParams.TransparencyAndComposition = new Fsr3Upscaler.ResourceView(_resources.AutoComposition);
+ dispatchParams.Reactive = new ResourceView(_resources.AutoReactive);
+ dispatchParams.TransparencyAndComposition = new ResourceView(_resources.AutoComposition);
}
// Compute luminance pyramid
diff --git a/Assets/Scripts/Fsr3UpscalerImageEffect.cs b/Assets/Scripts/Fsr3UpscalerImageEffect.cs
index a3efcca..63a880f 100644
--- a/Assets/Scripts/Fsr3UpscalerImageEffect.cs
+++ b/Assets/Scripts/Fsr3UpscalerImageEffect.cs
@@ -325,20 +325,20 @@ namespace FidelityFX
private void SetupDispatchDescription()
{
// Set up the main FSR3 Upscaler dispatch parameters
- _dispatchDescription.Color = new Fsr3Upscaler.ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color);
- _dispatchDescription.Depth = new Fsr3Upscaler.ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
- _dispatchDescription.MotionVectors = new Fsr3Upscaler.ResourceView(BuiltinRenderTextureType.MotionVectors);
- _dispatchDescription.Exposure = Fsr3Upscaler.ResourceView.Unassigned;
- _dispatchDescription.Reactive = Fsr3Upscaler.ResourceView.Unassigned;
- _dispatchDescription.TransparencyAndComposition = Fsr3Upscaler.ResourceView.Unassigned;
+ _dispatchDescription.Color = new ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color);
+ _dispatchDescription.Depth = new ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
+ _dispatchDescription.MotionVectors = new ResourceView(BuiltinRenderTextureType.MotionVectors);
+ _dispatchDescription.Exposure = ResourceView.Unassigned;
+ _dispatchDescription.Reactive = ResourceView.Unassigned;
+ _dispatchDescription.TransparencyAndComposition = ResourceView.Unassigned;
- if (!enableAutoExposure && exposure != null) _dispatchDescription.Exposure = new Fsr3Upscaler.ResourceView(exposure);
- if (reactiveMask != null) _dispatchDescription.Reactive = new Fsr3Upscaler.ResourceView(reactiveMask);
- if (transparencyAndCompositionMask != null) _dispatchDescription.TransparencyAndComposition = new Fsr3Upscaler.ResourceView(transparencyAndCompositionMask);
+ if (!enableAutoExposure && exposure != null) _dispatchDescription.Exposure = new ResourceView(exposure);
+ if (reactiveMask != null) _dispatchDescription.Reactive = new ResourceView(reactiveMask);
+ if (transparencyAndCompositionMask != null) _dispatchDescription.TransparencyAndComposition = new ResourceView(transparencyAndCompositionMask);
var scaledRenderSize = GetScaledRenderSize();
- _dispatchDescription.Output = new Fsr3Upscaler.ResourceView(Fsr3ShaderIDs.UavUpscaledOutput);
+ _dispatchDescription.Output = new ResourceView(Fsr3ShaderIDs.UavUpscaledOutput);
_dispatchDescription.PreExposure = preExposure;
_dispatchDescription.EnableSharpening = performSharpenPass;
_dispatchDescription.Sharpness = sharpness;
@@ -357,7 +357,7 @@ namespace FidelityFX
_dispatchDescription.EnableAutoReactive = autoGenerateTransparencyAndComposition;
if (autoGenerateTransparencyAndComposition)
{
- _dispatchDescription.ColorOpaqueOnly = new Fsr3Upscaler.ResourceView(_colorOpaqueOnly);
+ _dispatchDescription.ColorOpaqueOnly = new ResourceView(_colorOpaqueOnly);
_dispatchDescription.AutoTcThreshold = generateTransparencyAndCompositionParameters.autoTcThreshold;
_dispatchDescription.AutoTcScale = generateTransparencyAndCompositionParameters.autoTcScale;
_dispatchDescription.AutoReactiveScale = generateTransparencyAndCompositionParameters.autoReactiveScale;
@@ -374,9 +374,9 @@ namespace FidelityFX
private void SetupAutoReactiveDescription()
{
// Set up the parameters to auto-generate a reactive mask
- _genReactiveDescription.ColorOpaqueOnly = new Fsr3Upscaler.ResourceView(_colorOpaqueOnly);
- _genReactiveDescription.ColorPreUpscale = new Fsr3Upscaler.ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color);
- _genReactiveDescription.OutReactive = new Fsr3Upscaler.ResourceView(Fsr3ShaderIDs.UavAutoReactive);
+ _genReactiveDescription.ColorOpaqueOnly = new ResourceView(_colorOpaqueOnly);
+ _genReactiveDescription.ColorPreUpscale = new ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color);
+ _genReactiveDescription.OutReactive = new ResourceView(Fsr3ShaderIDs.UavAutoReactive);
_genReactiveDescription.RenderSize = GetScaledRenderSize();
_genReactiveDescription.Scale = generateReactiveParameters.scale;
_genReactiveDescription.CutoffThreshold = generateReactiveParameters.cutoffThreshold;
@@ -420,7 +420,7 @@ namespace FidelityFX
var scaledRenderSize = GetScaledRenderSize();
_dispatchCommandBuffer.GetTemporaryRT(Fsr3ShaderIDs.UavAutoReactive, scaledRenderSize.x, scaledRenderSize.y, 0, default, GraphicsFormat.R8_UNorm, 1, true);
_context.GenerateReactiveMask(_genReactiveDescription, _dispatchCommandBuffer);
- _dispatchDescription.Reactive = new Fsr3Upscaler.ResourceView(Fsr3ShaderIDs.UavAutoReactive);
+ _dispatchDescription.Reactive = new ResourceView(Fsr3ShaderIDs.UavAutoReactive);
}
// The backbuffer is not set up to allow random-write access, so we need a temporary render texture for FSR3 to output to