Browse Source

Renamed UNITY_FSR_ keywords and macros to UNITY_FFX_ to reflect that they're to be commonly used by all sorts of FidelityFX shaders.

framework
Nico de Poel 2 years ago
parent
commit
5944893e4b
  1. 4
      Runtime/FSR2/Fsr2Context.cs
  2. 4
      Runtime/FSR3/Fsr3UpscalerContext.cs
  3. 2
      Shaders/ffx_fsr2_accumulate_pass.compute
  4. 2
      Shaders/ffx_fsr2_autogen_reactive_pass.compute
  5. 2
      Shaders/ffx_fsr2_compute_luminance_pyramid_pass.compute
  6. 2
      Shaders/ffx_fsr2_depth_clip_pass.compute
  7. 2
      Shaders/ffx_fsr2_lock_pass.compute
  8. 2
      Shaders/ffx_fsr2_rcas_pass.compute
  9. 2
      Shaders/ffx_fsr2_reconstruct_previous_depth_pass.compute
  10. 2
      Shaders/ffx_fsr2_tcr_autogen_pass.compute
  11. 2
      Shaders/ffx_fsr3upscaler_accumulate_pass.compute
  12. 2
      Shaders/ffx_fsr3upscaler_autogen_reactive_pass.compute
  13. 2
      Shaders/ffx_fsr3upscaler_debug_view_pass.compute
  14. 2
      Shaders/ffx_fsr3upscaler_luma_instability_pass.compute
  15. 2
      Shaders/ffx_fsr3upscaler_luma_pyramid_pass.compute
  16. 2
      Shaders/ffx_fsr3upscaler_prepare_inputs_pass.compute
  17. 2
      Shaders/ffx_fsr3upscaler_prepare_reactivity_pass.compute
  18. 2
      Shaders/ffx_fsr3upscaler_rcas_pass.compute
  19. 2
      Shaders/ffx_fsr3upscaler_shading_change_pass.compute
  20. 2
      Shaders/ffx_fsr3upscaler_shading_change_pyramid_pass.compute
  21. 2
      Shaders/ffx_fsr3upscaler_tcr_autogen_pass.compute
  22. 12
      Shaders/ffx_unity_common.cginc
  23. 48
      Shaders/shaders/fsr2/ffx_fsr2_callbacks_hlsl.h
  24. 60
      Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h

4
Runtime/FSR2/Fsr2Context.cs

@ -137,7 +137,7 @@ namespace FidelityFX.FSR2
} }
if (dispatchParams.UseTextureArrays) if (dispatchParams.UseTextureArrays)
commandBuffer.EnableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY");
commandBuffer.EnableShaderKeyword("UNITY_FFX_TEXTURE2D_X_ARRAY");
if (_firstExecution) if (_firstExecution)
{ {
@ -261,7 +261,7 @@ namespace FidelityFX.FSR2
Fsr2Resources.DestroyAliasableResources(commandBuffer); Fsr2Resources.DestroyAliasableResources(commandBuffer);
commandBuffer.DisableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY");
commandBuffer.DisableShaderKeyword("UNITY_FFX_TEXTURE2D_X_ARRAY");
commandBuffer.EndSample(_sampler); commandBuffer.EndSample(_sampler);
} }

4
Runtime/FSR3/Fsr3UpscalerContext.cs

@ -154,7 +154,7 @@ namespace FidelityFX.FSR3
} }
if (dispatchParams.UseTextureArrays) if (dispatchParams.UseTextureArrays)
commandBuffer.EnableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY");
commandBuffer.EnableShaderKeyword("UNITY_FFX_TEXTURE2D_X_ARRAY");
if (_firstExecution) if (_firstExecution)
{ {
@ -284,7 +284,7 @@ namespace FidelityFX.FSR3
Fsr3UpscalerResources.DestroyAliasableResources(commandBuffer); Fsr3UpscalerResources.DestroyAliasableResources(commandBuffer);
commandBuffer.DisableShaderKeyword("UNITY_FSR_TEXTURE2D_X_ARRAY");
commandBuffer.DisableShaderKeyword("UNITY_FFX_TEXTURE2D_X_ARRAY");
commandBuffer.EndSample(_sampler); commandBuffer.EndSample(_sampler);
} }

2
Shaders/ffx_fsr2_accumulate_pass.compute

@ -28,7 +28,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile_local __ FFX_FSR2_OPTION_APPLY_SHARPENING #pragma multi_compile_local __ FFX_FSR2_OPTION_APPLY_SHARPENING
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr2_autogen_reactive_pass.compute

@ -25,7 +25,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr2_compute_luminance_pyramid_pass.compute

@ -25,7 +25,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr2_depth_clip_pass.compute

@ -25,7 +25,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr2_lock_pass.compute

@ -25,7 +25,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr2_rcas_pass.compute

@ -24,7 +24,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr2_reconstruct_previous_depth_pass.compute

@ -26,7 +26,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr2_tcr_autogen_pass.compute

@ -25,7 +25,7 @@
#pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR2_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_accumulate_pass.compute

@ -26,7 +26,7 @@
#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_APPLY_SHARPENING #pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_APPLY_SHARPENING
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_autogen_reactive_pass.compute

@ -22,7 +22,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_debug_view_pass.compute

@ -22,7 +22,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_luma_instability_pass.compute

@ -22,7 +22,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_luma_pyramid_pass.compute

@ -22,7 +22,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_prepare_inputs_pass.compute

@ -24,7 +24,7 @@
#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS
#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH #pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_prepare_reactivity_pass.compute

@ -22,7 +22,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_rcas_pass.compute

@ -20,7 +20,7 @@
#pragma kernel CS #pragma kernel CS
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_shading_change_pass.compute

@ -22,7 +22,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_shading_change_pyramid_pass.compute

@ -22,7 +22,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

2
Shaders/ffx_fsr3upscaler_tcr_autogen_pass.compute

@ -23,7 +23,7 @@
#pragma multi_compile_local __ FFX_HALF #pragma multi_compile_local __ FFX_HALF
#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS #pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS
#pragma multi_compile __ UNITY_FSR_TEXTURE2D_X_ARRAY
#pragma multi_compile __ UNITY_FFX_TEXTURE2D_X_ARRAY
#include "ffx_unity_common.cginc" #include "ffx_unity_common.cginc"

12
Shaders/ffx_unity_common.cginc

@ -52,7 +52,7 @@
#endif #endif
// Control if TEXTURE2D_X macros will expand to texture arrays // Control if TEXTURE2D_X macros will expand to texture arrays
#if defined(UNITY_TEXTURE2D_X_ARRAY_SUPPORTED) && defined(UNITY_FSR_TEXTURE2D_X_ARRAY)
#if defined(UNITY_TEXTURE2D_X_ARRAY_SUPPORTED) && defined(UNITY_FFX_TEXTURE2D_X_ARRAY)
#define USE_TEXTURE2D_X_AS_ARRAY #define USE_TEXTURE2D_X_AS_ARRAY
#endif #endif
@ -73,10 +73,10 @@
#endif #endif
// Declare and sample camera buffers as texture arrays // Declare and sample camera buffers as texture arrays
#define UNITY_FSR_TEX2D(type) Texture2DArray<type>
#define UNITY_FSR_RWTEX2D(type) RWTexture2DArray<type>
#define UNITY_FSR_POS(pxPos) FfxUInt32x3(pxPos, SLICE_ARRAY_INDEX)
#define UNITY_FSR_UV(uv) FfxFloat32x3(uv, SLICE_ARRAY_INDEX)
#define UNITY_FSR_GETDIMS(tex, w, h) { FfxUInt32 uElements; (tex).GetDimensions((w), (h), uElements); }
#define UNITY_FFX_TEX2D(type) Texture2DArray<type>
#define UNITY_FFX_RWTEX2D(type) RWTexture2DArray<type>
#define UNITY_FFX_POS(pxPos) FfxUInt32x3(pxPos, SLICE_ARRAY_INDEX)
#define UNITY_FFX_UV(uv) FfxFloat32x3(uv, SLICE_ARRAY_INDEX)
#define UNITY_FFX_GETDIMS(tex, w, h) { FfxUInt32 uElements; (tex).GetDimensions((w), (h), uElements); }
#endif #endif

48
Shaders/shaders/fsr2/ffx_fsr2_callbacks_hlsl.h

@ -340,17 +340,17 @@ FfxUInt32x2 SPD_RenderSize()
#endif // #if defined(FSR2_BIND_CB_SPD) #endif // #if defined(FSR2_BIND_CB_SPD)
// Declare and sample camera buffers as regular textures, unless overridden // Declare and sample camera buffers as regular textures, unless overridden
#if !defined(UNITY_FSR_TEX2D)
#define UNITY_FSR_TEX2D(type) Texture2D<type>
#if !defined(UNITY_FFX_TEX2D)
#define UNITY_FFX_TEX2D(type) Texture2D<type>
#endif #endif
#if !defined(UNITY_FSR_RWTEX2D)
#define UNITY_FSR_RWTEX2D(type) RWTexture2D<type>
#if !defined(UNITY_FFX_RWTEX2D)
#define UNITY_FFX_RWTEX2D(type) RWTexture2D<type>
#endif #endif
#if !defined(UNITY_FSR_POS)
#define UNITY_FSR_POS(pxPos) (pxPos)
#if !defined(UNITY_FFX_POS)
#define UNITY_FFX_POS(pxPos) (pxPos)
#endif #endif
#if !defined(UNITY_FSR_UV)
#define UNITY_FSR_UV(uv) (uv)
#if !defined(UNITY_FFX_UV)
#define UNITY_FFX_UV(uv) (uv)
#endif #endif
SamplerState s_PointClamp : register(s0); SamplerState s_PointClamp : register(s0);
@ -358,16 +358,16 @@ SamplerState s_LinearClamp : register(s1);
// SRVs // SRVs
#if defined FSR2_BIND_SRV_INPUT_COLOR #if defined FSR2_BIND_SRV_INPUT_COLOR
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_COLOR);
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_COLOR);
#endif #endif
#if defined FSR2_BIND_SRV_INPUT_OPAQUE_ONLY #if defined FSR2_BIND_SRV_INPUT_OPAQUE_ONLY
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY);
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY);
#endif #endif
#if defined FSR2_BIND_SRV_INPUT_MOTION_VECTORS #if defined FSR2_BIND_SRV_INPUT_MOTION_VECTORS
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_MOTION_VECTORS);
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_MOTION_VECTORS);
#endif #endif
#if defined FSR2_BIND_SRV_INPUT_DEPTH #if defined FSR2_BIND_SRV_INPUT_DEPTH
UNITY_FSR_TEX2D(FfxFloat32) r_input_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_DEPTH);
UNITY_FFX_TEX2D(FfxFloat32) r_input_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_DEPTH);
#endif #endif
#if defined FSR2_BIND_SRV_INPUT_EXPOSURE #if defined FSR2_BIND_SRV_INPUT_EXPOSURE
Texture2D<FfxFloat32x2> r_input_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_EXPOSURE); Texture2D<FfxFloat32x2> r_input_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_EXPOSURE);
@ -376,10 +376,10 @@ SamplerState s_LinearClamp : register(s1);
Texture2D<FfxFloat32x2> r_auto_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_AUTO_EXPOSURE); Texture2D<FfxFloat32x2> r_auto_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_AUTO_EXPOSURE);
#endif #endif
#if defined FSR2_BIND_SRV_REACTIVE_MASK #if defined FSR2_BIND_SRV_REACTIVE_MASK
UNITY_FSR_TEX2D(FfxFloat32) r_reactive_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_REACTIVE_MASK);
UNITY_FFX_TEX2D(FfxFloat32) r_reactive_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_REACTIVE_MASK);
#endif #endif
#if defined FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK #if defined FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK
UNITY_FSR_TEX2D(FfxFloat32) r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK);
UNITY_FFX_TEX2D(FfxFloat32) r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK);
#endif #endif
#if defined FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH #if defined FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH
Texture2D<FfxUInt32> r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH); Texture2D<FfxUInt32> r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH);
@ -463,7 +463,7 @@ SamplerState s_LinearClamp : register(s1);
RWTexture2D<FfxFloat32x4> rw_luma_history : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LUMA_HISTORY); RWTexture2D<FfxFloat32x4> rw_luma_history : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LUMA_HISTORY);
#endif #endif
#if defined FSR2_BIND_UAV_UPSCALED_OUTPUT #if defined FSR2_BIND_UAV_UPSCALED_OUTPUT
UNITY_FSR_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_UPSCALED_OUTPUT);
UNITY_FFX_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_UPSCALED_OUTPUT);
#endif #endif
#if defined FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE #if defined FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE
globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE); globallycoherent RWTexture2D<FfxFloat32> rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE);
@ -514,42 +514,42 @@ FfxFloat32 SampleMipLuma(FfxFloat32x2 fUV, FfxUInt32 mipLevel)
#if defined(FSR2_BIND_SRV_INPUT_DEPTH) #if defined(FSR2_BIND_SRV_INPUT_DEPTH)
FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos) FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos)
{ {
return r_input_depth[UNITY_FSR_POS(iPxPos)];
return r_input_depth[UNITY_FFX_POS(iPxPos)];
} }
#endif #endif
#if defined(FSR2_BIND_SRV_INPUT_DEPTH) #if defined(FSR2_BIND_SRV_INPUT_DEPTH)
FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV) FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV)
{ {
return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).x;
return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).x;
} }
#endif #endif
#if defined(FSR2_BIND_SRV_REACTIVE_MASK) #if defined(FSR2_BIND_SRV_REACTIVE_MASK)
FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos) FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos)
{ {
return r_reactive_mask[UNITY_FSR_POS(iPxPos)];
return r_reactive_mask[UNITY_FFX_POS(iPxPos)];
} }
#endif #endif
#if defined(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK) #if defined(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK)
FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos) FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos)
{ {
return r_transparency_and_composition_mask[UNITY_FSR_POS(iPxPos)];
return r_transparency_and_composition_mask[UNITY_FFX_POS(iPxPos)];
} }
#endif #endif
#if defined(FSR2_BIND_SRV_INPUT_COLOR) #if defined(FSR2_BIND_SRV_INPUT_COLOR)
FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos) FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos)
{ {
return r_input_color_jittered[UNITY_FSR_POS(iPxPos)].rgb;
return r_input_color_jittered[UNITY_FFX_POS(iPxPos)].rgb;
} }
#endif #endif
#if defined(FSR2_BIND_SRV_INPUT_COLOR) #if defined(FSR2_BIND_SRV_INPUT_COLOR)
FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV) FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV)
{ {
return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).rgb;
return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).rgb;
} }
#endif #endif
@ -563,7 +563,7 @@ FfxFloat32x3 LoadPreparedInputColor(FfxUInt32x2 iPxPos)
#if defined(FSR2_BIND_SRV_INPUT_MOTION_VECTORS) #if defined(FSR2_BIND_SRV_INPUT_MOTION_VECTORS)
FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos) FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos)
{ {
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FSR_POS(iPxDilatedMotionVectorPos)].xy;
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FFX_POS(iPxDilatedMotionVectorPos)].xy;
FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale();
@ -622,7 +622,7 @@ void StoreInternalColorAndWeight(FfxUInt32x2 iPxPos, FfxFloat32x4 fColorAndWeigh
#if defined(FSR2_BIND_UAV_UPSCALED_OUTPUT) #if defined(FSR2_BIND_UAV_UPSCALED_OUTPUT)
void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor)
{ {
rw_upscaled_output[UNITY_FSR_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f);
rw_upscaled_output[UNITY_FFX_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f);
} }
#endif #endif
@ -833,7 +833,7 @@ void StoreDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETE
#if defined(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY) #if defined(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY)
FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos)
{ {
return r_input_opaque_only[UNITY_FSR_POS(iPxPos)].xyz;
return r_input_opaque_only[UNITY_FFX_POS(iPxPos)].xyz;
} }
#endif #endif

60
Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h

@ -320,20 +320,20 @@ FfxUInt32x2 SPD_RenderSize()
#endif // #if defined(FSR3UPSCALER_BIND_CB_SPD) #endif // #if defined(FSR3UPSCALER_BIND_CB_SPD)
// Declare and sample camera buffers as regular textures, unless overridden // Declare and sample camera buffers as regular textures, unless overridden
#if !defined(UNITY_FSR_TEX2D)
#define UNITY_FSR_TEX2D(type) Texture2D<type>
#if !defined(UNITY_FFX_TEX2D)
#define UNITY_FFX_TEX2D(type) Texture2D<type>
#endif #endif
#if !defined(UNITY_FSR_RWTEX2D)
#define UNITY_FSR_RWTEX2D(type) RWTexture2D<type>
#if !defined(UNITY_FFX_RWTEX2D)
#define UNITY_FFX_RWTEX2D(type) RWTexture2D<type>
#endif #endif
#if !defined(UNITY_FSR_POS)
#define UNITY_FSR_POS(pxPos) (pxPos)
#if !defined(UNITY_FFX_POS)
#define UNITY_FFX_POS(pxPos) (pxPos)
#endif #endif
#if !defined(UNITY_FSR_UV)
#define UNITY_FSR_UV(uv) (uv)
#if !defined(UNITY_FFX_UV)
#define UNITY_FFX_UV(uv) (uv)
#endif #endif
#if !defined(UNITY_FSR_GETDIMS)
#define UNITY_FSR_GETDIMS(tex, w, h) (tex).GetDimensions((w), (h))
#if !defined(UNITY_FFX_GETDIMS)
#define UNITY_FFX_GETDIMS(tex, w, h) (tex).GetDimensions((w), (h))
#endif #endif
SamplerState s_PointClamp : register(s0); SamplerState s_PointClamp : register(s0);
@ -359,85 +359,85 @@ FfxFloat32x2 SampleSPDMipLevel(FfxFloat32x2 fUV, FfxUInt32 mipLevel)
#endif #endif
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH) #if defined(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH)
UNITY_FSR_TEX2D(FfxFloat32) r_input_depth : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH);
UNITY_FFX_TEX2D(FfxFloat32) r_input_depth : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH);
FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos) FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos)
{ {
return r_input_depth[UNITY_FSR_POS(iPxPos)];
return r_input_depth[UNITY_FFX_POS(iPxPos)];
} }
FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV) FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV)
{ {
return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).x;
return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).x;
} }
#endif #endif
#if defined(FSR3UPSCALER_BIND_SRV_REACTIVE_MASK) #if defined(FSR3UPSCALER_BIND_SRV_REACTIVE_MASK)
UNITY_FSR_TEX2D(FfxFloat32) r_reactive_mask : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_REACTIVE_MASK);
UNITY_FFX_TEX2D(FfxFloat32) r_reactive_mask : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_REACTIVE_MASK);
FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos) FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos)
{ {
return r_reactive_mask[UNITY_FSR_POS(iPxPos)];
return r_reactive_mask[UNITY_FFX_POS(iPxPos)];
} }
FfxInt32x2 GetReactiveMaskResourceDimensions() FfxInt32x2 GetReactiveMaskResourceDimensions()
{ {
FfxUInt32 uWidth; FfxUInt32 uWidth;
FfxUInt32 uHeight; FfxUInt32 uHeight;
UNITY_FSR_GETDIMS(r_reactive_mask, uWidth, uHeight);
UNITY_FFX_GETDIMS(r_reactive_mask, uWidth, uHeight);
return FfxInt32x2(uWidth, uHeight); return FfxInt32x2(uWidth, uHeight);
} }
FfxFloat32 SampleReactiveMask(FfxFloat32x2 fUV) FfxFloat32 SampleReactiveMask(FfxFloat32x2 fUV)
{ {
return r_reactive_mask.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).x;
return r_reactive_mask.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).x;
} }
#endif #endif
#if defined(FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK) #if defined(FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK)
UNITY_FSR_TEX2D(FfxFloat32) r_transparency_and_composition_mask : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK);
UNITY_FFX_TEX2D(FfxFloat32) r_transparency_and_composition_mask : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK);
FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos) FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos)
{ {
return r_transparency_and_composition_mask[UNITY_FSR_POS(iPxPos)];
return r_transparency_and_composition_mask[UNITY_FFX_POS(iPxPos)];
} }
FfxInt32x2 GetTransparencyAndCompositionMaskResourceDimensions() FfxInt32x2 GetTransparencyAndCompositionMaskResourceDimensions()
{ {
FfxUInt32 uWidth; FfxUInt32 uWidth;
FfxUInt32 uHeight; FfxUInt32 uHeight;
UNITY_FSR_GETDIMS(r_transparency_and_composition_mask, uWidth, uHeight);
UNITY_FFX_GETDIMS(r_transparency_and_composition_mask, uWidth, uHeight);
return FfxInt32x2(uWidth, uHeight); return FfxInt32x2(uWidth, uHeight);
} }
FfxFloat32 SampleTransparencyAndCompositionMask(FfxFloat32x2 fUV) FfxFloat32 SampleTransparencyAndCompositionMask(FfxFloat32x2 fUV)
{ {
return r_transparency_and_composition_mask.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).x;
return r_transparency_and_composition_mask.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).x;
} }
#endif #endif
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_COLOR) #if defined(FSR3UPSCALER_BIND_SRV_INPUT_COLOR)
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_COLOR);
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_COLOR);
FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos) FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos)
{ {
return r_input_color_jittered[UNITY_FSR_POS(iPxPos)].rgb;
return r_input_color_jittered[UNITY_FFX_POS(iPxPos)].rgb;
} }
FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV) FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV)
{ {
return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FSR_UV(fUV), 0).rgb;
return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FFX_UV(fUV), 0).rgb;
} }
#endif #endif
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS) #if defined(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS)
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS);
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS);
FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos) FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos)
{ {
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FSR_POS(iPxDilatedMotionVectorPos)].xy;
FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FFX_POS(iPxDilatedMotionVectorPos)].xy;
FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale();
@ -515,11 +515,11 @@ void StoreInternalColorAndWeight(FfxUInt32x2 iPxPos, FfxFloat32x4 fColorAndWeigh
#endif #endif
#if defined(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT) #if defined(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT)
UNITY_FSR_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT);
UNITY_FFX_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT);
void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor)
{ {
rw_upscaled_output[UNITY_FSR_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f);
rw_upscaled_output[UNITY_FFX_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f);
} }
#endif #endif
@ -830,11 +830,11 @@ void StoreDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETE
#endif #endif
#if defined(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY) #if defined(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY)
UNITY_FSR_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY);
UNITY_FFX_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY);
FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos)
{ {
return r_input_opaque_only[UNITY_FSR_POS(iPxPos)].xyz;
return r_input_opaque_only[UNITY_FFX_POS(iPxPos)].xyz;
} }
#endif #endif

Loading…
Cancel
Save