From d8a4bc3f6142823c4574627a6d964333d113410f Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sun, 20 Aug 2023 22:21:48 +0200 Subject: [PATCH] Unity 2020.1 compatibility testing results --- Assets/Scripts/Core/Fsr2.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Core/Fsr2.cs b/Assets/Scripts/Core/Fsr2.cs index 89a8c42..9866358 100644 --- a/Assets/Scripts/Core/Fsr2.cs +++ b/Assets/Scripts/Core/Fsr2.cs @@ -125,6 +125,13 @@ namespace FidelityFX return Mathf.Abs(value) < Mathf.Epsilon ? 1.0f : Mathf.Sin(Mathf.PI * value) / (Mathf.PI * value) * (Mathf.Sin(0.5f * Mathf.PI * value) / (0.5f * Mathf.PI * value)); } +#if !UNITY_2021_1_OR_NEWER + internal static void SetBufferData(this CommandBuffer commandBuffer, ComputeBuffer computeBuffer, Array data) + { + commandBuffer.SetComputeBufferData(computeBuffer, data); + } +#endif + public enum QualityMode { UltraQuality = 0, @@ -157,11 +164,11 @@ namespace FidelityFX } /// - /// A structure wrapping all of the necessary information to bind a specific buffer or attachment of a render target to a compute shader. + /// 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 RenderTargetView { - public static readonly RenderTargetView Empty = new RenderTargetView(default(RenderTargetIdentifier)); + public static readonly RenderTargetView Empty = new RenderTargetView(default); public RenderTargetView(in RenderTargetIdentifier renderTarget, RenderTextureSubElement subElement = RenderTextureSubElement.Default, int mipLevel = 0) { @@ -170,7 +177,7 @@ namespace FidelityFX MipLevel = mipLevel; } - public bool IsEmpty => RenderTarget.Equals(default(RenderTargetIdentifier)); + public bool IsEmpty => RenderTarget.Equals(default); public readonly RenderTargetIdentifier RenderTarget; public readonly RenderTextureSubElement SubElement; @@ -213,6 +220,7 @@ namespace FidelityFX } /// + /// A structure encapsulating the parameters for automatic generation of a reactive mask. /// The default values for Scale, CutoffThreshold, BinaryValue and Flags were taken from the FSR2 demo project. /// public class GenerateReactiveDescription