Browse Source

Added profiling samplers around the entire FSR2/3 process

framework
Nico de Poel 2 years ago
parent
commit
328011f7ba
  1. 6
      Runtime/FSR2/Fsr2Context.cs
  2. 6
      Runtime/FSR3/Fsr3UpscalerContext.cs

6
Runtime/FSR2/Fsr2Context.cs

@ -20,6 +20,7 @@
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling;
using UnityEngine.Rendering; using UnityEngine.Rendering;
namespace FidelityFX.FSR2 namespace FidelityFX.FSR2
@ -57,6 +58,8 @@ namespace FidelityFX.FSR2
private bool _firstExecution; private bool _firstExecution;
private Vector2 _previousJitterOffset; private Vector2 _previousJitterOffset;
private int _resourceFrameIndex; private int _resourceFrameIndex;
private readonly CustomSampler _sampler = CustomSampler.Create("FSR2");
public void Create(Fsr2.ContextDescription contextDescription) public void Create(Fsr2.ContextDescription contextDescription)
{ {
@ -126,6 +129,8 @@ namespace FidelityFX.FSR2
public void Dispatch(Fsr2.DispatchDescription dispatchParams, CommandBuffer commandBuffer) public void Dispatch(Fsr2.DispatchDescription dispatchParams, CommandBuffer commandBuffer)
{ {
commandBuffer.BeginSample(_sampler);
if ((_contextDescription.Flags & Fsr2.InitializationFlags.EnableDebugChecking) != 0) if ((_contextDescription.Flags & Fsr2.InitializationFlags.EnableDebugChecking) != 0)
{ {
DebugCheckDispatch(dispatchParams); DebugCheckDispatch(dispatchParams);
@ -257,6 +262,7 @@ namespace FidelityFX.FSR2
Fsr2Resources.DestroyAliasableResources(commandBuffer); Fsr2Resources.DestroyAliasableResources(commandBuffer);
commandBuffer.DisableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY"); commandBuffer.DisableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY");
commandBuffer.EndSample(_sampler);
} }
public void GenerateReactiveMask(Fsr2.GenerateReactiveDescription dispatchParams) public void GenerateReactiveMask(Fsr2.GenerateReactiveDescription dispatchParams)

6
Runtime/FSR3/Fsr3UpscalerContext.cs

@ -21,6 +21,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using UnityEngine; using UnityEngine;
using UnityEngine.Profiling;
using UnityEngine.Rendering; using UnityEngine.Rendering;
namespace FidelityFX.FSR3 namespace FidelityFX.FSR3
@ -65,6 +66,8 @@ namespace FidelityFX.FSR3
private Vector2 _previousJitterOffset; private Vector2 _previousJitterOffset;
private float _preExposure; private float _preExposure;
private float _previousFramePreExposure; private float _previousFramePreExposure;
private readonly CustomSampler _sampler = CustomSampler.Create("FSR3 Upscaler");
public void Create(Fsr3Upscaler.ContextDescription contextDescription) public void Create(Fsr3Upscaler.ContextDescription contextDescription)
{ {
@ -144,6 +147,8 @@ namespace FidelityFX.FSR3
public void Dispatch(Fsr3Upscaler.DispatchDescription dispatchParams, CommandBuffer commandBuffer) public void Dispatch(Fsr3Upscaler.DispatchDescription dispatchParams, CommandBuffer commandBuffer)
{ {
commandBuffer.BeginSample(_sampler);
if ((_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDebugChecking) != 0) if ((_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDebugChecking) != 0)
{ {
DebugCheckDispatch(dispatchParams); DebugCheckDispatch(dispatchParams);
@ -281,6 +286,7 @@ namespace FidelityFX.FSR3
Fsr3UpscalerResources.DestroyAliasableResources(commandBuffer); Fsr3UpscalerResources.DestroyAliasableResources(commandBuffer);
commandBuffer.DisableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY"); commandBuffer.DisableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY");
commandBuffer.EndSample(_sampler);
} }
public void GenerateReactiveMask(Fsr3Upscaler.GenerateReactiveDescription dispatchParams) public void GenerateReactiveMask(Fsr3Upscaler.GenerateReactiveDescription dispatchParams)

Loading…
Cancel
Save