Browse Source

Added some comments to the main FSR2 classes

mac-autoexp
Nico de Poel 3 years ago
parent
commit
c1326fc261
  1. 3
      Assets/Scripts/Fsr2.cs
  2. 4
      Assets/Scripts/Fsr2Callbacks.cs
  3. 6
      Assets/Scripts/Fsr2Context.cs
  4. 2
      Assets/Scripts/Fsr2Controller.cs
  5. 5
      Assets/Scripts/Fsr2Pipeline.cs
  6. 4
      Assets/Scripts/Fsr2Resources.cs

3
Assets/Scripts/Fsr2.cs

@ -5,6 +5,9 @@ using UnityEngine.Rendering;
namespace FidelityFX namespace FidelityFX
{ {
/// <summary>
/// A collection of helper functions and data structures required by the FSR2 process.
/// </summary>
public static class Fsr2 public static class Fsr2
{ {
// Allow overriding of certain Unity resource management behaviors by the programmer // Allow overriding of certain Unity resource management behaviors by the programmer

4
Assets/Scripts/Fsr2Callbacks.cs

@ -2,6 +2,10 @@
namespace FidelityFX namespace FidelityFX
{ {
/// <summary>
/// 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.
/// </summary>
public class Fsr2Callbacks public class Fsr2Callbacks
{ {
public virtual void Message(Fsr2.MessageType type, string message) public virtual void Message(Fsr2.MessageType type, string message)

6
Assets/Scripts/Fsr2Context.cs

@ -6,6 +6,12 @@ using UnityEngine.Rendering;
namespace FidelityFX namespace FidelityFX
{ {
/// <summary>
/// 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.
/// </summary>
public class Fsr2Context public class Fsr2Context
{ {
private const int MaxQueuedFrames = 16; private const int MaxQueuedFrames = 16;

2
Assets/Scripts/Fsr2Controller.cs

@ -8,7 +8,7 @@ namespace FidelityFX
/// <summary> /// <summary>
/// This class is responsible for hooking into various Unity events and translating them to the FSR2 subsystem. /// 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 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.
/// </summary> /// </summary>
[RequireComponent(typeof(Camera))] [RequireComponent(typeof(Camera))]
public class Fsr2Controller : MonoBehaviour public class Fsr2Controller : MonoBehaviour

5
Assets/Scripts/Fsr2Pipeline.cs

@ -6,6 +6,11 @@ using UnityEngine.Rendering;
namespace FidelityFX namespace FidelityFX
{ {
/// <summary>
/// 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.
/// </summary>
internal abstract class Fsr2Pipeline: IDisposable internal abstract class Fsr2Pipeline: IDisposable
{ {
internal const int ShadingChangeMipLevel = 4; // This matches the FFX_FSR2_SHADING_CHANGE_MIP_LEVEL define internal const int ShadingChangeMipLevel = 4; // This matches the FFX_FSR2_SHADING_CHANGE_MIP_LEVEL define

4
Assets/Scripts/Fsr2Resources.cs

@ -4,6 +4,10 @@ using UnityEngine.Experimental.Rendering;
namespace FidelityFX namespace FidelityFX
{ {
/// <summary>
/// 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.
/// </summary>
internal class Fsr2Resources internal class Fsr2Resources
{ {
public Texture2D DefaultExposure; public Texture2D DefaultExposure;

Loading…
Cancel
Save