diff --git a/Assets/Scripts/Core/Fsr2.cs b/Assets/Scripts/Core/Fsr2.cs
index 9866358..1da9ff2 100644
--- a/Assets/Scripts/Core/Fsr2.cs
+++ b/Assets/Scripts/Core/Fsr2.cs
@@ -168,7 +168,17 @@ namespace FidelityFX
///
public readonly struct RenderTargetView
{
- public static readonly RenderTargetView Empty = new RenderTargetView(default);
+ ///
+ /// 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 RenderTargetView Unassigned = new RenderTargetView(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 RenderTargetView None = new RenderTargetView(BuiltinRenderTextureType.None);
public RenderTargetView(in RenderTargetIdentifier renderTarget, RenderTextureSubElement subElement = RenderTextureSubElement.Default, int mipLevel = 0)
{
@@ -177,7 +187,7 @@ namespace FidelityFX
MipLevel = mipLevel;
}
- public bool IsEmpty => RenderTarget.Equals(default);
+ public bool IsValid => !RenderTarget.Equals(default);
public readonly RenderTargetIdentifier RenderTarget;
public readonly RenderTextureSubElement SubElement;
diff --git a/Assets/Scripts/Core/Fsr2Context.cs b/Assets/Scripts/Core/Fsr2Context.cs
index 089f6bf..102b918 100644
--- a/Assets/Scripts/Core/Fsr2Context.cs
+++ b/Assets/Scripts/Core/Fsr2Context.cs
@@ -159,7 +159,7 @@ namespace FidelityFX
// If auto exposure is enabled use the auto exposure SRV, otherwise what the app sends
if ((_contextDescription.Flags & Fsr2.InitializationFlags.EnableAutoExposure) != 0)
dispatchParams.Exposure = new Fsr2.RenderTargetView(_resources.AutoExposure);
- else if (dispatchParams.Exposure.IsEmpty)
+ else if (!dispatchParams.Exposure.IsValid)
dispatchParams.Exposure = new Fsr2.RenderTargetView(_resources.DefaultExposure);
if (dispatchParams.EnableAutoReactive)
@@ -170,7 +170,7 @@ namespace FidelityFX
if (resetAccumulation)
{
- RenderTargetIdentifier opaqueOnly = dispatchParams.ColorOpaqueOnly.IsEmpty ? Fsr2ShaderIDs.SrvOpaqueOnly : dispatchParams.ColorOpaqueOnly.RenderTarget;
+ RenderTargetIdentifier opaqueOnly = dispatchParams.ColorOpaqueOnly.IsValid ? dispatchParams.ColorOpaqueOnly.RenderTarget : Fsr2ShaderIDs.SrvOpaqueOnly;
commandBuffer.Blit(_resources.PrevPreAlpha[frameIndex ^ 1], opaqueOnly);
}
}
@@ -180,8 +180,8 @@ namespace FidelityFX
_resources.DestroyTcrAutogenResources();
}
- if (dispatchParams.Reactive.IsEmpty) dispatchParams.Reactive = new Fsr2.RenderTargetView(_resources.DefaultReactive);
- if (dispatchParams.TransparencyAndComposition.IsEmpty) dispatchParams.TransparencyAndComposition = new Fsr2.RenderTargetView(_resources.DefaultReactive);
+ if (!dispatchParams.Reactive.IsValid) dispatchParams.Reactive = new Fsr2.RenderTargetView(_resources.DefaultReactive);
+ if (!dispatchParams.TransparencyAndComposition.IsValid) dispatchParams.TransparencyAndComposition = new Fsr2.RenderTargetView(_resources.DefaultReactive);
Fsr2Resources.CreateAliasableResources(commandBuffer, _contextDescription, dispatchParams);
SetupConstants(dispatchParams, resetAccumulation);
@@ -436,27 +436,27 @@ namespace FidelityFX
private void DebugCheckDispatch(Fsr2.DispatchDescription dispatchParams)
{
- if (dispatchParams.Color.IsEmpty)
+ if (!dispatchParams.Color.IsValid)
{
Debug.LogError("Color resource is null");
}
- if (dispatchParams.Depth.IsEmpty)
+ if (!dispatchParams.Depth.IsValid)
{
Debug.LogError("Depth resource is null");
}
- if (dispatchParams.MotionVectors.IsEmpty)
+ if (!dispatchParams.MotionVectors.IsValid)
{
Debug.LogError("MotionVectors resource is null");
}
- if (dispatchParams.Output.IsEmpty)
+ if (!dispatchParams.Output.IsValid)
{
Debug.LogError("Output resource is null");
}
- if (!dispatchParams.Exposure.IsEmpty && (_contextDescription.Flags & Fsr2.InitializationFlags.EnableAutoExposure) != 0)
+ if (dispatchParams.Exposure.IsValid && (_contextDescription.Flags & Fsr2.InitializationFlags.EnableAutoExposure) != 0)
{
Debug.LogWarning("Exposure resource provided, however auto exposure flag is present");
}
diff --git a/Assets/Scripts/Fsr2ImageEffect.cs b/Assets/Scripts/Fsr2ImageEffect.cs
index f29e0dc..e67c364 100644
--- a/Assets/Scripts/Fsr2ImageEffect.cs
+++ b/Assets/Scripts/Fsr2ImageEffect.cs
@@ -328,9 +328,9 @@ namespace FidelityFX
_dispatchDescription.Color = new Fsr2.RenderTargetView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Color);
_dispatchDescription.Depth = new Fsr2.RenderTargetView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
_dispatchDescription.MotionVectors = new Fsr2.RenderTargetView(BuiltinRenderTextureType.MotionVectors);
- _dispatchDescription.Exposure = Fsr2.RenderTargetView.Empty;
- _dispatchDescription.Reactive = Fsr2.RenderTargetView.Empty;
- _dispatchDescription.TransparencyAndComposition = Fsr2.RenderTargetView.Empty;
+ _dispatchDescription.Exposure = Fsr2.RenderTargetView.Unassigned;
+ _dispatchDescription.Reactive = Fsr2.RenderTargetView.Unassigned;
+ _dispatchDescription.TransparencyAndComposition = Fsr2.RenderTargetView.Unassigned;
if (!enableAutoExposure && exposure != null) _dispatchDescription.Exposure = new Fsr2.RenderTargetView(exposure);
if (reactiveMask != null) _dispatchDescription.Reactive = new Fsr2.RenderTargetView(reactiveMask);