|
|
@ -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); |
|
|
|