Browse Source

Updated shader assets names and references for the new collection of passes.

fsr3.1
Nico de Poel 2 years ago
parent
commit
0e481544bf
  1. 10
      Assets/Fsr3UpscalerAssets.asset
  2. 61
      Assets/Scripts/Core/Fsr3UpscalerAssets.cs
  3. 8
      Assets/Scripts/Core/Fsr3UpscalerPass.cs

10
Assets/Fsr3UpscalerAssets.asset

@ -13,10 +13,12 @@ MonoBehaviour:
m_Name: Fsr3UpscalerAssets m_Name: Fsr3UpscalerAssets
m_EditorClassIdentifier: m_EditorClassIdentifier:
shaders: shaders:
computeLuminancePyramidPass: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3}
reconstructPreviousDepthPass: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3}
depthClipPass: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3}
lockPass: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3}
prepareInputsPass: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3}
lumaPyramidPass: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3}
shadingChangePyramidPass: {fileID: 7200000, guid: 251e663738905fa4d8817001682d802f, type: 3}
shadingChangePass: {fileID: 7200000, guid: 9a2bff2f97619ed4989d9b0577ba0641, type: 3}
prepareReactivityPass: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3}
lumaInstabilityPass: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3}
accumulatePass: {fileID: 7200000, guid: c9b45f0ae7673694ba57a4aadfe212e9, type: 3} accumulatePass: {fileID: 7200000, guid: c9b45f0ae7673694ba57a4aadfe212e9, type: 3}
sharpenPass: {fileID: 7200000, guid: 7aaf5cfff022de2499e9b0412f947f6c, type: 3} sharpenPass: {fileID: 7200000, guid: 7aaf5cfff022de2499e9b0412f947f6c, type: 3}
autoGenReactivePass: {fileID: 7200000, guid: 5716b91fdaa4e9e439df6b96a796fe6e, type: 3} autoGenReactivePass: {fileID: 7200000, guid: 5716b91fdaa4e9e439df6b96a796fe6e, type: 3}

61
Assets/Scripts/Core/Fsr3UpscalerAssets.cs

@ -1,4 +1,4 @@
// Copyright (c) 2023 Nico de Poel
// Copyright (c) 2024 Nico de Poel
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
@ -19,6 +19,7 @@
// THE SOFTWARE. // THE SOFTWARE.
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
namespace FidelityFX namespace FidelityFX
{ {
@ -35,10 +36,12 @@ namespace FidelityFX
{ {
shaders = new Fsr3UpscalerShaders shaders = new Fsr3UpscalerShaders
{ {
computeLuminancePyramidPass = FindComputeShader("ffx_fsr3upscaler_compute_luminance_pyramid_pass"),
reconstructPreviousDepthPass = FindComputeShader("ffx_fsr3upscaler_reconstruct_previous_depth_pass"),
depthClipPass = FindComputeShader("ffx_fsr3upscaler_depth_clip_pass"),
lockPass = FindComputeShader("ffx_fsr3upscaler_lock_pass"),
prepareInputsPass = FindComputeShader("ffx_fsr3upscaler_prepare_inputs_pass"),
lumaPyramidPass = FindComputeShader("ffx_fsr3upscaler_luma_pyramid_pass"),
shadingChangePyramidPass = FindComputeShader("ffx_fsr3upscaler_shading_change_pyramid_pass"),
shadingChangePass = FindComputeShader("ffx_fsr3upscaler_shading_change_pass"),
prepareReactivityPass = FindComputeShader("ffx_fsr3upscaler_prepare_reactivity_pass"),
lumaInstabilityPass = FindComputeShader("ffx_fsr3upscaler_luma_instability_pass"),
accumulatePass = FindComputeShader("ffx_fsr3upscaler_accumulate_pass"), accumulatePass = FindComputeShader("ffx_fsr3upscaler_accumulate_pass"),
sharpenPass = FindComputeShader("ffx_fsr3upscaler_rcas_pass"), sharpenPass = FindComputeShader("ffx_fsr3upscaler_rcas_pass"),
autoGenReactivePass = FindComputeShader("ffx_fsr3upscaler_autogen_reactive_pass"), autoGenReactivePass = FindComputeShader("ffx_fsr3upscaler_autogen_reactive_pass"),
@ -64,25 +67,39 @@ namespace FidelityFX
[System.Serializable] [System.Serializable]
public class Fsr3UpscalerShaders public class Fsr3UpscalerShaders
{ {
/// <summary>
/// The compute shader used by the prepare inputs pass.
/// </summary>
[FormerlySerializedAs("reconstructPreviousDepthPass")]
public ComputeShader prepareInputsPass;
/// <summary> /// <summary>
/// The compute shader used by the luminance pyramid computation pass. /// The compute shader used by the luminance pyramid computation pass.
/// </summary> /// </summary>
public ComputeShader computeLuminancePyramidPass;
[FormerlySerializedAs("computeLuminancePyramidPass")]
public ComputeShader lumaPyramidPass;
/// <summary> /// <summary>
/// The compute shader used by the previous depth reconstruction pass.
/// The compute shader used by the shading change pyramid pass.
/// </summary> /// </summary>
public ComputeShader reconstructPreviousDepthPass;
public ComputeShader shadingChangePyramidPass;
/// <summary> /// <summary>
/// The compute shader used by the depth clip pass.
/// The compute shader used by the shading change pass.
/// </summary> /// </summary>
public ComputeShader depthClipPass;
public ComputeShader shadingChangePass;
/// <summary> /// <summary>
/// The compute shader used by the lock pass.
/// The compute shader used by the prepare reactivity pass.
/// </summary>
[FormerlySerializedAs("depthClipPass")]
public ComputeShader prepareReactivityPass;
/// <summary>
/// The compute shader used by the luma instability pass.
/// </summary> /// </summary>
public ComputeShader lockPass;
[FormerlySerializedAs("lockPass")]
public ComputeShader lumaInstabilityPass;
/// <summary> /// <summary>
/// The compute shader used by the accumulation pass. /// The compute shader used by the accumulation pass.
@ -121,10 +138,12 @@ namespace FidelityFX
{ {
return new Fsr3UpscalerShaders return new Fsr3UpscalerShaders
{ {
computeLuminancePyramidPass = Object.Instantiate(computeLuminancePyramidPass),
reconstructPreviousDepthPass = Object.Instantiate(reconstructPreviousDepthPass),
depthClipPass = Object.Instantiate(depthClipPass),
lockPass = Object.Instantiate(lockPass),
prepareInputsPass = Object.Instantiate(prepareInputsPass),
lumaPyramidPass = Object.Instantiate(lumaPyramidPass),
shadingChangePyramidPass = Object.Instantiate(shadingChangePyramidPass),
shadingChangePass = Object.Instantiate(shadingChangePass),
prepareReactivityPass = Object.Instantiate(prepareReactivityPass),
lumaInstabilityPass = Object.Instantiate(lumaInstabilityPass),
accumulatePass = Object.Instantiate(accumulatePass), accumulatePass = Object.Instantiate(accumulatePass),
sharpenPass = Object.Instantiate(sharpenPass), sharpenPass = Object.Instantiate(sharpenPass),
autoGenReactivePass = Object.Instantiate(autoGenReactivePass), autoGenReactivePass = Object.Instantiate(autoGenReactivePass),
@ -138,10 +157,12 @@ namespace FidelityFX
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
Object.Destroy(computeLuminancePyramidPass);
Object.Destroy(reconstructPreviousDepthPass);
Object.Destroy(depthClipPass);
Object.Destroy(lockPass);
Object.Destroy(prepareInputsPass);
Object.Destroy(lumaPyramidPass);
Object.Destroy(shadingChangePyramidPass);
Object.Destroy(shadingChangePass);
Object.Destroy(prepareReactivityPass);
Object.Destroy(lumaInstabilityPass);
Object.Destroy(accumulatePass); Object.Destroy(accumulatePass);
Object.Destroy(sharpenPass); Object.Destroy(sharpenPass);
Object.Destroy(autoGenReactivePass); Object.Destroy(autoGenReactivePass);

8
Assets/Scripts/Core/Fsr3UpscalerPass.cs

@ -103,7 +103,7 @@ namespace FidelityFX
{ {
_spdConstants = spdConstants; _spdConstants = spdConstants;
InitComputeShader("compute_luminance_pyramid_pass", contextDescription.Shaders.computeLuminancePyramidPass);
InitComputeShader("compute_luminance_pyramid_pass", contextDescription.Shaders.lumaPyramidPass);
} }
public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY)
@ -128,7 +128,7 @@ namespace FidelityFX
public Fsr3UpscalerReconstructPreviousDepthPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) public Fsr3UpscalerReconstructPreviousDepthPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants)
: base(contextDescription, resources, constants) : base(contextDescription, resources, constants)
{ {
InitComputeShader("reconstruct_previous_depth_pass", contextDescription.Shaders.reconstructPreviousDepthPass);
InitComputeShader("reconstruct_previous_depth_pass", contextDescription.Shaders.prepareInputsPass);
} }
public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY)
@ -156,7 +156,7 @@ namespace FidelityFX
public Fsr3UpscalerDepthClipPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) public Fsr3UpscalerDepthClipPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants)
: base(contextDescription, resources, constants) : base(contextDescription, resources, constants)
{ {
InitComputeShader("depth_clip_pass", contextDescription.Shaders.depthClipPass);
InitComputeShader("depth_clip_pass", contextDescription.Shaders.prepareReactivityPass);
} }
public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY)
@ -191,7 +191,7 @@ namespace FidelityFX
public Fsr3UpscalerLockPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) public Fsr3UpscalerLockPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants)
: base(contextDescription, resources, constants) : base(contextDescription, resources, constants)
{ {
InitComputeShader("lock_pass", contextDescription.Shaders.lockPass);
InitComputeShader("lock_pass", contextDescription.Shaders.lumaInstabilityPass);
} }
public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY)

Loading…
Cancel
Save