From c1326fc261e82d0ba3828145c6acb3cd10fbd70a Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Tue, 28 Feb 2023 11:16:46 +0100 Subject: [PATCH] Added some comments to the main FSR2 classes --- Assets/Scripts/Fsr2.cs | 3 +++ Assets/Scripts/Fsr2Callbacks.cs | 4 ++++ Assets/Scripts/Fsr2Context.cs | 6 ++++++ Assets/Scripts/Fsr2Controller.cs | 2 +- Assets/Scripts/Fsr2Pipeline.cs | 5 +++++ Assets/Scripts/Fsr2Resources.cs | 4 ++++ 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Fsr2.cs b/Assets/Scripts/Fsr2.cs index fd995fe..7821f12 100644 --- a/Assets/Scripts/Fsr2.cs +++ b/Assets/Scripts/Fsr2.cs @@ -5,6 +5,9 @@ using UnityEngine.Rendering; namespace FidelityFX { + /// + /// A collection of helper functions and data structures required by the FSR2 process. + /// public static class Fsr2 { // Allow overriding of certain Unity resource management behaviors by the programmer diff --git a/Assets/Scripts/Fsr2Callbacks.cs b/Assets/Scripts/Fsr2Callbacks.cs index a00938b..70bb61e 100644 --- a/Assets/Scripts/Fsr2Callbacks.cs +++ b/Assets/Scripts/Fsr2Callbacks.cs @@ -2,6 +2,10 @@ namespace FidelityFX { + /// + /// A collection of callbacks required by the FSR2 process. + /// This allows some customization by the game dev on how to integrate FSR2 into their own game setup. + /// public class Fsr2Callbacks { public virtual void Message(Fsr2.MessageType type, string message) diff --git a/Assets/Scripts/Fsr2Context.cs b/Assets/Scripts/Fsr2Context.cs index 476560c..30d626d 100644 --- a/Assets/Scripts/Fsr2Context.cs +++ b/Assets/Scripts/Fsr2Context.cs @@ -6,6 +6,12 @@ using UnityEngine.Rendering; namespace FidelityFX { + /// + /// This class loosely matches the FfxFsr2Context struct from the original FSR2 codebase. + /// It manages the various resources and compute passes required by the FSR2 process. + /// Note that this class does not know anything about Unity render pipelines; all it knows is CommandBuffers and RenderTargetIdentifiers. + /// This should make it suitable for integration with any of the available Unity render pipelines. + /// public class Fsr2Context { private const int MaxQueuedFrames = 16; diff --git a/Assets/Scripts/Fsr2Controller.cs b/Assets/Scripts/Fsr2Controller.cs index 54ab307..d2685f9 100644 --- a/Assets/Scripts/Fsr2Controller.cs +++ b/Assets/Scripts/Fsr2Controller.cs @@ -8,7 +8,7 @@ namespace FidelityFX /// /// This class is responsible for hooking into various Unity events and translating them to the FSR2 subsystem. /// This includes creation and destruction of the FSR2 context, as well as dispatching commands at the right time. - /// This class also exposes various FSR2 parameters to the Unity inspector. + /// This component also exposes various FSR2 parameters to the Unity inspector. /// [RequireComponent(typeof(Camera))] public class Fsr2Controller : MonoBehaviour diff --git a/Assets/Scripts/Fsr2Pipeline.cs b/Assets/Scripts/Fsr2Pipeline.cs index c40343f..147b5a9 100644 --- a/Assets/Scripts/Fsr2Pipeline.cs +++ b/Assets/Scripts/Fsr2Pipeline.cs @@ -6,6 +6,11 @@ using UnityEngine.Rendering; namespace FidelityFX { + /// + /// Base class for all of the compute passes that make up the FSR2 process. + /// This loosely matches the FfxPipelineState struct from the original FSR2 codebase, wrapped in an object-oriented blanket. + /// These classes are responsible for loading compute shaders, managing temporary resources, binding resources to shader kernels and dispatching said shaders. + /// internal abstract class Fsr2Pipeline: IDisposable { internal const int ShadingChangeMipLevel = 4; // This matches the FFX_FSR2_SHADING_CHANGE_MIP_LEVEL define diff --git a/Assets/Scripts/Fsr2Resources.cs b/Assets/Scripts/Fsr2Resources.cs index 47fe871..18bcd8e 100644 --- a/Assets/Scripts/Fsr2Resources.cs +++ b/Assets/Scripts/Fsr2Resources.cs @@ -4,6 +4,10 @@ using UnityEngine.Experimental.Rendering; namespace FidelityFX { + /// + /// Helper class for bundling and managing persistent resources required by the FSR2 process. + /// This includes lookup tables, default fallback resources and double-buffered resources that get swapped between frames. + /// internal class Fsr2Resources { public Texture2D DefaultExposure;