From c71e487b15fee2c8af59322d2fedca4200bd7d99 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sat, 16 Dec 2023 12:14:21 +0100 Subject: [PATCH] Updated SuperResolution shaders and code to FSR3 --- Assets/Scenes/SampleScenePPV2.unity | 2 +- Assets/Scripts/DebugDumper.cs | 6 +- .../Editor/PostProcessLayerEditor.cs | 2 +- .../PostProcessing/PostProcessResources.asset | 67 +- .../Runtime/Effects/SuperResolution.cs | 92 +- .../PostProcessing/Runtime/FSR2/Fsr2.cs.meta | 3 - .../Runtime/FSR2/Fsr2Context.cs.meta | 3 - .../Runtime/FSR2/Fsr2Pass.cs.meta | 3 - .../Runtime/FSR2/Fsr2Resources.cs.meta | 3 - .../Runtime/FSR2/Fsr2ShaderIDs.cs.meta | 3 - .../Runtime/{FSR2.meta => FSR3.meta} | 2 +- .../Fsr3ShaderIDs.cs} | 8 +- .../Runtime/FSR3/Fsr3ShaderIDs.cs.meta | 3 + .../{FSR2/Fsr2.cs => FSR3/Fsr3Upscaler.cs} | 31 +- .../Runtime/FSR3/Fsr3Upscaler.cs.meta | 3 + .../Fsr3UpscalerCallbacks.cs} | 22 +- .../Fsr3UpscalerCallbacks.cs.meta} | 2 +- .../Fsr3UpscalerContext.cs} | 208 ++-- .../Runtime/FSR3/Fsr3UpscalerContext.cs.meta | 3 + .../Fsr2Pass.cs => FSR3/Fsr3UpscalerPass.cs} | 250 +++-- .../Runtime/FSR3/Fsr3UpscalerPass.cs.meta | 3 + .../Fsr3UpscalerResources.cs} | 110 +-- .../FSR3/Fsr3UpscalerResources.cs.meta | 3 + .../Runtime/PostProcessLayer.cs | 2 +- .../FSR2/ffx_fsr2_lock_pass.compute.meta | 8 - .../FSR2/ffx_fsr2_rcas_pass.compute.meta | 8 - ...construct_previous_depth_pass.compute.meta | 8 - .../ffx_fsr2_tcr_autogen_pass.compute.meta | 8 - .../FSR2/shaders/ffx_common_types.h.meta | 60 -- .../Shaders/FSR2/shaders/ffx_core.h.meta | 60 -- .../Shaders/FSR2/shaders/ffx_core_cpu.h.meta | 60 -- .../FSR2/shaders/ffx_core_gpu_common.h.meta | 60 -- .../shaders/ffx_core_gpu_common_half.h.meta | 60 -- .../Shaders/FSR2/shaders/ffx_core_hlsl.h.meta | 60 -- .../FSR2/shaders/ffx_core_portability.h.meta | 60 -- .../Shaders/FSR2/shaders/ffx_fsr1.h.meta | 60 -- .../FSR2/shaders/ffx_fsr2_accumulate.h.meta | 60 -- .../shaders/ffx_fsr2_accumulate_pass.hlsl | 78 -- .../ffx_fsr2_autogen_reactive_pass.hlsl | 85 -- .../FSR2/shaders/ffx_fsr2_callbacks_hlsl.h | 817 --------------- .../shaders/ffx_fsr2_callbacks_hlsl.h.meta | 60 -- .../FSR2/shaders/ffx_fsr2_common.h.meta | 60 -- .../ffx_fsr2_compute_luminance_pyramid.h.meta | 60 -- ...x_fsr2_compute_luminance_pyramid_pass.hlsl | 131 --- .../FSR2/shaders/ffx_fsr2_depth_clip.h.meta | 60 -- .../shaders/ffx_fsr2_depth_clip_pass.hlsl | 66 -- .../Shaders/FSR2/shaders/ffx_fsr2_lock.h.meta | 60 -- .../FSR2/shaders/ffx_fsr2_lock_pass.hlsl | 53 - .../FSR2/shaders/ffx_fsr2_lock_pass.hlsl.meta | 7 - .../ffx_fsr2_postprocess_lock_status.h.meta | 60 -- .../Shaders/FSR2/shaders/ffx_fsr2_rcas.h.meta | 60 -- .../FSR2/shaders/ffx_fsr2_rcas_pass.hlsl | 75 -- .../FSR2/shaders/ffx_fsr2_rcas_pass.hlsl.meta | 7 - ...dilated_velocity_and_previous_depth.h.meta | 60 -- ..._fsr2_reconstruct_previous_depth_pass.hlsl | 63 -- ..._reconstruct_previous_depth_pass.hlsl.meta | 7 - .../FSR2/shaders/ffx_fsr2_reproject.h.meta | 60 -- .../Shaders/FSR2/shaders/ffx_fsr2_resources.h | 105 -- .../FSR2/shaders/ffx_fsr2_resources.h.meta | 60 -- .../FSR2/shaders/ffx_fsr2_sample.h.meta | 60 -- .../FSR2/shaders/ffx_fsr2_tcr_autogen.h.meta | 60 -- .../ffx_fsr2_tcr_autogen_pass.hlsl.meta | 7 - .../FSR2/shaders/ffx_fsr2_upsample.h.meta | 60 -- .../Shaders/FSR2/shaders/ffx_spd.h.meta | 60 -- .../Shaders/{FSR2.meta => FSR3.meta} | 2 +- .../ffx_fsr3upscaler_accumulate_pass.compute} | 24 +- ...fsr3upscaler_accumulate_pass.compute.meta} | 2 +- ...sr3upscaler_autogen_reactive_pass.compute} | 12 +- ...scaler_autogen_reactive_pass.compute.meta} | 2 +- ...er_compute_luminance_pyramid_pass.compute} | 16 +- ...mpute_luminance_pyramid_pass.compute.meta} | 2 +- .../ffx_fsr3upscaler_depth_clip_pass.compute} | 12 +- ...fsr3upscaler_depth_clip_pass.compute.meta} | 2 +- .../ffx_fsr3upscaler_lock_pass.compute} | 10 +- .../ffx_fsr3upscaler_lock_pass.compute.meta | 8 + .../ffx_fsr3upscaler_rcas_pass.compute} | 10 +- .../ffx_fsr3upscaler_rcas_pass.compute.meta | 8 + ...r_reconstruct_previous_depth_pass.compute} | 14 +- ...construct_previous_depth_pass.compute.meta | 8 + ...ffx_fsr3upscaler_tcr_autogen_pass.compute} | 12 +- ...fsr3upscaler_tcr_autogen_pass.compute.meta | 8 + .../ffx_fsr3upscaler_unity_common.cginc} | 11 +- .../ffx_fsr3upscaler_unity_common.cginc.meta} | 2 +- .../Shaders/{FSR2 => FSR3}/shaders.meta | 2 +- .../ffx_fsr3upscaler_accumulate_pass.hlsl | 79 ++ ...fx_fsr3upscaler_accumulate_pass.hlsl.meta} | 2 +- ...fx_fsr3upscaler_autogen_reactive_pass.hlsl | 77 ++ ...3upscaler_autogen_reactive_pass.hlsl.meta} | 2 +- ...scaler_compute_luminance_pyramid_pass.hlsl | 55 ++ ..._compute_luminance_pyramid_pass.hlsl.meta} | 2 +- .../ffx_fsr3upscaler_depth_clip_pass.hlsl | 67 ++ ...ffx_fsr3upscaler_depth_clip_pass.hlsl.meta | 7 + .../shaders/ffx_fsr3upscaler_lock_pass.hlsl | 56 ++ .../ffx_fsr3upscaler_lock_pass.hlsl.meta | 7 + .../shaders/ffx_fsr3upscaler_rcas_pass.hlsl | 53 + .../ffx_fsr3upscaler_rcas_pass.hlsl.meta | 7 + ...caler_reconstruct_previous_depth_pass.hlsl | 64 ++ ..._reconstruct_previous_depth_pass.hlsl.meta | 7 + .../ffx_fsr3upscaler_tcr_autogen_pass.hlsl} | 96 +- ...fx_fsr3upscaler_tcr_autogen_pass.hlsl.meta | 7 + .../Shaders/FSR3/shaders/fsr3upscaler.meta | 8 + .../shaders/fsr3upscaler}/ffx_common_types.h | 167 +++- .../fsr3upscaler/ffx_common_types.h.meta} | 2 +- .../shaders/fsr3upscaler}/ffx_core.h | 52 +- .../FSR3/shaders/fsr3upscaler/ffx_core.h.meta | 27 + .../shaders/fsr3upscaler}/ffx_core_cpu.h | 60 +- .../shaders/fsr3upscaler/ffx_core_cpu.h.meta | 27 + .../fsr3upscaler}/ffx_core_gpu_common.h | 486 ++++----- .../fsr3upscaler/ffx_core_gpu_common.h.meta | 27 + .../fsr3upscaler}/ffx_core_gpu_common_half.h | 423 ++++---- .../ffx_core_gpu_common_half.h.meta | 27 + .../shaders/fsr3upscaler}/ffx_core_hlsl.h | 401 +++++--- .../shaders/fsr3upscaler/ffx_core_hlsl.h.meta | 27 + .../fsr3upscaler}/ffx_core_portability.h | 9 +- .../fsr3upscaler/ffx_core_portability.h.meta | 27 + .../ffx_fsr3upscaler_accumulate.h} | 47 +- .../ffx_fsr3upscaler_accumulate.h.meta | 27 + .../ffx_fsr3upscaler_callbacks_hlsl.h | 928 ++++++++++++++++++ .../ffx_fsr3upscaler_callbacks_hlsl.h.meta | 27 + .../fsr3upscaler/ffx_fsr3upscaler_common.h} | 49 +- .../ffx_fsr3upscaler_common.h.meta | 27 + ..._fsr3upscaler_compute_luminance_pyramid.h} | 73 +- ...3upscaler_compute_luminance_pyramid.h.meta | 27 + .../ffx_fsr3upscaler_depth_clip.h} | 19 +- .../ffx_fsr3upscaler_depth_clip.h.meta | 27 + .../fsr3upscaler/ffx_fsr3upscaler_lock.h} | 21 +- .../fsr3upscaler/ffx_fsr3upscaler_lock.h.meta | 27 + ...fx_fsr3upscaler_postprocess_lock_status.h} | 19 +- ...sr3upscaler_postprocess_lock_status.h.meta | 27 + .../fsr3upscaler/ffx_fsr3upscaler_rcas.h} | 18 +- .../fsr3upscaler/ffx_fsr3upscaler_rcas.h.meta | 27 + ...uct_dilated_velocity_and_previous_depth.h} | 21 +- ...dilated_velocity_and_previous_depth.h.meta | 27 + .../ffx_fsr3upscaler_reproject.h} | 35 +- .../ffx_fsr3upscaler_reproject.h.meta | 27 + .../fsr3upscaler/ffx_fsr3upscaler_resources.h | 104 ++ .../ffx_fsr3upscaler_resources.h.meta | 27 + .../fsr3upscaler/ffx_fsr3upscaler_sample.h} | 31 +- .../ffx_fsr3upscaler_sample.h.meta | 27 + .../ffx_fsr3upscaler_tcr_autogen.h} | 2 +- .../ffx_fsr3upscaler_tcr_autogen.h.meta | 27 + .../fsr3upscaler/ffx_fsr3upscaler_upsample.h} | 47 +- .../ffx_fsr3upscaler_upsample.h.meta | 27 + .../FSR3/shaders/fsr3upscaler/fsr1.meta | 8 + .../shaders/fsr3upscaler/fsr1}/ffx_fsr1.h | 54 +- .../shaders/fsr3upscaler/fsr1/ffx_fsr1.h.meta | 27 + .../FSR3/shaders/fsr3upscaler/spd.meta | 8 + .../shaders/fsr3upscaler/spd}/ffx_spd.h | 210 ++-- .../shaders/fsr3upscaler/spd/ffx_spd.h.meta | 27 + 149 files changed, 3977 insertions(+), 4421 deletions(-) delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2.cs.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Context.cs.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pass.cs.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Resources.cs.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2ShaderIDs.cs.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2.meta => FSR3.meta} (77%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2/Fsr2ShaderIDs.cs => FSR3/Fsr3ShaderIDs.cs} (96%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3ShaderIDs.cs.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2/Fsr2.cs => FSR3/Fsr3Upscaler.cs} (92%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2/Fsr2Callbacks.cs => FSR3/Fsr3UpscalerCallbacks.cs} (85%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2/Fsr2Callbacks.cs.meta => FSR3/Fsr3UpscalerCallbacks.cs.meta} (83%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2/Fsr2Context.cs => FSR3/Fsr3UpscalerContext.cs} (70%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerContext.cs.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2/Fsr2Pass.cs => FSR3/Fsr3UpscalerPass.cs} (59%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerPass.cs.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/{FSR2/Fsr2Resources.cs => FSR3/Fsr3UpscalerResources.cs} (64%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_lock_pass.compute.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_rcas_pass.compute.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_tcr_autogen_pass.compute.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_common_types.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_cpu.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common_half.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_hlsl.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_portability.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr1.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_common.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_postprocess_lock_status.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reproject.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_sample.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_upsample.h.meta delete mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_spd.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2.meta => FSR3.meta} (77%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_accumulate_pass.compute => FSR3/ffx_fsr3upscaler_accumulate_pass.compute} (61%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute.meta => FSR3/ffx_fsr3upscaler_accumulate_pass.compute.meta} (79%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_depth_clip_pass.compute => FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute} (74%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_autogen_reactive_pass.compute.meta => FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute.meta} (79%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute => FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute} (76%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_depth_clip_pass.compute.meta => FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute.meta} (79%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_tcr_autogen_pass.compute => FSR3/ffx_fsr3upscaler_depth_clip_pass.compute} (74%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_accumulate_pass.compute.meta => FSR3/ffx_fsr3upscaler_depth_clip_pass.compute.meta} (79%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_lock_pass.compute => FSR3/ffx_fsr3upscaler_lock_pass.compute} (77%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_lock_pass.compute.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_rcas_pass.compute => FSR3/ffx_fsr3upscaler_rcas_pass.compute} (77%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute => FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute} (70%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_autogen_reactive_pass.compute => FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute} (74%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_unity_common.cginc => FSR3/ffx_fsr3upscaler_unity_common.cginc} (92%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl.meta => FSR3/ffx_fsr3upscaler_unity_common.cginc.meta} (75%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2 => FSR3}/shaders.meta (77%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl.meta => FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl.meta} (75%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl.meta => FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl.meta} (75%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl.meta => FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl.meta} (75%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl => FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl} (56%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler}/ffx_common_types.h (83%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/ffx_fsr2_unity_common.cginc.meta => FSR3/shaders/fsr3upscaler/ffx_common_types.h.meta} (92%) rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler}/ffx_core.h (66%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler}/ffx_core_cpu.h (93%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_cpu.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler}/ffx_core_gpu_common.h (91%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler}/ffx_core_gpu_common_half.h (94%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common_half.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler}/ffx_core_hlsl.h (86%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_hlsl.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler}/ffx_core_portability.h (94%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_portability.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_accumulate.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h} (90%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_common.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h} (91%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h} (85%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_depth_clip.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h} (97%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_lock.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h} (91%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_postprocess_lock_status.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h} (91%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_rcas.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h} (93%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h} (91%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_reproject.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h} (77%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_sample.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h} (96%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_tcr_autogen.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h} (99%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders/ffx_fsr2_upsample.h => FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h} (85%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler/fsr1}/ffx_fsr1.h (97%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h.meta create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd.meta rename Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/{FSR2/shaders => FSR3/shaders/fsr3upscaler/spd}/ffx_spd.h (82%) create mode 100644 Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h.meta diff --git a/Assets/Scenes/SampleScenePPV2.unity b/Assets/Scenes/SampleScenePPV2.unity index cac09d2..cc0ef7f 100644 --- a/Assets/Scenes/SampleScenePPV2.unity +++ b/Assets/Scenes/SampleScenePPV2.unity @@ -347,7 +347,7 @@ MonoBehaviour: stationaryBlending: 0.95 motionBlending: 0.85 superResolution: - qualityMode: 1 + qualityMode: 2 performSharpenPass: 1 sharpness: 0.8 enableFP16: 0 diff --git a/Assets/Scripts/DebugDumper.cs b/Assets/Scripts/DebugDumper.cs index eb7f1da..738b5f7 100644 --- a/Assets/Scripts/DebugDumper.cs +++ b/Assets/Scripts/DebugDumper.cs @@ -78,8 +78,8 @@ public class DebugDumper : MonoBehaviour if (Input.GetButtonDown("Fire2")) { int quality = (int)_layer.superResolution.qualityMode; - quality = (quality + 1) % Enum.GetValues(typeof(Fsr2.QualityMode)).Length; - _layer.superResolution.qualityMode = (Fsr2.QualityMode)quality; + quality = (quality + 1) % Enum.GetValues(typeof(Fsr3Upscaler.QualityMode)).Length; + _layer.superResolution.qualityMode = (Fsr3Upscaler.QualityMode)quality; } if (Input.GetButtonDown("Fire3")) @@ -115,7 +115,7 @@ public class DebugDumper : MonoBehaviour GUI.matrix = Matrix4x4.Scale(new Vector3(scale, scale, scale)); } - GUILayout.Label($"FSR2: {(_layer.antialiasingMode == PostProcessLayer.Antialiasing.SuperResolution ? "Enabled" : "Disabled")}"); + GUILayout.Label($"FSR3 Upscaler: {(_layer.antialiasingMode == PostProcessLayer.Antialiasing.SuperResolution ? "Enabled" : "Disabled")}"); GUILayout.Label($"Quality: {_layer.superResolution.qualityMode}"); GUILayout.Label($"Auto-exposure: {(_layer.superResolution.exposureSource)}"); GUILayout.Label($"Scale: {_scaleFactor:0.00}"); diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs index 20f363c..691483d 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Editor/PostProcessLayerEditor.cs @@ -62,7 +62,7 @@ namespace UnityEditor.Rendering.PostProcessing new GUIContent("Fast Approximate Anti-aliasing (FXAA)"), new GUIContent("Subpixel Morphological Anti-aliasing (SMAA)"), new GUIContent("Temporal Anti-aliasing (TAA)"), - new GUIContent("FidelityFX Super Resolution 2 (FSR2)") + new GUIContent("FidelityFX Super Resolution 3 (FSR3) Upscaler") }; enum ExportMode diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/PostProcessResources.asset b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/PostProcessResources.asset index ae78db2..aba839f 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/PostProcessResources.asset +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/PostProcessResources.asset @@ -3,8 +3,9 @@ --- !u!114 &11400000 MonoBehaviour: m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 @@ -92,19 +93,15 @@ MonoBehaviour: bloom: {fileID: 4800000, guid: c1e1d3119c6fd4646aea0b4b74cacc1a, type: 3} copy: {fileID: 4800000, guid: cdbdb71de5f9c454b980f6d0e87f0afb, type: 3} copyStd: {fileID: 4800000, guid: 4bf4cff0d0bac3d43894e2e8839feb40, type: 3} - copyStdFromTexArray: {fileID: 4800000, guid: 02d2da9bc88d25c4d878c1ed4e0b3854, - type: 3} - copyStdFromDoubleWide: {fileID: 4800000, guid: e8ce9961912f3214586fe8709b9012c1, - type: 3} + copyStdFromTexArray: {fileID: 4800000, guid: 02d2da9bc88d25c4d878c1ed4e0b3854, type: 3} + copyStdFromDoubleWide: {fileID: 4800000, guid: e8ce9961912f3214586fe8709b9012c1, type: 3} discardAlpha: {fileID: 4800000, guid: 5ab0816423f0dfe45841cab3b05ec9ef, type: 3} depthOfField: {fileID: 4800000, guid: 0ef78d24e85a44f4da9d5b5eaa00e50b, type: 3} finalPass: {fileID: 4800000, guid: f75014305794b3948a3c6d5ccd550e05, type: 3} grainBaker: {fileID: 4800000, guid: 0d8afcb51cc9f0349a6d190da929b838, type: 3} motionBlur: {fileID: 4800000, guid: 2c459b89a7c8b1a4fbefe0d81341651c, type: 3} - temporalAntialiasing: {fileID: 4800000, guid: 51bcf79c50dc92e47ba87821b61100c3, - type: 3} - subpixelMorphologicalAntialiasing: {fileID: 4800000, guid: 81af42a93ade3dd46a9b583d4eec76d6, - type: 3} + temporalAntialiasing: {fileID: 4800000, guid: 51bcf79c50dc92e47ba87821b61100c3, type: 3} + subpixelMorphologicalAntialiasing: {fileID: 4800000, guid: 81af42a93ade3dd46a9b583d4eec76d6, type: 3} texture2dLerp: {fileID: 4800000, guid: 34a819c9e33402547a81619693adc8d5, type: 3} uber: {fileID: 4800000, guid: 382151503e2a43a4ebb7366d1632731d, type: 3} lut2DBaker: {fileID: 4800000, guid: 7ad194cbe7d006f4bace915156972026, type: 3} @@ -116,8 +113,7 @@ MonoBehaviour: deferredFog: {fileID: 4800000, guid: 4117fce9491711c4094d33a048e36e73, type: 3} scalableAO: {fileID: 4800000, guid: d7640629310e79646af0f46eb55ae466, type: 3} multiScaleAO: {fileID: 4800000, guid: 67f9497810829eb4791ec19e95781e51, type: 3} - screenSpaceReflections: {fileID: 4800000, guid: f997a3dc9254c44459323cced085150c, - type: 3} + screenSpaceReflections: {fileID: 4800000, guid: f997a3dc9254c44459323cced085150c, type: 3} computeShaders: autoExposure: {fileID: 7200000, guid: 34845e0ca016b7448842e965db5890a5, type: 3} exposureHistogram: {fileID: 7200000, guid: 8c2fcbdf9bc58664f89917f7b9d79501, type: 3} @@ -126,30 +122,25 @@ MonoBehaviour: gammaHistogram: {fileID: 7200000, guid: 18183ebfeeab97749b43e38b928604a7, type: 3} waveform: {fileID: 7200000, guid: 92c63830cd50c0b4fbb8233613839958, type: 3} vectorscope: {fileID: 7200000, guid: e1efca7c36fd01840aae0dd10378de5c, type: 3} - multiScaleAODownsample1: {fileID: 7200000, guid: 4c63bc487e6c29a4a99f85a6c47b292b, - type: 3} - multiScaleAODownsample2: {fileID: 7200000, guid: e4d3e4779e48a374f91d48d4c0aedb7b, - type: 3} - multiScaleAORender: {fileID: 7200000, guid: 34a460e8a2e66c243a9c12024e5a798d, - type: 3} - multiScaleAOUpsample: {fileID: 7200000, guid: 600d6212b59bb40409d19d750b5fd1e9, - type: 3} - gaussianDownsample: {fileID: 7200000, guid: 6dba4103d23a7904fbc49099355aff3e, - type: 3} + multiScaleAODownsample1: {fileID: 7200000, guid: 4c63bc487e6c29a4a99f85a6c47b292b, type: 3} + multiScaleAODownsample2: {fileID: 7200000, guid: e4d3e4779e48a374f91d48d4c0aedb7b, type: 3} + multiScaleAORender: {fileID: 7200000, guid: 34a460e8a2e66c243a9c12024e5a798d, type: 3} + multiScaleAOUpsample: {fileID: 7200000, guid: 600d6212b59bb40409d19d750b5fd1e9, type: 3} + gaussianDownsample: {fileID: 7200000, guid: 6dba4103d23a7904fbc49099355aff3e, type: 3} namedShaders: - - name: FSR2/ffx_fsr2_compute_luminance_pyramid_pass - shader: {fileID: 7200000, guid: 0894ebeefb6aa7d4680c71dffbda3fee, type: 3} - - name: FSR2/ffx_fsr2_reconstruct_previous_depth_pass - shader: {fileID: 7200000, guid: 6ef1b4c25874e334dad5ba3ac6345e32, type: 3} - - name: FSR2/ffx_fsr2_depth_clip_pass - shader: {fileID: 7200000, guid: 8026d9d8542eab6499c32d5d46beb2b6, type: 3} - - name: FSR2/ffx_fsr2_lock_pass - shader: {fileID: 7200000, guid: 3c96d72b39a840c428c901628dab92c0, type: 3} - - name: FSR2/ffx_fsr2_accumulate_pass - shader: {fileID: 7200000, guid: 702560780e923c84394c9b22ba460a9c, type: 3} - - name: FSR2/ffx_fsr2_rcas_pass - shader: {fileID: 7200000, guid: 5a82801f160ff6a4eb47db567216e592, type: 3} - - name: FSR2/ffx_fsr2_autogen_reactive_pass - shader: {fileID: 7200000, guid: d18fb8811ca4753469c439784546104e, type: 3} - - name: FSR2/ffx_fsr2_tcr_autogen_pass - shader: {fileID: 7200000, guid: b478fba0a6a87b44b8be7c35deb5f0dc, type: 3} + - name: FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass + shader: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3} + - name: FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass + shader: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3} + - name: FSR3/ffx_fsr3upscaler_depth_clip_pass + shader: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3} + - name: FSR3/ffx_fsr3upscaler_lock_pass + shader: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3} + - name: FSR3/ffx_fsr3upscaler_accumulate_pass + shader: {fileID: 7200000, guid: c9b45f0ae7673694ba57a4aadfe212e9, type: 3} + - name: FSR3/ffx_fsr3upscaler_rcas_pass + shader: {fileID: 7200000, guid: 7aaf5cfff022de2499e9b0412f947f6c, type: 3} + - name: FSR3/ffx_fsr3upscaler_autogen_reactive_pass + shader: {fileID: 7200000, guid: 5716b91fdaa4e9e439df6b96a796fe6e, type: 3} + - name: FSR3/ffx_fsr3upscaler_tcr_autogen_pass + shader: {fileID: 7200000, guid: 75cdc6ef23f08ed498d4da511923fcea, type: 3} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs index fa87fa6..8e8c890 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/SuperResolution.cs @@ -31,10 +31,10 @@ namespace UnityEngine.Rendering.PostProcessing [Serializable] public class SuperResolution { - public Func callbacksFactory { get; set; } = (context) => new Callbacks(context.resources); + public Func callbacksFactory { get; set; } = (context) => new Callbacks(context.resources); [Tooltip("Standard scaling ratio presets.")] - public Fsr2.QualityMode qualityMode = Fsr2.QualityMode.Quality; + public Fsr3Upscaler.QualityMode qualityMode = Fsr3Upscaler.QualityMode.Quality; [Tooltip("Apply RCAS sharpening to the image after upscaling.")] public bool performSharpenPass = true; @@ -44,7 +44,7 @@ namespace UnityEngine.Rendering.PostProcessing [Tooltip("Allow the use of half precision compute operations, potentially improving performance if the platform supports it.")] public bool enableFP16 = false; - [Tooltip("Choose where to get the exposure value from. Use auto-exposure from either FSR2 or Unity, provide a manual exposure texture, or use a default value.")] + [Tooltip("Choose where to get the exposure value from. Use auto-exposure from either FSR3 or Unity, provide a manual exposure texture, or use a default value.")] public ExposureSource exposureSource = ExposureSource.Auto; [Tooltip("Value by which the input signal will be divided, to get back to the original signal produced by the game.")] public float preExposure = 1.0f; @@ -78,7 +78,7 @@ namespace UnityEngine.Rendering.PostProcessing [Tooltip("A value to set for the binary reactive mask")] [Range(0, 1)] public float binaryValue = 0.9f; [Tooltip("Flags to determine how to generate the reactive mask")] - public Fsr2.GenerateReactiveFlags flags = Fsr2.GenerateReactiveFlags.ApplyTonemap | Fsr2.GenerateReactiveFlags.ApplyThreshold | Fsr2.GenerateReactiveFlags.UseComponentsMax; + public Fsr3Upscaler.GenerateReactiveFlags flags = Fsr3Upscaler.GenerateReactiveFlags.ApplyTonemap | Fsr3Upscaler.GenerateReactiveFlags.ApplyThreshold | Fsr3Upscaler.GenerateReactiveFlags.UseComponentsMax; } [Tooltip("(Experimental) Automatically generate and use Reactive mask and Transparency & composition mask internally.")] @@ -104,17 +104,17 @@ namespace UnityEngine.Rendering.PostProcessing public Vector2Int displaySize => _displaySize; public RenderTargetIdentifier colorOpaqueOnly { get; set; } - private Fsr2Context _fsrContext; + private Fsr3UpscalerContext _fsrContext; private Vector2Int _maxRenderSize; private Vector2Int _displaySize; private bool _resetHistory; - private IFsr2Callbacks _callbacks; + private IFsr3UpscalerCallbacks _callbacks; - private readonly Fsr2.DispatchDescription _dispatchDescription = new Fsr2.DispatchDescription(); - private readonly Fsr2.GenerateReactiveDescription _genReactiveDescription = new Fsr2.GenerateReactiveDescription(); + private readonly Fsr3Upscaler.DispatchDescription _dispatchDescription = new Fsr3Upscaler.DispatchDescription(); + private readonly Fsr3Upscaler.GenerateReactiveDescription _genReactiveDescription = new Fsr3Upscaler.GenerateReactiveDescription(); - private Fsr2.QualityMode _prevQualityMode; + private Fsr3Upscaler.QualityMode _prevQualityMode; private ExposureSource _prevExposureSource; private Vector2Int _prevDisplaySize; @@ -152,7 +152,7 @@ namespace UnityEngine.Rendering.PostProcessing // Determine the desired rendering and display resolutions _displaySize = new Vector2Int(camera.pixelWidth, camera.pixelHeight); - Fsr2.GetRenderResolutionFromQualityMode(out int maxRenderWidth, out int maxRenderHeight, _displaySize.x, _displaySize.y, qualityMode); + Fsr3Upscaler.GetRenderResolutionFromQualityMode(out int maxRenderWidth, out int maxRenderHeight, _displaySize.x, _displaySize.y, qualityMode); _maxRenderSize = new Vector2Int(maxRenderWidth, maxRenderHeight); // Render to a smaller portion of the screen by manipulating the camera's viewport rect @@ -168,10 +168,10 @@ namespace UnityEngine.Rendering.PostProcessing public void Render(PostProcessRenderContext context) { var cmd = context.command; - cmd.BeginSample("FSR2"); + cmd.BeginSample("FSR3 Upscaler"); - // Monitor for any resolution changes and recreate the FSR2 context if necessary - // We can't create an FSR2 context without info from the post-processing context, so delay the initial setup until here + // Monitor for any resolution changes and recreate the FSR3 Upscaler context if necessary + // We can't create an FSR3 Upscaler context without info from the post-processing context, so delay the initial setup until here if (_fsrContext == null || _displaySize.x != _prevDisplaySize.x || _displaySize.y != _prevDisplaySize.y || qualityMode != _prevQualityMode || exposureSource != _prevExposureSource) { DestroyFsrContext(); @@ -185,14 +185,14 @@ namespace UnityEngine.Rendering.PostProcessing SetupAutoReactiveDescription(context); var scaledRenderSize = _genReactiveDescription.RenderSize; - cmd.GetTemporaryRT(Fsr2ShaderIDs.UavAutoReactive, scaledRenderSize.x, scaledRenderSize.y, 0, default, GraphicsFormat.R8_UNorm, 1, true); + cmd.GetTemporaryRT(Fsr3ShaderIDs.UavAutoReactive, scaledRenderSize.x, scaledRenderSize.y, 0, default, GraphicsFormat.R8_UNorm, 1, true); _fsrContext.GenerateReactiveMask(_genReactiveDescription, cmd); - _dispatchDescription.Reactive = new Fsr2.ResourceView(Fsr2ShaderIDs.UavAutoReactive); + _dispatchDescription.Reactive = new Fsr3Upscaler.ResourceView(Fsr3ShaderIDs.UavAutoReactive); } _fsrContext.Dispatch(_dispatchDescription, cmd); - cmd.EndSample("FSR2"); + cmd.EndSample("FSR3 Upscaler"); _resetHistory = false; } @@ -203,18 +203,18 @@ namespace UnityEngine.Rendering.PostProcessing _prevExposureSource = exposureSource; _prevDisplaySize = _displaySize; - // Initialize FSR2 context - Fsr2.InitializationFlags flags = 0; - if (context.camera.allowHDR) flags |= Fsr2.InitializationFlags.EnableHighDynamicRange; - if (enableFP16) flags |= Fsr2.InitializationFlags.EnableFP16Usage; - if (exposureSource == ExposureSource.Auto) flags |= Fsr2.InitializationFlags.EnableAutoExposure; - if (RuntimeUtilities.IsDynamicResolutionEnabled(context.camera)) flags |= Fsr2.InitializationFlags.EnableDynamicResolution; + // Initialize FSR3 Upscaler context + Fsr3Upscaler.InitializationFlags flags = 0; + if (context.camera.allowHDR) flags |= Fsr3Upscaler.InitializationFlags.EnableHighDynamicRange; + if (enableFP16) flags |= Fsr3Upscaler.InitializationFlags.EnableFP16Usage; + if (exposureSource == ExposureSource.Auto) flags |= Fsr3Upscaler.InitializationFlags.EnableAutoExposure; + if (RuntimeUtilities.IsDynamicResolutionEnabled(context.camera)) flags |= Fsr3Upscaler.InitializationFlags.EnableDynamicResolution; _callbacks = callbacksFactory(context); - _fsrContext = Fsr2.CreateContext(_displaySize, _maxRenderSize, _callbacks, flags); + _fsrContext = Fsr3Upscaler.CreateContext(_displaySize, _maxRenderSize, _callbacks, flags); // Apply a mipmap bias so that textures retain their sharpness - float biasOffset = Fsr2.GetMipmapBiasOffset(_maxRenderSize.x, _displaySize.x); + float biasOffset = Fsr3Upscaler.GetMipmapBiasOffset(_maxRenderSize.x, _displaySize.x); if (!float.IsNaN(biasOffset) && !float.IsInfinity(biasOffset)) { _callbacks.ApplyMipmapBias(biasOffset); @@ -241,9 +241,9 @@ namespace UnityEngine.Rendering.PostProcessing { var scaledRenderSize = GetScaledRenderSize(camera); - // Perform custom jittering of the camera's projection matrix according to FSR2's recipe - int jitterPhaseCount = Fsr2.GetJitterPhaseCount(scaledRenderSize.x, _displaySize.x); - Fsr2.GetJitterOffset(out float jitterX, out float jitterY, Time.frameCount, jitterPhaseCount); + // Perform custom jittering of the camera's projection matrix according to FSR3's recipe + int jitterPhaseCount = Fsr3Upscaler.GetJitterPhaseCount(scaledRenderSize.x, _displaySize.x); + Fsr3Upscaler.GetJitterOffset(out float jitterX, out float jitterY, Time.frameCount, jitterPhaseCount); _dispatchDescription.JitterOffset = new Vector2(jitterX, jitterY); @@ -262,22 +262,22 @@ namespace UnityEngine.Rendering.PostProcessing { var camera = context.camera; - // Set up the main FSR2 dispatch parameters - _dispatchDescription.Color = new Fsr2.ResourceView(context.source); - _dispatchDescription.Depth = new Fsr2.ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth); - _dispatchDescription.MotionVectors = new Fsr2.ResourceView(BuiltinRenderTextureType.MotionVectors); - _dispatchDescription.Exposure = Fsr2.ResourceView.Unassigned; - _dispatchDescription.Reactive = Fsr2.ResourceView.Unassigned; - _dispatchDescription.TransparencyAndComposition = Fsr2.ResourceView.Unassigned; - - if (exposureSource == ExposureSource.Manual && exposure != null) _dispatchDescription.Exposure = new Fsr2.ResourceView(exposure); - if (exposureSource == ExposureSource.Unity) _dispatchDescription.Exposure = new Fsr2.ResourceView(context.autoExposureTexture); - if (reactiveMask != null) _dispatchDescription.Reactive = new Fsr2.ResourceView(reactiveMask); - if (transparencyAndCompositionMask != null) _dispatchDescription.TransparencyAndComposition = new Fsr2.ResourceView(transparencyAndCompositionMask); + // Set up the main FSR3 Upscaler dispatch parameters + _dispatchDescription.Color = new Fsr3Upscaler.ResourceView(context.source); + _dispatchDescription.Depth = new Fsr3Upscaler.ResourceView(BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth); + _dispatchDescription.MotionVectors = new Fsr3Upscaler.ResourceView(BuiltinRenderTextureType.MotionVectors); + _dispatchDescription.Exposure = Fsr3Upscaler.ResourceView.Unassigned; + _dispatchDescription.Reactive = Fsr3Upscaler.ResourceView.Unassigned; + _dispatchDescription.TransparencyAndComposition = Fsr3Upscaler.ResourceView.Unassigned; + + if (exposureSource == ExposureSource.Manual && exposure != null) _dispatchDescription.Exposure = new Fsr3Upscaler.ResourceView(exposure); + if (exposureSource == ExposureSource.Unity) _dispatchDescription.Exposure = new Fsr3Upscaler.ResourceView(context.autoExposureTexture); + if (reactiveMask != null) _dispatchDescription.Reactive = new Fsr3Upscaler.ResourceView(reactiveMask); + if (transparencyAndCompositionMask != null) _dispatchDescription.TransparencyAndComposition = new Fsr3Upscaler.ResourceView(transparencyAndCompositionMask); var scaledRenderSize = GetScaledRenderSize(context.camera); - _dispatchDescription.Output = new Fsr2.ResourceView(context.destination); + _dispatchDescription.Output = new Fsr3Upscaler.ResourceView(context.destination); _dispatchDescription.PreExposure = preExposure; _dispatchDescription.EnableSharpening = performSharpenPass; _dispatchDescription.Sharpness = sharpness; @@ -296,7 +296,7 @@ namespace UnityEngine.Rendering.PostProcessing _dispatchDescription.EnableAutoReactive = autoGenerateTransparencyAndComposition; if (autoGenerateTransparencyAndComposition) { - _dispatchDescription.ColorOpaqueOnly = new Fsr2.ResourceView(colorOpaqueOnly); + _dispatchDescription.ColorOpaqueOnly = new Fsr3Upscaler.ResourceView(colorOpaqueOnly); _dispatchDescription.AutoTcThreshold = generateTransparencyAndCompositionParameters.autoTcThreshold; _dispatchDescription.AutoTcScale = generateTransparencyAndCompositionParameters.autoTcScale; _dispatchDescription.AutoReactiveScale = generateTransparencyAndCompositionParameters.autoReactiveScale; @@ -305,7 +305,7 @@ namespace UnityEngine.Rendering.PostProcessing if (SystemInfo.usesReversedZBuffer) { - // Swap the near and far clip plane distances as FSR2 expects this when using inverted depth + // Swap the near and far clip plane distances as FSR3 expects this when using inverted depth (_dispatchDescription.CameraNear, _dispatchDescription.CameraFar) = (_dispatchDescription.CameraFar, _dispatchDescription.CameraNear); } } @@ -313,9 +313,9 @@ namespace UnityEngine.Rendering.PostProcessing private void SetupAutoReactiveDescription(PostProcessRenderContext context) { // Set up the parameters to auto-generate a reactive mask - _genReactiveDescription.ColorOpaqueOnly = new Fsr2.ResourceView(colorOpaqueOnly); - _genReactiveDescription.ColorPreUpscale = new Fsr2.ResourceView(context.source); - _genReactiveDescription.OutReactive = new Fsr2.ResourceView(Fsr2ShaderIDs.UavAutoReactive); + _genReactiveDescription.ColorOpaqueOnly = new Fsr3Upscaler.ResourceView(colorOpaqueOnly); + _genReactiveDescription.ColorPreUpscale = new Fsr3Upscaler.ResourceView(context.source); + _genReactiveDescription.OutReactive = new Fsr3Upscaler.ResourceView(Fsr3ShaderIDs.UavAutoReactive); _genReactiveDescription.RenderSize = GetScaledRenderSize(context.camera); _genReactiveDescription.Scale = generateReactiveParameters.scale; _genReactiveDescription.CutoffThreshold = generateReactiveParameters.cutoffThreshold; @@ -331,7 +331,7 @@ namespace UnityEngine.Rendering.PostProcessing return new Vector2Int(Mathf.CeilToInt(_maxRenderSize.x * ScalableBufferManager.widthScaleFactor), Mathf.CeilToInt(_maxRenderSize.y * ScalableBufferManager.heightScaleFactor)); } - private class Callbacks : Fsr2CallbacksBase + private class Callbacks : Fsr3UpscalerCallbacksBase { private readonly PostProcessResources _resources; diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2.cs.meta deleted file mode 100644 index 10fe120..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 742d52dc87714f0d93f3b59719859dff -timeCreated: 1673441954 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Context.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Context.cs.meta deleted file mode 100644 index ed50468..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Context.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 2f00ea267c3443d88bbd0e9dd7c08b4a -timeCreated: 1673442225 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pass.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pass.cs.meta deleted file mode 100644 index 06ce7e4..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pass.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 14234aed75ce454183019d2e20a44d24 -timeCreated: 1676885169 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Resources.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Resources.cs.meta deleted file mode 100644 index 0e993b4..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Resources.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 22ad49193f244ab4a36d0a1512f3015f -timeCreated: 1677236102 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2ShaderIDs.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2ShaderIDs.cs.meta deleted file mode 100644 index ef83135..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2ShaderIDs.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: ad1eca9398174f6c85d8bc01d10993df -timeCreated: 1679060863 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3.meta similarity index 77% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3.meta index 1579387..e12cfa8 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9e2d87f36f288024cb500a20acaae11e +guid: bfeca308812376e4a8e5e49e0d96c5c6 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2ShaderIDs.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3ShaderIDs.cs similarity index 96% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2ShaderIDs.cs rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3ShaderIDs.cs index b07c967..3a28843 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2ShaderIDs.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3ShaderIDs.cs @@ -22,7 +22,7 @@ using UnityEngine; namespace FidelityFX { - internal static class Fsr2ShaderIDs + internal static class Fsr3ShaderIDs { // Shader resource views, i.e. read-only bindings internal static readonly int SrvInputColor = Shader.PropertyToID("r_input_color_jittered"); @@ -36,7 +36,7 @@ namespace FidelityFX internal static readonly int SrvReconstructedPrevNearestDepth = Shader.PropertyToID("r_reconstructed_previous_nearest_depth"); internal static readonly int SrvDilatedMotionVectors = Shader.PropertyToID("r_dilated_motion_vectors"); internal static readonly int SrvPrevDilatedMotionVectors = Shader.PropertyToID("r_previous_dilated_motion_vectors"); - internal static readonly int SrvDilatedDepth = Shader.PropertyToID("r_dilatedDepth"); + internal static readonly int SrvDilatedDepth = Shader.PropertyToID("r_dilated_depth"); internal static readonly int SrvInternalUpscaled = Shader.PropertyToID("r_internal_upscaled_color"); internal static readonly int SrvLockStatus = Shader.PropertyToID("r_lock_status"); internal static readonly int SrvLockInputLuma = Shader.PropertyToID("r_lock_input_luma"); @@ -53,7 +53,7 @@ namespace FidelityFX // Unordered access views, i.e. random read/write bindings internal static readonly int UavReconstructedPrevNearestDepth = Shader.PropertyToID("rw_reconstructed_previous_nearest_depth"); internal static readonly int UavDilatedMotionVectors = Shader.PropertyToID("rw_dilated_motion_vectors"); - internal static readonly int UavDilatedDepth = Shader.PropertyToID("rw_dilatedDepth"); + internal static readonly int UavDilatedDepth = Shader.PropertyToID("rw_dilated_depth"); internal static readonly int UavInternalUpscaled = Shader.PropertyToID("rw_internal_upscaled_color"); internal static readonly int UavLockStatus = Shader.PropertyToID("rw_lock_status"); internal static readonly int UavLockInputLuma = Shader.PropertyToID("rw_lock_input_luma"); @@ -72,7 +72,7 @@ namespace FidelityFX internal static readonly int UavPrevColorPostAlpha = Shader.PropertyToID("rw_output_prev_color_post_alpha"); // Constant buffer bindings - internal static readonly int CbFsr2 = Shader.PropertyToID("cbFSR2"); + internal static readonly int CbFsr3Upscaler = Shader.PropertyToID("cbFSR3Upscaler"); internal static readonly int CbSpd = Shader.PropertyToID("cbSPD"); internal static readonly int CbRcas = Shader.PropertyToID("cbRCAS"); internal static readonly int CbGenReactive = Shader.PropertyToID("cbGenerateReactive"); diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3ShaderIDs.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3ShaderIDs.cs.meta new file mode 100644 index 0000000..9012617 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3ShaderIDs.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a0e0bcc2967836742b7864d1cafafbf0 +timeCreated: 1679060863 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs similarity index 92% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2.cs rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs index 1ba8192..d31a82e 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs @@ -26,14 +26,14 @@ using UnityEngine.Rendering; namespace FidelityFX { /// - /// A collection of helper functions and data structures required by the FSR2 process. + /// A collection of helper functions and data structures required by the FSR3 Upscaler process. /// - public static class Fsr2 + public static class Fsr3Upscaler { /// - /// Creates a new FSR2 context with standard parameters that are appropriate for the current platform. + /// Creates a new FSR3 Upscaler context with standard parameters that are appropriate for the current platform. /// - public static Fsr2Context CreateContext(Vector2Int displaySize, Vector2Int maxRenderSize, IFsr2Callbacks callbacks, InitializationFlags flags = 0) + public static Fsr3UpscalerContext CreateContext(Vector2Int displaySize, Vector2Int maxRenderSize, IFsr3UpscalerCallbacks callbacks, InitializationFlags flags = 0) { if (SystemInfo.usesReversedZBuffer) flags |= InitializationFlags.EnableDepthInverted; @@ -44,7 +44,7 @@ namespace FidelityFX flags |= InitializationFlags.EnableDebugChecking; #endif - Debug.Log($"Setting up FSR2 with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}"); + Debug.Log($"Setting up FSR3 Upscaler with render size: {maxRenderSize.x}x{maxRenderSize.y}, display size: {displaySize.x}x{displaySize.y}, flags: {flags}"); var contextDescription = new ContextDescription { @@ -54,7 +54,7 @@ namespace FidelityFX Callbacks = callbacks, }; - var context = new Fsr2Context(); + var context = new Fsr3UpscalerContext(); context.Create(contextDescription); return context; } @@ -63,6 +63,8 @@ namespace FidelityFX { switch (qualityMode) { + case QualityMode.NativeAA: + return 1.0f; case QualityMode.UltraQuality: return 1.2f; case QualityMode.Quality: @@ -134,11 +136,12 @@ namespace FidelityFX public enum QualityMode { - UltraQuality = 0, - Quality = 1, - Balanced = 2, - Performance = 3, - UltraPerformance = 4, + NativeAA = 0, + UltraQuality = 1, + Quality = 2, + Balanced = 3, + Performance = 4, + UltraPerformance = 5, } [Flags] @@ -160,7 +163,7 @@ namespace FidelityFX public InitializationFlags Flags; public Vector2Int MaxRenderSize; public Vector2Int DisplaySize; - public IFsr2Callbacks Callbacks; + public IFsr3UpscalerCallbacks Callbacks; } /// @@ -231,7 +234,7 @@ namespace FidelityFX /// /// A structure encapsulating the parameters for automatic generation of a reactive mask. - /// The default values for Scale, CutoffThreshold, BinaryValue and Flags were taken from the FSR2 demo project. + /// The default values for Scale, CutoffThreshold, BinaryValue and Flags were taken from the FSR3 demo project. /// public class GenerateReactiveDescription { @@ -255,7 +258,7 @@ namespace FidelityFX } [Serializable, StructLayout(LayoutKind.Sequential)] - internal struct Fsr2Constants + internal struct UpscalerConstants { public Vector2Int renderSize; public Vector2Int maxRenderSize; diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs.meta new file mode 100644 index 0000000..6717df4 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3Upscaler.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: df8b18c192f2dc145b4b43e68fd3407d +timeCreated: 1673441954 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Callbacks.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerCallbacks.cs similarity index 85% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Callbacks.cs rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerCallbacks.cs index ad41d98..01e974b 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Callbacks.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerCallbacks.cs @@ -23,13 +23,11 @@ using UnityEngine; namespace FidelityFX { /// - /// 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. + /// A collection of callbacks required by the FSR3 Upscaler process. + /// This allows some customization by the game dev on how to integrate FSR3 upscaling into their own game setup. /// - public interface IFsr2Callbacks + public interface IFsr3UpscalerCallbacks { - Shader LoadShader(string name); - void UnloadShader(Shader shader); ComputeShader LoadComputeShader(string name); void UnloadComputeShader(ComputeShader shader); @@ -47,22 +45,12 @@ namespace FidelityFX } /// - /// Default implementation of IFsr2Callbacks using simple Resources calls. + /// Default implementation of IFsr3UpscalerCallbacks using simple Resources calls. /// These are fine for testing but a proper game will want to extend and override these methods. /// - public class Fsr2CallbacksBase: IFsr2Callbacks + public class Fsr3UpscalerCallbacksBase: IFsr3UpscalerCallbacks { protected float CurrentBiasOffset = 0; - - public virtual Shader LoadShader(string name) - { - return Resources.Load(name); - } - - public virtual void UnloadShader(Shader shader) - { - Resources.UnloadAsset(shader); - } public virtual ComputeShader LoadComputeShader(string name) { diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Callbacks.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerCallbacks.cs.meta similarity index 83% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Callbacks.cs.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerCallbacks.cs.meta index abc4d96..ae2ee1a 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Callbacks.cs.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerCallbacks.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5906deeb6ec2854449bf33db2e71a046 +guid: e1b555daa29ec3043a8cf89b4db31a26 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Context.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerContext.cs similarity index 70% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Context.cs rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerContext.cs index 5c8975c..0f3b99d 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Context.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerContext.cs @@ -19,7 +19,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.Rendering; @@ -27,69 +26,69 @@ using UnityEngine.Rendering; namespace FidelityFX { /// - /// 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. + /// This class loosely matches the FfxFsr3UpscalerContext struct from the original FSR3 codebase. + /// It manages the various resources and compute passes required by the FSR3 Upscaler 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. /// - public class Fsr2Context + public class Fsr3UpscalerContext { private const int MaxQueuedFrames = 16; - private Fsr2.ContextDescription _contextDescription; + private Fsr3Upscaler.ContextDescription _contextDescription; private CommandBuffer _commandBuffer; - private Fsr2Pass _depthClipPass; - private Fsr2Pass _reconstructPreviousDepthPass; - private Fsr2Pass _lockPass; - private Fsr2Pass _accumulatePass; - private Fsr2Pass _rcasPass; - private Fsr2Pass _computeLuminancePyramidPass; - private Fsr2Pass _generateReactivePass; - private Fsr2Pass _tcrAutogeneratePass; + private Fsr3UpscalerPass _depthClipPass; + private Fsr3UpscalerPass _reconstructPreviousDepthPass; + private Fsr3UpscalerPass _lockPass; + private Fsr3UpscalerPass _accumulatePass; + private Fsr3UpscalerPass _rcasPass; + private Fsr3UpscalerPass _computeLuminancePyramidPass; + private Fsr3UpscalerPass _generateReactivePass; + private Fsr3UpscalerPass _tcrAutogeneratePass; - private readonly Fsr2Resources _resources = new Fsr2Resources(); + private readonly Fsr3UpscalerResources _resources = new Fsr3UpscalerResources(); - private ComputeBuffer _fsr2ConstantsBuffer; - private readonly Fsr2.Fsr2Constants[] _fsr2ConstantsArray = { new Fsr2.Fsr2Constants() }; - private ref Fsr2.Fsr2Constants Constants => ref _fsr2ConstantsArray[0]; + private ComputeBuffer _upscalerConstantsBuffer; + private readonly Fsr3Upscaler.UpscalerConstants[] _upscalerConstantsArray = { new Fsr3Upscaler.UpscalerConstants() }; + private ref Fsr3Upscaler.UpscalerConstants UpscalerConsts => ref _upscalerConstantsArray[0]; private ComputeBuffer _spdConstantsBuffer; - private readonly Fsr2.SpdConstants[] _spdConstantsArray = { new Fsr2.SpdConstants() }; - private ref Fsr2.SpdConstants SpdConsts => ref _spdConstantsArray[0]; + private readonly Fsr3Upscaler.SpdConstants[] _spdConstantsArray = { new Fsr3Upscaler.SpdConstants() }; + private ref Fsr3Upscaler.SpdConstants SpdConsts => ref _spdConstantsArray[0]; private ComputeBuffer _rcasConstantsBuffer; - private readonly Fsr2.RcasConstants[] _rcasConstantsArray = new Fsr2.RcasConstants[1]; - private ref Fsr2.RcasConstants RcasConsts => ref _rcasConstantsArray[0]; + private readonly Fsr3Upscaler.RcasConstants[] _rcasConstantsArray = new Fsr3Upscaler.RcasConstants[1]; + private ref Fsr3Upscaler.RcasConstants RcasConsts => ref _rcasConstantsArray[0]; private ComputeBuffer _generateReactiveConstantsBuffer; - private readonly Fsr2.GenerateReactiveConstants[] _generateReactiveConstantsArray = { new Fsr2.GenerateReactiveConstants() }; - private ref Fsr2.GenerateReactiveConstants GenReactiveConsts => ref _generateReactiveConstantsArray[0]; + private readonly Fsr3Upscaler.GenerateReactiveConstants[] _generateReactiveConstantsArray = { new Fsr3Upscaler.GenerateReactiveConstants() }; + private ref Fsr3Upscaler.GenerateReactiveConstants GenReactiveConsts => ref _generateReactiveConstantsArray[0]; private ComputeBuffer _tcrAutogenerateConstantsBuffer; - private readonly Fsr2.GenerateReactiveConstants2[] _tcrAutogenerateConstantsArray = { new Fsr2.GenerateReactiveConstants2() }; - private ref Fsr2.GenerateReactiveConstants2 TcrAutoGenConsts => ref _tcrAutogenerateConstantsArray[0]; + private readonly Fsr3Upscaler.GenerateReactiveConstants2[] _tcrAutogenerateConstantsArray = { new Fsr3Upscaler.GenerateReactiveConstants2() }; + private ref Fsr3Upscaler.GenerateReactiveConstants2 TcrAutoGenConsts => ref _tcrAutogenerateConstantsArray[0]; private bool _firstExecution; private Vector2 _previousJitterOffset; private int _resourceFrameIndex; - public void Create(Fsr2.ContextDescription contextDescription) + public void Create(Fsr3Upscaler.ContextDescription contextDescription) { _contextDescription = contextDescription; - _commandBuffer = new CommandBuffer { name = "FSR2" }; + _commandBuffer = new CommandBuffer { name = "FSR3 Upscaler" }; - _fsr2ConstantsBuffer = CreateConstantBuffer(); - _spdConstantsBuffer = CreateConstantBuffer(); - _rcasConstantsBuffer = CreateConstantBuffer(); - _generateReactiveConstantsBuffer = CreateConstantBuffer(); - _tcrAutogenerateConstantsBuffer = CreateConstantBuffer(); + _upscalerConstantsBuffer = CreateConstantBuffer(); + _spdConstantsBuffer = CreateConstantBuffer(); + _rcasConstantsBuffer = CreateConstantBuffer(); + _generateReactiveConstantsBuffer = CreateConstantBuffer(); + _tcrAutogenerateConstantsBuffer = CreateConstantBuffer(); // Set defaults _firstExecution = true; _resourceFrameIndex = 0; - Constants.displaySize = _contextDescription.DisplaySize; + UpscalerConsts.displaySize = _contextDescription.DisplaySize; _resources.Create(_contextDescription); CreatePasses(); @@ -97,14 +96,14 @@ namespace FidelityFX private void CreatePasses() { - _computeLuminancePyramidPass = new Fsr2ComputeLuminancePyramidPass(_contextDescription, _resources, _fsr2ConstantsBuffer, _spdConstantsBuffer); - _reconstructPreviousDepthPass = new Fsr2ReconstructPreviousDepthPass(_contextDescription, _resources, _fsr2ConstantsBuffer); - _depthClipPass = new Fsr2DepthClipPass(_contextDescription, _resources, _fsr2ConstantsBuffer); - _lockPass = new Fsr2LockPass(_contextDescription, _resources, _fsr2ConstantsBuffer); - _accumulatePass = new Fsr2AccumulatePass(_contextDescription, _resources, _fsr2ConstantsBuffer); - _rcasPass = new Fsr2RcasPass(_contextDescription, _resources, _fsr2ConstantsBuffer, _rcasConstantsBuffer); - _generateReactivePass = new Fsr2GenerateReactivePass(_contextDescription, _resources, _generateReactiveConstantsBuffer); - _tcrAutogeneratePass = new Fsr2TcrAutogeneratePass(_contextDescription, _resources, _fsr2ConstantsBuffer, _tcrAutogenerateConstantsBuffer); + _computeLuminancePyramidPass = new Fsr3UpscalerComputeLuminancePyramidPass(_contextDescription, _resources, _upscalerConstantsBuffer, _spdConstantsBuffer); + _reconstructPreviousDepthPass = new Fsr3UpscalerReconstructPreviousDepthPass(_contextDescription, _resources, _upscalerConstantsBuffer); + _depthClipPass = new Fsr3UpscalerDepthClipPass(_contextDescription, _resources, _upscalerConstantsBuffer); + _lockPass = new Fsr3UpscalerLockPass(_contextDescription, _resources, _upscalerConstantsBuffer); + _accumulatePass = new Fsr3UpscalerAccumulatePass(_contextDescription, _resources, _upscalerConstantsBuffer); + _rcasPass = new Fsr3UpscalerRcasPass(_contextDescription, _resources, _upscalerConstantsBuffer, _rcasConstantsBuffer); + _generateReactivePass = new Fsr3UpscalerGenerateReactivePass(_contextDescription, _resources, _generateReactiveConstantsBuffer); + _tcrAutogeneratePass = new Fsr3UpscalerTcrAutogeneratePass(_contextDescription, _resources, _upscalerConstantsBuffer, _tcrAutogenerateConstantsBuffer); } public void Destroy() @@ -124,22 +123,22 @@ namespace FidelityFX DestroyConstantBuffer(ref _generateReactiveConstantsBuffer); DestroyConstantBuffer(ref _rcasConstantsBuffer); DestroyConstantBuffer(ref _spdConstantsBuffer); - DestroyConstantBuffer(ref _fsr2ConstantsBuffer); + DestroyConstantBuffer(ref _upscalerConstantsBuffer); _commandBuffer.Dispose(); _commandBuffer = null; } - public void Dispatch(Fsr2.DispatchDescription dispatchParams) + public void Dispatch(Fsr3Upscaler.DispatchDescription dispatchParams) { _commandBuffer.Clear(); Dispatch(dispatchParams, _commandBuffer); Graphics.ExecuteCommandBuffer(_commandBuffer); } - public void Dispatch(Fsr2.DispatchDescription dispatchParams, CommandBuffer commandBuffer) + public void Dispatch(Fsr3Upscaler.DispatchDescription dispatchParams, CommandBuffer commandBuffer) { - if ((_contextDescription.Flags & Fsr2.InitializationFlags.EnableDebugChecking) != 0) + if ((_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDebugChecking) != 0) { DebugCheckDispatch(dispatchParams); } @@ -157,10 +156,10 @@ namespace FidelityFX _firstExecution = false; // If auto exposure is enabled use the auto exposure SRV, otherwise what the app sends - if ((_contextDescription.Flags & Fsr2.InitializationFlags.EnableAutoExposure) != 0) - dispatchParams.Exposure = new Fsr2.ResourceView(_resources.AutoExposure); + if ((_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableAutoExposure) != 0) + dispatchParams.Exposure = new Fsr3Upscaler.ResourceView(_resources.AutoExposure); else if (!dispatchParams.Exposure.IsValid) - dispatchParams.Exposure = new Fsr2.ResourceView(_resources.DefaultExposure); + dispatchParams.Exposure = new Fsr3Upscaler.ResourceView(_resources.DefaultExposure); if (dispatchParams.EnableAutoReactive) { @@ -170,7 +169,7 @@ namespace FidelityFX if (resetAccumulation) { - RenderTargetIdentifier opaqueOnly = dispatchParams.ColorOpaqueOnly.IsValid ? dispatchParams.ColorOpaqueOnly.RenderTarget : Fsr2ShaderIDs.SrvOpaqueOnly; + RenderTargetIdentifier opaqueOnly = dispatchParams.ColorOpaqueOnly.IsValid ? dispatchParams.ColorOpaqueOnly.RenderTarget : Fsr3ShaderIDs.SrvOpaqueOnly; commandBuffer.Blit(_resources.PrevPreAlpha[frameIndex ^ 1], opaqueOnly); } } @@ -180,16 +179,16 @@ namespace FidelityFX _resources.DestroyTcrAutogenResources(); } - if (!dispatchParams.Reactive.IsValid) dispatchParams.Reactive = new Fsr2.ResourceView(_resources.DefaultReactive); - if (!dispatchParams.TransparencyAndComposition.IsValid) dispatchParams.TransparencyAndComposition = new Fsr2.ResourceView(_resources.DefaultReactive); - Fsr2Resources.CreateAliasableResources(commandBuffer, _contextDescription, dispatchParams); + if (!dispatchParams.Reactive.IsValid) dispatchParams.Reactive = new Fsr3Upscaler.ResourceView(_resources.DefaultReactive); + if (!dispatchParams.TransparencyAndComposition.IsValid) dispatchParams.TransparencyAndComposition = new Fsr3Upscaler.ResourceView(_resources.DefaultReactive); + Fsr3UpscalerResources.CreateAliasableResources(commandBuffer, _contextDescription, dispatchParams); SetupConstants(dispatchParams, resetAccumulation); // Reactive mask bias const int threadGroupWorkRegionDim = 8; - int dispatchSrcX = (Constants.renderSize.x + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; - int dispatchSrcY = (Constants.renderSize.y + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; + int dispatchSrcX = (UpscalerConsts.renderSize.x + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; + int dispatchSrcY = (UpscalerConsts.renderSize.y + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; int dispatchDstX = (_contextDescription.DisplaySize.x + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; int dispatchDstY = (_contextDescription.DisplaySize.y + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; @@ -214,19 +213,24 @@ namespace FidelityFX commandBuffer.ClearRenderTarget(false, true, Color.clear); } + // FSR3: need to clear here since we need the content of this surface for frame interpolation, so clearing in the lock pass is not an option + bool depthInverted = (_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDepthInverted) == Fsr3Upscaler.InitializationFlags.EnableDepthInverted; + commandBuffer.SetRenderTarget(Fsr3ShaderIDs.UavReconstructedPrevNearestDepth); + commandBuffer.ClearRenderTarget(false, true, depthInverted ? Color.clear : Color.white); + // Auto exposure SetupSpdConstants(dispatchParams, out var dispatchThreadGroupCount); // Initialize constant buffers data - commandBuffer.SetBufferData(_fsr2ConstantsBuffer, _fsr2ConstantsArray); + commandBuffer.SetBufferData(_upscalerConstantsBuffer, _upscalerConstantsArray); commandBuffer.SetBufferData(_spdConstantsBuffer, _spdConstantsArray); // Auto reactive if (dispatchParams.EnableAutoReactive) { GenerateTransparencyCompositionReactive(dispatchParams, commandBuffer, frameIndex); - dispatchParams.Reactive = new Fsr2.ResourceView(_resources.AutoReactive); - dispatchParams.TransparencyAndComposition = new Fsr2.ResourceView(_resources.AutoComposition); + dispatchParams.Reactive = new Fsr3Upscaler.ResourceView(_resources.AutoReactive); + dispatchParams.TransparencyAndComposition = new Fsr3Upscaler.ResourceView(_resources.AutoComposition); } // Compute luminance pyramid @@ -259,17 +263,17 @@ namespace FidelityFX _resourceFrameIndex = (_resourceFrameIndex + 1) % MaxQueuedFrames; - Fsr2Resources.DestroyAliasableResources(commandBuffer); + Fsr3UpscalerResources.DestroyAliasableResources(commandBuffer); } - public void GenerateReactiveMask(Fsr2.GenerateReactiveDescription dispatchParams) + public void GenerateReactiveMask(Fsr3Upscaler.GenerateReactiveDescription dispatchParams) { _commandBuffer.Clear(); GenerateReactiveMask(dispatchParams, _commandBuffer); Graphics.ExecuteCommandBuffer(_commandBuffer); } - public void GenerateReactiveMask(Fsr2.GenerateReactiveDescription dispatchParams, CommandBuffer commandBuffer) + public void GenerateReactiveMask(Fsr3Upscaler.GenerateReactiveDescription dispatchParams, CommandBuffer commandBuffer) { const int threadGroupWorkRegionDim = 8; int dispatchSrcX = (dispatchParams.RenderSize.x + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; @@ -281,10 +285,10 @@ namespace FidelityFX GenReactiveConsts.flags = (uint)dispatchParams.Flags; commandBuffer.SetBufferData(_generateReactiveConstantsBuffer, _generateReactiveConstantsArray); - ((Fsr2GenerateReactivePass)_generateReactivePass).ScheduleDispatch(commandBuffer, dispatchParams, dispatchSrcX, dispatchSrcY); + ((Fsr3UpscalerGenerateReactivePass)_generateReactivePass).ScheduleDispatch(commandBuffer, dispatchParams, dispatchSrcX, dispatchSrcY); } - private void GenerateTransparencyCompositionReactive(Fsr2.DispatchDescription dispatchParams, CommandBuffer commandBuffer, int frameIndex) + private void GenerateTransparencyCompositionReactive(Fsr3Upscaler.DispatchDescription dispatchParams, CommandBuffer commandBuffer, int frameIndex) { const int threadGroupWorkRegionDim = 8; int dispatchSrcX = (dispatchParams.RenderSize.x + (threadGroupWorkRegionDim - 1)) / threadGroupWorkRegionDim; @@ -299,9 +303,9 @@ namespace FidelityFX _tcrAutogeneratePass.ScheduleDispatch(commandBuffer, dispatchParams, frameIndex, dispatchSrcX, dispatchSrcY); } - private void SetupConstants(Fsr2.DispatchDescription dispatchParams, bool resetAccumulation) + private void SetupConstants(Fsr3Upscaler.DispatchDescription dispatchParams, bool resetAccumulation) { - ref Fsr2.Fsr2Constants constants = ref Constants; + ref Fsr3Upscaler.UpscalerConstants constants = ref UpscalerConsts; constants.jitterOffset = dispatchParams.JitterOffset; constants.renderSize = dispatchParams.RenderSize; @@ -323,17 +327,17 @@ namespace FidelityFX constants.preExposure = (dispatchParams.PreExposure != 0) ? dispatchParams.PreExposure : 1.0f; // Motion vector data - Vector2Int motionVectorsTargetSize = (_contextDescription.Flags & Fsr2.InitializationFlags.EnableDisplayResolutionMotionVectors) != 0 ? constants.displaySize : constants.renderSize; + Vector2Int motionVectorsTargetSize = (_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDisplayResolutionMotionVectors) != 0 ? constants.displaySize : constants.renderSize; constants.motionVectorScale = dispatchParams.MotionVectorScale / motionVectorsTargetSize; // Compute jitter cancellation - if ((_contextDescription.Flags & Fsr2.InitializationFlags.EnableMotionVectorsJitterCancellation) != 0) + if ((_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableMotionVectorsJitterCancellation) != 0) { constants.motionVectorJitterCancellation = (_previousJitterOffset - constants.jitterOffset) / motionVectorsTargetSize; _previousJitterOffset = constants.jitterOffset; } - int jitterPhaseCount = Fsr2.GetJitterPhaseCount(dispatchParams.RenderSize.x, _contextDescription.DisplaySize.x); + int jitterPhaseCount = Fsr3Upscaler.GetJitterPhaseCount(dispatchParams.RenderSize.x, _contextDescription.DisplaySize.x); if (resetAccumulation || constants.jitterPhaseCount == 0) { constants.jitterPhaseCount = jitterPhaseCount; @@ -356,17 +360,17 @@ namespace FidelityFX constants.frameIndex++; // Shading change usage of the SPD mip levels - constants.lumaMipLevelToUse = Fsr2Pass.ShadingChangeMipLevel; + constants.lumaMipLevelToUse = Fsr3UpscalerPass.ShadingChangeMipLevel; float mipDiv = 2 << constants.lumaMipLevelToUse; constants.lumaMipDimensions.x = (int)(constants.maxRenderSize.x / mipDiv); constants.lumaMipDimensions.y = (int)(constants.maxRenderSize.y / mipDiv); } - private Vector4 SetupDeviceDepthToViewSpaceDepthParams(Fsr2.DispatchDescription dispatchParams) + private Vector4 SetupDeviceDepthToViewSpaceDepthParams(Fsr3Upscaler.DispatchDescription dispatchParams) { - bool inverted = (_contextDescription.Flags & Fsr2.InitializationFlags.EnableDepthInverted) != 0; - bool infinite = (_contextDescription.Flags & Fsr2.InitializationFlags.EnableDepthInfinite) != 0; + bool inverted = (_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDepthInverted) != 0; + bool infinite = (_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDepthInfinite) != 0; // make sure it has no impact if near and far plane values are swapped in dispatch params // the flags "inverted" and "infinite" will decide what transform to use @@ -396,19 +400,19 @@ namespace FidelityFX 1.0f / cotHalfFovY); } - private void SetupRcasConstants(Fsr2.DispatchDescription dispatchParams) + private void SetupRcasConstants(Fsr3Upscaler.DispatchDescription dispatchParams) { int sharpnessIndex = Mathf.RoundToInt(Mathf.Clamp01(dispatchParams.Sharpness) * (RcasConfigs.Length - 1)); RcasConsts = RcasConfigs[sharpnessIndex]; } - private void SetupSpdConstants(Fsr2.DispatchDescription dispatchParams, out Vector2Int dispatchThreadGroupCount) + private void SetupSpdConstants(Fsr3Upscaler.DispatchDescription dispatchParams, out Vector2Int dispatchThreadGroupCount) { RectInt rectInfo = new RectInt(0, 0, dispatchParams.RenderSize.x, dispatchParams.RenderSize.y); SpdSetup(rectInfo, out dispatchThreadGroupCount, out var workGroupOffset, out var numWorkGroupsAndMips); // Downsample - ref Fsr2.SpdConstants spdConstants = ref SpdConsts; + ref Fsr3Upscaler.SpdConstants spdConstants = ref SpdConsts; spdConstants.numWorkGroups = (uint)numWorkGroupsAndMips.x; spdConstants.mips = (uint)numWorkGroupsAndMips.y; spdConstants.workGroupOffsetX = (uint)workGroupOffset.x; @@ -434,7 +438,7 @@ namespace FidelityFX } } - private void DebugCheckDispatch(Fsr2.DispatchDescription dispatchParams) + private void DebugCheckDispatch(Fsr3Upscaler.DispatchDescription dispatchParams) { if (!dispatchParams.Color.IsValid) { @@ -456,7 +460,7 @@ namespace FidelityFX Debug.LogError("Output resource is null"); } - if (dispatchParams.Exposure.IsValid && (_contextDescription.Flags & Fsr2.InitializationFlags.EnableAutoExposure) != 0) + if (dispatchParams.Exposure.IsValid && (_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableAutoExposure) != 0) { Debug.LogWarning("Exposure resource provided, however auto exposure flag is present"); } @@ -496,8 +500,8 @@ namespace FidelityFX Debug.LogError("PreExposure provided as 0.0f which is invalid"); } - bool infiniteDepth = (_contextDescription.Flags & Fsr2.InitializationFlags.EnableDepthInfinite) != 0; - bool inverseDepth = (_contextDescription.Flags & Fsr2.InitializationFlags.EnableDepthInverted) != 0; + bool infiniteDepth = (_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDepthInfinite) != 0; + bool inverseDepth = (_contextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDepthInverted) != 0; if (inverseDepth) { @@ -552,32 +556,32 @@ namespace FidelityFX } /// - /// The FSR2 C++ codebase uses floats bitwise converted to ints to pass sharpness parameters to the RCAS shader. + /// The FSR3 C++ codebase uses floats bitwise converted to ints to pass sharpness parameters to the RCAS shader. /// This is not possible in C# without enabling unsafe code compilation, so to avoid that we instead use a table of precomputed values. /// - private static readonly Fsr2.RcasConstants[] RcasConfigs = new [] + private static readonly Fsr3Upscaler.RcasConstants[] RcasConfigs = new [] { - new Fsr2.RcasConstants(1048576000u, 872428544u), - new Fsr2.RcasConstants(1049178080u, 877212745u), - new Fsr2.RcasConstants(1049823372u, 882390168u), - new Fsr2.RcasConstants(1050514979u, 887895276u), - new Fsr2.RcasConstants(1051256227u, 893859143u), - new Fsr2.RcasConstants(1052050675u, 900216232u), - new Fsr2.RcasConstants(1052902144u, 907032080u), - new Fsr2.RcasConstants(1053814727u, 914306687u), - new Fsr2.RcasConstants(1054792807u, 922105590u), - new Fsr2.RcasConstants(1055841087u, 930494326u), - new Fsr2.RcasConstants(1056964608u, 939538432u), - new Fsr2.RcasConstants(1057566688u, 944322633u), - new Fsr2.RcasConstants(1058211980u, 949500056u), - new Fsr2.RcasConstants(1058903587u, 955005164u), - new Fsr2.RcasConstants(1059644835u, 960969031u), - new Fsr2.RcasConstants(1060439283u, 967326120u), - new Fsr2.RcasConstants(1061290752u, 974141968u), - new Fsr2.RcasConstants(1062203335u, 981416575u), - new Fsr2.RcasConstants(1063181415u, 989215478u), - new Fsr2.RcasConstants(1064229695u, 997604214u), - new Fsr2.RcasConstants(1065353216u, 1006648320), + new Fsr3Upscaler.RcasConstants(1048576000u, 872428544u), + new Fsr3Upscaler.RcasConstants(1049178080u, 877212745u), + new Fsr3Upscaler.RcasConstants(1049823372u, 882390168u), + new Fsr3Upscaler.RcasConstants(1050514979u, 887895276u), + new Fsr3Upscaler.RcasConstants(1051256227u, 893859143u), + new Fsr3Upscaler.RcasConstants(1052050675u, 900216232u), + new Fsr3Upscaler.RcasConstants(1052902144u, 907032080u), + new Fsr3Upscaler.RcasConstants(1053814727u, 914306687u), + new Fsr3Upscaler.RcasConstants(1054792807u, 922105590u), + new Fsr3Upscaler.RcasConstants(1055841087u, 930494326u), + new Fsr3Upscaler.RcasConstants(1056964608u, 939538432u), + new Fsr3Upscaler.RcasConstants(1057566688u, 944322633u), + new Fsr3Upscaler.RcasConstants(1058211980u, 949500056u), + new Fsr3Upscaler.RcasConstants(1058903587u, 955005164u), + new Fsr3Upscaler.RcasConstants(1059644835u, 960969031u), + new Fsr3Upscaler.RcasConstants(1060439283u, 967326120u), + new Fsr3Upscaler.RcasConstants(1061290752u, 974141968u), + new Fsr3Upscaler.RcasConstants(1062203335u, 981416575u), + new Fsr3Upscaler.RcasConstants(1063181415u, 989215478u), + new Fsr3Upscaler.RcasConstants(1064229695u, 997604214u), + new Fsr3Upscaler.RcasConstants(1065353216u, 1006648320), }; private static ComputeBuffer CreateConstantBuffer() where TConstants: struct @@ -594,7 +598,7 @@ namespace FidelityFX bufferRef = null; } - private static void DestroyPass(ref Fsr2Pass pass) + private static void DestroyPass(ref Fsr3UpscalerPass pass) { if (pass == null) return; diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerContext.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerContext.cs.meta new file mode 100644 index 0000000..673b2ef --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerContext.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 14c8dc4c7c3e4ac418e50a859cec0b2f +timeCreated: 1673442225 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pass.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerPass.cs similarity index 59% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pass.cs rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerPass.cs index 23b8e6c..bb7f746 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Pass.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerPass.cs @@ -26,24 +26,22 @@ using UnityEngine.Rendering; namespace FidelityFX { /// - /// 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. + /// Base class for all of the compute passes that make up the FSR3 Upscaler process. + /// This loosely matches the FfxPipelineState struct from the original FSR3 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. /// - internal abstract class Fsr2Pass: IDisposable + internal abstract class Fsr3UpscalerPass: 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_FSR3UPSCALER_SHADING_CHANGE_MIP_LEVEL define - protected readonly Fsr2.ContextDescription ContextDescription; - protected readonly Fsr2Resources Resources; + protected readonly Fsr3Upscaler.ContextDescription ContextDescription; + protected readonly Fsr3UpscalerResources Resources; protected readonly ComputeBuffer Constants; protected ComputeShader ComputeShader; protected int KernelIndex; - protected virtual bool AllowFP16 => true; - - protected Fsr2Pass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) + protected Fsr3UpscalerPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) { ContextDescription = contextDescription; Resources = resources; @@ -55,14 +53,14 @@ namespace FidelityFX UnloadComputeShader(); } - public abstract void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY); + public abstract void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY); protected void LoadComputeShader(string name) { LoadComputeShader(name, ContextDescription.Flags, ref ComputeShader, out KernelIndex); } - private void LoadComputeShader(string name, Fsr2.InitializationFlags flags, ref ComputeShader shaderRef, out int kernelIndex) + private void LoadComputeShader(string name, Fsr3Upscaler.InitializationFlags flags, ref ComputeShader shaderRef, out int kernelIndex) { if (shaderRef == null) { @@ -81,22 +79,19 @@ namespace FidelityFX } #endif - // Allow 16-bit floating point as a configuration option, except on passes that explicitly disable it - bool supportedFP16 = ((flags & Fsr2.InitializationFlags.EnableFP16Usage) != 0 && AllowFP16); - // This matches the permutation rules from the CreatePipeline* functions - if ((flags & Fsr2.InitializationFlags.EnableHighDynamicRange) != 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_HDR_COLOR_INPUT"); - if ((flags & Fsr2.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS"); - if ((flags & Fsr2.InitializationFlags.EnableMotionVectorsJitterCancellation) != 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS"); - if ((flags & Fsr2.InitializationFlags.EnableDepthInverted) != 0) shaderRef.EnableKeyword("FFX_FSR2_OPTION_INVERTED_DEPTH"); - if (useLut) shaderRef.EnableKeyword("FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE"); - if (supportedFP16) shaderRef.EnableKeyword("FFX_HALF"); + if ((flags & Fsr3Upscaler.InitializationFlags.EnableHighDynamicRange) != 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT"); + if ((flags & Fsr3Upscaler.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS"); + if ((flags & Fsr3Upscaler.InitializationFlags.EnableMotionVectorsJitterCancellation) != 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS"); + if ((flags & Fsr3Upscaler.InitializationFlags.EnableDepthInverted) != 0) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH"); + if (useLut) shaderRef.EnableKeyword("FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE"); + if ((flags & Fsr3Upscaler.InitializationFlags.EnableFP16Usage) != 0) shaderRef.EnableKeyword("FFX_HALF"); // Inform the shader which render pipeline we're currently using var pipeline = GraphicsSettings.currentRenderPipeline; if (pipeline != null && pipeline.GetType().Name.Contains("HDRenderPipeline")) { - shaderRef.EnableKeyword("UNITY_FSR2_HDRP"); + shaderRef.EnableKeyword("UNITY_FSR3UPSCALER_HDRP"); } } @@ -115,72 +110,72 @@ namespace FidelityFX } } - internal class Fsr2ComputeLuminancePyramidPass : Fsr2Pass + internal class Fsr3UpscalerComputeLuminancePyramidPass : Fsr3UpscalerPass { private readonly ComputeBuffer _spdConstants; - public Fsr2ComputeLuminancePyramidPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants, ComputeBuffer spdConstants) + public Fsr3UpscalerComputeLuminancePyramidPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants, ComputeBuffer spdConstants) : base(contextDescription, resources, constants) { _spdConstants = spdConstants; - LoadComputeShader("FSR2/ffx_fsr2_compute_luminance_pyramid_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass"); } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { ref var color = ref dispatchParams.Color; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavSpdAtomicCount, Resources.SpdAtomicCounter); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavExposureMipLumaChange, Resources.SceneLuminance, ShadingChangeMipLevel); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavExposureMip5, Resources.SceneLuminance, 5); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoExposure, Resources.AutoExposure); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavSpdAtomicCount, Resources.SpdAtomicCounter); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavExposureMipLumaChange, Resources.SceneLuminance, ShadingChangeMipLevel); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavExposureMip5, Resources.SceneLuminance, 5); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavAutoExposure, Resources.AutoExposure); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbSpd, _spdConstants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbFsr3Upscaler, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbSpd, _spdConstants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } - internal class Fsr2ReconstructPreviousDepthPass : Fsr2Pass + internal class Fsr3UpscalerReconstructPreviousDepthPass : Fsr3UpscalerPass { - public Fsr2ReconstructPreviousDepthPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) + public Fsr3UpscalerReconstructPreviousDepthPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_reconstruct_previous_depth_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass"); } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { ref var color = ref dispatchParams.Color; ref var depth = ref dispatchParams.Depth; ref var motionVectors = ref dispatchParams.MotionVectors; ref var exposure = ref dispatchParams.Exposure; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputDepth, depth.RenderTarget, depth.MipLevel, depth.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputDepth, depth.RenderTarget, depth.MipLevel, depth.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbFsr3Upscaler, Constants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } - internal class Fsr2DepthClipPass : Fsr2Pass + internal class Fsr3UpscalerDepthClipPass : Fsr3UpscalerPass { - public Fsr2DepthClipPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) + public Fsr3UpscalerDepthClipPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_depth_clip_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_depth_clip_pass"); } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { ref var color = ref dispatchParams.Color; ref var depth = ref dispatchParams.Depth; @@ -189,62 +184,59 @@ namespace FidelityFX ref var reactive = ref dispatchParams.Reactive; ref var tac = ref dispatchParams.TransparencyAndComposition; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputDepth, depth.RenderTarget, depth.MipLevel, depth.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvReactiveMask, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvTransparencyAndCompositionMask, tac.RenderTarget, tac.MipLevel, tac.SubElement); - - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvReconstructedPrevNearestDepth, Fsr2ShaderIDs.UavReconstructedPrevNearestDepth); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedDepth, Fsr2ShaderIDs.UavDilatedDepth); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPrevDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex ^ 1]); - - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputDepth, depth.RenderTarget, depth.MipLevel, depth.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvReactiveMask, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvTransparencyAndCompositionMask, tac.RenderTarget, tac.MipLevel, tac.SubElement); + + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvReconstructedPrevNearestDepth, Fsr3ShaderIDs.UavReconstructedPrevNearestDepth); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvDilatedDepth, Fsr3ShaderIDs.UavDilatedDepth); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvPrevDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex ^ 1]); + + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbFsr3Upscaler, Constants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } - internal class Fsr2LockPass : Fsr2Pass + internal class Fsr3UpscalerLockPass : Fsr3UpscalerPass { - public Fsr2LockPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) + public Fsr3UpscalerLockPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_lock_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_lock_pass"); } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLockInputLuma, Fsr2ShaderIDs.UavLockInputLuma); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvLockInputLuma, Fsr3ShaderIDs.UavLockInputLuma); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbFsr3Upscaler, Constants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } - internal class Fsr2AccumulatePass : Fsr2Pass + internal class Fsr3UpscalerAccumulatePass : Fsr3UpscalerPass { - private const string SharpeningKeyword = "FFX_FSR2_OPTION_APPLY_SHARPENING"; - - // Workaround: Disable FP16 path for the accumulate pass on NVIDIA due to reduced occupancy and high VRAM throughput. - protected override bool AllowFP16 => SystemInfo.graphicsDeviceVendorID != 0x10DE; + private const string SharpeningKeyword = "FFX_FSR3UPSCALER_OPTION_APPLY_SHARPENING"; #if UNITY_2021_2_OR_NEWER private readonly LocalKeyword _sharpeningKeyword; #endif - public Fsr2AccumulatePass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants) + public Fsr3UpscalerAccumulatePass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants) : base(contextDescription, resources, constants) { - LoadComputeShader("FSR2/ffx_fsr2_accumulate_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_accumulate_pass"); #if UNITY_2021_2_OR_NEWER _sharpeningKeyword = new LocalKeyword(ComputeShader, SharpeningKeyword); #endif } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { #if UNITY_2021_2_OR_NEWER if (dispatchParams.EnableSharpening) @@ -258,115 +250,115 @@ namespace FidelityFX commandBuffer.DisableShaderKeyword(SharpeningKeyword); #endif - if ((ContextDescription.Flags & Fsr2.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) + if ((ContextDescription.Flags & Fsr3Upscaler.InitializationFlags.EnableDisplayResolutionMotionVectors) == 0) { - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvDilatedMotionVectors, Resources.DilatedMotionVectors[frameIndex]); } else { ref var motionVectors = ref dispatchParams.MotionVectors; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); } ref var exposure = ref dispatchParams.Exposure; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); - - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvDilatedReactiveMasks, Fsr2ShaderIDs.UavDilatedReactiveMasks); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInternalUpscaled, Resources.InternalUpscaled[frameIndex ^ 1]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLockStatus, Resources.LockStatus[frameIndex ^ 1]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPreparedInputColor, Fsr2ShaderIDs.UavPreparedInputColor); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLanczosLut, Resources.LanczosLut); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvUpscaleMaximumBiasLut, Resources.MaximumBiasLut); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvSceneLuminanceMips, Resources.SceneLuminance); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvAutoExposure, Resources.AutoExposure); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]); - - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavInternalUpscaled, Resources.InternalUpscaled[frameIndex]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavLockStatus, Resources.LockStatus[frameIndex]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavLumaHistory, Resources.LumaHistory[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); + + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvDilatedReactiveMasks, Fsr3ShaderIDs.UavDilatedReactiveMasks); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInternalUpscaled, Resources.InternalUpscaled[frameIndex ^ 1]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvLockStatus, Resources.LockStatus[frameIndex ^ 1]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvPreparedInputColor, Fsr3ShaderIDs.UavPreparedInputColor); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvLanczosLut, Resources.LanczosLut); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvUpscaleMaximumBiasLut, Resources.MaximumBiasLut); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvSceneLuminanceMips, Resources.SceneLuminance); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvAutoExposure, Resources.AutoExposure); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvLumaHistory, Resources.LumaHistory[frameIndex ^ 1]); + + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavInternalUpscaled, Resources.InternalUpscaled[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavLockStatus, Resources.LockStatus[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavLumaHistory, Resources.LumaHistory[frameIndex]); ref var output = ref dispatchParams.Output; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavUpscaledOutput, output.RenderTarget, output.MipLevel, output.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavUpscaledOutput, output.RenderTarget, output.MipLevel, output.SubElement); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbFsr3Upscaler, Constants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } - internal class Fsr2RcasPass : Fsr2Pass + internal class Fsr3UpscalerRcasPass : Fsr3UpscalerPass { private readonly ComputeBuffer _rcasConstants; - public Fsr2RcasPass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants, ComputeBuffer rcasConstants) + public Fsr3UpscalerRcasPass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants, ComputeBuffer rcasConstants) : base(contextDescription, resources, constants) { _rcasConstants = rcasConstants; - LoadComputeShader("FSR2/ffx_fsr2_rcas_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_rcas_pass"); } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { ref var exposure = ref dispatchParams.Exposure; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvRcasInput, Resources.InternalUpscaled[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputExposure, exposure.RenderTarget, exposure.MipLevel, exposure.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvRcasInput, Resources.InternalUpscaled[frameIndex]); ref var output = ref dispatchParams.Output; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavUpscaledOutput, output.RenderTarget, output.MipLevel, output.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavUpscaledOutput, output.RenderTarget, output.MipLevel, output.SubElement); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbRcas, _rcasConstants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbFsr3Upscaler, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbRcas, _rcasConstants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } - internal class Fsr2GenerateReactivePass : Fsr2Pass + internal class Fsr3UpscalerGenerateReactivePass : Fsr3UpscalerPass { private readonly ComputeBuffer _generateReactiveConstants; - public Fsr2GenerateReactivePass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer generateReactiveConstants) + public Fsr3UpscalerGenerateReactivePass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer generateReactiveConstants) : base(contextDescription, resources, null) { _generateReactiveConstants = generateReactiveConstants; - LoadComputeShader("FSR2/ffx_fsr2_autogen_reactive_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_autogen_reactive_pass"); } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { } - public void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.GenerateReactiveDescription dispatchParams, int dispatchX, int dispatchY) + public void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.GenerateReactiveDescription dispatchParams, int dispatchX, int dispatchY) { ref var opaqueOnly = ref dispatchParams.ColorOpaqueOnly; ref var color = ref dispatchParams.ColorPreUpscale; ref var reactive = ref dispatchParams.OutReactive; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvOpaqueOnly, opaqueOnly.RenderTarget, opaqueOnly.MipLevel, opaqueOnly.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoReactive, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvOpaqueOnly, opaqueOnly.RenderTarget, opaqueOnly.MipLevel, opaqueOnly.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavAutoReactive, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbGenReactive, _generateReactiveConstants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbGenReactive, _generateReactiveConstants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } } - internal class Fsr2TcrAutogeneratePass : Fsr2Pass + internal class Fsr3UpscalerTcrAutogeneratePass : Fsr3UpscalerPass { private readonly ComputeBuffer _tcrAutogenerateConstants; - public Fsr2TcrAutogeneratePass(Fsr2.ContextDescription contextDescription, Fsr2Resources resources, ComputeBuffer constants, ComputeBuffer tcrAutogenerateConstants) + public Fsr3UpscalerTcrAutogeneratePass(Fsr3Upscaler.ContextDescription contextDescription, Fsr3UpscalerResources resources, ComputeBuffer constants, ComputeBuffer tcrAutogenerateConstants) : base(contextDescription, resources, constants) { _tcrAutogenerateConstants = tcrAutogenerateConstants; - LoadComputeShader("FSR2/ffx_fsr2_tcr_autogen_pass"); + LoadComputeShader("FSR3/ffx_fsr3upscaler_tcr_autogen_pass"); } - public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr2.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) + public override void ScheduleDispatch(CommandBuffer commandBuffer, Fsr3Upscaler.DispatchDescription dispatchParams, int frameIndex, int dispatchX, int dispatchY) { ref var color = ref dispatchParams.Color; ref var motionVectors = ref dispatchParams.MotionVectors; @@ -374,21 +366,21 @@ namespace FidelityFX ref var reactive = ref dispatchParams.Reactive; ref var tac = ref dispatchParams.TransparencyAndComposition; - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvOpaqueOnly, opaqueOnly.RenderTarget, opaqueOnly.MipLevel, opaqueOnly.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPrevColorPreAlpha, Resources.PrevPreAlpha[frameIndex ^ 1]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvPrevColorPostAlpha, Resources.PrevPostAlpha[frameIndex ^ 1]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvReactiveMask, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.SrvTransparencyAndCompositionMask, tac.RenderTarget, tac.MipLevel, tac.SubElement); - - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoReactive, Resources.AutoReactive); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavAutoComposition, Resources.AutoComposition); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavPrevColorPreAlpha, Resources.PrevPreAlpha[frameIndex]); - commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr2ShaderIDs.UavPrevColorPostAlpha, Resources.PrevPostAlpha[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvOpaqueOnly, opaqueOnly.RenderTarget, opaqueOnly.MipLevel, opaqueOnly.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputColor, color.RenderTarget, color.MipLevel, color.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvInputMotionVectors, motionVectors.RenderTarget, motionVectors.MipLevel, motionVectors.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvPrevColorPreAlpha, Resources.PrevPreAlpha[frameIndex ^ 1]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvPrevColorPostAlpha, Resources.PrevPostAlpha[frameIndex ^ 1]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvReactiveMask, reactive.RenderTarget, reactive.MipLevel, reactive.SubElement); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.SrvTransparencyAndCompositionMask, tac.RenderTarget, tac.MipLevel, tac.SubElement); + + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavAutoReactive, Resources.AutoReactive); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavAutoComposition, Resources.AutoComposition); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavPrevColorPreAlpha, Resources.PrevPreAlpha[frameIndex]); + commandBuffer.SetComputeTextureParam(ComputeShader, KernelIndex, Fsr3ShaderIDs.UavPrevColorPostAlpha, Resources.PrevPostAlpha[frameIndex]); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbFsr2, Constants, 0, Marshal.SizeOf()); - commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr2ShaderIDs.CbGenReactive, _tcrAutogenerateConstants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbFsr3Upscaler, Constants, 0, Marshal.SizeOf()); + commandBuffer.SetComputeConstantBufferParam(ComputeShader, Fsr3ShaderIDs.CbGenReactive, _tcrAutogenerateConstants, 0, Marshal.SizeOf()); commandBuffer.DispatchCompute(ComputeShader, KernelIndex, dispatchX, dispatchY, 1); } diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerPass.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerPass.cs.meta new file mode 100644 index 0000000..8ffd58e --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerPass.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: cfd077da533b192458b0b548668776e7 +timeCreated: 1676885169 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Resources.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs similarity index 64% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Resources.cs rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs index a3e8e27..676867b 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR2/Fsr2Resources.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs @@ -26,10 +26,10 @@ using UnityEngine.Rendering; namespace FidelityFX { /// - /// Helper class for bundling and managing persistent resources required by the FSR2 process. + /// Helper class for bundling and managing persistent resources required by the FSR3 Upscaler process. /// This includes lookup tables, default fallback resources and double-buffered resources that get swapped between frames. /// - internal class Fsr2Resources + internal class Fsr3UpscalerResources { public Texture2D DefaultExposure; public Texture2D DefaultReactive; @@ -47,7 +47,7 @@ namespace FidelityFX public readonly RenderTexture[] PrevPreAlpha = new RenderTexture[2]; public readonly RenderTexture[] PrevPostAlpha = new RenderTexture[2]; - public void Create(Fsr2.ContextDescription contextDescription) + public void Create(Fsr3Upscaler.ContextDescription contextDescription) { // Generate the data for the LUT const int lanczos2LutWidth = 128; @@ -55,7 +55,7 @@ namespace FidelityFX for (int currentLanczosWidthIndex = 0; currentLanczosWidthIndex < lanczos2LutWidth; ++currentLanczosWidthIndex) { float x = 2.0f * currentLanczosWidthIndex / (lanczos2LutWidth - 1); - float y = Fsr2.Lanczos2(x); + float y = Fsr3Upscaler.Lanczos2(x); lanczos2Weights[currentLanczosWidthIndex] = y; } @@ -65,108 +65,108 @@ namespace FidelityFX maximumBias[i] = MaximumBias[i] / 2.0f; } - // Resource FSR2_LanczosLutData: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R16_SNORM, FFX_RESOURCE_FLAGS_NONE + // Resource FSR3UPSCALER_LanczosLutData: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R16_SNORM, FFX_RESOURCE_FLAGS_NONE // R16_SNorm textures are not supported by Unity on most platforms, strangely enough. So instead we use R32_SFloat and upload pre-normalized float data. - LanczosLut = new Texture2D(lanczos2LutWidth, 1, GraphicsFormat.R32_SFloat, TextureCreationFlags.None) { name = "FSR2_LanczosLutData" }; + LanczosLut = new Texture2D(lanczos2LutWidth, 1, GraphicsFormat.R32_SFloat, TextureCreationFlags.None) { name = "FSR3UPSCALER_LanczosLutData" }; LanczosLut.SetPixelData(lanczos2Weights, 0); LanczosLut.Apply(); - // Resource FSR2_MaximumUpsampleBias: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R16_SNORM, FFX_RESOURCE_FLAGS_NONE - MaximumBiasLut = new Texture2D(MaximumBiasTextureWidth, MaximumBiasTextureHeight, GraphicsFormat.R32_SFloat, TextureCreationFlags.None) { name = "FSR2_MaximumUpsampleBias" }; + // Resource FSR3UPSCALER_MaximumUpsampleBias: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R16_SNORM, FFX_RESOURCE_FLAGS_NONE + MaximumBiasLut = new Texture2D(MaximumBiasTextureWidth, MaximumBiasTextureHeight, GraphicsFormat.R32_SFloat, TextureCreationFlags.None) { name = "FSR3UPSCALER_MaximumUpsampleBias" }; MaximumBiasLut.SetPixelData(maximumBias, 0); MaximumBiasLut.Apply(); - // Resource FSR2_DefaultExposure: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R32G32_FLOAT, FFX_RESOURCE_FLAGS_NONE - DefaultExposure = new Texture2D(1, 1, GraphicsFormat.R32G32_SFloat, TextureCreationFlags.None) { name = "FSR2_DefaultExposure" }; + // Resource FSR3UPSCALER_DefaultExposure: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R32G32_FLOAT, FFX_RESOURCE_FLAGS_NONE + DefaultExposure = new Texture2D(1, 1, GraphicsFormat.R32G32_SFloat, TextureCreationFlags.None) { name = "FSR3UPSCALER_DefaultExposure" }; DefaultExposure.SetPixel(0, 0, Color.clear); DefaultExposure.Apply(); - // Resource FSR2_DefaultReactivityMask: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE - DefaultReactive = new Texture2D(1, 1, GraphicsFormat.R8_UNorm, TextureCreationFlags.None) { name = "FSR2_DefaultReactivityMask" }; + // Resource FSR3UPSCALER_DefaultReactivityMask: FFX_RESOURCE_USAGE_READ_ONLY, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE + DefaultReactive = new Texture2D(1, 1, GraphicsFormat.R8_UNorm, TextureCreationFlags.None) { name = "FSR3UPSCALER_DefaultReactivityMask" }; DefaultReactive.SetPixel(0, 0, Color.clear); DefaultReactive.Apply(); - // Resource FSR2_SpdAtomicCounter: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_ALIASABLE - // Despite what the original FSR2 codebase says, this resource really isn't aliasable. Resetting this counter to 0 every frame breaks auto-exposure on MacOS Metal. - SpdAtomicCounter = new RenderTexture(1, 1, 0, GraphicsFormat.R32_UInt) { name = "FSR2_SpdAtomicCounter", enableRandomWrite = true }; + // Resource FSR3UPSCALER_SpdAtomicCounter: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_ALIASABLE + // Despite what the original FSR3 codebase says, this resource really isn't aliasable. Resetting this counter to 0 every frame breaks auto-exposure on MacOS Metal. + SpdAtomicCounter = new RenderTexture(1, 1, 0, GraphicsFormat.R32_UInt) { name = "FSR3UPSCALER_SpdAtomicCounter", enableRandomWrite = true }; SpdAtomicCounter.Create(); - // Resource FSR2_AutoExposure: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32G32_FLOAT, FFX_RESOURCE_FLAGS_NONE - AutoExposure = new RenderTexture(1, 1, 0, GraphicsFormat.R32G32_SFloat) { name = "FSR2_AutoExposure", enableRandomWrite = true }; + // Resource FSR3UPSCALER_AutoExposure: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32G32_FLOAT, FFX_RESOURCE_FLAGS_NONE + AutoExposure = new RenderTexture(1, 1, 0, GraphicsFormat.R32G32_SFloat) { name = "FSR3UPSCALER_AutoExposure", enableRandomWrite = true }; AutoExposure.Create(); - // Resource FSR2_ExposureMips: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE + // Resource FSR3UPSCALER_ExposureMips: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE // This is a rather special case: it's an aliasable resource, but because we require a mipmap chain and bind specific mip levels per shader, we can't easily use temporary RTs for this. int w = contextDescription.MaxRenderSize.x / 2, h = contextDescription.MaxRenderSize.y / 2; int mipCount = 1 + Mathf.FloorToInt(Mathf.Log(Math.Max(w, h), 2.0f)); - SceneLuminance = new RenderTexture(w, h, 0, GraphicsFormat.R16_SFloat, mipCount) { name = "FSR2_ExposureMips", enableRandomWrite = true, useMipMap = true, autoGenerateMips = false }; + SceneLuminance = new RenderTexture(w, h, 0, GraphicsFormat.R16_SFloat, mipCount) { name = "FSR3UPSCALER_ExposureMips", enableRandomWrite = true, useMipMap = true, autoGenerateMips = false }; SceneLuminance.Create(); - // Resources FSR2_InternalDilatedVelocity1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_FLOAT, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(DilatedMotionVectors, "FSR2_InternalDilatedVelocity", contextDescription.MaxRenderSize, GraphicsFormat.R16G16_SFloat); + // Resources FSR3UPSCALER_InternalDilatedVelocity1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_FLOAT, FFX_RESOURCE_FLAGS_NONE + CreateDoubleBufferedResource(DilatedMotionVectors, "FSR3UPSCALER_InternalDilatedVelocity", contextDescription.MaxRenderSize, GraphicsFormat.R16G16_SFloat); - // Resources FSR2_LockStatus1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_FLOAT, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(LockStatus, "FSR2_LockStatus", contextDescription.DisplaySize, GraphicsFormat.R16G16_SFloat); + // Resources FSR3UPSCALER_LockStatus1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16_FLOAT, FFX_RESOURCE_FLAGS_NONE + CreateDoubleBufferedResource(LockStatus, "FSR3UPSCALER_LockStatus", contextDescription.DisplaySize, GraphicsFormat.R16G16_SFloat); - // Resources FSR2_InternalUpscaled1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(InternalUpscaled, "FSR2_InternalUpscaled", contextDescription.DisplaySize, GraphicsFormat.R16G16B16A16_SFloat); + // Resources FSR3UPSCALER_InternalUpscaled1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, FFX_RESOURCE_FLAGS_NONE + CreateDoubleBufferedResource(InternalUpscaled, "FSR3UPSCALER_InternalUpscaled", contextDescription.DisplaySize, GraphicsFormat.R16G16B16A16_SFloat); - // Resources FSR2_LumaHistory1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8G8B8A8_UNORM, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(LumaHistory, "FSR2_LumaHistory", contextDescription.DisplaySize, GraphicsFormat.R8G8B8A8_UNorm); + // Resources FSR3UPSCALER_LumaHistory1/2: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8G8B8A8_UNORM, FFX_RESOURCE_FLAGS_NONE + CreateDoubleBufferedResource(LumaHistory, "FSR3UPSCALER_LumaHistory", contextDescription.DisplaySize, GraphicsFormat.R8G8B8A8_UNorm); } - public void CreateTcrAutogenResources(Fsr2.ContextDescription contextDescription) + public void CreateTcrAutogenResources(Fsr3Upscaler.ContextDescription contextDescription) { - // Resource FSR2_AutoReactive: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE - AutoReactive = new RenderTexture(contextDescription.MaxRenderSize.x, contextDescription.MaxRenderSize.y, 0, GraphicsFormat.R8_UNorm) { name = "FSR2_AutoReactive", enableRandomWrite = true }; + // Resource FSR3UPSCALER_AutoReactive: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE + AutoReactive = new RenderTexture(contextDescription.MaxRenderSize.x, contextDescription.MaxRenderSize.y, 0, GraphicsFormat.R8_UNorm) { name = "FSR3UPSCALER_AutoReactive", enableRandomWrite = true }; AutoReactive.Create(); - // Resource FSR2_AutoComposition: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE - AutoComposition = new RenderTexture(contextDescription.MaxRenderSize.x, contextDescription.MaxRenderSize.y, 0, GraphicsFormat.R8_UNorm) { name = "FSR2_AutoComposition", enableRandomWrite = true }; + // Resource FSR3UPSCALER_AutoComposition: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_NONE + AutoComposition = new RenderTexture(contextDescription.MaxRenderSize.x, contextDescription.MaxRenderSize.y, 0, GraphicsFormat.R8_UNorm) { name = "FSR3UPSCALER_AutoComposition", enableRandomWrite = true }; AutoComposition.Create(); - // Resources FSR2_PrevPreAlpha0/1: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R11G11B10_FLOAT, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(PrevPreAlpha, "FSR2_PrevPreAlpha", contextDescription.MaxRenderSize, GraphicsFormat.B10G11R11_UFloatPack32); + // Resources FSR3UPSCALER_PrevPreAlpha0/1: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R11G11B10_FLOAT, FFX_RESOURCE_FLAGS_NONE + CreateDoubleBufferedResource(PrevPreAlpha, "FSR3UPSCALER_PrevPreAlpha", contextDescription.MaxRenderSize, GraphicsFormat.B10G11R11_UFloatPack32); - // Resources FSR2_PrevPostAlpha0/1: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R11G11B10_FLOAT, FFX_RESOURCE_FLAGS_NONE - CreateDoubleBufferedResource(PrevPostAlpha, "FSR2_PrevPostAlpha", contextDescription.MaxRenderSize, GraphicsFormat.B10G11R11_UFloatPack32); + // Resources FSR3UPSCALER_PrevPostAlpha0/1: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R11G11B10_FLOAT, FFX_RESOURCE_FLAGS_NONE + CreateDoubleBufferedResource(PrevPostAlpha, "FSR3UPSCALER_PrevPostAlpha", contextDescription.MaxRenderSize, GraphicsFormat.B10G11R11_UFloatPack32); } // Set up shared aliasable resources, i.e. temporary render textures // These do not need to persist between frames, but they do need to be available between passes - public static void CreateAliasableResources(CommandBuffer commandBuffer, Fsr2.ContextDescription contextDescription, Fsr2.DispatchDescription dispatchParams) + public static void CreateAliasableResources(CommandBuffer commandBuffer, Fsr3Upscaler.ContextDescription contextDescription, Fsr3Upscaler.DispatchDescription dispatchParams) { Vector2Int displaySize = contextDescription.DisplaySize; Vector2Int maxRenderSize = contextDescription.MaxRenderSize; - // FSR2_ReconstructedPrevNearestDepth: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavReconstructedPrevNearestDepth, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R32_UInt, 1, true); + // FSR3UPSCALER_ReconstructedPrevNearestDepth: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_UINT, FFX_RESOURCE_FLAGS_ALIASABLE + commandBuffer.GetTemporaryRT(Fsr3ShaderIDs.UavReconstructedPrevNearestDepth, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R32_UInt, 1, true); - // FSR2_DilatedDepth: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavDilatedDepth, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R32_SFloat, 1, true); + // FSR3UPSCALER_DilatedDepth: FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R32_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE + commandBuffer.GetTemporaryRT(Fsr3ShaderIDs.UavDilatedDepth, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R32_SFloat, 1, true); - // FSR2_LockInputLuma: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavLockInputLuma, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R16_SFloat, 1, true); + // FSR3UPSCALER_LockInputLuma: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE + commandBuffer.GetTemporaryRT(Fsr3ShaderIDs.UavLockInputLuma, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R16_SFloat, 1, true); - // FSR2_DilatedReactiveMasks: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8G8_UNORM, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavDilatedReactiveMasks, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R8G8_UNorm, 1, true); + // FSR3UPSCALER_DilatedReactiveMasks: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8G8_UNORM, FFX_RESOURCE_FLAGS_ALIASABLE + commandBuffer.GetTemporaryRT(Fsr3ShaderIDs.UavDilatedReactiveMasks, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R8G8_UNorm, 1, true); - // FSR2_PreparedInputColor: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavPreparedInputColor, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R16G16B16A16_SFloat, 1, true); + // FSR3UPSCALER_PreparedInputColor: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, FFX_RESOURCE_FLAGS_ALIASABLE + commandBuffer.GetTemporaryRT(Fsr3ShaderIDs.UavPreparedInputColor, maxRenderSize.x, maxRenderSize.y, 0, default, GraphicsFormat.R16G16B16A16_SFloat, 1, true); - // FSR2_NewLocks: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_ALIASABLE - commandBuffer.GetTemporaryRT(Fsr2ShaderIDs.UavNewLocks, displaySize.x, displaySize.y, 0, default, GraphicsFormat.R8_UNorm, 1, true); + // FSR3UPSCALER_NewLocks: FFX_RESOURCE_USAGE_UAV, FFX_SURFACE_FORMAT_R8_UNORM, FFX_RESOURCE_FLAGS_ALIASABLE + commandBuffer.GetTemporaryRT(Fsr3ShaderIDs.UavNewLocks, displaySize.x, displaySize.y, 0, default, GraphicsFormat.R8_UNorm, 1, true); } public static void DestroyAliasableResources(CommandBuffer commandBuffer) { // Release all of the aliasable resources used this frame - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavReconstructedPrevNearestDepth); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavDilatedDepth); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavLockInputLuma); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavDilatedReactiveMasks); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavPreparedInputColor); - commandBuffer.ReleaseTemporaryRT(Fsr2ShaderIDs.UavNewLocks); + commandBuffer.ReleaseTemporaryRT(Fsr3ShaderIDs.UavReconstructedPrevNearestDepth); + commandBuffer.ReleaseTemporaryRT(Fsr3ShaderIDs.UavDilatedDepth); + commandBuffer.ReleaseTemporaryRT(Fsr3ShaderIDs.UavLockInputLuma); + commandBuffer.ReleaseTemporaryRT(Fsr3ShaderIDs.UavDilatedReactiveMasks); + commandBuffer.ReleaseTemporaryRT(Fsr3ShaderIDs.UavPreparedInputColor); + commandBuffer.ReleaseTemporaryRT(Fsr3ShaderIDs.UavNewLocks); } private static void CreateDoubleBufferedResource(RenderTexture[] resource, string name, Vector2Int size, GraphicsFormat format) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs.meta new file mode 100644 index 0000000..bf03a07 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/FSR3/Fsr3UpscalerResources.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ec6c0c34c7b11f041885ddee4aa72818 +timeCreated: 1677236102 \ No newline at end of file diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs index ae6d0f6..835e918 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs @@ -97,7 +97,7 @@ namespace UnityEngine.Rendering.PostProcessing public TemporalAntialiasing temporalAntialiasing; /// - /// FSR2 upscaling & anti-aliasing settings for this camera. + /// FSR3 upscaling & anti-aliasing settings for this camera. /// public SuperResolution superResolution; diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_lock_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_lock_pass.compute.meta deleted file mode 100644 index a197b49..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_lock_pass.compute.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3c96d72b39a840c428c901628dab92c0 -ComputeShaderImporter: - externalObjects: {} - preprocessorOverride: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_rcas_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_rcas_pass.compute.meta deleted file mode 100644 index ea6c978..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_rcas_pass.compute.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5a82801f160ff6a4eb47db567216e592 -ComputeShaderImporter: - externalObjects: {} - preprocessorOverride: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute.meta deleted file mode 100644 index 6396b86..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6ef1b4c25874e334dad5ba3ac6345e32 -ComputeShaderImporter: - externalObjects: {} - preprocessorOverride: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_tcr_autogen_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_tcr_autogen_pass.compute.meta deleted file mode 100644 index 0002090..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_tcr_autogen_pass.compute.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b478fba0a6a87b44b8be7c35deb5f0dc -ComputeShaderImporter: - externalObjects: {} - preprocessorOverride: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_common_types.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_common_types.h.meta deleted file mode 100644 index f2cc805..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_common_types.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: c6da07d8aae05f04f87e4db20f84c73e -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core.h.meta deleted file mode 100644 index a5f80a7..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: b37eb663a0ae01b469b0b5a54365b301 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_cpu.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_cpu.h.meta deleted file mode 100644 index 7edf590..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_cpu.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 9d1d6ed5c9da0c64b882f3ebc2bac307 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common.h.meta deleted file mode 100644 index 8f9711f..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 402c509393f5bf647b41a962a48ed8e2 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common_half.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common_half.h.meta deleted file mode 100644 index 1d826e4..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common_half.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 142bf3947ada43541a0f31a328fdec07 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_hlsl.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_hlsl.h.meta deleted file mode 100644 index 5a91c43..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_hlsl.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 89d6e02f97594f64ca2da4c8124df6cf -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_portability.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_portability.h.meta deleted file mode 100644 index aad361f..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_portability.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 5d6e692075988194382122bac7819f02 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr1.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr1.h.meta deleted file mode 100644 index cf43a8b..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr1.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 7524e42f73f97f34bbeb414ea412a808 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h.meta deleted file mode 100644 index 51859c3..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: a04cb2522aaff1045869a272ed129964 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl deleted file mode 100644 index 747f380..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl +++ /dev/null @@ -1,78 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define FSR2_BIND_SRV_INPUT_EXPOSURE 0 -#define FSR2_BIND_SRV_DILATED_REACTIVE_MASKS 1 -#if FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS -#define FSR2_BIND_SRV_DILATED_MOTION_VECTORS 2 -#else -#define FSR2_BIND_SRV_INPUT_MOTION_VECTORS 2 -#endif -#define FSR2_BIND_SRV_INTERNAL_UPSCALED 3 -#define FSR2_BIND_SRV_LOCK_STATUS 4 -#define FSR2_BIND_SRV_PREPARED_INPUT_COLOR 5 -#define FSR2_BIND_SRV_LANCZOS_LUT 6 -#define FSR2_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT 7 -#define FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS 8 -#define FSR2_BIND_SRV_AUTO_EXPOSURE 9 -#define FSR2_BIND_SRV_LUMA_HISTORY 10 - -#define FSR2_BIND_UAV_INTERNAL_UPSCALED 0 -#define FSR2_BIND_UAV_LOCK_STATUS 1 -#define FSR2_BIND_UAV_UPSCALED_OUTPUT 2 -#define FSR2_BIND_UAV_NEW_LOCKS 3 -#define FSR2_BIND_UAV_LUMA_HISTORY 4 - -#define FSR2_BIND_CB_FSR2 0 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" -#include "ffx_fsr2_sample.h" -#include "ffx_fsr2_upsample.h" -#include "ffx_fsr2_postprocess_lock_status.h" -#include "ffx_fsr2_reproject.h" -#include "ffx_fsr2_accumulate.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 8 -#endif // FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -FFX_FSR2_PREFER_WAVE64 -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_ROOTSIG_CONTENT -void CS(uint2 uGroupId : SV_GroupID, uint2 uGroupThreadId : SV_GroupThreadID) -{ - const uint GroupRows = (uint(DisplaySize().y) + FFX_FSR2_THREAD_GROUP_HEIGHT - 1) / FFX_FSR2_THREAD_GROUP_HEIGHT; - uGroupId.y = GroupRows - uGroupId.y - 1; - - uint2 uDispatchThreadId = uGroupId * uint2(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT) + uGroupThreadId; - - Accumulate(uDispatchThreadId); -} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl deleted file mode 100644 index a78a8e3..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl +++ /dev/null @@ -1,85 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define FSR2_BIND_SRV_INPUT_OPAQUE_ONLY 0 -#define FSR2_BIND_SRV_INPUT_COLOR 1 -#define FSR2_BIND_UAV_AUTOREACTIVE 0 - -#define FSR2_BIND_CB_FSR2 0 -#define FSR2_BIND_CB_REACTIVE 1 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 8 -#endif // FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -#if defined(FSR2_BIND_CB_REACTIVE) -cbuffer cbGenerateReactive : FFX_FSR2_DECLARE_CB(FSR2_BIND_CB_REACTIVE) -{ - float scale; - float threshold; - float binaryValue; - uint flags; -}; -#endif - -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_ROOTSIG_CONTENT -void CS(uint2 uGroupId : SV_GroupID, uint2 uGroupThreadId : SV_GroupThreadID) -{ - uint2 uDispatchThreadId = uGroupId * uint2(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT) + uGroupThreadId; - - float3 ColorPreAlpha = LoadOpaqueOnly( FFX_MIN16_I2(uDispatchThreadId) ).rgb; - float3 ColorPostAlpha = LoadInputColor(uDispatchThreadId).rgb; - - if (flags & FFX_FSR2_AUTOREACTIVEFLAGS_APPLY_TONEMAP) - { - ColorPreAlpha = Tonemap(ColorPreAlpha); - ColorPostAlpha = Tonemap(ColorPostAlpha); - } - - if (flags & FFX_FSR2_AUTOREACTIVEFLAGS_APPLY_INVERSETONEMAP) - { - ColorPreAlpha = InverseTonemap(ColorPreAlpha); - ColorPostAlpha = InverseTonemap(ColorPostAlpha); - } - - float out_reactive_value = 0.f; - float3 delta = abs(ColorPostAlpha - ColorPreAlpha); - - out_reactive_value = (flags & FFX_FSR2_AUTOREACTIVEFLAGS_USE_COMPONENTS_MAX) ? max(delta.x, max(delta.y, delta.z)) : length(delta); - out_reactive_value *= scale; - - out_reactive_value = (flags & FFX_FSR2_AUTOREACTIVEFLAGS_APPLY_THRESHOLD) ? (out_reactive_value < threshold ? 0 : binaryValue) : out_reactive_value; - - rw_output_autoreactive[uDispatchThreadId] = out_reactive_value; -} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h deleted file mode 100644 index de79c82..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h +++ /dev/null @@ -1,817 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#include "ffx_fsr2_resources.h" - -#if defined(FFX_GPU) -#ifdef __hlsl_dx_compiler -#pragma dxc diagnostic push -#pragma dxc diagnostic ignored "-Wambig-lit-shift" -#endif //__hlsl_dx_compiler -#include "ffx_core.h" -#ifdef __hlsl_dx_compiler -#pragma dxc diagnostic pop -#endif //__hlsl_dx_compiler -#endif // #if defined(FFX_GPU) - -#if defined(FFX_GPU) -#ifndef FFX_FSR2_PREFER_WAVE64 -#define FFX_FSR2_PREFER_WAVE64 -#endif // #if defined(FFX_GPU) - -#if defined(FFX_GPU) -#pragma warning(disable: 3205) // conversion from larger type to smaller -#endif // #if defined(FFX_GPU) - -#define DECLARE_SRV_REGISTER(regIndex) t##regIndex -#define DECLARE_UAV_REGISTER(regIndex) u##regIndex -#define DECLARE_CB_REGISTER(regIndex) b##regIndex -#define FFX_FSR2_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex)) -#define FFX_FSR2_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex)) -#define FFX_FSR2_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex)) - -#if defined(FSR2_BIND_CB_FSR2) || defined(FFX_INTERNAL) - cbuffer cbFSR2 : FFX_FSR2_DECLARE_CB(FSR2_BIND_CB_FSR2) - { - FfxInt32x2 iRenderSize; - FfxInt32x2 iMaxRenderSize; - FfxInt32x2 iDisplaySize; - FfxInt32x2 iInputColorResourceDimensions; - FfxInt32x2 iLumaMipDimensions; - FfxInt32 iLumaMipLevelToUse; - FfxInt32 iFrameIndex; - - FfxFloat32x4 fDeviceToViewDepth; - FfxFloat32x2 fJitter; - FfxFloat32x2 fMotionVectorScale; - FfxFloat32x2 fDownscaleFactor; - FfxFloat32x2 fMotionVectorJitterCancellation; - FfxFloat32 fPreExposure; - FfxFloat32 fPreviousFramePreExposure; - FfxFloat32 fTanHalfFOV; - FfxFloat32 fJitterSequenceLength; - FfxFloat32 fDeltaTime; - FfxFloat32 fDynamicResChangeFactor; - FfxFloat32 fViewSpaceToMetersFactor; - - FfxInt32 iDummy; - }; - -#define FFX_FSR2_CONSTANT_BUFFER_1_SIZE (sizeof(cbFSR2) / 4) // Number of 32-bit values. This must be kept in sync with the cbFSR2 size. -#endif - -#if defined(FFX_GPU) -#define FFX_FSR2_ROOTSIG_STRINGIFY(p) FFX_FSR2_ROOTSIG_STR(p) -#define FFX_FSR2_ROOTSIG_STR(p) #p -#define FFX_FSR2_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \ - "DescriptorTable(SRV(t0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \ - "RootConstants(num32BitConstants=" FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_CONSTANT_BUFFER_1_SIZE) ", b0), " \ - "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \ - "addressU = TEXTURE_ADDRESS_CLAMP, " \ - "addressV = TEXTURE_ADDRESS_CLAMP, " \ - "addressW = TEXTURE_ADDRESS_CLAMP, " \ - "comparisonFunc = COMPARISON_NEVER, " \ - "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \ - "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ - "addressU = TEXTURE_ADDRESS_CLAMP, " \ - "addressV = TEXTURE_ADDRESS_CLAMP, " \ - "addressW = TEXTURE_ADDRESS_CLAMP, " \ - "comparisonFunc = COMPARISON_NEVER, " \ - "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] - -#define FFX_FSR2_CONSTANT_BUFFER_2_SIZE 6 // Number of 32-bit values. This must be kept in sync with max( cbRCAS , cbSPD) size. - -#define FFX_FSR2_CB2_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \ - "DescriptorTable(SRV(t0, numDescriptors = " FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_RESOURCE_IDENTIFIER_COUNT) ")), " \ - "RootConstants(num32BitConstants=" FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_CONSTANT_BUFFER_1_SIZE) ", b0), " \ - "RootConstants(num32BitConstants=" FFX_FSR2_ROOTSIG_STRINGIFY(FFX_FSR2_CONSTANT_BUFFER_2_SIZE) ", b1), " \ - "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \ - "addressU = TEXTURE_ADDRESS_CLAMP, " \ - "addressV = TEXTURE_ADDRESS_CLAMP, " \ - "addressW = TEXTURE_ADDRESS_CLAMP, " \ - "comparisonFunc = COMPARISON_NEVER, " \ - "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \ - "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ - "addressU = TEXTURE_ADDRESS_CLAMP, " \ - "addressV = TEXTURE_ADDRESS_CLAMP, " \ - "addressW = TEXTURE_ADDRESS_CLAMP, " \ - "comparisonFunc = COMPARISON_NEVER, " \ - "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] -#if defined(FFX_FSR2_EMBED_ROOTSIG) -#define FFX_FSR2_EMBED_ROOTSIG_CONTENT FFX_FSR2_ROOTSIG -#define FFX_FSR2_EMBED_CB2_ROOTSIG_CONTENT FFX_FSR2_CB2_ROOTSIG -#else -#define FFX_FSR2_EMBED_ROOTSIG_CONTENT -#define FFX_FSR2_EMBED_CB2_ROOTSIG_CONTENT -#endif // #if FFX_FSR2_EMBED_ROOTSIG -#endif // #if defined(FFX_GPU) - -// Declare and sample camera buffers as regular textures, unless overridden -#if !defined(UNITY_FSR2_TEX2D) -#define UNITY_FSR2_TEX2D(type) Texture2D -#endif -#if !defined(UNITY_FSR2_POS) -#define UNITY_FSR2_POS(pxPos) (pxPos) -#endif -#if !defined(UNITY_FSR2_UV) -#define UNITY_FSR2_UV(uv) (uv) -#endif - -/* Define getter functions in the order they are defined in the CB! */ -FfxInt32x2 RenderSize() -{ - return iRenderSize; -} - -FfxInt32x2 MaxRenderSize() -{ - return iMaxRenderSize; -} - -FfxInt32x2 DisplaySize() -{ - return iDisplaySize; -} - -FfxInt32x2 InputColorResourceDimensions() -{ - return iInputColorResourceDimensions; -} - -FfxInt32x2 LumaMipDimensions() -{ - return iLumaMipDimensions; -} - -FfxInt32 LumaMipLevelToUse() -{ - return iLumaMipLevelToUse; -} - -FfxInt32 FrameIndex() -{ - return iFrameIndex; -} - -FfxFloat32x2 Jitter() -{ - return fJitter; -} - -FfxFloat32x4 DeviceToViewSpaceTransformFactors() -{ - return fDeviceToViewDepth; -} - -FfxFloat32x2 MotionVectorScale() -{ - return fMotionVectorScale; -} - -FfxFloat32x2 DownscaleFactor() -{ - return fDownscaleFactor; -} - -FfxFloat32x2 MotionVectorJitterCancellation() -{ - return fMotionVectorJitterCancellation; -} - -FfxFloat32 PreExposure() -{ - return fPreExposure; -} - -FfxFloat32 PreviousFramePreExposure() -{ - return fPreviousFramePreExposure; -} - -FfxFloat32 TanHalfFoV() -{ - return fTanHalfFOV; -} - -FfxFloat32 JitterSequenceLength() -{ - return fJitterSequenceLength; -} - -FfxFloat32 DeltaTime() -{ - return fDeltaTime; -} - -FfxFloat32 DynamicResChangeFactor() -{ - return fDynamicResChangeFactor; -} - -FfxFloat32 ViewSpaceToMetersFactor() -{ - return fViewSpaceToMetersFactor; -} - - -SamplerState s_PointClamp : register(s0); -SamplerState s_LinearClamp : register(s1); - -// SRVs -#if defined(FFX_INTERNAL) - UNITY_FSR2_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_OPAQUE_ONLY); - UNITY_FSR2_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_COLOR); - UNITY_FSR2_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_MOTION_VECTORS); - UNITY_FSR2_TEX2D(FfxFloat32) r_input_depth : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_DEPTH); - Texture2D r_input_exposure : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_EXPOSURE); - Texture2D r_auto_exposure : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTO_EXPOSURE); - Texture2D r_reactive_mask : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_REACTIVE_MASK); - Texture2D r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_TRANSPARENCY_AND_COMPOSITION_MASK); - Texture2D r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_RECONSTRUCTED_PREVIOUS_NEAREST_DEPTH); - Texture2D r_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS); - Texture2D r_previous_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREVIOUS_DILATED_MOTION_VECTORS); - Texture2D r_dilatedDepth : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_DEPTH); - Texture2D r_internal_upscaled_color : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR); - Texture2D r_lock_status : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS); - Texture2D r_lock_input_luma : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_INPUT_LUMA); - Texture2D r_new_locks : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_NEW_LOCKS); - Texture2D r_prepared_input_color : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREPARED_INPUT_COLOR); - Texture2D r_luma_history : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LUMA_HISTORY); - Texture2D r_rcas_input : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_RCAS_INPUT); - Texture2D r_lanczos_lut : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_LANCZOS_LUT); - Texture2D r_imgMips : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE); - Texture2D r_upsample_maximum_bias_lut : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTITIER_UPSAMPLE_MAXIMUM_BIAS_LUT); - Texture2D r_dilated_reactive_masks : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_REACTIVE_MASKS); - Texture2D r_input_prev_color_pre_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR); - Texture2D r_input_prev_color_post_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR); - - Texture2D r_debug_out : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_DEBUG_OUTPUT); - - // UAV declarations - RWTexture2D rw_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_RECONSTRUCTED_PREVIOUS_NEAREST_DEPTH); - RWTexture2D rw_dilated_motion_vectors : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS); - RWTexture2D rw_dilatedDepth : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_DEPTH); - RWTexture2D rw_internal_upscaled_color : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR); - RWTexture2D rw_lock_status : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS); - RWTexture2D rw_lock_input_luma : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_INPUT_LUMA); - RWTexture2D rw_new_locks : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_NEW_LOCKS); - RWTexture2D rw_prepared_input_color : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_PREPARED_INPUT_COLOR); - RWTexture2D rw_luma_history : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_LUMA_HISTORY); - RWTexture2D rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_UPSCALED_OUTPUT); - - globallycoherent RWTexture2D rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE); - globallycoherent RWTexture2D rw_img_mip_5 : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_5); - RWTexture2D rw_dilated_reactive_masks : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_REACTIVE_MASKS); - RWTexture2D rw_auto_exposure : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTO_EXPOSURE); - globallycoherent RWTexture2D rw_spd_global_atomic : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_SPD_ATOMIC_COUNT); - RWTexture2D rw_debug_out : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_DEBUG_OUTPUT); - - RWTexture2D rw_output_autoreactive : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTOREACTIVE); - RWTexture2D rw_output_autocomposition : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_AUTOCOMPOSITION); - RWTexture2D rw_output_prev_color_pre_alpha : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR); - RWTexture2D rw_output_prev_color_post_alpha : FFX_FSR2_DECLARE_UAV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR); - -#else // #if defined(FFX_INTERNAL) - #if defined FSR2_BIND_SRV_INPUT_COLOR - UNITY_FSR2_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_COLOR); - #endif - #if defined FSR2_BIND_SRV_INPUT_OPAQUE_ONLY - UNITY_FSR2_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY); - #endif - #if defined FSR2_BIND_SRV_INPUT_MOTION_VECTORS - UNITY_FSR2_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_MOTION_VECTORS); - #endif - #if defined FSR2_BIND_SRV_INPUT_DEPTH - UNITY_FSR2_TEX2D(FfxFloat32) r_input_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_DEPTH); - #endif - #if defined FSR2_BIND_SRV_INPUT_EXPOSURE - Texture2D r_input_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INPUT_EXPOSURE); - #endif - #if defined FSR2_BIND_SRV_AUTO_EXPOSURE - Texture2D r_auto_exposure : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_AUTO_EXPOSURE); - #endif - #if defined FSR2_BIND_SRV_REACTIVE_MASK - Texture2D r_reactive_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_REACTIVE_MASK); - #endif - #if defined FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK - Texture2D r_transparency_and_composition_mask : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK); - #endif - #if defined FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH - Texture2D r_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH); - #endif - #if defined FSR2_BIND_SRV_DILATED_MOTION_VECTORS - Texture2D r_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_DILATED_MOTION_VECTORS); - #endif - #if defined FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS - Texture2D r_previous_dilated_motion_vectors : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS); - #endif - #if defined FSR2_BIND_SRV_DILATED_DEPTH - Texture2D r_dilatedDepth : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_DILATED_DEPTH); - #endif - #if defined FSR2_BIND_SRV_INTERNAL_UPSCALED - Texture2D r_internal_upscaled_color : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_INTERNAL_UPSCALED); - #endif - #if defined FSR2_BIND_SRV_LOCK_STATUS - Texture2D r_lock_status : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LOCK_STATUS); - #endif - #if defined FSR2_BIND_SRV_LOCK_INPUT_LUMA - Texture2D r_lock_input_luma : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LOCK_INPUT_LUMA); - #endif - #if defined FSR2_BIND_SRV_NEW_LOCKS - Texture2D r_new_locks : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_NEW_LOCKS); - #endif - #if defined FSR2_BIND_SRV_PREPARED_INPUT_COLOR - Texture2D r_prepared_input_color : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_PREPARED_INPUT_COLOR); - #endif - #if defined FSR2_BIND_SRV_LUMA_HISTORY - Texture2D r_luma_history : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LUMA_HISTORY); - #endif - #if defined FSR2_BIND_SRV_RCAS_INPUT - Texture2D r_rcas_input : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_RCAS_INPUT); - #endif - #if defined FSR2_BIND_SRV_LANCZOS_LUT - Texture2D r_lanczos_lut : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_LANCZOS_LUT); - #endif - #if defined FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS - Texture2D r_imgMips : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS); - #endif - #if defined FSR2_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT - Texture2D r_upsample_maximum_bias_lut : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT); - #endif - #if defined FSR2_BIND_SRV_DILATED_REACTIVE_MASKS - Texture2D r_dilated_reactive_masks : FFX_FSR2_DECLARE_SRV(FSR2_BIND_SRV_DILATED_REACTIVE_MASKS); - #endif - - #if defined FSR2_BIND_SRV_PREV_PRE_ALPHA_COLOR - Texture2D r_input_prev_color_pre_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR); - #endif - #if defined FSR2_BIND_SRV_PREV_POST_ALPHA_COLOR - Texture2D r_input_prev_color_post_alpha : FFX_FSR2_DECLARE_SRV(FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR); - #endif - - // UAV declarations - #if defined FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH - RWTexture2D rw_reconstructed_previous_nearest_depth : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH); - #endif - #if defined FSR2_BIND_UAV_DILATED_MOTION_VECTORS - RWTexture2D rw_dilated_motion_vectors : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_MOTION_VECTORS); - #endif - #if defined FSR2_BIND_UAV_DILATED_DEPTH - RWTexture2D rw_dilatedDepth : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_DEPTH); - #endif - #if defined FSR2_BIND_UAV_INTERNAL_UPSCALED - RWTexture2D rw_internal_upscaled_color : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_INTERNAL_UPSCALED); - #endif - #if defined FSR2_BIND_UAV_LOCK_STATUS - RWTexture2D rw_lock_status : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LOCK_STATUS); - #endif - #if defined FSR2_BIND_UAV_LOCK_INPUT_LUMA - RWTexture2D rw_lock_input_luma : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LOCK_INPUT_LUMA); - #endif - #if defined FSR2_BIND_UAV_NEW_LOCKS - RWTexture2D rw_new_locks : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_NEW_LOCKS); - #endif - #if defined FSR2_BIND_UAV_PREPARED_INPUT_COLOR - RWTexture2D rw_prepared_input_color : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREPARED_INPUT_COLOR); - #endif - #if defined FSR2_BIND_UAV_LUMA_HISTORY - RWTexture2D rw_luma_history : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_LUMA_HISTORY); - #endif - #if defined FSR2_BIND_UAV_UPSCALED_OUTPUT - RWTexture2D rw_upscaled_output : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_UPSCALED_OUTPUT); - #endif - #if defined FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE - globallycoherent RWTexture2D rw_img_mip_shading_change : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE); - #endif - #if defined FSR2_BIND_UAV_EXPOSURE_MIP_5 - globallycoherent RWTexture2D rw_img_mip_5 : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE_MIP_5); - #endif - #if defined FSR2_BIND_UAV_DILATED_REACTIVE_MASKS - RWTexture2D rw_dilated_reactive_masks : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_DILATED_REACTIVE_MASKS); - #endif - #if defined FSR2_BIND_UAV_EXPOSURE - RWTexture2D rw_exposure : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_EXPOSURE); - #endif - #if defined FSR2_BIND_UAV_AUTO_EXPOSURE - RWTexture2D rw_auto_exposure : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_AUTO_EXPOSURE); - #endif - #if defined FSR2_BIND_UAV_SPD_GLOBAL_ATOMIC - globallycoherent RWTexture2D rw_spd_global_atomic : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_SPD_GLOBAL_ATOMIC); - #endif - - #if defined FSR2_BIND_UAV_AUTOREACTIVE - RWTexture2D rw_output_autoreactive : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_AUTOREACTIVE); - #endif - #if defined FSR2_BIND_UAV_AUTOCOMPOSITION - RWTexture2D rw_output_autocomposition : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_AUTOCOMPOSITION); - #endif - #if defined FSR2_BIND_UAV_PREV_PRE_ALPHA_COLOR - RWTexture2D rw_output_prev_color_pre_alpha : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREV_PRE_ALPHA_COLOR); - #endif - #if defined FSR2_BIND_UAV_PREV_POST_ALPHA_COLOR - RWTexture2D rw_output_prev_color_post_alpha : FFX_FSR2_DECLARE_UAV(FSR2_BIND_UAV_PREV_POST_ALPHA_COLOR); - #endif -#endif // #if defined(FFX_INTERNAL) - -#if defined(FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS) || defined(FFX_INTERNAL) -FfxFloat32 LoadMipLuma(FfxUInt32x2 iPxPos, FfxUInt32 mipLevel) -{ - return r_imgMips.mips[mipLevel][iPxPos]; -} -#endif - -#if defined(FSR2_BIND_SRV_SCENE_LUMINANCE_MIPS) || defined(FFX_INTERNAL) -FfxFloat32 SampleMipLuma(FfxFloat32x2 fUV, FfxUInt32 mipLevel) -{ - return r_imgMips.SampleLevel(s_LinearClamp, fUV, mipLevel); -} -#endif - -#if defined(FSR2_BIND_SRV_INPUT_DEPTH) || defined(FFX_INTERNAL) -FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos) -{ - return r_input_depth[UNITY_FSR2_POS(iPxPos)]; -} -#endif - -#if defined(FSR2_BIND_SRV_INPUT_DEPTH) || defined(FFX_INTERNAL) -FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV) -{ - return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FSR2_UV(fUV), 0).x; -} -#endif - -#if defined(FSR2_BIND_SRV_REACTIVE_MASK) || defined(FFX_INTERNAL) -FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos) -{ - return r_reactive_mask[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK) || defined(FFX_INTERNAL) -FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos) -{ - return r_transparency_and_composition_mask[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_SRV_INPUT_COLOR) || defined(FFX_INTERNAL) -FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos) -{ - return r_input_color_jittered[UNITY_FSR2_POS(iPxPos)].rgb; -} -#endif - -#if defined(FSR2_BIND_SRV_INPUT_COLOR) || defined(FFX_INTERNAL) -FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV) -{ - return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FSR2_UV(fUV), 0).rgb; -} -#endif - -#if defined(FSR2_BIND_SRV_PREPARED_INPUT_COLOR) || defined(FFX_INTERNAL) -FfxFloat32x3 LoadPreparedInputColor(FfxUInt32x2 iPxPos) -{ - return r_prepared_input_color[iPxPos].xyz; -} -#endif - -#if defined(FSR2_BIND_SRV_INPUT_MOTION_VECTORS) || defined(FFX_INTERNAL) -FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos) -{ - FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FSR2_POS(iPxDilatedMotionVectorPos)].xy; - - FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); - -#if FFX_FSR2_OPTION_JITTERED_MOTION_VECTORS - fUvMotionVector -= MotionVectorJitterCancellation(); -#endif - - return fUvMotionVector; -} -#endif - -#if defined(FSR2_BIND_SRV_INTERNAL_UPSCALED) || defined(FFX_INTERNAL) -FfxFloat32x4 LoadHistory(FfxUInt32x2 iPxHistory) -{ - return r_internal_upscaled_color[iPxHistory]; -} -#endif - -#if defined(FSR2_BIND_UAV_LUMA_HISTORY) || defined(FFX_INTERNAL) -void StoreLumaHistory(FfxUInt32x2 iPxPos, FfxFloat32x4 fLumaHistory) -{ - rw_luma_history[iPxPos] = fLumaHistory; -} - -FfxFloat32x4 LoadRwLumaHistory(FFX_MIN16_I2 iPxPos) -{ - return rw_luma_history[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_SRV_LUMA_HISTORY) || defined(FFX_INTERNAL) -FfxFloat32x4 SampleLumaHistory(FfxFloat32x2 fUV) -{ - return r_luma_history.SampleLevel(s_LinearClamp, fUV, 0); -} -#endif - -#if defined(FFX_INTERNAL) -FfxFloat32x4 SampleDebug(FfxFloat32x2 fUV) -{ - return r_debug_out.SampleLevel(s_LinearClamp, fUV, 0).w; -} -#endif - -#if defined(FSR2_BIND_UAV_INTERNAL_UPSCALED) || defined(FFX_INTERNAL) -void StoreReprojectedHistory(FfxUInt32x2 iPxHistory, FfxFloat32x4 fHistory) -{ - rw_internal_upscaled_color[iPxHistory] = fHistory; -} -#endif - -#if defined(FSR2_BIND_UAV_INTERNAL_UPSCALED) || defined(FFX_INTERNAL) -void StoreInternalColorAndWeight(FfxUInt32x2 iPxPos, FfxFloat32x4 fColorAndWeight) -{ - rw_internal_upscaled_color[iPxPos] = fColorAndWeight; -} -#endif - -#if defined(FSR2_BIND_UAV_UPSCALED_OUTPUT) || defined(FFX_INTERNAL) -void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) -{ - rw_upscaled_output[iPxPos] = FfxFloat32x4(fColor, 1.f); -} -#endif - -//LOCK_LIFETIME_REMAINING == 0 -//Should make LockInitialLifetime() return a const 1.0f later -#if defined(FSR2_BIND_SRV_LOCK_STATUS) || defined(FFX_INTERNAL) -FfxFloat32x2 LoadLockStatus(FfxUInt32x2 iPxPos) -{ - return r_lock_status[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_UAV_LOCK_STATUS) || defined(FFX_INTERNAL) -void StoreLockStatus(FfxUInt32x2 iPxPos, FfxFloat32x2 fLockStatus) -{ - rw_lock_status[iPxPos] = fLockStatus; -} -#endif - -#if defined(FSR2_BIND_SRV_LOCK_INPUT_LUMA) || defined(FFX_INTERNAL) -FfxFloat32 LoadLockInputLuma(FfxUInt32x2 iPxPos) -{ - return r_lock_input_luma[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_UAV_LOCK_INPUT_LUMA) || defined(FFX_INTERNAL) -void StoreLockInputLuma(FfxUInt32x2 iPxPos, FfxFloat32 fLuma) -{ - rw_lock_input_luma[iPxPos] = fLuma; -} -#endif - -#if defined(FSR2_BIND_SRV_NEW_LOCKS) || defined(FFX_INTERNAL) -FfxFloat32 LoadNewLocks(FfxUInt32x2 iPxPos) -{ - return r_new_locks[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_UAV_NEW_LOCKS) || defined(FFX_INTERNAL) -FfxFloat32 LoadRwNewLocks(FfxUInt32x2 iPxPos) -{ - return rw_new_locks[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_UAV_NEW_LOCKS) || defined(FFX_INTERNAL) -void StoreNewLocks(FfxUInt32x2 iPxPos, FfxFloat32 newLock) -{ - rw_new_locks[iPxPos] = newLock; -} -#endif - -#if defined(FSR2_BIND_UAV_PREPARED_INPUT_COLOR) || defined(FFX_INTERNAL) -void StorePreparedInputColor(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 fTonemapped) -{ - rw_prepared_input_color[iPxPos] = fTonemapped; -} -#endif - -#if defined(FSR2_BIND_SRV_PREPARED_INPUT_COLOR) || defined(FFX_INTERNAL) -FfxFloat32 SampleDepthClip(FfxFloat32x2 fUV) -{ - return r_prepared_input_color.SampleLevel(s_LinearClamp, fUV, 0).w; -} -#endif - -#if defined(FSR2_BIND_SRV_LOCK_STATUS) || defined(FFX_INTERNAL) -FfxFloat32x2 SampleLockStatus(FfxFloat32x2 fUV) -{ - FfxFloat32x2 fLockStatus = r_lock_status.SampleLevel(s_LinearClamp, fUV, 0); - return fLockStatus; -} -#endif - -#if defined(FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH) || defined(FFX_INTERNAL) -FfxFloat32 LoadReconstructedPrevDepth(FfxUInt32x2 iPxPos) -{ - return asfloat(r_reconstructed_previous_nearest_depth[iPxPos]); -} -#endif - -#if defined(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH) || defined(FFX_INTERNAL) -void StoreReconstructedDepth(FfxUInt32x2 iPxSample, FfxFloat32 fDepth) -{ - FfxUInt32 uDepth = asuint(fDepth); - - #if FFX_FSR2_OPTION_INVERTED_DEPTH - InterlockedMax(rw_reconstructed_previous_nearest_depth[iPxSample], uDepth); - #else - InterlockedMin(rw_reconstructed_previous_nearest_depth[iPxSample], uDepth); // min for standard, max for inverted depth - #endif -} -#endif - -#if defined(FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH) || defined(FFX_INTERNAL) -void SetReconstructedDepth(FfxUInt32x2 iPxSample, const FfxUInt32 uValue) -{ - rw_reconstructed_previous_nearest_depth[iPxSample] = uValue; -} -#endif - -#if defined(FSR2_BIND_UAV_DILATED_DEPTH) || defined(FFX_INTERNAL) -void StoreDilatedDepth(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 fDepth) -{ - rw_dilatedDepth[iPxPos] = fDepth; -} -#endif - -#if defined(FSR2_BIND_UAV_DILATED_MOTION_VECTORS) || defined(FFX_INTERNAL) -void StoreDilatedMotionVector(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 fMotionVector) -{ - rw_dilated_motion_vectors[iPxPos] = fMotionVector; -} -#endif - -#if defined(FSR2_BIND_SRV_DILATED_MOTION_VECTORS) || defined(FFX_INTERNAL) -FfxFloat32x2 LoadDilatedMotionVector(FfxUInt32x2 iPxInput) -{ - return r_dilated_motion_vectors[iPxInput].xy; -} -#endif - -#if defined(FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS) || defined(FFX_INTERNAL) -FfxFloat32x2 LoadPreviousDilatedMotionVector(FfxUInt32x2 iPxInput) -{ - return r_previous_dilated_motion_vectors[iPxInput].xy; -} - -FfxFloat32x2 SamplePreviousDilatedMotionVector(FfxFloat32x2 uv) -{ - return r_previous_dilated_motion_vectors.SampleLevel(s_LinearClamp, uv, 0).xy; -} -#endif - -#if defined(FSR2_BIND_SRV_DILATED_DEPTH) || defined(FFX_INTERNAL) -FfxFloat32 LoadDilatedDepth(FfxUInt32x2 iPxInput) -{ - return r_dilatedDepth[iPxInput]; -} -#endif - -#if defined(FSR2_BIND_SRV_INPUT_EXPOSURE) || defined(FFX_INTERNAL) -FfxFloat32 Exposure() -{ - FfxFloat32 exposure = r_input_exposure[FfxUInt32x2(0, 0)].x; - - if (exposure == 0.0f) { - exposure = 1.0f; - } - - return exposure; -} -#endif - -#if defined(FSR2_BIND_SRV_AUTO_EXPOSURE) || defined(FFX_INTERNAL) -FfxFloat32 AutoExposure() -{ - FfxFloat32 exposure = r_auto_exposure[FfxUInt32x2(0, 0)].x; - - if (exposure == 0.0f) { - exposure = 1.0f; - } - - return exposure; -} -#endif - -FfxFloat32 SampleLanczos2Weight(FfxFloat32 x) -{ -#if defined(FSR2_BIND_SRV_LANCZOS_LUT) || defined(FFX_INTERNAL) - return r_lanczos_lut.SampleLevel(s_LinearClamp, FfxFloat32x2(x / 2, 0.5f), 0); -#else - return 0.f; -#endif -} - -#if defined(FSR2_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT) || defined(FFX_INTERNAL) -FfxFloat32 SampleUpsampleMaximumBias(FfxFloat32x2 uv) -{ - // Stored as a SNORM, so make sure to multiply by 2 to retrieve the actual expected range. - return FfxFloat32(2.0) * r_upsample_maximum_bias_lut.SampleLevel(s_LinearClamp, abs(uv) * 2.0, 0); -} -#endif - -#if defined(FSR2_BIND_SRV_DILATED_REACTIVE_MASKS) || defined(FFX_INTERNAL) -FfxFloat32x2 SampleDilatedReactiveMasks(FfxFloat32x2 fUV) -{ - return r_dilated_reactive_masks.SampleLevel(s_LinearClamp, fUV, 0); -} -#endif - -#if defined(FSR2_BIND_SRV_DILATED_REACTIVE_MASKS) || defined(FFX_INTERNAL) -FfxFloat32x2 LoadDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos) -{ - return r_dilated_reactive_masks[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_UAV_DILATED_REACTIVE_MASKS) || defined(FFX_INTERNAL) -void StoreDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 fDilatedReactiveMasks) -{ - rw_dilated_reactive_masks[iPxPos] = fDilatedReactiveMasks; -} -#endif - -#if defined(FSR2_BIND_SRV_INPUT_OPAQUE_ONLY) || defined(FFX_INTERNAL) -FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) -{ - return r_input_opaque_only[UNITY_FSR2_POS(iPxPos)].xyz; -} -#endif - -#if defined(FSR2_BIND_SRV_PREV_PRE_ALPHA_COLOR) || defined(FFX_INTERNAL) -FfxFloat32x3 LoadPrevPreAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) -{ - return r_input_prev_color_pre_alpha[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_SRV_PREV_POST_ALPHA_COLOR) || defined(FFX_INTERNAL) -FfxFloat32x3 LoadPrevPostAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) -{ - return r_input_prev_color_post_alpha[iPxPos]; -} -#endif - -#if defined(FSR2_BIND_UAV_AUTOREACTIVE) || defined(FFX_INTERNAL) -#if defined(FSR2_BIND_UAV_AUTOCOMPOSITION) || defined(FFX_INTERNAL) -void StoreAutoReactive(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F2 fReactive) -{ - rw_output_autoreactive[iPxPos] = fReactive.x; - - rw_output_autocomposition[iPxPos] = fReactive.y; -} -#endif -#endif - -#if defined(FSR2_BIND_UAV_PREV_PRE_ALPHA_COLOR) || defined(FFX_INTERNAL) -void StorePrevPreAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F3 color) -{ - rw_output_prev_color_pre_alpha[iPxPos] = color; - -} -#endif - -#if defined(FSR2_BIND_UAV_PREV_POST_ALPHA_COLOR) || defined(FFX_INTERNAL) -void StorePrevPostAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F3 color) -{ - rw_output_prev_color_post_alpha[iPxPos] = color; -} -#endif - -#endif // #if defined(FFX_GPU) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h.meta deleted file mode 100644 index 97858ae..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_callbacks_hlsl.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: eb121968296f9ba44b35d7e18d2b79df -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_common.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_common.h.meta deleted file mode 100644 index 0e3bb9c..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_common.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 2176dca22b6e9604da8329c79abae68d -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h.meta deleted file mode 100644 index c8cb631..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: dbcdb6dfb36311a49aa7b05bc5054280 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl deleted file mode 100644 index 2b96636..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl +++ /dev/null @@ -1,131 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define FSR2_BIND_SRV_INPUT_COLOR 0 -#define FSR2_BIND_UAV_SPD_GLOBAL_ATOMIC 0 -#define FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE 1 -#define FSR2_BIND_UAV_EXPOSURE_MIP_5 2 -#define FSR2_BIND_UAV_AUTO_EXPOSURE 3 -#define FSR2_BIND_CB_FSR2 0 -#define FSR2_BIND_CB_SPD 1 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" - -#if defined(FSR2_BIND_CB_SPD) - cbuffer cbSPD : FFX_FSR2_DECLARE_CB(FSR2_BIND_CB_SPD) { - - FfxUInt32 mips; - FfxUInt32 numWorkGroups; - FfxUInt32x2 workGroupOffset; - FfxUInt32x2 renderSize; - }; - - FfxUInt32 MipCount() - { - return mips; - } - - FfxUInt32 NumWorkGroups() - { - return numWorkGroups; - } - - FfxUInt32x2 WorkGroupOffset() - { - return workGroupOffset; - } - - FfxUInt32x2 SPD_RenderSize() - { - return renderSize; - } -#endif - - -FfxFloat32x2 SPD_LoadExposureBuffer() -{ - return rw_auto_exposure[FfxInt32x2(0,0)]; -} - -void SPD_SetExposureBuffer(FfxFloat32x2 value) -{ - rw_auto_exposure[FfxInt32x2(0,0)] = value; -} - -FfxFloat32x4 SPD_LoadMipmap5(FfxInt32x2 iPxPos) -{ - return FfxFloat32x4(rw_img_mip_5[iPxPos], 0, 0, 0); -} - -void SPD_SetMipmap(FfxInt32x2 iPxPos, FfxInt32 slice, FfxFloat32 value) -{ - switch (slice) - { - case FFX_FSR2_SHADING_CHANGE_MIP_LEVEL: - rw_img_mip_shading_change[iPxPos] = value; - break; - case 5: - rw_img_mip_5[iPxPos] = value; - break; - default: - - // avoid flattened side effect -#if defined(FSR2_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE) || defined(FFX_INTERNAL) - rw_img_mip_shading_change[iPxPos] = rw_img_mip_shading_change[iPxPos]; -#elif defined(FSR2_BIND_UAV_EXPOSURE_MIP_5) || defined(FFX_INTERNAL) - rw_img_mip_5[iPxPos] = rw_img_mip_5[iPxPos]; -#endif - break; - } -} - -void SPD_IncreaseAtomicCounter(inout FfxUInt32 spdCounter) -{ - InterlockedAdd(rw_spd_global_atomic[FfxInt32x2(0,0)], 1, spdCounter); -} - -void SPD_ResetAtomicCounter() -{ - rw_spd_global_atomic[FfxInt32x2(0,0)] = 0; -} - -#include "ffx_fsr2_compute_luminance_pyramid.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 256 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_CB2_ROOTSIG_CONTENT -void CS(uint3 WorkGroupId : SV_GroupID, uint LocalThreadIndex : SV_GroupIndex) -{ - ComputeAutoExposure(WorkGroupId, LocalThreadIndex); -} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h.meta deleted file mode 100644 index dbdf299..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: f7c16477aeb3a9b4f94f4ef818d10d9b -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl deleted file mode 100644 index 3cf501c..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl +++ /dev/null @@ -1,66 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define FSR2_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH 0 -#define FSR2_BIND_SRV_DILATED_MOTION_VECTORS 1 -#define FSR2_BIND_SRV_DILATED_DEPTH 2 -#define FSR2_BIND_SRV_REACTIVE_MASK 3 -#define FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK 4 -#define FSR2_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS 5 -#define FSR2_BIND_SRV_INPUT_MOTION_VECTORS 6 -#define FSR2_BIND_SRV_INPUT_COLOR 7 -#define FSR2_BIND_SRV_INPUT_DEPTH 8 -#define FSR2_BIND_SRV_INPUT_EXPOSURE 9 - -#define FSR2_BIND_UAV_DILATED_REACTIVE_MASKS 0 -#define FSR2_BIND_UAV_PREPARED_INPUT_COLOR 1 - -#define FSR2_BIND_CB_FSR2 0 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" -#include "ffx_fsr2_sample.h" -#include "ffx_fsr2_depth_clip.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -FFX_FSR2_PREFER_WAVE64 -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_ROOTSIG_CONTENT -void CS( - int2 iGroupId : SV_GroupID, - int2 iDispatchThreadId : SV_DispatchThreadID, - int2 iGroupThreadId : SV_GroupThreadID, - int iGroupIndex : SV_GroupIndex) -{ - DepthClip(iDispatchThreadId); -} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock.h.meta deleted file mode 100644 index 21f4814..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 9b4cdc5f81194ac4fa946c31b86234ed -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl deleted file mode 100644 index 1409dce..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl +++ /dev/null @@ -1,53 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define FSR2_BIND_SRV_LOCK_INPUT_LUMA 0 -#define FSR2_BIND_UAV_NEW_LOCKS 0 -#define FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH 1 -#define FSR2_BIND_CB_FSR2 0 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" -#include "ffx_fsr2_sample.h" -#include "ffx_fsr2_lock.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -FFX_FSR2_PREFER_WAVE64 -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_ROOTSIG_CONTENT -void CS(uint2 uGroupId : SV_GroupID, uint2 uGroupThreadId : SV_GroupThreadID) -{ - uint2 uDispatchThreadId = uGroupId * uint2(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT) + uGroupThreadId; - - ComputeLock(uDispatchThreadId); -} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl.meta deleted file mode 100644 index 4ded638..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock_pass.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 471a3f7a033c72f4fa737d4f8238a9bd -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_postprocess_lock_status.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_postprocess_lock_status.h.meta deleted file mode 100644 index ddb6dda..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_postprocess_lock_status.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 3945c3cfd2cc1a64cb0513864d88d8ca -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas.h.meta deleted file mode 100644 index e962499..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 7bd7d4eb34c626342966cb9b3fe00363 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl deleted file mode 100644 index f447b7e..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl +++ /dev/null @@ -1,75 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define FSR2_BIND_SRV_INPUT_EXPOSURE 0 -#define FSR2_BIND_SRV_RCAS_INPUT 1 -#define FSR2_BIND_UAV_UPSCALED_OUTPUT 0 -#define FSR2_BIND_CB_FSR2 0 -#define FSR2_BIND_CB_RCAS 1 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" - -//Move to prototype shader! -#if defined(FSR2_BIND_CB_RCAS) - cbuffer cbRCAS : FFX_FSR2_DECLARE_CB(FSR2_BIND_CB_RCAS) - { - uint4 rcasConfig; - }; - - uint4 RCASConfig() - { - return rcasConfig; - } -#else - uint4 RCASConfig() - { - return 0; - } -#endif - - -float4 LoadRCAS_Input(FfxInt32x2 iPxPos) -{ - return r_rcas_input[iPxPos]; -} - -#include "ffx_fsr2_rcas.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 64 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_CB2_ROOTSIG_CONTENT -void CS(uint3 LocalThreadId : SV_GroupThreadID, uint3 WorkGroupId : SV_GroupID, uint3 Dtid : SV_DispatchThreadID) -{ - RCAS(LocalThreadId, WorkGroupId, Dtid); -} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl.meta deleted file mode 100644 index b7e089b..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas_pass.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 871ca1938c701d64f94ef8ec00ef06f4 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h.meta deleted file mode 100644 index 9b82a1a..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 13cd33c3d34a317409049dfd939e64ef -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl deleted file mode 100644 index 33c044e..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl +++ /dev/null @@ -1,63 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#define FSR2_BIND_SRV_INPUT_MOTION_VECTORS 0 -#define FSR2_BIND_SRV_INPUT_DEPTH 1 -#define FSR2_BIND_SRV_INPUT_COLOR 2 -#define FSR2_BIND_SRV_INPUT_EXPOSURE 3 - -#define FSR2_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH 0 -#define FSR2_BIND_UAV_DILATED_MOTION_VECTORS 1 -#define FSR2_BIND_UAV_DILATED_DEPTH 2 -#define FSR2_BIND_UAV_LOCK_INPUT_LUMA 3 - -#define FSR2_BIND_CB_FSR2 0 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" -#include "ffx_fsr2_sample.h" -#include "ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -FFX_FSR2_PREFER_WAVE64 -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_ROOTSIG_CONTENT -void CS( - int2 iGroupId : SV_GroupID, - int2 iDispatchThreadId : SV_DispatchThreadID, - int2 iGroupThreadId : SV_GroupThreadID, - int iGroupIndex : SV_GroupIndex -) -{ - ReconstructAndDilate(iDispatchThreadId); -} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl.meta deleted file mode 100644 index 4f5036c..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9355c255c8505ae48ae89af286943747 -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reproject.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reproject.h.meta deleted file mode 100644 index ef8ce86..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reproject.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 63fc917ca6895cb4aac237ea35edb838 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h deleted file mode 100644 index 535dbc3..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h +++ /dev/null @@ -1,105 +0,0 @@ -// This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#ifndef FFX_FSR2_RESOURCES_H -#define FFX_FSR2_RESOURCES_H - -#if defined(FFX_CPU) || defined(FFX_GPU) -#define FFX_FSR2_RESOURCE_IDENTIFIER_NULL 0 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_OPAQUE_ONLY 1 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_COLOR 2 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_MOTION_VECTORS 3 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_DEPTH 4 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_EXPOSURE 5 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_REACTIVE_MASK 6 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INPUT_TRANSPARENCY_AND_COMPOSITION_MASK 7 -#define FFX_FSR2_RESOURCE_IDENTIFIER_RECONSTRUCTED_PREVIOUS_NEAREST_DEPTH 8 -#define FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS 9 -#define FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_DEPTH 10 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR 11 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS 12 -#define FFX_FSR2_RESOURCE_IDENTIFIER_NEW_LOCKS 13 -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREPARED_INPUT_COLOR 14 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LUMA_HISTORY 15 -#define FFX_FSR2_RESOURCE_IDENTIFIER_DEBUG_OUTPUT 16 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LANCZOS_LUT 17 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SPD_ATOMIC_COUNT 18 -#define FFX_FSR2_RESOURCE_IDENTIFIER_UPSCALED_OUTPUT 19 -#define FFX_FSR2_RESOURCE_IDENTIFIER_RCAS_INPUT 20 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS_1 21 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_STATUS_2 22 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR_1 23 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR_2 24 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_REACTIVITY 25 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_TRANSPARENCY_AND_COMPOSITION 26 -#define FFX_FSR2_RESOURCE_IDENTITIER_UPSAMPLE_MAXIMUM_BIAS_LUT 27 -#define FFX_FSR2_RESOURCE_IDENTIFIER_DILATED_REACTIVE_MASKS 28 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE 29 // same as FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0 29 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_1 30 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_2 31 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_3 32 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_4 33 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_5 34 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_6 35 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_7 36 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_8 37 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_9 38 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_10 39 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_11 40 -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_12 41 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_EXPOSURE 42 -#define FFX_FSR2_RESOURCE_IDENTIFIER_AUTO_EXPOSURE 43 -#define FFX_FSR2_RESOURCE_IDENTIFIER_AUTOREACTIVE 44 -#define FFX_FSR2_RESOURCE_IDENTIFIER_AUTOCOMPOSITION 45 - -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR 46 -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR 47 -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR_1 48 -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR_1 49 -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR_2 50 -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR_2 51 -#define FFX_FSR2_RESOURCE_IDENTIFIER_PREVIOUS_DILATED_MOTION_VECTORS 52 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_DILATED_MOTION_VECTORS_1 53 -#define FFX_FSR2_RESOURCE_IDENTIFIER_INTERNAL_DILATED_MOTION_VECTORS_2 54 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LUMA_HISTORY_1 55 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LUMA_HISTORY_2 56 -#define FFX_FSR2_RESOURCE_IDENTIFIER_LOCK_INPUT_LUMA 57 - -// Shading change detection mip level setting, value must be in the range [FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0, FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_12] -#define FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_4 -#define FFX_FSR2_SHADING_CHANGE_MIP_LEVEL (FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE - FFX_FSR2_RESOURCE_IDENTIFIER_SCENE_LUMINANCE) - -#define FFX_FSR2_RESOURCE_IDENTIFIER_COUNT 58 - -#define FFX_FSR2_CONSTANTBUFFER_IDENTIFIER_FSR2 0 -#define FFX_FSR2_CONSTANTBUFFER_IDENTIFIER_SPD 1 -#define FFX_FSR2_CONSTANTBUFFER_IDENTIFIER_RCAS 2 -#define FFX_FSR2_CONSTANTBUFFER_IDENTIFIER_GENREACTIVE 3 - -#define FFX_FSR2_AUTOREACTIVEFLAGS_APPLY_TONEMAP 1 -#define FFX_FSR2_AUTOREACTIVEFLAGS_APPLY_INVERSETONEMAP 2 -#define FFX_FSR2_AUTOREACTIVEFLAGS_APPLY_THRESHOLD 4 -#define FFX_FSR2_AUTOREACTIVEFLAGS_USE_COMPONENTS_MAX 8 - -#endif // #if defined(FFX_CPU) || defined(FFX_GPU) - -#endif //!defined( FFX_FSR2_RESOURCES_H ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h.meta deleted file mode 100644 index 69e95a4..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_resources.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: fd5bed2bf4ba07444ae815390168a15d -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_sample.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_sample.h.meta deleted file mode 100644 index acc8bab..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_sample.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: ba3ee190167b6c240aaeb1f8f4dbcb67 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen.h.meta deleted file mode 100644 index a2af34e..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 18b8590c99b171a4e9af68dfd2c3ff02 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl.meta deleted file mode 100644 index d133259..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 9feb1fa4d6cff5a4799298dc69b12a8e -ShaderIncludeImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_upsample.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_upsample.h.meta deleted file mode 100644 index c9fa0a3..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_upsample.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 1ff3a385cfe07db4387e4d7b457238f8 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_spd.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_spd.h.meta deleted file mode 100644 index d896fc1..0000000 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_spd.h.meta +++ /dev/null @@ -1,60 +0,0 @@ -fileFormatVersion: 2 -guid: 3ef69a900a925bb498651c10581e0979 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Editor: 1 - Exclude GameCoreScarlett: 1 - Exclude GameCoreXboxOne: 1 - Exclude Linux64: 1 - Exclude OSXUniversal: 1 - Exclude PS4: 1 - Exclude PS5: 1 - Exclude WebGL: 1 - Exclude Win: 1 - Exclude Win64: 1 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: None - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: None - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3.meta similarity index 77% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3.meta index 6d47067..3e30dae 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cad7d53fa2166a0449bec7a9b4f17d69 +guid: 37c436021e67c00459f44b59099c024a folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_accumulate_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute similarity index 61% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_accumulate_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute index a359485..5cbfb80 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_accumulate_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute @@ -21,21 +21,21 @@ #pragma kernel CS #pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE -#pragma multi_compile_local __ FFX_FSR2_OPTION_HDR_COLOR_INPUT -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_APPLY_SHARPENING +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_APPLY_SHARPENING -#pragma multi_compile_local __ UNITY_FSR2_HDRP +#pragma multi_compile_local __ UNITY_FSR3UPSCALER_HDRP -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" // Ensure the correct value is defined for this keyword, as it is used to select one of multiple sampler functions -#ifdef FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE -#undef FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE -#define FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE 1 +#ifdef FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE +#undef FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE +#define FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE 1 #endif -#include "shaders/ffx_fsr2_accumulate_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_accumulate_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute.meta similarity index 79% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute.meta index 49033cb..dbe5282 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_accumulate_pass.compute.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0894ebeefb6aa7d4680c71dffbda3fee +guid: c9b45f0ae7673694ba57a4aadfe212e9 ComputeShaderImporter: externalObjects: {} preprocessorOverride: 0 diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_depth_clip_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute similarity index 74% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_depth_clip_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute index 4e41933..e13c001 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_depth_clip_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute @@ -21,12 +21,12 @@ #pragma kernel CS #pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH -#pragma multi_compile_local __ UNITY_FSR2_HDRP +#pragma multi_compile_local __ UNITY_FSR3UPSCALER_HDRP -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" -#include "shaders/ffx_fsr2_depth_clip_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_autogen_reactive_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute.meta similarity index 79% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_autogen_reactive_pass.compute.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute.meta index 19d1df3..1df041b 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_autogen_reactive_pass.compute.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_autogen_reactive_pass.compute.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d18fb8811ca4753469c439784546104e +guid: 5716b91fdaa4e9e439df6b96a796fe6e ComputeShaderImporter: externalObjects: {} preprocessorOverride: 0 diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute similarity index 76% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute index 385dfe4..d5903c0 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_compute_luminance_pyramid_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute @@ -20,14 +20,14 @@ #pragma kernel CS -//#pragma multi_compile_local __ FFX_HALF // causes a hard-coded error message from the shader include ¯\_(ツ)_/¯ -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_HALF +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH -#pragma multi_compile_local __ UNITY_FSR2_HDRP +#pragma multi_compile_local __ UNITY_FSR3UPSCALER_HDRP -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" // Wave operations require shader model 6.0; this can only be enabled when using DXC on D3D12 // These pragmas are commented out by default as Unity will sometimes ignore the #if's and try to enable these features anyway. @@ -36,7 +36,7 @@ //#pragma require WaveBasic // Required for WaveGetLaneIndex //#pragma require WaveBallot // Required for WaveReadLaneAt //#else -#define SPD_NO_WAVE_OPERATIONS +#define FFX_SPD_NO_WAVE_OPERATIONS //#endif -#include "shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_depth_clip_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute.meta similarity index 79% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_depth_clip_pass.compute.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute.meta index 26fb9ba..9e002c0 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_depth_clip_pass.compute.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_compute_luminance_pyramid_pass.compute.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8026d9d8542eab6499c32d5d46beb2b6 +guid: d253be05abcdc80428503d3e4cce3a36 ComputeShaderImporter: externalObjects: {} preprocessorOverride: 0 diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_tcr_autogen_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_depth_clip_pass.compute similarity index 74% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_tcr_autogen_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_depth_clip_pass.compute index 62d386b..0ccd388 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_tcr_autogen_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_depth_clip_pass.compute @@ -21,12 +21,12 @@ #pragma kernel CS #pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH -#pragma multi_compile_local __ UNITY_FSR2_HDRP +#pragma multi_compile_local __ UNITY_FSR3UPSCALER_HDRP -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" -#include "shaders/ffx_fsr2_tcr_autogen_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_accumulate_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_depth_clip_pass.compute.meta similarity index 79% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_accumulate_pass.compute.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_depth_clip_pass.compute.meta index 3864379..d695f48 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_accumulate_pass.compute.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_depth_clip_pass.compute.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 702560780e923c84394c9b22ba460a9c +guid: 20e44016ed34b0d4b8de499d1b566c69 ComputeShaderImporter: externalObjects: {} preprocessorOverride: 0 diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_lock_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_lock_pass.compute similarity index 77% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_lock_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_lock_pass.compute index 5f8c13d..e38ad99 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_lock_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_lock_pass.compute @@ -21,10 +21,10 @@ #pragma kernel CS #pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" -#include "shaders/ffx_fsr2_lock_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_lock_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_lock_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_lock_pass.compute.meta new file mode 100644 index 0000000..c01e009 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_lock_pass.compute.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a135306e6d1857e43a86ef20db2a47fe +ComputeShaderImporter: + externalObjects: {} + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_rcas_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute similarity index 77% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_rcas_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute index 6d97414..04c2fe4 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_rcas_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute @@ -20,10 +20,10 @@ #pragma kernel CS -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" -#include "shaders/ffx_fsr2_rcas_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_rcas_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute.meta new file mode 100644 index 0000000..cd12641 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_rcas_pass.compute.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7aaf5cfff022de2499e9b0412f947f6c +ComputeShaderImporter: + externalObjects: {} + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute similarity index 70% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute index c6cc99f..ee2f276 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_reconstruct_previous_depth_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute @@ -21,13 +21,13 @@ #pragma kernel CS #pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_HDR_COLOR_INPUT -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH -#pragma multi_compile_local __ UNITY_FSR2_HDRP +#pragma multi_compile_local __ UNITY_FSR3UPSCALER_HDRP -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" -#include "shaders/ffx_fsr2_reconstruct_previous_depth_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute.meta new file mode 100644 index 0000000..1053c34 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_reconstruct_previous_depth_pass.compute.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4f59e5b9179d74844ae06a30ae1e0629 +ComputeShaderImporter: + externalObjects: {} + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_autogen_reactive_pass.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute similarity index 74% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_autogen_reactive_pass.compute rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute index d27a02d..6338918 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_autogen_reactive_pass.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute @@ -21,12 +21,12 @@ #pragma kernel CS #pragma multi_compile_local __ FFX_HALF -#pragma multi_compile_local __ FFX_FSR2_OPTION_LOW_RESOLUTION_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_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS +#pragma multi_compile_local __ FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH -#pragma multi_compile_local __ UNITY_FSR2_HDRP +#pragma multi_compile_local __ UNITY_FSR3UPSCALER_HDRP -#include "ffx_fsr2_unity_common.cginc" +#include "ffx_fsr3upscaler_unity_common.cginc" -#include "shaders/ffx_fsr2_autogen_reactive_pass.hlsl" +#include "shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute.meta new file mode 100644 index 0000000..ad42fbb --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_tcr_autogen_pass.compute.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 75cdc6ef23f08ed498d4da511923fcea +ComputeShaderImporter: + externalObjects: {} + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_unity_common.cginc b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc similarity index 92% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_unity_common.cginc rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc index 98c5b17..758bb0c 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_unity_common.cginc +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc @@ -1,4 +1,4 @@ -// Copyright (c) 2023 Nico de Poel +// Copyright (c) 2023 Nico de Poel // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -46,7 +46,7 @@ // Workaround for HDRP using texture arrays for its camera buffers on some platforms // The below defines are copied from: Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/TextureXR.hlsl -#if defined(UNITY_FSR2_HDRP) +#if defined(UNITY_FSR3UPSCALER_HDRP) // Must be in sync with C# with property useTexArray in TextureXR.cs #if ((defined(SHADER_API_D3D11) || defined(SHADER_API_D3D12)) && !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_GAMECORE)) || defined(SHADER_API_PSSL) || defined(SHADER_API_VULKAN) #define UNITY_TEXTURE2D_X_ARRAY_SUPPORTED @@ -73,9 +73,10 @@ #endif // Declare and sample camera buffers as texture arrays - #define UNITY_FSR2_TEX2D(type) Texture2DArray - #define UNITY_FSR2_POS(pxPos) FfxUInt32x3(pxPos, SLICE_ARRAY_INDEX) - #define UNITY_FSR2_UV(uv) FfxFloat32x3(uv, SLICE_ARRAY_INDEX) + #define UNITY_FSR3_TEX2D(type) Texture2DArray + #define UNITY_FSR3_RWTEX2D(type) RWTexture2DArray + #define UNITY_FSR3_POS(pxPos) FfxUInt32x3(pxPos, SLICE_ARRAY_INDEX) + #define UNITY_FSR3_UV(uv) FfxFloat32x3(uv, SLICE_ARRAY_INDEX) #endif #endif diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc.meta similarity index 75% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc.meta index 2e93435..5a68b6c 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_autogen_reactive_pass.hlsl.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/ffx_fsr3upscaler_unity_common.cginc.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cc76bd6f46792f3418a56b79eb5c959b +guid: 3ce00ba677bb7e14bb91772fd68bfe6b ShaderIncludeImporter: externalObjects: {} userData: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders.meta similarity index 77% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders.meta index 676ff9a..8a4ff2b 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4a24e63edc822264a871f58397325d51 +guid: 8364d4f86c613ec4d999d062f5f773b8 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl new file mode 100644 index 0000000..d2f1b32 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl @@ -0,0 +1,79 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#define FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE 0 +#define FSR3UPSCALER_BIND_SRV_DILATED_REACTIVE_MASKS 1 +#if FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#define FSR3UPSCALER_BIND_SRV_DILATED_MOTION_VECTORS 2 +#else +#define FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS 2 +#endif +#define FSR3UPSCALER_BIND_SRV_INTERNAL_UPSCALED 3 +#define FSR3UPSCALER_BIND_SRV_LOCK_STATUS 4 +#define FSR3UPSCALER_BIND_SRV_PREPARED_INPUT_COLOR 5 +#define FSR3UPSCALER_BIND_SRV_LANCZOS_LUT 6 +#define FSR3UPSCALER_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT 7 +#define FSR3UPSCALER_BIND_SRV_SCENE_LUMINANCE_MIPS 8 +#define FSR3UPSCALER_BIND_SRV_AUTO_EXPOSURE 9 +#define FSR3UPSCALER_BIND_SRV_LUMA_HISTORY 10 + +#define FSR3UPSCALER_BIND_UAV_INTERNAL_UPSCALED 0 +#define FSR3UPSCALER_BIND_UAV_LOCK_STATUS 1 +#define FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT 2 +#define FSR3UPSCALER_BIND_UAV_NEW_LOCKS 3 +#define FSR3UPSCALER_BIND_UAV_LUMA_HISTORY 4 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" +#include "fsr3upscaler/ffx_fsr3upscaler_sample.h" +#include "fsr3upscaler/ffx_fsr3upscaler_upsample.h" +#include "fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h" +#include "fsr3upscaler/ffx_fsr3upscaler_reproject.h" +#include "fsr3upscaler/ffx_fsr3upscaler_accumulate.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 8 +#endif // FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_PREFER_WAVE64 +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT +void CS(uint2 uGroupId : SV_GroupID, uint2 uGroupThreadId : SV_GroupThreadID) +{ + const uint GroupRows = (uint(DisplaySize().y) + FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT - 1) / FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT; + uGroupId.y = GroupRows - uGroupId.y - 1; + + uint2 uDispatchThreadId = uGroupId * uint2(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT) + uGroupThreadId; + + Accumulate(uDispatchThreadId); +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl.meta similarity index 75% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl.meta index ac39806..80f209e 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid_pass.hlsl.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_accumulate_pass.hlsl.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 19dfb00afb70c3144b43ec2dc05ecdd9 +guid: 507ab779c38eddb429cdcedf9c108d1b ShaderIncludeImporter: externalObjects: {} userData: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl new file mode 100644 index 0000000..0d6e2eb --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl @@ -0,0 +1,77 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#define FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY 0 +#define FSR3UPSCALER_BIND_SRV_INPUT_COLOR 1 + +#define FSR3UPSCALER_BIND_UAV_AUTOREACTIVE 0 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 +#define FSR3UPSCALER_BIND_CB_REACTIVE 1 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 8 +#endif // FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT +void CS(uint2 uGroupId : SV_GroupID, uint2 uGroupThreadId : SV_GroupThreadID) +{ + uint2 uDispatchThreadId = uGroupId * uint2(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT) + uGroupThreadId; + + float3 ColorPreAlpha = LoadOpaqueOnly( FFX_MIN16_I2(uDispatchThreadId) ).rgb; + float3 ColorPostAlpha = LoadInputColor(uDispatchThreadId).rgb; + + if (GenReactiveFlags() & FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_TONEMAP) + { + ColorPreAlpha = Tonemap(ColorPreAlpha); + ColorPostAlpha = Tonemap(ColorPostAlpha); + } + + if (GenReactiveFlags() & FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_INVERSETONEMAP) + { + ColorPreAlpha = InverseTonemap(ColorPreAlpha); + ColorPostAlpha = InverseTonemap(ColorPostAlpha); + } + + float out_reactive_value = 0.f; + float3 delta = abs(ColorPostAlpha - ColorPreAlpha); + + out_reactive_value = (GenReactiveFlags() & FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_USE_COMPONENTS_MAX) ? max(delta.x, max(delta.y, delta.z)) : length(delta); + out_reactive_value *= GenReactiveScale(); + + out_reactive_value = (GenReactiveFlags() & FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_THRESHOLD) ? (out_reactive_value < GenReactiveThreshold() ? 0 : GenReactiveBinaryValue()) : out_reactive_value; + + rw_output_autoreactive[uDispatchThreadId] = out_reactive_value; +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl.meta similarity index 75% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl.meta index d7ce66d..c55f004 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip_pass.hlsl.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_autogen_reactive_pass.hlsl.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7981b48622ddaa944909ebf209284d83 +guid: 52cdb7a7c30cb614984908593ed19082 ShaderIncludeImporter: externalObjects: {} userData: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl new file mode 100644 index 0000000..93b7332 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl @@ -0,0 +1,55 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#define FSR3UPSCALER_BIND_SRV_INPUT_COLOR 0 + +#define FSR3UPSCALER_BIND_UAV_SPD_GLOBAL_ATOMIC 0 +#define FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE 1 +#define FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5 2 +#define FSR3UPSCALER_BIND_UAV_AUTO_EXPOSURE 3 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 +#define FSR3UPSCALER_BIND_CB_SPD 1 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" +#include "fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 256 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_CB2_ROOTSIG_CONTENT +void CS(uint3 WorkGroupId : SV_GroupID, uint LocalThreadIndex : SV_GroupIndex) +{ + ComputeAutoExposure(WorkGroupId, LocalThreadIndex); +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl.meta similarity index 75% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl.meta index cad5022..508b43e 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate_pass.hlsl.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_compute_luminance_pyramid_pass.hlsl.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 356ec46d3f01672428b5a7a0de727548 +guid: 2d149b52ba0f5bb468a94a71dbbcb66f ShaderIncludeImporter: externalObjects: {} userData: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl new file mode 100644 index 0000000..70cc7ba --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl @@ -0,0 +1,67 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#define FSR3UPSCALER_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH 0 +#define FSR3UPSCALER_BIND_SRV_DILATED_MOTION_VECTORS 1 +#define FSR3UPSCALER_BIND_SRV_DILATED_DEPTH 2 +#define FSR3UPSCALER_BIND_SRV_REACTIVE_MASK 3 +#define FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK 4 +#define FSR3UPSCALER_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS 5 +#define FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS 6 +#define FSR3UPSCALER_BIND_SRV_INPUT_COLOR 7 +#define FSR3UPSCALER_BIND_SRV_INPUT_DEPTH 8 +#define FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE 9 + +#define FSR3UPSCALER_BIND_UAV_DILATED_REACTIVE_MASKS 0 +#define FSR3UPSCALER_BIND_UAV_PREPARED_INPUT_COLOR 1 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" +#include "fsr3upscaler/ffx_fsr3upscaler_sample.h" +#include "fsr3upscaler/ffx_fsr3upscaler_depth_clip.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_PREFER_WAVE64 +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT +void CS( + int2 iGroupId : SV_GroupID, + int2 iDispatchThreadId : SV_DispatchThreadID, + int2 iGroupThreadId : SV_GroupThreadID, + int iGroupIndex : SV_GroupIndex) +{ + DepthClip(iDispatchThreadId); +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl.meta new file mode 100644 index 0000000..cde3a5e --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_depth_clip_pass.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: da435b71cf57e2247b80ae0f0f86d1f8 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl new file mode 100644 index 0000000..26b28f0 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl @@ -0,0 +1,56 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#define FSR3UPSCALER_BIND_SRV_LOCK_INPUT_LUMA 0 + +#define FSR3UPSCALER_BIND_UAV_NEW_LOCKS 0 +#define FSR3UPSCALER_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH 1 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" +#include "fsr3upscaler/ffx_fsr3upscaler_sample.h" +#include "fsr3upscaler/ffx_fsr3upscaler_lock.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_PREFER_WAVE64 +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT +void CS(uint2 uGroupId : SV_GroupID, uint2 uGroupThreadId : SV_GroupThreadID) +{ + uint2 uDispatchThreadId = uGroupId * uint2(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT) + uGroupThreadId; + + ComputeLock(uDispatchThreadId); +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl.meta new file mode 100644 index 0000000..45c99dc --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_lock_pass.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 98d2cbbda5e90dd4ebd1d70abbb63a09 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl new file mode 100644 index 0000000..bebdeb3 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl @@ -0,0 +1,53 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#define FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE 0 +#define FSR3UPSCALER_BIND_SRV_RCAS_INPUT 1 + +#define FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT 0 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 +#define FSR3UPSCALER_BIND_CB_RCAS 1 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" +#include "fsr3upscaler/ffx_fsr3upscaler_rcas.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 64 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_CB2_ROOTSIG_CONTENT +void CS(uint3 LocalThreadId : SV_GroupThreadID, uint3 WorkGroupId : SV_GroupID, uint3 Dtid : SV_DispatchThreadID) +{ + RCAS(LocalThreadId, WorkGroupId, Dtid); +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl.meta new file mode 100644 index 0000000..fb9bfe2 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_rcas_pass.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9a15fc73170a9bc478801c8fa4d8d574 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl new file mode 100644 index 0000000..f277fd1 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl @@ -0,0 +1,64 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#define FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS 0 +#define FSR3UPSCALER_BIND_SRV_INPUT_DEPTH 1 +#define FSR3UPSCALER_BIND_SRV_INPUT_COLOR 2 +#define FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE 3 + +#define FSR3UPSCALER_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH 0 +#define FSR3UPSCALER_BIND_UAV_DILATED_MOTION_VECTORS 1 +#define FSR3UPSCALER_BIND_UAV_DILATED_DEPTH 2 +#define FSR3UPSCALER_BIND_UAV_LOCK_INPUT_LUMA 3 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" +#include "fsr3upscaler/ffx_fsr3upscaler_sample.h" +#include "fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_PREFER_WAVE64 +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT +void CS( + int2 iGroupId : SV_GroupID, + int2 iDispatchThreadId : SV_DispatchThreadID, + int2 iGroupThreadId : SV_GroupThreadID, + int iGroupIndex : SV_GroupIndex +) +{ + ReconstructAndDilate(iDispatchThreadId); +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl.meta new file mode 100644 index 0000000..6489d6d --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_reconstruct_previous_depth_pass.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bafb3726a76b97a49bb343d8a4323754 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl similarity index 56% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl index 8e635d1..6180885 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen_pass.hlsl +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl @@ -19,68 +19,44 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#define FSR2_BIND_SRV_INPUT_OPAQUE_ONLY 0 -#define FSR2_BIND_SRV_INPUT_COLOR 1 -#define FSR2_BIND_SRV_INPUT_MOTION_VECTORS 2 -#define FSR2_BIND_SRV_PREV_PRE_ALPHA_COLOR 3 -#define FSR2_BIND_SRV_PREV_POST_ALPHA_COLOR 4 -#define FSR2_BIND_SRV_REACTIVE_MASK 4 -#define FSR2_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK 5 - -#define FSR2_BIND_UAV_AUTOREACTIVE 0 -#define FSR2_BIND_UAV_AUTOCOMPOSITION 1 -#define FSR2_BIND_UAV_PREV_PRE_ALPHA_COLOR 2 -#define FSR2_BIND_UAV_PREV_POST_ALPHA_COLOR 3 - -#define FSR2_BIND_CB_FSR2 0 -#define FSR2_BIND_CB_AUTOREACTIVE 1 - -#include "ffx_fsr2_callbacks_hlsl.h" -#include "ffx_fsr2_common.h" - -#if defined(FSR2_BIND_CB_AUTOREACTIVE) - cbuffer cbGenerateReactive : FFX_FSR2_DECLARE_CB(FSR2_BIND_CB_AUTOREACTIVE) - { - float fTcThreshold; // 0.1 is a good starting value, lower will result in more TC pixels - float fTcScale; - float fReactiveScale; - float fReactiveMax; - }; - float getTcThreshold() - { - return fTcThreshold; - } -#else - #define fTcThreshold 0.05f - #define fTcScale 1.00f - #define fReactiveScale 10.0f - #define fReactiveMax 0.90f - float getTcThreshold() - { - return fTcThreshold; - } -#endif - -#include "ffx_fsr2_tcr_autogen.h" - -#ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#define FFX_FSR2_THREAD_GROUP_WIDTH 8 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_WIDTH -#ifndef FFX_FSR2_THREAD_GROUP_HEIGHT -#define FFX_FSR2_THREAD_GROUP_HEIGHT 8 -#endif // FFX_FSR2_THREAD_GROUP_HEIGHT -#ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#define FFX_FSR2_THREAD_GROUP_DEPTH 1 -#endif // #ifndef FFX_FSR2_THREAD_GROUP_DEPTH -#ifndef FFX_FSR2_NUM_THREADS -#define FFX_FSR2_NUM_THREADS [numthreads(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT, FFX_FSR2_THREAD_GROUP_DEPTH)] -#endif // #ifndef FFX_FSR2_NUM_THREADS - -FFX_FSR2_NUM_THREADS -FFX_FSR2_EMBED_ROOTSIG_CONTENT +#define FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY 0 +#define FSR3UPSCALER_BIND_SRV_INPUT_COLOR 1 +#define FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS 2 +#define FSR3UPSCALER_BIND_SRV_PREV_PRE_ALPHA_COLOR 3 +#define FSR3UPSCALER_BIND_SRV_PREV_POST_ALPHA_COLOR 4 +#define FSR3UPSCALER_BIND_SRV_REACTIVE_MASK 4 +#define FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK 5 + +#define FSR3UPSCALER_BIND_UAV_AUTOREACTIVE 0 +#define FSR3UPSCALER_BIND_UAV_AUTOCOMPOSITION 1 +#define FSR3UPSCALER_BIND_UAV_PREV_PRE_ALPHA_COLOR 2 +#define FSR3UPSCALER_BIND_UAV_PREV_POST_ALPHA_COLOR 3 + +#define FSR3UPSCALER_BIND_CB_FSR3UPSCALER 0 +#define FSR3UPSCALER_BIND_CB_AUTOREACTIVE 1 + +#include "fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h" +#include "fsr3upscaler/ffx_fsr3upscaler_common.h" +#include "fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h" + +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#define FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT 8 +#endif // FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#define FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FSR3UPSCALER_NUM_THREADS +#define FFX_FSR3UPSCALER_NUM_THREADS [numthreads(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT, FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH)] +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_FSR3UPSCALER_NUM_THREADS +FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT void CS(uint2 uGroupId : SV_GroupID, uint2 uGroupThreadId : SV_GroupThreadID) { - FFX_MIN16_I2 uDispatchThreadId = FFX_MIN16_I2(uGroupId * uint2(FFX_FSR2_THREAD_GROUP_WIDTH, FFX_FSR2_THREAD_GROUP_HEIGHT) + uGroupThreadId); + FFX_MIN16_I2 uDispatchThreadId = FFX_MIN16_I2(uGroupId * uint2(FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH, FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT) + uGroupThreadId); // ToDo: take into account jitter (i.e. add delta of previous jitter and current jitter to previous UV // fetch pre- and post-alpha color values diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl.meta new file mode 100644 index 0000000..02c5f46 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/ffx_fsr3upscaler_tcr_autogen_pass.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 712d171118b59fc4fb28d0d487060d42 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler.meta new file mode 100644 index 0000000..2626a2e --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ae9c6d015ae76544f9e8117e79ea862b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_common_types.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_common_types.h similarity index 83% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_common_types.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_common_types.h index 4594dc1..f0b62ab 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_common_types.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_common_types.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -18,6 +18,8 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + + #ifndef FFX_COMMON_TYPES_H #define FFX_COMMON_TYPES_H @@ -25,127 +27,200 @@ #define FFX_PARAMETER_IN #define FFX_PARAMETER_OUT #define FFX_PARAMETER_INOUT +#define FFX_PARAMETER_UNIFORM #elif defined(FFX_HLSL) #define FFX_PARAMETER_IN in #define FFX_PARAMETER_OUT out #define FFX_PARAMETER_INOUT inout +#define FFX_PARAMETER_UNIFORM uniform #elif defined(FFX_GLSL) #define FFX_PARAMETER_IN in #define FFX_PARAMETER_OUT out #define FFX_PARAMETER_INOUT inout +#define FFX_PARAMETER_UNIFORM const //[cacao_placeholder] until a better fit is found! #endif // #if defined(FFX_CPU) #if defined(FFX_CPU) /// A typedef for a boolean value. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef bool FfxBoolean; /// A typedef for a unsigned 8bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef uint8_t FfxUInt8; /// A typedef for a unsigned 16bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef uint16_t FfxUInt16; /// A typedef for a unsigned 32bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef uint32_t FfxUInt32; /// A typedef for a unsigned 64bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef uint64_t FfxUInt64; /// A typedef for a signed 8bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef int8_t FfxInt8; /// A typedef for a signed 16bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef int16_t FfxInt16; /// A typedef for a signed 32bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef int32_t FfxInt32; /// A typedef for a signed 64bit integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef int64_t FfxInt64; /// A typedef for a floating point value. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef float FfxFloat32; /// A typedef for a 2-dimensional floating point value. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef float FfxFloat32x2[2]; /// A typedef for a 3-dimensional floating point value. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef float FfxFloat32x3[3]; /// A typedef for a 4-dimensional floating point value. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef float FfxFloat32x4[4]; /// A typedef for a 2-dimensional 32bit unsigned integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef uint32_t FfxUInt32x2[2]; /// A typedef for a 3-dimensional 32bit unsigned integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef uint32_t FfxUInt32x3[3]; /// A typedef for a 4-dimensional 32bit unsigned integer. /// -/// @ingroup CPU +/// @ingroup CPUTypes typedef uint32_t FfxUInt32x4[4]; #endif // #if defined(FFX_CPU) #if defined(FFX_HLSL) + +#define FfxFloat32Mat4 matrix +#define FfxFloat32Mat3 matrix + /// A typedef for a boolean value. /// -/// @ingroup GPU +/// @ingroup HLSLTypes typedef bool FfxBoolean; -#if FFX_HLSL_6_2 +#if FFX_HLSL_SM>=62 + +/// @defgroup HLSL62Types HLSL 6.2 And Above Types +/// HLSL 6.2 and above type defines for all commonly used variables +/// +/// @ingroup HLSLTypes + +/// A typedef for a floating point value. +/// +/// @ingroup HLSL62Types typedef float32_t FfxFloat32; + +/// A typedef for a 2-dimensional floating point value. +/// +/// @ingroup HLSL62Types typedef float32_t2 FfxFloat32x2; + +/// A typedef for a 3-dimensional floating point value. +/// +/// @ingroup HLSL62Types typedef float32_t3 FfxFloat32x3; + +/// A typedef for a 4-dimensional floating point value. +/// +/// @ingroup HLSL62Types typedef float32_t4 FfxFloat32x4; +/// A [cacao_placeholder] typedef for matrix type until confirmed. +typedef float4x4 FfxFloat32x4x4; +typedef float3x3 FfxFloat32x3x3; +typedef float2x2 FfxFloat32x2x2; + /// A typedef for a unsigned 32bit integer. /// -/// @ingroup GPU +/// @ingroup HLSL62Types typedef uint32_t FfxUInt32; + +/// A typedef for a 2-dimensional 32bit unsigned integer. +/// +/// @ingroup HLSL62Types typedef uint32_t2 FfxUInt32x2; + +/// A typedef for a 3-dimensional 32bit unsigned integer. +/// +/// @ingroup HLSL62Types typedef uint32_t3 FfxUInt32x3; + +/// A typedef for a 4-dimensional 32bit unsigned integer. +/// +/// @ingroup HLSL62Types typedef uint32_t4 FfxUInt32x4; + +/// A typedef for a signed 32bit integer. +/// +/// @ingroup HLSL62Types typedef int32_t FfxInt32; + +/// A typedef for a 2-dimensional signed 32bit integer. +/// +/// @ingroup HLSL62Types typedef int32_t2 FfxInt32x2; + +/// A typedef for a 3-dimensional signed 32bit integer. +/// +/// @ingroup HLSL62Types typedef int32_t3 FfxInt32x3; + +/// A typedef for a 4-dimensional signed 32bit integer. +/// +/// @ingroup HLSL62Types typedef int32_t4 FfxInt32x4; -#else + +#else // #if FFX_HLSL_SM>=62 + +/// @defgroup HLSLBaseTypes HLSL 6.1 And Below Types +/// HLSL 6.1 and below type defines for all commonly used variables +/// +/// @ingroup HLSLTypes + #define FfxFloat32 float #define FfxFloat32x2 float2 #define FfxFloat32x3 float3 #define FfxFloat32x4 float4 +/// A [cacao_placeholder] typedef for matrix type until confirmed. +#define FfxFloat32x4x4 float4x4 +#define FfxFloat32x3x3 float3x3 +#define FfxFloat32x2x2 float2x2 + /// A typedef for a unsigned 32bit integer. /// /// @ingroup GPU @@ -153,14 +228,18 @@ typedef uint FfxUInt32; typedef uint2 FfxUInt32x2; typedef uint3 FfxUInt32x3; typedef uint4 FfxUInt32x4; + typedef int FfxInt32; typedef int2 FfxInt32x2; typedef int3 FfxInt32x3; typedef int4 FfxInt32x4; -#endif // #if defined(FFX_HLSL_6_2) + +#endif // #if FFX_HLSL_SM>=62 #if FFX_HALF -#if FFX_HLSL_6_2 + +#if FFX_HLSL_SM >= 62 + typedef float16_t FfxFloat16; typedef float16_t2 FfxFloat16x2; typedef float16_t3 FfxFloat16x3; @@ -168,7 +247,7 @@ typedef float16_t4 FfxFloat16x4; /// A typedef for an unsigned 16bit integer. /// -/// @ingroup GPU +/// @ingroup HLSLTypes typedef uint16_t FfxUInt16; typedef uint16_t2 FfxUInt16x2; typedef uint16_t3 FfxUInt16x3; @@ -176,7 +255,7 @@ typedef uint16_t4 FfxUInt16x4; /// A typedef for a signed 16bit integer. /// -/// @ingroup GPU +/// @ingroup HLSLTypes typedef int16_t FfxInt16; typedef int16_t2 FfxInt16x2; typedef int16_t3 FfxInt16x3; @@ -204,7 +283,7 @@ typedef short FfxInt16; typedef short2 FfxInt16x2; typedef short3 FfxInt16x3; typedef short4 FfxInt16x4; -#else +#else // #if FFX_HLSL_SM>=62 typedef min16float FfxFloat16; typedef min16float2 FfxFloat16x2; typedef min16float3 FfxFloat16x3; @@ -212,7 +291,7 @@ typedef min16float4 FfxFloat16x4; /// A typedef for an unsigned 16bit integer. /// -/// @ingroup GPU +/// @ingroup HLSLTypes typedef min16uint FfxUInt16; typedef min16uint2 FfxUInt16x2; typedef min16uint3 FfxUInt16x3; @@ -220,19 +299,25 @@ typedef min16uint4 FfxUInt16x4; /// A typedef for a signed 16bit integer. /// -/// @ingroup GPU +/// @ingroup HLSLTypes typedef min16int FfxInt16; typedef min16int2 FfxInt16x2; typedef min16int3 FfxInt16x3; typedef min16int4 FfxInt16x4; -#endif // FFX_HLSL_6_2 +#endif // #if FFX_HLSL_SM>=62 + #endif // FFX_HALF + #endif // #if defined(FFX_HLSL) #if defined(FFX_GLSL) + +#define FfxFloat32Mat4 mat4 +#define FfxFloat32Mat3 mat3 + /// A typedef for a boolean value. /// -/// @ingroup GPU +/// @ingroup GLSLTypes #define FfxBoolean bool #define FfxFloat32 float #define FfxFloat32x2 vec2 @@ -246,6 +331,12 @@ typedef min16int4 FfxInt16x4; #define FfxInt32x2 ivec2 #define FfxInt32x3 ivec3 #define FfxInt32x4 ivec4 + +/// A [cacao_placeholder] typedef for matrix type until confirmed. +#define FfxFloat32x4x4 mat4 +#define FfxFloat32x3x3 mat3 +#define FfxFloat32x2x2 mat2 + #if FFX_HALF #define FfxFloat16 float16_t #define FfxFloat16x2 f16vec2 @@ -264,11 +355,11 @@ typedef min16int4 FfxInt16x4; // Global toggles: // #define FFX_HALF (1) -// #define FFX_HLSL_6_2 (1) +// #define FFX_HLSL_SM (62) -#if defined(FFX_HALF) && !defined(SHADER_API_PSSL) +#if FFX_HALF && !defined(SHADER_API_PSSL) -#if FFX_HLSL_6_2 +#if FFX_HLSL_SM >= 62 #define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType##16_t TypeName; #define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; @@ -278,7 +369,7 @@ typedef min16int4 FfxInt16x4; #define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; #define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix TypeName; -#else //FFX_HLSL_6_2 +#else //FFX_HLSL_SM>=62 #define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef min16##BaseComponentType TypeName; #define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; @@ -288,7 +379,7 @@ typedef min16int4 FfxInt16x4; #define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ); #define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ); -#endif //FFX_HLSL_6_2 +#endif //FFX_HLSL_SM>=62 #else //FFX_HALF diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_unity_common.cginc.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_common_types.h.meta similarity index 92% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_unity_common.cginc.meta rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_common_types.h.meta index 8393144..8d9b15f 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/ffx_fsr2_unity_common.cginc.meta +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_common_types.h.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bb2d4d4671c448698877526c29f2fc99 +guid: 7974b728d5c1b6d4a8a8e3965d03f96d PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core.h similarity index 66% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core.h index 4e687d6..02f6b3f 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,17 +19,40 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -/// @defgroup Core -/// @defgroup HLSL -/// @defgroup GLSL -/// @defgroup GPU -/// @defgroup CPU -/// @defgroup CAS -/// @defgroup FSR1 + +/// @defgroup FfxGPU GPU +/// The FidelityFX SDK GPU References +/// +/// @ingroup ffxSDK + +/// @defgroup FfxHLSL HLSL References +/// FidelityFX SDK HLSL GPU References +/// +/// @ingroup FfxGPU + +/// @defgroup FfxGLSL GLSL References +/// FidelityFX SDK GLSL GPU References +/// +/// @ingroup FfxGPU + +/// @defgroup FfxGPUEffects FidelityFX GPU References +/// FidelityFX Effect GPU Reference Documentation +/// +/// @ingroup FfxGPU + +/// @defgroup GPUCore GPU Core +/// GPU defines and functions +/// +/// @ingroup FfxGPU #if !defined(FFX_CORE_H) #define FFX_CORE_H +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic push +#pragma dxc diagnostic ignored "-Wambig-lit-shift" +#endif //__hlsl_dx_compiler + #include "ffx_common_types.h" #if defined(FFX_CPU) @@ -49,4 +72,9 @@ #include "ffx_core_gpu_common_half.h" #include "ffx_core_portability.h" #endif // #if defined(FFX_GPU) -#endif // #if !defined(FFX_CORE_H) \ No newline at end of file + +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic pop +#endif //__hlsl_dx_compiler + +#endif // #if !defined(FFX_CORE_H) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core.h.meta new file mode 100644 index 0000000..562741a --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: b91c5f52b89ff554dacb51045a802ed8 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_cpu.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_cpu.h similarity index 93% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_cpu.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_cpu.h index 3bf0295..865258d 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_cpu.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_cpu.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,23 +19,29 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + /// A define for a true value in a boolean expression. /// -/// @ingroup CPU +/// @ingroup CPUTypes #define FFX_TRUE (1) /// A define for a false value in a boolean expression. /// -/// @ingroup CPU +/// @ingroup CPUTypes #define FFX_FALSE (0) #if !defined(FFX_STATIC) /// A define to abstract declaration of static variables and functions. /// -/// @ingroup CPU +/// @ingroup CPUTypes #define FFX_STATIC static #endif // #if !defined(FFX_STATIC) +/// @defgroup CPUCore CPU Core +/// Core CPU-side defines and functions +/// +/// @ingroup ffxHost + #ifdef __clang__ #pragma clang diagnostic ignored "-Wunused-variable" #endif @@ -47,7 +53,7 @@ /// @returns /// An unsigned 32bit integer value containing the bit pattern of x. /// -/// @ingroup CPU +/// @ingroup CPUCore FFX_STATIC FfxUInt32 ffxAsUInt32(FfxFloat32 x) { union @@ -89,7 +95,7 @@ FFX_STATIC FfxFloat32 ffxDot4(FfxFloat32x4 a, FfxFloat32x4 b) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup CPU +/// @ingroup CPUCore FFX_STATIC FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t) { return y * t + (-x * t + x); @@ -102,10 +108,10 @@ FFX_STATIC FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t) /// @returns /// The reciprocal value of x. /// -/// @ingroup CPU -FFX_STATIC FfxFloat32 ffxReciprocal(FfxFloat32 a) +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxReciprocal(FfxFloat32 x) { - return 1.0f / a; + return 1.0f / x; } /// Compute the square root of a value. @@ -115,7 +121,7 @@ FFX_STATIC FfxFloat32 ffxReciprocal(FfxFloat32 a) /// @returns /// The the square root of x. /// -/// @ingroup CPU +/// @ingroup CPUCore FFX_STATIC FfxFloat32 ffxSqrt(FfxFloat32 x) { return sqrt(x); @@ -135,10 +141,10 @@ FFX_STATIC FfxUInt32 AShrSU1(FfxUInt32 a, FfxUInt32 b) /// @returns /// The fractional part of x. /// -/// @ingroup CPU -FFX_STATIC FfxFloat32 ffxFract(FfxFloat32 a) +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxFract(FfxFloat32 x) { - return a - floor(a); + return x - floor(x); } /// Compute the reciprocal square root of a value. @@ -148,10 +154,10 @@ FFX_STATIC FfxFloat32 ffxFract(FfxFloat32 a) /// @returns /// The reciprocal square root value of x. /// -/// @ingroup CPU -FFX_STATIC FfxFloat32 rsqrt(FfxFloat32 a) +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 rsqrt(FfxFloat32 x) { - return ffxReciprocal(ffxSqrt(a)); + return ffxReciprocal(ffxSqrt(x)); } FFX_STATIC FfxFloat32 ffxMin(FfxFloat32 x, FfxFloat32 y) @@ -181,10 +187,10 @@ FFX_STATIC FfxUInt32 ffxMax(FfxUInt32 x, FfxUInt32 y) /// @returns /// The clamped version of x. /// -/// @ingroup CPU -FFX_STATIC FfxFloat32 ffxSaturate(FfxFloat32 a) +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxSaturate(FfxFloat32 x) { - return ffxMin(1.0f, ffxMax(0.0f, a)); + return ffxMin(1.0f, ffxMax(0.0f, x)); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -245,7 +251,7 @@ FFX_STATIC void opARcpF3(FfxFloat32x3 d, FfxFloat32x3 a) /// @returns /// The closest 16bit floating point value to f. /// -/// @ingroup CPU +/// @ingroup CPUCore FFX_STATIC FfxUInt32 f32tof16(FfxFloat32 f) { static FfxUInt16 base[512] = { @@ -320,13 +326,13 @@ FFX_STATIC FfxUInt32 f32tof16(FfxFloat32 f) /// point representation, and then stores the X and Y components in the lower and upper 16 bits of the /// 32bit unsigned integer respectively. /// -/// @param [in] value A 2-dimensional floating point value to convert and pack. +/// @param [in] x A 2-dimensional floating point value to convert and pack. /// /// @returns /// A packed 32bit value containing 2 16bit floating point values. /// -/// @ingroup CPU -FFX_STATIC FfxUInt32 packHalf2x16(FfxFloat32x2 a) +/// @ingroup CPUCore +FFX_STATIC FfxUInt32 packHalf2x16(FfxFloat32x2 x) { - return f32tof16(a[0]) + (f32tof16(a[1]) << 16); + return f32tof16(x[0]) + (f32tof16(x[1]) << 16); } diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_cpu.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_cpu.h.meta new file mode 100644 index 0000000..9aed874 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_cpu.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 4c88c0b7a4dec1e479272449c19ca981 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common.h similarity index 91% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common.h index ae07642..2f687df 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,31 +19,35 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + /// A define for a true value in a boolean expression. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_TRUE (true) /// A define for a false value in a boolean expression. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_FALSE (false) /// A define value for positive infinity. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_POSITIVE_INFINITY_FLOAT ffxAsFloat(0x7f800000u) /// A define value for negative infinity. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_NEGATIVE_INFINITY_FLOAT ffxAsFloat(0xff800000u) /// A define value for PI. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_PI (3.14159) +FFX_STATIC const FfxFloat32 FFX_FP16_MIN = 6.10e-05f; +FFX_STATIC const FfxFloat32 FFX_FP16_MAX = 65504.0f; +FFX_STATIC const FfxFloat32 FFX_TONEMAP_EPSILON = 1.0f / FFX_FP16_MAX; /// Compute the reciprocal of value. /// @@ -52,7 +56,7 @@ /// @returns /// The 1 / value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxReciprocal(FfxFloat32 value) { return rcp(value); @@ -65,7 +69,7 @@ FfxFloat32 ffxReciprocal(FfxFloat32 value) /// @returns /// The 1 / value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxReciprocal(FfxFloat32x2 value) { return rcp(value); @@ -78,7 +82,7 @@ FfxFloat32x2 ffxReciprocal(FfxFloat32x2 value) /// @returns /// The 1 / value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxReciprocal(FfxFloat32x3 value) { return rcp(value); @@ -91,7 +95,7 @@ FfxFloat32x3 ffxReciprocal(FfxFloat32x3 value) /// @returns /// The 1 / value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxReciprocal(FfxFloat32x4 value) { return rcp(value); @@ -105,7 +109,7 @@ FfxFloat32x4 ffxReciprocal(FfxFloat32x4 value) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxMin(FfxFloat32 x, FfxFloat32 y) { return min(x, y); @@ -119,7 +123,7 @@ FfxFloat32 ffxMin(FfxFloat32 x, FfxFloat32 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxMin(FfxFloat32x2 x, FfxFloat32x2 y) { return min(x, y); @@ -133,7 +137,7 @@ FfxFloat32x2 ffxMin(FfxFloat32x2 x, FfxFloat32x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxMin(FfxFloat32x3 x, FfxFloat32x3 y) { return min(x, y); @@ -147,7 +151,7 @@ FfxFloat32x3 ffxMin(FfxFloat32x3 x, FfxFloat32x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxMin(FfxFloat32x4 x, FfxFloat32x4 y) { return min(x, y); @@ -161,7 +165,7 @@ FfxFloat32x4 ffxMin(FfxFloat32x4 x, FfxFloat32x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32 ffxMin(FfxInt32 x, FfxInt32 y) { return min(x, y); @@ -175,7 +179,7 @@ FfxInt32 ffxMin(FfxInt32 x, FfxInt32 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32x2 ffxMin(FfxInt32x2 x, FfxInt32x2 y) { return min(x, y); @@ -189,7 +193,7 @@ FfxInt32x2 ffxMin(FfxInt32x2 x, FfxInt32x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32x3 ffxMin(FfxInt32x3 x, FfxInt32x3 y) { return min(x, y); @@ -203,7 +207,7 @@ FfxInt32x3 ffxMin(FfxInt32x3 x, FfxInt32x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32x4 ffxMin(FfxInt32x4 x, FfxInt32x4 y) { return min(x, y); @@ -217,7 +221,7 @@ FfxInt32x4 ffxMin(FfxInt32x4 x, FfxInt32x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxMin(FfxUInt32 x, FfxUInt32 y) { return min(x, y); @@ -231,7 +235,7 @@ FfxUInt32 ffxMin(FfxUInt32 x, FfxUInt32 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxMin(FfxUInt32x2 x, FfxUInt32x2 y) { return min(x, y); @@ -245,7 +249,7 @@ FfxUInt32x2 ffxMin(FfxUInt32x2 x, FfxUInt32x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x3 ffxMin(FfxUInt32x3 x, FfxUInt32x3 y) { return min(x, y); @@ -259,7 +263,7 @@ FfxUInt32x3 ffxMin(FfxUInt32x3 x, FfxUInt32x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x4 ffxMin(FfxUInt32x4 x, FfxUInt32x4 y) { return min(x, y); @@ -273,7 +277,7 @@ FfxUInt32x4 ffxMin(FfxUInt32x4 x, FfxUInt32x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxMax(FfxFloat32 x, FfxFloat32 y) { return max(x, y); @@ -287,7 +291,7 @@ FfxFloat32 ffxMax(FfxFloat32 x, FfxFloat32 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxMax(FfxFloat32x2 x, FfxFloat32x2 y) { return max(x, y); @@ -301,7 +305,7 @@ FfxFloat32x2 ffxMax(FfxFloat32x2 x, FfxFloat32x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxMax(FfxFloat32x3 x, FfxFloat32x3 y) { return max(x, y); @@ -315,7 +319,7 @@ FfxFloat32x3 ffxMax(FfxFloat32x3 x, FfxFloat32x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxMax(FfxFloat32x4 x, FfxFloat32x4 y) { return max(x, y); @@ -329,7 +333,7 @@ FfxFloat32x4 ffxMax(FfxFloat32x4 x, FfxFloat32x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32 ffxMax(FfxInt32 x, FfxInt32 y) { return max(x, y); @@ -343,7 +347,7 @@ FfxInt32 ffxMax(FfxInt32 x, FfxInt32 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32x2 ffxMax(FfxInt32x2 x, FfxInt32x2 y) { return max(x, y); @@ -357,7 +361,7 @@ FfxInt32x2 ffxMax(FfxInt32x2 x, FfxInt32x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32x3 ffxMax(FfxInt32x3 x, FfxInt32x3 y) { return max(x, y); @@ -371,7 +375,7 @@ FfxInt32x3 ffxMax(FfxInt32x3 x, FfxInt32x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt32x4 ffxMax(FfxInt32x4 x, FfxInt32x4 y) { return max(x, y); @@ -385,7 +389,7 @@ FfxInt32x4 ffxMax(FfxInt32x4 x, FfxInt32x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxMax(FfxUInt32 x, FfxUInt32 y) { return max(x, y); @@ -399,7 +403,7 @@ FfxUInt32 ffxMax(FfxUInt32 x, FfxUInt32 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxMax(FfxUInt32x2 x, FfxUInt32x2 y) { return max(x, y); @@ -413,7 +417,7 @@ FfxUInt32x2 ffxMax(FfxUInt32x2 x, FfxUInt32x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x3 ffxMax(FfxUInt32x3 x, FfxUInt32x3 y) { return max(x, y); @@ -427,7 +431,7 @@ FfxUInt32x3 ffxMax(FfxUInt32x3 x, FfxUInt32x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x4 ffxMax(FfxUInt32x4 x, FfxUInt32x4 y) { return max(x, y); @@ -441,7 +445,7 @@ FfxUInt32x4 ffxMax(FfxUInt32x4 x, FfxUInt32x4 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxPow(FfxFloat32 x, FfxFloat32 y) { return pow(x, y); @@ -455,7 +459,7 @@ FfxFloat32 ffxPow(FfxFloat32 x, FfxFloat32 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxPow(FfxFloat32x2 x, FfxFloat32x2 y) { return pow(x, y); @@ -469,7 +473,7 @@ FfxFloat32x2 ffxPow(FfxFloat32x2 x, FfxFloat32x2 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxPow(FfxFloat32x3 x, FfxFloat32x3 y) { return pow(x, y); @@ -483,7 +487,7 @@ FfxFloat32x3 ffxPow(FfxFloat32x3 x, FfxFloat32x3 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxPow(FfxFloat32x4 x, FfxFloat32x4 y) { return pow(x, y); @@ -496,7 +500,7 @@ FfxFloat32x4 ffxPow(FfxFloat32x4 x, FfxFloat32x4 y) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxSqrt(FfxFloat32 x) { return sqrt(x); @@ -509,7 +513,7 @@ FfxFloat32 ffxSqrt(FfxFloat32 x) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxSqrt(FfxFloat32x2 x) { return sqrt(x); @@ -522,7 +526,7 @@ FfxFloat32x2 ffxSqrt(FfxFloat32x2 x) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxSqrt(FfxFloat32x3 x) { return sqrt(x); @@ -535,7 +539,7 @@ FfxFloat32x3 ffxSqrt(FfxFloat32x3 x) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxSqrt(FfxFloat32x4 x) { return sqrt(x); @@ -549,7 +553,7 @@ FfxFloat32x4 ffxSqrt(FfxFloat32x4 x) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxCopySignBit(FfxFloat32 d, FfxFloat32 s) { return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & FfxUInt32(0x80000000u))); @@ -563,7 +567,7 @@ FfxFloat32 ffxCopySignBit(FfxFloat32 d, FfxFloat32 s) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxCopySignBit(FfxFloat32x2 d, FfxFloat32x2 s) { return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & ffxBroadcast2(0x80000000u))); @@ -577,7 +581,7 @@ FfxFloat32x2 ffxCopySignBit(FfxFloat32x2 d, FfxFloat32x2 s) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxCopySignBit(FfxFloat32x3 d, FfxFloat32x3 s) { return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & ffxBroadcast3(0x80000000u))); @@ -591,7 +595,7 @@ FfxFloat32x3 ffxCopySignBit(FfxFloat32x3 d, FfxFloat32x3 s) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxCopySignBit(FfxFloat32x4 d, FfxFloat32x4 s) { return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & ffxBroadcast4(0x80000000u))); @@ -614,7 +618,7 @@ FfxFloat32x4 ffxCopySignBit(FfxFloat32x4 d, FfxFloat32x4 s) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or position. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxIsSigned(FfxFloat32 m) { return ffxSaturate(m * FfxFloat32(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -637,7 +641,7 @@ FfxFloat32 ffxIsSigned(FfxFloat32 m) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or position. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxIsSigned(FfxFloat32x2 m) { return ffxSaturate(m * ffxBroadcast2(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -660,7 +664,7 @@ FfxFloat32x2 ffxIsSigned(FfxFloat32x2 m) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or position. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxIsSigned(FfxFloat32x3 m) { return ffxSaturate(m * ffxBroadcast3(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -683,7 +687,7 @@ FfxFloat32x3 ffxIsSigned(FfxFloat32x3 m) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or positive. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxIsSigned(FfxFloat32x4 m) { return ffxSaturate(m * ffxBroadcast4(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -701,7 +705,7 @@ FfxFloat32x4 ffxIsSigned(FfxFloat32x4 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxIsGreaterThanZero(FfxFloat32 m) { return ffxSaturate(m * FfxFloat32(FFX_POSITIVE_INFINITY_FLOAT)); @@ -719,7 +723,7 @@ FfxFloat32 ffxIsGreaterThanZero(FfxFloat32 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxIsGreaterThanZero(FfxFloat32x2 m) { return ffxSaturate(m * ffxBroadcast2(FFX_POSITIVE_INFINITY_FLOAT)); @@ -737,7 +741,7 @@ FfxFloat32x2 ffxIsGreaterThanZero(FfxFloat32x2 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxIsGreaterThanZero(FfxFloat32x3 m) { return ffxSaturate(m * ffxBroadcast3(FFX_POSITIVE_INFINITY_FLOAT)); @@ -755,7 +759,7 @@ FfxFloat32x3 ffxIsGreaterThanZero(FfxFloat32x3 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxIsGreaterThanZero(FfxFloat32x4 m) { return ffxSaturate(m * ffxBroadcast4(FFX_POSITIVE_INFINITY_FLOAT)); @@ -775,7 +779,7 @@ FfxFloat32x4 ffxIsGreaterThanZero(FfxFloat32x4 m) /// @returns /// The sortable integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxFloatToSortableInteger(FfxUInt32 value) { return value ^ ((AShrSU1(value, FfxUInt32(31))) | FfxUInt32(0x80000000)); @@ -792,7 +796,7 @@ FfxUInt32 ffxFloatToSortableInteger(FfxUInt32 value) /// @returns /// The sortable integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxSortableIntegerToFloat(FfxUInt32 value) { return value ^ ((~AShrSU1(value, FfxUInt32(31))) | FfxUInt32(0x80000000)); @@ -811,10 +815,10 @@ FfxUInt32 ffxSortableIntegerToFloat(FfxUInt32 value) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32 ffxApproximateSqrt(FfxFloat32 a) +/// @ingroup GPUCore +FfxFloat32 ffxApproximateSqrt(FfxFloat32 value) { - return ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(1)) + FfxUInt32(0x1fbc4639)); + return ffxAsFloat((ffxAsUInt32(value) >> FfxUInt32(1)) + FfxUInt32(0x1fbc4639)); } /// Calculate a low-quality approximation for the reciprocal of a value. @@ -830,10 +834,10 @@ FfxFloat32 ffxApproximateSqrt(FfxFloat32 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32 ffxApproximateReciprocal(FfxFloat32 a) +/// @ingroup GPUCore +FfxFloat32 ffxApproximateReciprocal(FfxFloat32 value) { - return ffxAsFloat(FfxUInt32(0x7ef07ebb) - ffxAsUInt32(a)); + return ffxAsFloat(FfxUInt32(0x7ef07ebb) - ffxAsUInt32(value)); } /// Calculate a medium-quality approximation for the reciprocal of a value. @@ -849,7 +853,7 @@ FfxFloat32 ffxApproximateReciprocal(FfxFloat32 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximateReciprocalMedium(FfxFloat32 value) { FfxFloat32 b = ffxAsFloat(FfxUInt32(0x7ef19fff) - ffxAsUInt32(value)); @@ -869,10 +873,10 @@ FfxFloat32 ffxApproximateReciprocalMedium(FfxFloat32 value) /// @returns /// An approximation of the reciprocal square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32 ffxApproximateReciprocalSquareRoot(FfxFloat32 a) +/// @ingroup GPUCore +FfxFloat32 ffxApproximateReciprocalSquareRoot(FfxFloat32 value) { - return ffxAsFloat(FfxUInt32(0x5f347d74) - (ffxAsUInt32(a) >> FfxUInt32(1))); + return ffxAsFloat(FfxUInt32(0x5f347d74) - (ffxAsUInt32(value) >> FfxUInt32(1))); } /// Calculate a low-quality approximation for the square root of a value. @@ -888,10 +892,10 @@ FfxFloat32 ffxApproximateReciprocalSquareRoot(FfxFloat32 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x2 ffxApproximateSqrt(FfxFloat32x2 a) +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateSqrt(FfxFloat32x2 value) { - return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(1u)) + ffxBroadcast2(0x1fbc4639u)); + return ffxAsFloat((ffxAsUInt32(value) >> ffxBroadcast2(1u)) + ffxBroadcast2(0x1fbc4639u)); } /// Calculate a low-quality approximation for the reciprocal of a value. @@ -907,10 +911,10 @@ FfxFloat32x2 ffxApproximateSqrt(FfxFloat32x2 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x2 ffxApproximateReciprocal(FfxFloat32x2 a) +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateReciprocal(FfxFloat32x2 value) { - return ffxAsFloat(ffxBroadcast2(0x7ef07ebbu) - ffxAsUInt32(a)); + return ffxAsFloat(ffxBroadcast2(0x7ef07ebbu) - ffxAsUInt32(value)); } /// Calculate a medium-quality approximation for the reciprocal of a value. @@ -926,11 +930,11 @@ FfxFloat32x2 ffxApproximateReciprocal(FfxFloat32x2 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU -FfxFloat32x2 ffxApproximateReciprocalMedium(FfxFloat32x2 a) +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateReciprocalMedium(FfxFloat32x2 value) { - FfxFloat32x2 b = ffxAsFloat(ffxBroadcast2(0x7ef19fffu) - ffxAsUInt32(a)); - return b * (-b * a + ffxBroadcast2(2.0f)); + FfxFloat32x2 b = ffxAsFloat(ffxBroadcast2(0x7ef19fffu) - ffxAsUInt32(value)); + return b * (-b * value + ffxBroadcast2(2.0f)); } /// Calculate a low-quality approximation for the square root of a value. @@ -946,10 +950,10 @@ FfxFloat32x2 ffxApproximateReciprocalMedium(FfxFloat32x2 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x2 ffxApproximateReciprocalSquareRoot(FfxFloat32x2 a) +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateReciprocalSquareRoot(FfxFloat32x2 value) { - return ffxAsFloat(ffxBroadcast2(0x5f347d74u) - (ffxAsUInt32(a) >> ffxBroadcast2(1u))); + return ffxAsFloat(ffxBroadcast2(0x5f347d74u) - (ffxAsUInt32(value) >> ffxBroadcast2(1u))); } /// Calculate a low-quality approximation for the square root of a value. @@ -965,10 +969,10 @@ FfxFloat32x2 ffxApproximateReciprocalSquareRoot(FfxFloat32x2 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x3 ffxApproximateSqrt(FfxFloat32x3 a) +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateSqrt(FfxFloat32x3 value) { - return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(1u)) + ffxBroadcast3(0x1fbc4639u)); + return ffxAsFloat((ffxAsUInt32(value) >> ffxBroadcast3(1u)) + ffxBroadcast3(0x1fbc4639u)); } /// Calculate a low-quality approximation for the reciprocal of a value. @@ -984,10 +988,10 @@ FfxFloat32x3 ffxApproximateSqrt(FfxFloat32x3 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x3 ffxApproximateReciprocal(FfxFloat32x3 a) +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateReciprocal(FfxFloat32x3 value) { - return ffxAsFloat(ffxBroadcast3(0x7ef07ebbu) - ffxAsUInt32(a)); + return ffxAsFloat(ffxBroadcast3(0x7ef07ebbu) - ffxAsUInt32(value)); } /// Calculate a medium-quality approximation for the reciprocal of a value. @@ -1003,11 +1007,11 @@ FfxFloat32x3 ffxApproximateReciprocal(FfxFloat32x3 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU -FfxFloat32x3 ffxApproximateReciprocalMedium(FfxFloat32x3 a) +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateReciprocalMedium(FfxFloat32x3 value) { - FfxFloat32x3 b = ffxAsFloat(ffxBroadcast3(0x7ef19fffu) - ffxAsUInt32(a)); - return b * (-b * a + ffxBroadcast3(2.0f)); + FfxFloat32x3 b = ffxAsFloat(ffxBroadcast3(0x7ef19fffu) - ffxAsUInt32(value)); + return b * (-b * value + ffxBroadcast3(2.0f)); } /// Calculate a low-quality approximation for the square root of a value. @@ -1023,10 +1027,10 @@ FfxFloat32x3 ffxApproximateReciprocalMedium(FfxFloat32x3 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x3 ffxApproximateReciprocalSquareRoot(FfxFloat32x3 a) +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateReciprocalSquareRoot(FfxFloat32x3 value) { - return ffxAsFloat(ffxBroadcast3(0x5f347d74u) - (ffxAsUInt32(a) >> ffxBroadcast3(1u))); + return ffxAsFloat(ffxBroadcast3(0x5f347d74u) - (ffxAsUInt32(value) >> ffxBroadcast3(1u))); } /// Calculate a low-quality approximation for the square root of a value. @@ -1042,10 +1046,10 @@ FfxFloat32x3 ffxApproximateReciprocalSquareRoot(FfxFloat32x3 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x4 ffxApproximateSqrt(FfxFloat32x4 a) +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateSqrt(FfxFloat32x4 value) { - return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(1u)) + ffxBroadcast4(0x1fbc4639u)); + return ffxAsFloat((ffxAsUInt32(value) >> ffxBroadcast4(1u)) + ffxBroadcast4(0x1fbc4639u)); } /// Calculate a low-quality approximation for the reciprocal of a value. @@ -1061,10 +1065,10 @@ FfxFloat32x4 ffxApproximateSqrt(FfxFloat32x4 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x4 ffxApproximateReciprocal(FfxFloat32x4 a) +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateReciprocal(FfxFloat32x4 value) { - return ffxAsFloat(ffxBroadcast4(0x7ef07ebbu) - ffxAsUInt32(a)); + return ffxAsFloat(ffxBroadcast4(0x7ef07ebbu) - ffxAsUInt32(value)); } /// Calculate a medium-quality approximation for the reciprocal of a value. @@ -1080,11 +1084,11 @@ FfxFloat32x4 ffxApproximateReciprocal(FfxFloat32x4 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU -FfxFloat32x4 ffxApproximateReciprocalMedium(FfxFloat32x4 a) +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateReciprocalMedium(FfxFloat32x4 value) { - FfxFloat32x4 b = ffxAsFloat(ffxBroadcast4(0x7ef19fffu) - ffxAsUInt32(a)); - return b * (-b * a + ffxBroadcast4(2.0f)); + FfxFloat32x4 b = ffxAsFloat(ffxBroadcast4(0x7ef19fffu) - ffxAsUInt32(value)); + return b * (-b * value + ffxBroadcast4(2.0f)); } /// Calculate a low-quality approximation for the square root of a value. @@ -1100,10 +1104,10 @@ FfxFloat32x4 ffxApproximateReciprocalMedium(FfxFloat32x4 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU -FfxFloat32x4 ffxApproximateReciprocalSquareRoot(FfxFloat32x4 a) +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateReciprocalSquareRoot(FfxFloat32x4 value) { - return ffxAsFloat(ffxBroadcast4(0x5f347d74u) - (ffxAsUInt32(a) >> ffxBroadcast4(1u))); + return ffxAsFloat(ffxBroadcast4(0x5f347d74u) - (ffxAsUInt32(value) >> ffxBroadcast4(1u))); } /// Calculate dot product of 'a' and 'b'. @@ -1114,7 +1118,7 @@ FfxFloat32x4 ffxApproximateReciprocalSquareRoot(FfxFloat32x4 a) /// @returns /// The value of a dot b. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxDot2(FfxFloat32x2 a, FfxFloat32x2 b) { return dot(a, b); @@ -1128,7 +1132,7 @@ FfxFloat32 ffxDot2(FfxFloat32x2 a, FfxFloat32x2 b) /// @returns /// The value of a dot b. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxDot3(FfxFloat32x3 a, FfxFloat32x3 b) { return dot(a, b); @@ -1142,7 +1146,7 @@ FfxFloat32 ffxDot3(FfxFloat32x3 a, FfxFloat32x3 b) /// @returns /// The value of a dot b. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxDot4(FfxFloat32x4 a, FfxFloat32x4 b) { return dot(a, b); @@ -1160,7 +1164,7 @@ FfxFloat32 ffxDot4(FfxFloat32x4 a, FfxFloat32x4 b) /// @returns /// The value a converted into Gamma2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximatePQToGamma2Medium(FfxFloat32 a) { return a * a * a * a; @@ -1177,7 +1181,7 @@ FfxFloat32 ffxApproximatePQToGamma2Medium(FfxFloat32 a) /// @returns /// The value a converted into linear. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximatePQToLinear(FfxFloat32 a) { return a * a * a * a * a * a * a * a; @@ -1194,7 +1198,7 @@ FfxFloat32 ffxApproximatePQToLinear(FfxFloat32 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximateGamma2ToPQ(FfxFloat32 a) { return ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(2)) + FfxUInt32(0x2F9A4E46)); @@ -1211,7 +1215,7 @@ FfxFloat32 ffxApproximateGamma2ToPQ(FfxFloat32 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximateGamma2ToPQMedium(FfxFloat32 a) { FfxFloat32 b = ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(2)) + FfxUInt32(0x2F9A4E46)); @@ -1230,7 +1234,7 @@ FfxFloat32 ffxApproximateGamma2ToPQMedium(FfxFloat32 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximateGamma2ToPQHigh(FfxFloat32 a) { return ffxSqrt(ffxSqrt(a)); @@ -1247,7 +1251,7 @@ FfxFloat32 ffxApproximateGamma2ToPQHigh(FfxFloat32 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximateLinearToPQ(FfxFloat32 a) { return ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(3)) + FfxUInt32(0x378D8723)); @@ -1264,7 +1268,7 @@ FfxFloat32 ffxApproximateLinearToPQ(FfxFloat32 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximateLinearToPQMedium(FfxFloat32 a) { FfxFloat32 b = ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(3)) + FfxUInt32(0x378D8723)); @@ -1283,7 +1287,7 @@ FfxFloat32 ffxApproximateLinearToPQMedium(FfxFloat32 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxApproximateLinearToPQHigh(FfxFloat32 a) { return ffxSqrt(ffxSqrt(ffxSqrt(a))); @@ -1300,7 +1304,7 @@ FfxFloat32 ffxApproximateLinearToPQHigh(FfxFloat32 a) /// @returns /// The value a converted into Gamma2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximatePQToGamma2Medium(FfxFloat32x2 a) { return a * a * a * a; @@ -1317,7 +1321,7 @@ FfxFloat32x2 ffxApproximatePQToGamma2Medium(FfxFloat32x2 a) /// @returns /// The value a converted into linear. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximatePQToLinear(FfxFloat32x2 a) { return a * a * a * a * a * a * a * a; @@ -1334,7 +1338,7 @@ FfxFloat32x2 ffxApproximatePQToLinear(FfxFloat32x2 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximateGamma2ToPQ(FfxFloat32x2 a) { return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(2u)) + ffxBroadcast2(0x2F9A4E46u)); @@ -1351,7 +1355,7 @@ FfxFloat32x2 ffxApproximateGamma2ToPQ(FfxFloat32x2 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximateGamma2ToPQMedium(FfxFloat32x2 a) { FfxFloat32x2 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(2u)) + ffxBroadcast2(0x2F9A4E46u)); @@ -1370,7 +1374,7 @@ FfxFloat32x2 ffxApproximateGamma2ToPQMedium(FfxFloat32x2 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximateGamma2ToPQHigh(FfxFloat32x2 a) { return ffxSqrt(ffxSqrt(a)); @@ -1387,7 +1391,7 @@ FfxFloat32x2 ffxApproximateGamma2ToPQHigh(FfxFloat32x2 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximateLinearToPQ(FfxFloat32x2 a) { return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(3u)) + ffxBroadcast2(0x378D8723u)); @@ -1404,7 +1408,7 @@ FfxFloat32x2 ffxApproximateLinearToPQ(FfxFloat32x2 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximateLinearToPQMedium(FfxFloat32x2 a) { FfxFloat32x2 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(3u)) + ffxBroadcast2(0x378D8723u)); @@ -1423,7 +1427,7 @@ FfxFloat32x2 ffxApproximateLinearToPQMedium(FfxFloat32x2 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxApproximateLinearToPQHigh(FfxFloat32x2 a) { return ffxSqrt(ffxSqrt(ffxSqrt(a))); @@ -1440,7 +1444,7 @@ FfxFloat32x2 ffxApproximateLinearToPQHigh(FfxFloat32x2 a) /// @returns /// The value a converted into Gamma2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximatePQToGamma2Medium(FfxFloat32x3 a) { return a * a * a * a; @@ -1457,7 +1461,7 @@ FfxFloat32x3 ffxApproximatePQToGamma2Medium(FfxFloat32x3 a) /// @returns /// The value a converted into linear. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximatePQToLinear(FfxFloat32x3 a) { return a * a * a * a * a * a * a * a; @@ -1474,7 +1478,7 @@ FfxFloat32x3 ffxApproximatePQToLinear(FfxFloat32x3 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximateGamma2ToPQ(FfxFloat32x3 a) { return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(2u)) + ffxBroadcast3(0x2F9A4E46u)); @@ -1491,7 +1495,7 @@ FfxFloat32x3 ffxApproximateGamma2ToPQ(FfxFloat32x3 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximateGamma2ToPQMedium(FfxFloat32x3 a) { FfxFloat32x3 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(2u)) + ffxBroadcast3(0x2F9A4E46u)); @@ -1510,7 +1514,7 @@ FfxFloat32x3 ffxApproximateGamma2ToPQMedium(FfxFloat32x3 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximateGamma2ToPQHigh(FfxFloat32x3 a) { return ffxSqrt(ffxSqrt(a)); @@ -1527,7 +1531,7 @@ FfxFloat32x3 ffxApproximateGamma2ToPQHigh(FfxFloat32x3 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximateLinearToPQ(FfxFloat32x3 a) { return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(3u)) + ffxBroadcast3(0x378D8723u)); @@ -1544,7 +1548,7 @@ FfxFloat32x3 ffxApproximateLinearToPQ(FfxFloat32x3 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximateLinearToPQMedium(FfxFloat32x3 a) { FfxFloat32x3 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(3u)) + ffxBroadcast3(0x378D8723u)); @@ -1563,7 +1567,7 @@ FfxFloat32x3 ffxApproximateLinearToPQMedium(FfxFloat32x3 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxApproximateLinearToPQHigh(FfxFloat32x3 a) { return ffxSqrt(ffxSqrt(ffxSqrt(a))); @@ -1580,7 +1584,7 @@ FfxFloat32x3 ffxApproximateLinearToPQHigh(FfxFloat32x3 a) /// @returns /// The value a converted into Gamma2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximatePQToGamma2Medium(FfxFloat32x4 a) { return a * a * a * a; @@ -1597,7 +1601,7 @@ FfxFloat32x4 ffxApproximatePQToGamma2Medium(FfxFloat32x4 a) /// @returns /// The value a converted into linear. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximatePQToLinear(FfxFloat32x4 a) { return a * a * a * a * a * a * a * a; @@ -1614,7 +1618,7 @@ FfxFloat32x4 ffxApproximatePQToLinear(FfxFloat32x4 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximateGamma2ToPQ(FfxFloat32x4 a) { return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(2u)) + ffxBroadcast4(0x2F9A4E46u)); @@ -1631,7 +1635,7 @@ FfxFloat32x4 ffxApproximateGamma2ToPQ(FfxFloat32x4 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximateGamma2ToPQMedium(FfxFloat32x4 a) { FfxFloat32x4 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(2u)) + ffxBroadcast4(0x2F9A4E46u)); @@ -1650,7 +1654,7 @@ FfxFloat32x4 ffxApproximateGamma2ToPQMedium(FfxFloat32x4 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximateGamma2ToPQHigh(FfxFloat32x4 a) { return ffxSqrt(ffxSqrt(a)); @@ -1667,7 +1671,7 @@ FfxFloat32x4 ffxApproximateGamma2ToPQHigh(FfxFloat32x4 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximateLinearToPQ(FfxFloat32x4 a) { return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(3u)) + ffxBroadcast4(0x378D8723u)); @@ -1684,7 +1688,7 @@ FfxFloat32x4 ffxApproximateLinearToPQ(FfxFloat32x4 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximateLinearToPQMedium(FfxFloat32x4 a) { FfxFloat32x4 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(3u)) + ffxBroadcast4(0x378D8723u)); @@ -1703,7 +1707,7 @@ FfxFloat32x4 ffxApproximateLinearToPQMedium(FfxFloat32x4 a) /// @returns /// The value a converted into PQ. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxApproximateLinearToPQHigh(FfxFloat32x4 a) { return ffxSqrt(ffxSqrt(ffxSqrt(a))); @@ -1793,7 +1797,7 @@ FfxFloat32x2 ffxParabolicSinCos(FfxFloat32 x) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxZeroOneAnd(FfxUInt32 x, FfxUInt32 y) { return min(x, y); @@ -1807,7 +1811,7 @@ FfxUInt32 ffxZeroOneAnd(FfxUInt32 x, FfxUInt32 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxZeroOneAnd(FfxUInt32x2 x, FfxUInt32x2 y) { return min(x, y); @@ -1821,7 +1825,7 @@ FfxUInt32x2 ffxZeroOneAnd(FfxUInt32x2 x, FfxUInt32x2 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x3 ffxZeroOneAnd(FfxUInt32x3 x, FfxUInt32x3 y) { return min(x, y); @@ -1835,7 +1839,7 @@ FfxUInt32x3 ffxZeroOneAnd(FfxUInt32x3 x, FfxUInt32x3 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x4 ffxZeroOneAnd(FfxUInt32x4 x, FfxUInt32x4 y) { return min(x, y); @@ -1844,12 +1848,11 @@ FfxUInt32x4 ffxZeroOneAnd(FfxUInt32x4 x, FfxUInt32x4 y) /// Conditional free logic NOT operation using two values. /// /// @param [in] x The first value to be fed into the NOT operator. -/// @param [in] y The second value to be fed into the NOT operator. /// /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxZeroOneAnd(FfxUInt32 x) { return x ^ FfxUInt32(1); @@ -1858,12 +1861,11 @@ FfxUInt32 ffxZeroOneAnd(FfxUInt32 x) /// Conditional free logic NOT operation using two values. /// /// @param [in] x The first value to be fed into the NOT operator. -/// @param [in] y The second value to be fed into the NOT operator. /// /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxZeroOneAnd(FfxUInt32x2 x) { return x ^ ffxBroadcast2(1u); @@ -1872,12 +1874,11 @@ FfxUInt32x2 ffxZeroOneAnd(FfxUInt32x2 x) /// Conditional free logic NOT operation using two values. /// /// @param [in] x The first value to be fed into the NOT operator. -/// @param [in] y The second value to be fed into the NOT operator. /// /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x3 ffxZeroOneAnd(FfxUInt32x3 x) { return x ^ ffxBroadcast3(1u); @@ -1886,12 +1887,11 @@ FfxUInt32x3 ffxZeroOneAnd(FfxUInt32x3 x) /// Conditional free logic NOT operation using two values. /// /// @param [in] x The first value to be fed into the NOT operator. -/// @param [in] y The second value to be fed into the NOT operator. /// /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x4 ffxZeroOneAnd(FfxUInt32x4 x) { return x ^ ffxBroadcast4(1u); @@ -1905,7 +1905,7 @@ FfxUInt32x4 ffxZeroOneAnd(FfxUInt32x4 x) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxZeroOneOr(FfxUInt32 x, FfxUInt32 y) { return max(x, y); @@ -1919,7 +1919,7 @@ FfxUInt32 ffxZeroOneOr(FfxUInt32 x, FfxUInt32 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxZeroOneOr(FfxUInt32x2 x, FfxUInt32x2 y) { return max(x, y); @@ -1933,7 +1933,7 @@ FfxUInt32x2 ffxZeroOneOr(FfxUInt32x2 x, FfxUInt32x2 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x3 ffxZeroOneOr(FfxUInt32x3 x, FfxUInt32x3 y) { return max(x, y); @@ -1947,7 +1947,7 @@ FfxUInt32x3 ffxZeroOneOr(FfxUInt32x3 x, FfxUInt32x3 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x4 ffxZeroOneOr(FfxUInt32x4 x, FfxUInt32x4 y) { return max(x, y); @@ -1960,7 +1960,7 @@ FfxUInt32x4 ffxZeroOneOr(FfxUInt32x4 x, FfxUInt32x4 y) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxZeroOneAndToU1(FfxFloat32 x) { return FfxUInt32(FfxFloat32(1.0) - x); @@ -1973,7 +1973,7 @@ FfxUInt32 ffxZeroOneAndToU1(FfxFloat32 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxZeroOneAndToU2(FfxFloat32x2 x) { return FfxUInt32x2(ffxBroadcast2(1.0) - x); @@ -1986,7 +1986,7 @@ FfxUInt32x2 ffxZeroOneAndToU2(FfxFloat32x2 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x3 ffxZeroOneAndToU3(FfxFloat32x3 x) { return FfxUInt32x3(ffxBroadcast3(1.0) - x); @@ -1999,7 +1999,7 @@ FfxUInt32x3 ffxZeroOneAndToU3(FfxFloat32x3 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x4 ffxZeroOneAndToU4(FfxFloat32x4 x) { return FfxUInt32x4(ffxBroadcast4(1.0) - x); @@ -2015,7 +2015,7 @@ FfxUInt32x4 ffxZeroOneAndToU4(FfxFloat32x4 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxZeroOneAndOr(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) { return ffxSaturate(x * y + z); @@ -2031,7 +2031,7 @@ FfxFloat32 ffxZeroOneAndOr(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxZeroOneAndOr(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) { return ffxSaturate(x * y + z); @@ -2047,7 +2047,7 @@ FfxFloat32x2 ffxZeroOneAndOr(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxZeroOneAndOr(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) { return ffxSaturate(x * y + z); @@ -2063,7 +2063,7 @@ FfxFloat32x3 ffxZeroOneAndOr(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxZeroOneAndOr(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) { return ffxSaturate(x * y + z); @@ -2076,7 +2076,7 @@ FfxFloat32x4 ffxZeroOneAndOr(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxZeroOneIsGreaterThanZero(FfxFloat32 x) { return ffxSaturate(x * FfxFloat32(FFX_POSITIVE_INFINITY_FLOAT)); @@ -2089,7 +2089,7 @@ FfxFloat32 ffxZeroOneIsGreaterThanZero(FfxFloat32 x) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxZeroOneIsGreaterThanZero(FfxFloat32x2 x) { return ffxSaturate(x * ffxBroadcast2(FFX_POSITIVE_INFINITY_FLOAT)); @@ -2102,7 +2102,7 @@ FfxFloat32x2 ffxZeroOneIsGreaterThanZero(FfxFloat32x2 x) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxZeroOneIsGreaterThanZero(FfxFloat32x3 x) { return ffxSaturate(x * ffxBroadcast3(FFX_POSITIVE_INFINITY_FLOAT)); @@ -2115,7 +2115,7 @@ FfxFloat32x3 ffxZeroOneIsGreaterThanZero(FfxFloat32x3 x) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxZeroOneIsGreaterThanZero(FfxFloat32x4 x) { return ffxSaturate(x * ffxBroadcast4(FFX_POSITIVE_INFINITY_FLOAT)); @@ -2128,7 +2128,7 @@ FfxFloat32x4 ffxZeroOneIsGreaterThanZero(FfxFloat32x4 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxZeroOneAnd(FfxFloat32 x) { return FfxFloat32(1.0) - x; @@ -2141,7 +2141,7 @@ FfxFloat32 ffxZeroOneAnd(FfxFloat32 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxZeroOneAnd(FfxFloat32x2 x) { return ffxBroadcast2(1.0) - x; @@ -2154,7 +2154,7 @@ FfxFloat32x2 ffxZeroOneAnd(FfxFloat32x2 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxZeroOneAnd(FfxFloat32x3 x) { return ffxBroadcast3(1.0) - x; @@ -2167,7 +2167,7 @@ FfxFloat32x3 ffxZeroOneAnd(FfxFloat32x3 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxZeroOneAnd(FfxFloat32x4 x) { return ffxBroadcast4(1.0) - x; @@ -2181,7 +2181,7 @@ FfxFloat32x4 ffxZeroOneAnd(FfxFloat32x4 x) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxZeroOneOr(FfxFloat32 x, FfxFloat32 y) { return max(x, y); @@ -2195,7 +2195,7 @@ FfxFloat32 ffxZeroOneOr(FfxFloat32 x, FfxFloat32 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxZeroOneOr(FfxFloat32x2 x, FfxFloat32x2 y) { return max(x, y); @@ -2209,7 +2209,7 @@ FfxFloat32x2 ffxZeroOneOr(FfxFloat32x2 x, FfxFloat32x2 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxZeroOneOr(FfxFloat32x3 x, FfxFloat32x3 y) { return max(x, y); @@ -2223,7 +2223,7 @@ FfxFloat32x3 ffxZeroOneOr(FfxFloat32x3 x, FfxFloat32x3 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxZeroOneOr(FfxFloat32x4 x, FfxFloat32x4 y) { return max(x, y); @@ -2238,7 +2238,7 @@ FfxFloat32x4 ffxZeroOneOr(FfxFloat32x4 x, FfxFloat32x4 y) /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxZeroOneSelect(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) { FfxFloat32 r = (-x) * z + z; @@ -2254,7 +2254,7 @@ FfxFloat32 ffxZeroOneSelect(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxZeroOneSelect(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) { FfxFloat32x2 r = (-x) * z + z; @@ -2270,7 +2270,7 @@ FfxFloat32x2 ffxZeroOneSelect(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxZeroOneSelect(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) { FfxFloat32x3 r = (-x) * z + z; @@ -2286,7 +2286,7 @@ FfxFloat32x3 ffxZeroOneSelect(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxZeroOneSelect(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) { FfxFloat32x4 r = (-x) * z + z; @@ -2300,7 +2300,7 @@ FfxFloat32x4 ffxZeroOneSelect(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxZeroOneIsSigned(FfxFloat32 x) { return ffxSaturate(x * FfxFloat32(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -2313,7 +2313,7 @@ FfxFloat32 ffxZeroOneIsSigned(FfxFloat32 x) /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxZeroOneIsSigned(FfxFloat32x2 x) { return ffxSaturate(x * ffxBroadcast2(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -2326,7 +2326,7 @@ FfxFloat32x2 ffxZeroOneIsSigned(FfxFloat32x2 x) /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxZeroOneIsSigned(FfxFloat32x3 x) { return ffxSaturate(x * ffxBroadcast3(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -2339,7 +2339,7 @@ FfxFloat32x3 ffxZeroOneIsSigned(FfxFloat32x3 x) /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x4 ffxZeroOneIsSigned(FfxFloat32x4 x) { return ffxSaturate(x * ffxBroadcast4(FFX_NEGATIVE_INFINITY_FLOAT)); @@ -2358,7 +2358,7 @@ FfxFloat32x4 ffxZeroOneIsSigned(FfxFloat32x4 x) /// @returns /// The color in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxRec709FromLinear(FfxFloat32 color) { FfxFloat32x3 j = FfxFloat32x3(0.018 * 4.5, 4.5, 0.45); @@ -2379,7 +2379,7 @@ FfxFloat32 ffxRec709FromLinear(FfxFloat32 color) /// @returns /// The color in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxRec709FromLinear(FfxFloat32x2 color) { FfxFloat32x3 j = FfxFloat32x3(0.018 * 4.5, 4.5, 0.45); @@ -2400,7 +2400,7 @@ FfxFloat32x2 ffxRec709FromLinear(FfxFloat32x2 color) /// @returns /// The color in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxRec709FromLinear(FfxFloat32x3 color) { FfxFloat32x3 j = FfxFloat32x3(0.018 * 4.5, 4.5, 0.45); @@ -2420,10 +2420,10 @@ FfxFloat32x3 ffxRec709FromLinear(FfxFloat32x3 color) /// @returns /// A value in gamma space. /// -/// @ingroup GPU -FfxFloat32 ffxGammaFromLinear(FfxFloat32 color, FfxFloat32 rcpX) +/// @ingroup GPUCore +FfxFloat32 ffxGammaFromLinear(FfxFloat32 value, FfxFloat32 power) { - return pow(color, FfxFloat32(rcpX)); + return pow(value, FfxFloat32(power)); } /// Compute a gamma value from a linear value. @@ -2438,10 +2438,10 @@ FfxFloat32 ffxGammaFromLinear(FfxFloat32 color, FfxFloat32 rcpX) /// @returns /// A value in gamma space. /// -/// @ingroup GPU -FfxFloat32x2 ffxGammaFromLinear(FfxFloat32x2 color, FfxFloat32 rcpX) +/// @ingroup GPUCore +FfxFloat32x2 ffxGammaFromLinear(FfxFloat32x2 value, FfxFloat32 power) { - return pow(color, ffxBroadcast2(rcpX)); + return pow(value, ffxBroadcast2(power)); } /// Compute a gamma value from a linear value. @@ -2456,10 +2456,10 @@ FfxFloat32x2 ffxGammaFromLinear(FfxFloat32x2 color, FfxFloat32 rcpX) /// @returns /// A value in gamma space. /// -/// @ingroup GPU -FfxFloat32x3 ffxGammaFromLinear(FfxFloat32x3 color, FfxFloat32 rcpX) +/// @ingroup GPUCore +FfxFloat32x3 ffxGammaFromLinear(FfxFloat32x3 value, FfxFloat32 power) { - return pow(color, ffxBroadcast3(rcpX)); + return pow(value, ffxBroadcast3(power)); } /// Compute a PQ value from a linear value. @@ -2469,10 +2469,10 @@ FfxFloat32x3 ffxGammaFromLinear(FfxFloat32x3 color, FfxFloat32 rcpX) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32 ffxPQToLinear(FfxFloat32 x) +/// @ingroup GPUCore +FfxFloat32 ffxPQToLinear(FfxFloat32 value) { - FfxFloat32 p = pow(x, FfxFloat32(0.159302)); + FfxFloat32 p = pow(value, FfxFloat32(0.159302)); return pow((FfxFloat32(0.835938) + FfxFloat32(18.8516) * p) / (FfxFloat32(1.0) + FfxFloat32(18.6875) * p), FfxFloat32(78.8438)); } @@ -2483,10 +2483,10 @@ FfxFloat32 ffxPQToLinear(FfxFloat32 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32x2 ffxPQToLinear(FfxFloat32x2 x) +/// @ingroup GPUCore +FfxFloat32x2 ffxPQToLinear(FfxFloat32x2 value) { - FfxFloat32x2 p = pow(x, ffxBroadcast2(0.159302)); + FfxFloat32x2 p = pow(value, ffxBroadcast2(0.159302)); return pow((ffxBroadcast2(0.835938) + ffxBroadcast2(18.8516) * p) / (ffxBroadcast2(1.0) + ffxBroadcast2(18.6875) * p), ffxBroadcast2(78.8438)); } @@ -2497,10 +2497,10 @@ FfxFloat32x2 ffxPQToLinear(FfxFloat32x2 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32x3 ffxPQToLinear(FfxFloat32x3 x) +/// @ingroup GPUCore +FfxFloat32x3 ffxPQToLinear(FfxFloat32x3 value) { - FfxFloat32x3 p = pow(x, ffxBroadcast3(0.159302)); + FfxFloat32x3 p = pow(value, ffxBroadcast3(0.159302)); return pow((ffxBroadcast3(0.835938) + ffxBroadcast3(18.8516) * p) / (ffxBroadcast3(1.0) + ffxBroadcast3(18.6875) * p), ffxBroadcast3(78.8438)); } @@ -2511,12 +2511,12 @@ FfxFloat32x3 ffxPQToLinear(FfxFloat32x3 x) /// @returns /// A value in SRGB space. /// -/// @ingroup GPU -FfxFloat32 ffxSrgbToLinear(FfxFloat32 color) +/// @ingroup GPUCore +FfxFloat32 ffxSrgbToLinear(FfxFloat32 value) { FfxFloat32x3 j = FfxFloat32x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); FfxFloat32x2 k = FfxFloat32x2(1.055, -0.055); - return clamp(j.x, color * j.y, pow(color, j.z) * k.x + k.y); + return clamp(j.x, value * j.y, pow(value, j.z) * k.x + k.y); } /// Compute a linear value from a SRGB value. @@ -2526,12 +2526,12 @@ FfxFloat32 ffxSrgbToLinear(FfxFloat32 color) /// @returns /// A value in SRGB space. /// -/// @ingroup GPU -FfxFloat32x2 ffxSrgbToLinear(FfxFloat32x2 color) +/// @ingroup GPUCore +FfxFloat32x2 ffxSrgbToLinear(FfxFloat32x2 value) { FfxFloat32x3 j = FfxFloat32x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); FfxFloat32x2 k = FfxFloat32x2(1.055, -0.055); - return clamp(j.xx, color * j.yy, pow(color, j.zz) * k.xx + k.yy); + return clamp(j.xx, value * j.yy, pow(value, j.zz) * k.xx + k.yy); } /// Compute a linear value from a SRGB value. @@ -2541,12 +2541,12 @@ FfxFloat32x2 ffxSrgbToLinear(FfxFloat32x2 color) /// @returns /// A value in SRGB space. /// -/// @ingroup GPU -FfxFloat32x3 ffxSrgbToLinear(FfxFloat32x3 color) +/// @ingroup GPUCore +FfxFloat32x3 ffxSrgbToLinear(FfxFloat32x3 value) { FfxFloat32x3 j = FfxFloat32x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); FfxFloat32x2 k = FfxFloat32x2(1.055, -0.055); - return clamp(j.xxx, color * j.yyy, pow(color, j.zzz) * k.xxx + k.yyy); + return clamp(j.xxx, value * j.yyy, pow(value, j.zzz) * k.xxx + k.yyy); } /// Compute a linear value from a REC.709 value. @@ -2556,7 +2556,7 @@ FfxFloat32x3 ffxSrgbToLinear(FfxFloat32x3 color) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxLinearFromRec709(FfxFloat32 color) { FfxFloat32x3 j = FfxFloat32x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); @@ -2571,7 +2571,7 @@ FfxFloat32 ffxLinearFromRec709(FfxFloat32 color) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxLinearFromRec709(FfxFloat32x2 color) { FfxFloat32x3 j = FfxFloat32x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); @@ -2586,7 +2586,7 @@ FfxFloat32x2 ffxLinearFromRec709(FfxFloat32x2 color) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxLinearFromRec709(FfxFloat32x3 color) { FfxFloat32x3 j = FfxFloat32x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); @@ -2604,7 +2604,7 @@ FfxFloat32x3 ffxLinearFromRec709(FfxFloat32x3 color) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32 ffxLinearFromGamma(FfxFloat32 color, FfxFloat32 power) { return pow(color, FfxFloat32(power)); @@ -2620,7 +2620,7 @@ FfxFloat32 ffxLinearFromGamma(FfxFloat32 color, FfxFloat32 power) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x2 ffxLinearFromGamma(FfxFloat32x2 color, FfxFloat32 power) { return pow(color, ffxBroadcast2(power)); @@ -2636,7 +2636,7 @@ FfxFloat32x2 ffxLinearFromGamma(FfxFloat32x2 color, FfxFloat32 power) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat32x3 ffxLinearFromGamma(FfxFloat32x3 color, FfxFloat32 power) { return pow(color, ffxBroadcast3(power)); @@ -2651,10 +2651,10 @@ FfxFloat32x3 ffxLinearFromGamma(FfxFloat32x3 color, FfxFloat32 power) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32 ffxLinearFromPQ(FfxFloat32 x) +/// @ingroup GPUCore +FfxFloat32 ffxLinearFromPQ(FfxFloat32 value) { - FfxFloat32 p = pow(x, FfxFloat32(0.0126833)); + FfxFloat32 p = pow(value, FfxFloat32(0.0126833)); return pow(ffxSaturate(p - FfxFloat32(0.835938)) / (FfxFloat32(18.8516) - FfxFloat32(18.6875) * p), FfxFloat32(6.27739)); } @@ -2667,10 +2667,10 @@ FfxFloat32 ffxLinearFromPQ(FfxFloat32 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32x2 ffxLinearFromPQ(FfxFloat32x2 x) +/// @ingroup GPUCore +FfxFloat32x2 ffxLinearFromPQ(FfxFloat32x2 value) { - FfxFloat32x2 p = pow(x, ffxBroadcast2(0.0126833)); + FfxFloat32x2 p = pow(value, ffxBroadcast2(0.0126833)); return pow(ffxSaturate(p - ffxBroadcast2(0.835938)) / (ffxBroadcast2(18.8516) - ffxBroadcast2(18.6875) * p), ffxBroadcast2(6.27739)); } @@ -2683,10 +2683,10 @@ FfxFloat32x2 ffxLinearFromPQ(FfxFloat32x2 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32x3 ffxLinearFromPQ(FfxFloat32x3 x) +/// @ingroup GPUCore +FfxFloat32x3 ffxLinearFromPQ(FfxFloat32x3 value) { - FfxFloat32x3 p = pow(x, ffxBroadcast3(0.0126833)); + FfxFloat32x3 p = pow(value, ffxBroadcast3(0.0126833)); return pow(ffxSaturate(p - ffxBroadcast3(0.835938)) / (ffxBroadcast3(18.8516) - ffxBroadcast3(18.6875) * p), ffxBroadcast3(6.27739)); } @@ -2699,12 +2699,12 @@ FfxFloat32x3 ffxLinearFromPQ(FfxFloat32x3 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32 ffxLinearFromSrgb(FfxFloat32 color) +/// @ingroup GPUCore +FfxFloat32 ffxLinearFromSrgb(FfxFloat32 value) { FfxFloat32x3 j = FfxFloat32x3(0.04045 / 12.92, 1.0 / 12.92, 2.4); FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.055, 0.055 / 1.055); - return ffxZeroOneSelect(ffxZeroOneIsSigned(color - j.x), color * j.y, pow(color * k.x + k.y, j.z)); + return ffxZeroOneSelect(ffxZeroOneIsSigned(value - j.x), value * j.y, pow(value * k.x + k.y, j.z)); } /// Compute a linear value from a value in a SRGB space. @@ -2716,12 +2716,12 @@ FfxFloat32 ffxLinearFromSrgb(FfxFloat32 color) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32x2 ffxLinearFromSrgb(FfxFloat32x2 color) +/// @ingroup GPUCore +FfxFloat32x2 ffxLinearFromSrgb(FfxFloat32x2 value) { FfxFloat32x3 j = FfxFloat32x3(0.04045 / 12.92, 1.0 / 12.92, 2.4); FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.055, 0.055 / 1.055); - return ffxZeroOneSelect(ffxZeroOneIsSigned(color - j.xx), color * j.yy, pow(color * k.xx + k.yy, j.zz)); + return ffxZeroOneSelect(ffxZeroOneIsSigned(value - j.xx), value * j.yy, pow(value * k.xx + k.yy, j.zz)); } /// Compute a linear value from a value in a SRGB space. @@ -2733,12 +2733,12 @@ FfxFloat32x2 ffxLinearFromSrgb(FfxFloat32x2 color) /// @returns /// A value in linear space. /// -/// @ingroup GPU -FfxFloat32x3 ffxLinearFromSrgb(FfxFloat32x3 color) +/// @ingroup GPUCore +FfxFloat32x3 ffxLinearFromSrgb(FfxFloat32x3 value) { FfxFloat32x3 j = FfxFloat32x3(0.04045 / 12.92, 1.0 / 12.92, 2.4); FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.055, 0.055 / 1.055); - return ffxZeroOneSelect(ffxZeroOneIsSigned(color - j.xxx), color * j.yyy, pow(color * k.xxx + k.yyy, j.zzz)); + return ffxZeroOneSelect(ffxZeroOneIsSigned(value - j.xxx), value * j.yyy, pow(value * k.xxx + k.yyy, j.zzz)); } /// A remapping of 64x1 to 8x8 imposing rotated 2x2 pixel quads in quad linear. @@ -2753,7 +2753,7 @@ FfxFloat32x3 ffxLinearFromSrgb(FfxFloat32x3 color) /// @returns /// The remapped 2D coordinates. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxRemapForQuad(FfxUInt32 a) { return FfxUInt32x2(bitfieldExtract(a, 1u, 3u), bitfieldInsertMask(bitfieldExtract(a, 3u, 3u), a, 1u)); @@ -2777,7 +2777,7 @@ FfxUInt32x2 ffxRemapForQuad(FfxUInt32 a) /// @returns /// The remapped 2D coordinates. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxRemapForWaveReduction(FfxUInt32 a) { return FfxUInt32x2(bitfieldInsertMask(bitfieldExtract(a, 2u, 3u), a, 1u), bitfieldInsertMask(bitfieldExtract(a, 3u, 3u), bitfieldExtract(a, 1u, 2u), 2u)); diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common.h.meta new file mode 100644 index 0000000..ec380d2 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 05b921699d1374a429e32afca13137e2 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common_half.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common_half.h similarity index 94% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common_half.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common_half.h index c46ccb3..4c73daf 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_gpu_common_half.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common_half.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,28 +19,29 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + #if FFX_HALF -#if FFX_HLSL_6_2 +#if FFX_HLSL_SM >= 62 /// A define value for 16bit positive infinity. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_POSITIVE_INFINITY_HALF FFX_TO_FLOAT16((uint16_t)0x7c00u) /// A define value for 16bit negative infinity. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_NEGATIVE_INFINITY_HALF FFX_TO_FLOAT16((uint16_t)0xfc00u) #else /// A define value for 16bit positive infinity. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_POSITIVE_INFINITY_HALF FFX_TO_FLOAT16(0x7c00u) /// A define value for 16bit negative infinity. /// -/// @ingroup GPU +/// @ingroup GPUCore #define FFX_NEGATIVE_INFINITY_HALF FFX_TO_FLOAT16(0xfc00u) -#endif // FFX_HLSL_6_2 +#endif // #if FFX_HLSL_SM>=62 /// Compute the min of two values. /// @@ -50,7 +51,7 @@ /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxMin(FfxFloat16 x, FfxFloat16 y) { return min(x, y); @@ -64,7 +65,7 @@ FfxFloat16 ffxMin(FfxFloat16 x, FfxFloat16 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxMin(FfxFloat16x2 x, FfxFloat16x2 y) { return min(x, y); @@ -78,7 +79,7 @@ FfxFloat16x2 ffxMin(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxMin(FfxFloat16x3 x, FfxFloat16x3 y) { return min(x, y); @@ -92,7 +93,7 @@ FfxFloat16x3 ffxMin(FfxFloat16x3 x, FfxFloat16x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxMin(FfxFloat16x4 x, FfxFloat16x4 y) { return min(x, y); @@ -106,7 +107,7 @@ FfxFloat16x4 ffxMin(FfxFloat16x4 x, FfxFloat16x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16 ffxMin(FfxInt16 x, FfxInt16 y) { return min(x, y); @@ -120,7 +121,7 @@ FfxInt16 ffxMin(FfxInt16 x, FfxInt16 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16x2 ffxMin(FfxInt16x2 x, FfxInt16x2 y) { return min(x, y); @@ -134,7 +135,7 @@ FfxInt16x2 ffxMin(FfxInt16x2 x, FfxInt16x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16x3 ffxMin(FfxInt16x3 x, FfxInt16x3 y) { return min(x, y); @@ -148,7 +149,7 @@ FfxInt16x3 ffxMin(FfxInt16x3 x, FfxInt16x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16x4 ffxMin(FfxInt16x4 x, FfxInt16x4 y) { return min(x, y); @@ -162,7 +163,7 @@ FfxInt16x4 ffxMin(FfxInt16x4 x, FfxInt16x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxMin(FfxUInt16 x, FfxUInt16 y) { return min(x, y); @@ -176,7 +177,7 @@ FfxUInt16 ffxMin(FfxUInt16 x, FfxUInt16 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxMin(FfxUInt16x2 x, FfxUInt16x2 y) { return min(x, y); @@ -190,7 +191,7 @@ FfxUInt16x2 ffxMin(FfxUInt16x2 x, FfxUInt16x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x3 ffxMin(FfxUInt16x3 x, FfxUInt16x3 y) { return min(x, y); @@ -204,7 +205,7 @@ FfxUInt16x3 ffxMin(FfxUInt16x3 x, FfxUInt16x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x4 ffxMin(FfxUInt16x4 x, FfxUInt16x4 y) { return min(x, y); @@ -218,7 +219,7 @@ FfxUInt16x4 ffxMin(FfxUInt16x4 x, FfxUInt16x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxMax(FfxFloat16 x, FfxFloat16 y) { return max(x, y); @@ -232,7 +233,7 @@ FfxFloat16 ffxMax(FfxFloat16 x, FfxFloat16 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxMax(FfxFloat16x2 x, FfxFloat16x2 y) { return max(x, y); @@ -246,7 +247,7 @@ FfxFloat16x2 ffxMax(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxMax(FfxFloat16x3 x, FfxFloat16x3 y) { return max(x, y); @@ -260,7 +261,7 @@ FfxFloat16x3 ffxMax(FfxFloat16x3 x, FfxFloat16x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxMax(FfxFloat16x4 x, FfxFloat16x4 y) { return max(x, y); @@ -274,7 +275,7 @@ FfxFloat16x4 ffxMax(FfxFloat16x4 x, FfxFloat16x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16 ffxMax(FfxInt16 x, FfxInt16 y) { return max(x, y); @@ -288,7 +289,7 @@ FfxInt16 ffxMax(FfxInt16 x, FfxInt16 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16x2 ffxMax(FfxInt16x2 x, FfxInt16x2 y) { return max(x, y); @@ -302,7 +303,7 @@ FfxInt16x2 ffxMax(FfxInt16x2 x, FfxInt16x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16x3 ffxMax(FfxInt16x3 x, FfxInt16x3 y) { return max(x, y); @@ -316,7 +317,7 @@ FfxInt16x3 ffxMax(FfxInt16x3 x, FfxInt16x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxInt16x4 ffxMax(FfxInt16x4 x, FfxInt16x4 y) { return max(x, y); @@ -330,7 +331,7 @@ FfxInt16x4 ffxMax(FfxInt16x4 x, FfxInt16x4 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxMax(FfxUInt16 x, FfxUInt16 y) { return max(x, y); @@ -344,7 +345,7 @@ FfxUInt16 ffxMax(FfxUInt16 x, FfxUInt16 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxMax(FfxUInt16x2 x, FfxUInt16x2 y) { return max(x, y); @@ -358,7 +359,7 @@ FfxUInt16x2 ffxMax(FfxUInt16x2 x, FfxUInt16x2 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x3 ffxMax(FfxUInt16x3 x, FfxUInt16x3 y) { return max(x, y); @@ -372,7 +373,7 @@ FfxUInt16x3 ffxMax(FfxUInt16x3 x, FfxUInt16x3 y) /// @returns /// The the lowest of two values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x4 ffxMax(FfxUInt16x4 x, FfxUInt16x4 y) { return max(x, y); @@ -386,7 +387,7 @@ FfxUInt16x4 ffxMax(FfxUInt16x4 x, FfxUInt16x4 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxPow(FfxFloat16 x, FfxFloat16 y) { return pow(x, y); @@ -400,7 +401,7 @@ FfxFloat16 ffxPow(FfxFloat16 x, FfxFloat16 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPow(FfxFloat16x2 x, FfxFloat16x2 y) { return pow(x, y); @@ -414,7 +415,7 @@ FfxFloat16x2 ffxPow(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxPow(FfxFloat16x3 x, FfxFloat16x3 y) { return pow(x, y); @@ -428,7 +429,7 @@ FfxFloat16x3 ffxPow(FfxFloat16x3 x, FfxFloat16x3 y) /// @returns /// The value of the first parameter raised to the power of the second. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxPow(FfxFloat16x4 x, FfxFloat16x4 y) { return pow(x, y); @@ -441,7 +442,7 @@ FfxFloat16x4 ffxPow(FfxFloat16x4 x, FfxFloat16x4 y) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxSqrt(FfxFloat16 x) { return sqrt(x); @@ -454,7 +455,7 @@ FfxFloat16 ffxSqrt(FfxFloat16 x) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxSqrt(FfxFloat16x2 x) { return sqrt(x); @@ -467,7 +468,7 @@ FfxFloat16x2 ffxSqrt(FfxFloat16x2 x) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxSqrt(FfxFloat16x3 x) { return sqrt(x); @@ -480,7 +481,7 @@ FfxFloat16x3 ffxSqrt(FfxFloat16x3 x) /// @returns /// The the square root of x. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxSqrt(FfxFloat16x4 x) { return sqrt(x); @@ -494,7 +495,7 @@ FfxFloat16x4 ffxSqrt(FfxFloat16x4 x) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxCopySignBitHalf(FfxFloat16 d, FfxFloat16 s) { return FFX_TO_FLOAT16(FFX_TO_UINT16(d) | (FFX_TO_UINT16(s) & FFX_BROADCAST_UINT16(0x8000u))); @@ -508,7 +509,7 @@ FfxFloat16 ffxCopySignBitHalf(FfxFloat16 d, FfxFloat16 s) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxCopySignBitHalf(FfxFloat16x2 d, FfxFloat16x2 s) { return FFX_TO_FLOAT16X2(FFX_TO_UINT16X2(d) | (FFX_TO_UINT16X2(s) & FFX_BROADCAST_UINT16X2(0x8000u))); @@ -522,7 +523,7 @@ FfxFloat16x2 ffxCopySignBitHalf(FfxFloat16x2 d, FfxFloat16x2 s) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxCopySignBitHalf(FfxFloat16x3 d, FfxFloat16x3 s) { return FFX_TO_FLOAT16X3(FFX_TO_UINT16X3(d) | (FFX_TO_UINT16X3(s) & FFX_BROADCAST_UINT16X3(0x8000u))); @@ -536,7 +537,7 @@ FfxFloat16x3 ffxCopySignBitHalf(FfxFloat16x3 d, FfxFloat16x3 s) /// @returns /// The value of d with the sign bit from s. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxCopySignBitHalf(FfxFloat16x4 d, FfxFloat16x4 s) { return FFX_TO_FLOAT16X4(FFX_TO_UINT16X4(d) | (FFX_TO_UINT16X4(s) & FFX_BROADCAST_UINT16X4(0x8000u))); @@ -559,10 +560,10 @@ FfxFloat16x4 ffxCopySignBitHalf(FfxFloat16x4 d, FfxFloat16x4 s) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or position. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxIsSignedHalf(FfxFloat16 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16(ffxSaturate(m * FFX_BROADCAST_FLOAT16(FFX_NEGATIVE_INFINITY_HALF))); } /// A single operation to return the following: @@ -582,10 +583,10 @@ FfxFloat16 ffxIsSignedHalf(FfxFloat16 m) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or position. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxIsSignedHalf(FfxFloat16x2 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16X2(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16x2(ffxSaturate(m * FFX_BROADCAST_FLOAT16X2(FFX_NEGATIVE_INFINITY_HALF))); } /// A single operation to return the following: @@ -605,10 +606,10 @@ FfxFloat16x2 ffxIsSignedHalf(FfxFloat16x2 m) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or position. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxIsSignedHalf(FfxFloat16x3 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16X3(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16x3(ffxSaturate(m * FFX_BROADCAST_FLOAT16X3(FFX_NEGATIVE_INFINITY_HALF))); } /// A single operation to return the following: @@ -628,10 +629,10 @@ FfxFloat16x3 ffxIsSignedHalf(FfxFloat16x3 m) /// @returns /// 1.0 when the value is negative, or 0.0 when the value is 0 or position. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxIsSignedHalf(FfxFloat16x4 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16X4(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16x4(ffxSaturate(m * FFX_BROADCAST_FLOAT16X4(FFX_NEGATIVE_INFINITY_HALF))); } /// A single operation to return the following: @@ -646,10 +647,10 @@ FfxFloat16x4 ffxIsSignedHalf(FfxFloat16x4 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxIsGreaterThanZeroHalf(FfxFloat16 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16(ffxSaturate(m * FFX_BROADCAST_FLOAT16(FFX_POSITIVE_INFINITY_HALF))); } /// A single operation to return the following: @@ -664,10 +665,10 @@ FfxFloat16 ffxIsGreaterThanZeroHalf(FfxFloat16 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxIsGreaterThanZeroHalf(FfxFloat16x2 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16X2(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16x2(ffxSaturate(m * FFX_BROADCAST_FLOAT16X2(FFX_POSITIVE_INFINITY_HALF))); } /// A single operation to return the following: @@ -682,10 +683,10 @@ FfxFloat16x2 ffxIsGreaterThanZeroHalf(FfxFloat16x2 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxIsGreaterThanZeroHalf(FfxFloat16x3 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16X3(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16x3(ffxSaturate(m * FFX_BROADCAST_FLOAT16X3(FFX_POSITIVE_INFINITY_HALF))); } /// A single operation to return the following: @@ -700,10 +701,10 @@ FfxFloat16x3 ffxIsGreaterThanZeroHalf(FfxFloat16x3 m) /// @returns /// 1.0 when the value is position, or 0.0 when the value is 0 or negative. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxIsGreaterThanZeroHalf(FfxFloat16x4 m) { - return ffxSaturate(m * FFX_BROADCAST_FLOAT16X4(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16x4(ffxSaturate(m * FFX_BROADCAST_FLOAT16X4(FFX_POSITIVE_INFINITY_HALF))); } /// Convert a 16bit floating point value to sortable integer. @@ -720,7 +721,7 @@ FfxFloat16x4 ffxIsGreaterThanZeroHalf(FfxFloat16x4 m) /// @returns /// The sortable integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxFloatToSortableIntegerHalf(FfxUInt16 x) { return x ^ ((ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16(15))) | FFX_BROADCAST_UINT16(0x8000)); @@ -737,7 +738,7 @@ FfxUInt16 ffxFloatToSortableIntegerHalf(FfxUInt16 x) /// @returns /// The floating point value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxSortableIntegerToFloatHalf(FfxUInt16 x) { return x ^ ((~ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16(15))) | FFX_BROADCAST_UINT16(0x8000)); @@ -757,7 +758,7 @@ FfxUInt16 ffxSortableIntegerToFloatHalf(FfxUInt16 x) /// @returns /// The sortable integer values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxFloatToSortableIntegerHalf(FfxUInt16x2 x) { return x ^ ((ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16X2(15))) | FFX_BROADCAST_UINT16X2(0x8000)); @@ -774,7 +775,7 @@ FfxUInt16x2 ffxFloatToSortableIntegerHalf(FfxUInt16x2 x) /// @returns /// The floating point values. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxSortableIntegerToFloatHalf(FfxUInt16x2 x) { return x ^ ((~ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16X2(15))) | FFX_BROADCAST_UINT16X2(0x8000)); @@ -790,7 +791,7 @@ FfxUInt16x2 ffxSortableIntegerToFloatHalf(FfxUInt16x2 x) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesZeroY0ZeroX0(FfxUInt32x2 i) { return ((i.x) & 0xffu) | ((i.y << 16) & 0xff0000u); @@ -806,7 +807,7 @@ FfxUInt32 ffxPackBytesZeroY0ZeroX0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesZeroY1ZeroX1(FfxUInt32x2 i) { return ((i.x >> 8) & 0xffu) | ((i.y << 8) & 0xff0000u); @@ -822,7 +823,7 @@ FfxUInt32 ffxPackBytesZeroY1ZeroX1(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesZeroY2ZeroX2(FfxUInt32x2 i) { return ((i.x >> 16) & 0xffu) | ((i.y) & 0xff0000u); @@ -838,7 +839,7 @@ FfxUInt32 ffxPackBytesZeroY2ZeroX2(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesZeroY3ZeroX3(FfxUInt32x2 i) { return ((i.x >> 24) & 0xffu) | ((i.y >> 8) & 0xff0000u); @@ -854,7 +855,7 @@ FfxUInt32 ffxPackBytesZeroY3ZeroX3(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY3Y2Y1X0(FfxUInt32x2 i) { return ((i.x) & 0x000000ffu) | (i.y & 0xffffff00u); @@ -870,7 +871,7 @@ FfxUInt32 ffxPackBytesY3Y2Y1X0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY3Y2Y1X2(FfxUInt32x2 i) { return ((i.x >> 16) & 0x000000ffu) | (i.y & 0xffffff00u); @@ -886,7 +887,7 @@ FfxUInt32 ffxPackBytesY3Y2Y1X2(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY3Y2X0Y0(FfxUInt32x2 i) { return ((i.x << 8) & 0x0000ff00u) | (i.y & 0xffff00ffu); @@ -902,7 +903,7 @@ FfxUInt32 ffxPackBytesY3Y2X0Y0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY3Y2X2Y0(FfxUInt32x2 i) { return ((i.x >> 8) & 0x0000ff00u) | (i.y & 0xffff00ffu); @@ -918,7 +919,7 @@ FfxUInt32 ffxPackBytesY3Y2X2Y0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY3X0Y1Y0(FfxUInt32x2 i) { return ((i.x << 16) & 0x00ff0000u) | (i.y & 0xff00ffffu); @@ -934,7 +935,7 @@ FfxUInt32 ffxPackBytesY3X0Y1Y0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY3X2Y1Y0(FfxUInt32x2 i) { return ((i.x) & 0x00ff0000u) | (i.y & 0xff00ffffu); @@ -950,7 +951,7 @@ FfxUInt32 ffxPackBytesY3X2Y1Y0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesX0Y2Y1Y0(FfxUInt32x2 i) { return ((i.x << 24) & 0xff000000u) | (i.y & 0x00ffffffu); @@ -966,7 +967,7 @@ FfxUInt32 ffxPackBytesX0Y2Y1Y0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesX2Y2Y1Y0(FfxUInt32x2 i) { return ((i.x << 8) & 0xff000000u) | (i.y & 0x00ffffffu); @@ -982,7 +983,7 @@ FfxUInt32 ffxPackBytesX2Y2Y1Y0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY2X2Y0X0(FfxUInt32x2 i) { return ((i.x) & 0x00ff00ffu) | ((i.y << 8) & 0xff00ff00u); @@ -998,7 +999,7 @@ FfxUInt32 ffxPackBytesY2X2Y0X0(FfxUInt32x2 i) /// @returns /// The packed integer value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32 ffxPackBytesY2Y0X2X0(FfxUInt32x2 i) { return (((i.x) & 0xffu) | ((i.x >> 8) & 0xff00u) | ((i.y << 16) & 0xff0000u) | ((i.y << 8) & 0xff000000u)); @@ -1012,7 +1013,7 @@ FfxUInt32 ffxPackBytesY2Y0X2X0(FfxUInt32x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxPackX0Y0X1Y1UnsignedToUint16x2(FfxFloat16x2 x, FfxFloat16x2 y) { x *= FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0); @@ -1037,7 +1038,7 @@ FfxUInt16x2 ffxPackX0Y0X1Y1UnsignedToUint16x2(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteUByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); @@ -1061,7 +1062,7 @@ FfxUInt32x2 ffxPermuteUByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteUByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); @@ -1085,7 +1086,7 @@ FfxUInt32x2 ffxPermuteUByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteUByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); @@ -1109,7 +1110,7 @@ FfxUInt32x2 ffxPermuteUByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteUByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); @@ -1123,7 +1124,7 @@ FfxUInt32x2 ffxPermuteUByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteUByte0Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY0ZeroX0(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); @@ -1136,7 +1137,7 @@ FfxFloat16x2 ffxPermuteUByte0Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteUByte1Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY1ZeroX1(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); @@ -1149,7 +1150,7 @@ FfxFloat16x2 ffxPermuteUByte1Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteUByte2Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY2ZeroX2(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); @@ -1162,7 +1163,7 @@ FfxFloat16x2 ffxPermuteUByte2Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteUByte3Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY3ZeroX3(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); @@ -1176,7 +1177,7 @@ FfxFloat16x2 ffxPermuteUByte3Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxPackX0Y0X1Y1SignedToUint16x2(FfxFloat16x2 x, FfxFloat16x2 y) { x = x * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0); @@ -1195,7 +1196,7 @@ FfxUInt16x2 ffxPackX0Y0X1Y1SignedToUint16x2(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteSByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); @@ -1213,7 +1214,7 @@ FfxUInt32x2 ffxPermuteSByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteSByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); @@ -1231,7 +1232,7 @@ FfxUInt32x2 ffxPermuteSByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteSByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); @@ -1249,7 +1250,7 @@ FfxUInt32x2 ffxPermuteSByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteSByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); @@ -1270,7 +1271,7 @@ FfxUInt32x2 ffxPermuteSByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteZeroBasedSByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; @@ -1291,7 +1292,7 @@ FfxUInt32x2 ffxPermuteZeroBasedSByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteZeroBasedSByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; @@ -1312,7 +1313,7 @@ FfxUInt32x2 ffxPermuteZeroBasedSByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteZeroBasedSByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; @@ -1333,7 +1334,7 @@ FfxUInt32x2 ffxPermuteZeroBasedSByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x /// @returns /// The packed FfxUInt32x2 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt32x2 ffxPermuteZeroBasedSByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) { FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; @@ -1349,7 +1350,7 @@ FfxUInt32x2 ffxPermuteZeroBasedSByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteSByte0Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY0ZeroX0(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1364,7 +1365,7 @@ FfxFloat16x2 ffxPermuteSByte0Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteSByte1Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY1ZeroX1(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1379,7 +1380,7 @@ FfxFloat16x2 ffxPermuteSByte1Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteSByte2Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY2ZeroX2(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1394,7 +1395,7 @@ FfxFloat16x2 ffxPermuteSByte2Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteSByte3Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY3ZeroX3(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1409,7 +1410,7 @@ FfxFloat16x2 ffxPermuteSByte3Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteZeroBasedSByte0Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY0ZeroX0(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1424,7 +1425,7 @@ FfxFloat16x2 ffxPermuteZeroBasedSByte0Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteZeroBasedSByte1Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY1ZeroX1(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1439,7 +1440,7 @@ FfxFloat16x2 ffxPermuteZeroBasedSByte1Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteZeroBasedSByte2Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY2ZeroX2(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1454,7 +1455,7 @@ FfxFloat16x2 ffxPermuteZeroBasedSByte2Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// The unpacked FfxFloat16x2. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxPermuteZeroBasedSByte3Uint2ToFloat16x2(FfxUInt32x2 i) { return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY3ZeroX3(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); @@ -1473,7 +1474,7 @@ FfxFloat16x2 ffxPermuteZeroBasedSByte3Uint2ToFloat16x2(FfxUInt32x2 i) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxApproximateSqrtHalf(FfxFloat16 a) { return FFX_TO_FLOAT16((FFX_TO_UINT16(a) >> FFX_BROADCAST_UINT16(1)) + FFX_BROADCAST_UINT16(0x1de2)); @@ -1492,7 +1493,7 @@ FfxFloat16 ffxApproximateSqrtHalf(FfxFloat16 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxApproximateSqrtHalf(FfxFloat16x2 a) { return FFX_TO_FLOAT16X2((FFX_TO_UINT16X2(a) >> FFX_BROADCAST_UINT16X2(1)) + FFX_BROADCAST_UINT16X2(0x1de2)); @@ -1511,7 +1512,7 @@ FfxFloat16x2 ffxApproximateSqrtHalf(FfxFloat16x2 a) /// @returns /// An approximation of the square root, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxApproximateSqrtHalf(FfxFloat16x3 a) { return FFX_TO_FLOAT16X3((FFX_TO_UINT16X3(a) >> FFX_BROADCAST_UINT16X3(1)) + FFX_BROADCAST_UINT16X3(0x1de2)); @@ -1530,7 +1531,7 @@ FfxFloat16x3 ffxApproximateSqrtHalf(FfxFloat16x3 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxApproximateReciprocalHalf(FfxFloat16 a) { return FFX_TO_FLOAT16(FFX_BROADCAST_UINT16(0x7784) - FFX_TO_UINT16(a)); @@ -1549,7 +1550,7 @@ FfxFloat16 ffxApproximateReciprocalHalf(FfxFloat16 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxApproximateReciprocalHalf(FfxFloat16x2 a) { return FFX_TO_FLOAT16X2(FFX_BROADCAST_UINT16X2(0x7784) - FFX_TO_UINT16X2(a)); @@ -1568,7 +1569,7 @@ FfxFloat16x2 ffxApproximateReciprocalHalf(FfxFloat16x2 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxApproximateReciprocalHalf(FfxFloat16x3 a) { return FFX_TO_FLOAT16X3(FFX_BROADCAST_UINT16X3(0x7784) - FFX_TO_UINT16X3(a)); @@ -1587,7 +1588,7 @@ FfxFloat16x3 ffxApproximateReciprocalHalf(FfxFloat16x3 a) /// @returns /// An approximation of the reciprocal, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxApproximateReciprocalHalf(FfxFloat16x4 a) { return FFX_TO_FLOAT16X4(FFX_BROADCAST_UINT16X4(0x7784) - FFX_TO_UINT16X4(a)); @@ -1606,7 +1607,7 @@ FfxFloat16x4 ffxApproximateReciprocalHalf(FfxFloat16x4 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxApproximateReciprocalMediumHalf(FfxFloat16 a) { FfxFloat16 b = FFX_TO_FLOAT16(FFX_BROADCAST_UINT16(0x778d) - FFX_TO_UINT16(a)); @@ -1626,7 +1627,7 @@ FfxFloat16 ffxApproximateReciprocalMediumHalf(FfxFloat16 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxApproximateReciprocalMediumHalf(FfxFloat16x2 a) { FfxFloat16x2 b = FFX_TO_FLOAT16X2(FFX_BROADCAST_UINT16X2(0x778d) - FFX_TO_UINT16X2(a)); @@ -1646,7 +1647,7 @@ FfxFloat16x2 ffxApproximateReciprocalMediumHalf(FfxFloat16x2 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxApproximateReciprocalMediumHalf(FfxFloat16x3 a) { FfxFloat16x3 b = FFX_TO_FLOAT16X3(FFX_BROADCAST_UINT16X3(0x778d) - FFX_TO_UINT16X3(a)); @@ -1666,7 +1667,7 @@ FfxFloat16x3 ffxApproximateReciprocalMediumHalf(FfxFloat16x3 a) /// @returns /// An approximation of the reciprocal, estimated to medium quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxApproximateReciprocalMediumHalf(FfxFloat16x4 a) { FfxFloat16x4 b = FFX_TO_FLOAT16X4(FFX_BROADCAST_UINT16X4(0x778d) - FFX_TO_UINT16X4(a)); @@ -1686,7 +1687,7 @@ FfxFloat16x4 ffxApproximateReciprocalMediumHalf(FfxFloat16x4 a) /// @returns /// An approximation of the reciprocal of the square root, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxApproximateReciprocalSquareRootHalf(FfxFloat16 a) { return FFX_TO_FLOAT16(FFX_BROADCAST_UINT16(0x59a3) - (FFX_TO_UINT16(a) >> FFX_BROADCAST_UINT16(1))); @@ -1705,7 +1706,7 @@ FfxFloat16 ffxApproximateReciprocalSquareRootHalf(FfxFloat16 a) /// @returns /// An approximation of the reciprocal of the square root, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x2 a) { return FFX_TO_FLOAT16X2(FFX_BROADCAST_UINT16X2(0x59a3) - (FFX_TO_UINT16X2(a) >> FFX_BROADCAST_UINT16X2(1))); @@ -1724,7 +1725,7 @@ FfxFloat16x2 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x2 a) /// @returns /// An approximation of the reciprocal of the square root, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x3 a) { return FFX_TO_FLOAT16X3(FFX_BROADCAST_UINT16X3(0x59a3) - (FFX_TO_UINT16X3(a) >> FFX_BROADCAST_UINT16X3(1))); @@ -1743,7 +1744,7 @@ FfxFloat16x3 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x3 a) /// @returns /// An approximation of the reciprocal of the square root, estimated to low quality. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x4 a) { return FFX_TO_FLOAT16X4(FFX_BROADCAST_UINT16X4(0x59a3) - (FFX_TO_UINT16X4(a) >> FFX_BROADCAST_UINT16X4(1))); @@ -1833,7 +1834,7 @@ FfxFloat16x2 ffxParabolicSinCosHalf(FfxFloat16 x) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxZeroOneAndHalf(FfxUInt16 x, FfxUInt16 y) { return min(x, y); @@ -1847,7 +1848,7 @@ FfxUInt16 ffxZeroOneAndHalf(FfxUInt16 x, FfxUInt16 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxZeroOneAndHalf(FfxUInt16x2 x, FfxUInt16x2 y) { return min(x, y); @@ -1861,7 +1862,7 @@ FfxUInt16x2 ffxZeroOneAndHalf(FfxUInt16x2 x, FfxUInt16x2 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x3 ffxZeroOneAndHalf(FfxUInt16x3 x, FfxUInt16x3 y) { return min(x, y); @@ -1875,7 +1876,7 @@ FfxUInt16x3 ffxZeroOneAndHalf(FfxUInt16x3 x, FfxUInt16x3 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x4 ffxZeroOneAndHalf(FfxUInt16x4 x, FfxUInt16x4 y) { return min(x, y); @@ -1889,7 +1890,7 @@ FfxUInt16x4 ffxZeroOneAndHalf(FfxUInt16x4 x, FfxUInt16x4 y) /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxZeroOneNotHalf(FfxUInt16 x) { return x ^ FFX_BROADCAST_UINT16(1); @@ -1903,7 +1904,7 @@ FfxUInt16 ffxZeroOneNotHalf(FfxUInt16 x) /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxZeroOneNotHalf(FfxUInt16x2 x) { return x ^ FFX_BROADCAST_UINT16X2(1); @@ -1917,7 +1918,7 @@ FfxUInt16x2 ffxZeroOneNotHalf(FfxUInt16x2 x) /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x3 ffxZeroOneNotHalf(FfxUInt16x3 x) { return x ^ FFX_BROADCAST_UINT16X3(1); @@ -1931,7 +1932,7 @@ FfxUInt16x3 ffxZeroOneNotHalf(FfxUInt16x3 x) /// @returns /// Result of the NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x4 ffxZeroOneNotHalf(FfxUInt16x4 x) { return x ^ FFX_BROADCAST_UINT16X4(1); @@ -1945,7 +1946,7 @@ FfxUInt16x4 ffxZeroOneNotHalf(FfxUInt16x4 x) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxZeroOneOrHalf(FfxUInt16 x, FfxUInt16 y) { return max(x, y); @@ -1959,7 +1960,7 @@ FfxUInt16 ffxZeroOneOrHalf(FfxUInt16 x, FfxUInt16 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxZeroOneOrHalf(FfxUInt16x2 x, FfxUInt16x2 y) { return max(x, y); @@ -1973,7 +1974,7 @@ FfxUInt16x2 ffxZeroOneOrHalf(FfxUInt16x2 x, FfxUInt16x2 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x3 ffxZeroOneOrHalf(FfxUInt16x3 x, FfxUInt16x3 y) { return max(x, y); @@ -1987,7 +1988,7 @@ FfxUInt16x3 ffxZeroOneOrHalf(FfxUInt16x3 x, FfxUInt16x3 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x4 ffxZeroOneOrHalf(FfxUInt16x4 x, FfxUInt16x4 y) { return max(x, y); @@ -2000,7 +2001,7 @@ FfxUInt16x4 ffxZeroOneOrHalf(FfxUInt16x4 x, FfxUInt16x4 y) /// @returns /// The converted Uint value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16 ffxZeroOneFloat16ToUint16(FfxFloat16 x) { return FFX_TO_UINT16(x * FFX_TO_FLOAT16(FFX_TO_UINT16(1))); @@ -2013,7 +2014,7 @@ FfxUInt16 ffxZeroOneFloat16ToUint16(FfxFloat16 x) /// @returns /// The converted Uint value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxZeroOneFloat16x2ToUint16x2(FfxFloat16x2 x) { return FFX_TO_UINT16X2(x * FFX_TO_FLOAT16X2(FfxUInt16x2(1, 1))); @@ -2026,7 +2027,7 @@ FfxUInt16x2 ffxZeroOneFloat16x2ToUint16x2(FfxFloat16x2 x) /// @returns /// The converted Uint value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x3 ffxZeroOneFloat16x3ToUint16x3(FfxFloat16x3 x) { return FFX_TO_UINT16X3(x * FFX_TO_FLOAT16X3(FfxUInt16x3(1, 1, 1))); @@ -2039,7 +2040,7 @@ FfxUInt16x3 ffxZeroOneFloat16x3ToUint16x3(FfxFloat16x3 x) /// @returns /// The converted Uint value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x4 ffxZeroOneFloat16x4ToUint16x4(FfxFloat16x4 x) { return FFX_TO_UINT16X4(x * FFX_TO_FLOAT16X4(FfxUInt16x4(1, 1, 1, 1))); @@ -2052,7 +2053,7 @@ FfxUInt16x4 ffxZeroOneFloat16x4ToUint16x4(FfxFloat16x4 x) /// @returns /// The converted half-precision FfxFloat32 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneUint16ToFloat16(FfxUInt16 x) { return FFX_TO_FLOAT16(x * FFX_TO_UINT16(FFX_TO_FLOAT16(1.0))); @@ -2065,7 +2066,7 @@ FfxFloat16 ffxZeroOneUint16ToFloat16(FfxUInt16 x) /// @returns /// The converted half-precision FfxFloat32 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneUint16x2ToFloat16x2(FfxUInt16x2 x) { return FFX_TO_FLOAT16X2(x * FFX_TO_UINT16X2(FfxUInt16x2(FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0)))); @@ -2078,7 +2079,7 @@ FfxFloat16x2 ffxZeroOneUint16x2ToFloat16x2(FfxUInt16x2 x) /// @returns /// The converted half-precision FfxFloat32 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneUint16x3ToFloat16x3(FfxUInt16x3 x) { return FFX_TO_FLOAT16X3(x * FFX_TO_UINT16X3(FfxUInt16x3(FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0)))); @@ -2091,7 +2092,7 @@ FfxFloat16x3 ffxZeroOneUint16x3ToFloat16x3(FfxUInt16x3 x) /// @returns /// The converted half-precision FfxFloat32 value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneUint16x4ToFloat16x4(FfxUInt16x4 x) { return FFX_TO_FLOAT16X4(x * FFX_TO_UINT16X4(FfxUInt16x4(FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0)))); @@ -2105,7 +2106,7 @@ FfxFloat16x4 ffxZeroOneUint16x4ToFloat16x4(FfxUInt16x4 x) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneAndHalf(FfxFloat16 x, FfxFloat16 y) { return min(x, y); @@ -2119,7 +2120,7 @@ FfxFloat16 ffxZeroOneAndHalf(FfxFloat16 x, FfxFloat16 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneAndHalf(FfxFloat16x2 x, FfxFloat16x2 y) { return min(x, y); @@ -2133,7 +2134,7 @@ FfxFloat16x2 ffxZeroOneAndHalf(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneAndHalf(FfxFloat16x3 x, FfxFloat16x3 y) { return min(x, y); @@ -2147,7 +2148,7 @@ FfxFloat16x3 ffxZeroOneAndHalf(FfxFloat16x3 x, FfxFloat16x3 y) /// @returns /// Result of the AND operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneAndHalf(FfxFloat16x4 x, FfxFloat16x4 y) { return min(x, y); @@ -2161,7 +2162,7 @@ FfxFloat16x4 ffxZeroOneAndHalf(FfxFloat16x4 x, FfxFloat16x4 y) /// @returns /// Result of the AND NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxSignedZeroOneAndOrHalf(FfxFloat16 x, FfxFloat16 y) { return (-x) * y + FFX_BROADCAST_FLOAT16(1.0); @@ -2175,7 +2176,7 @@ FfxFloat16 ffxSignedZeroOneAndOrHalf(FfxFloat16 x, FfxFloat16 y) /// @returns /// Result of the AND NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxSignedZeroOneAndOrHalf(FfxFloat16x2 x, FfxFloat16x2 y) { return (-x) * y + FFX_BROADCAST_FLOAT16X2(1.0); @@ -2189,7 +2190,7 @@ FfxFloat16x2 ffxSignedZeroOneAndOrHalf(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// Result of the AND NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxSignedZeroOneAndOrHalf(FfxFloat16x3 x, FfxFloat16x3 y) { return (-x) * y + FFX_BROADCAST_FLOAT16X3(1.0); @@ -2203,7 +2204,7 @@ FfxFloat16x3 ffxSignedZeroOneAndOrHalf(FfxFloat16x3 x, FfxFloat16x3 y) /// @returns /// Result of the AND NOT operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxSignedZeroOneAndOrHalf(FfxFloat16x4 x, FfxFloat16x4 y) { return (-x) * y + FFX_BROADCAST_FLOAT16X4(1.0); @@ -2219,10 +2220,10 @@ FfxFloat16x4 ffxSignedZeroOneAndOrHalf(FfxFloat16x4 x, FfxFloat16x4 y) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneAndOrHalf(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) { - return ffxSaturate(x * y + z); + return FfxFloat16(ffxSaturate(x * y + z)); } /// Conditional free logic AND operation using two half-precision values followed by @@ -2235,10 +2236,10 @@ FfxFloat16 ffxZeroOneAndOrHalf(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneAndOrHalf(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) { - return ffxSaturate(x * y + z); + return FfxFloat16x2(ffxSaturate(x * y + z)); } /// Conditional free logic AND operation using two half-precision values followed by @@ -2251,10 +2252,10 @@ FfxFloat16x2 ffxZeroOneAndOrHalf(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneAndOrHalf(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) { - return ffxSaturate(x * y + z); + return FfxFloat16x3(ffxSaturate(x * y + z)); } /// Conditional free logic AND operation using two half-precision values followed by @@ -2267,10 +2268,10 @@ FfxFloat16x3 ffxZeroOneAndOrHalf(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneAndOrHalf(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) { - return ffxSaturate(x * y + z); + return FfxFloat16x4(ffxSaturate(x * y + z)); } /// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. @@ -2280,10 +2281,10 @@ FfxFloat16x4 ffxZeroOneAndOrHalf(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16(ffxSaturate(x * FFX_BROADCAST_FLOAT16(FFX_POSITIVE_INFINITY_HALF))); } /// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. @@ -2293,10 +2294,10 @@ FfxFloat16 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16 x) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x2 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16X2(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16x2(ffxSaturate(x * FFX_BROADCAST_FLOAT16X2(FFX_POSITIVE_INFINITY_HALF))); } /// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. @@ -2306,10 +2307,10 @@ FfxFloat16x2 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x2 x) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x3 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16X3(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16x3(ffxSaturate(x * FFX_BROADCAST_FLOAT16X3(FFX_POSITIVE_INFINITY_HALF))); } /// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. @@ -2319,10 +2320,10 @@ FfxFloat16x3 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x3 x) /// @returns /// Result of the greater than zero comparison. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x4 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16X4(FFX_POSITIVE_INFINITY_HALF)); + return FfxFloat16x4(ffxSaturate(x * FFX_BROADCAST_FLOAT16X4(FFX_POSITIVE_INFINITY_HALF))); } /// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. @@ -2332,7 +2333,7 @@ FfxFloat16x4 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x4 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneNotHalf(FfxFloat16 x) { return FFX_BROADCAST_FLOAT16(1.0) - x; @@ -2345,7 +2346,7 @@ FfxFloat16 ffxZeroOneNotHalf(FfxFloat16 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneNotHalf(FfxFloat16x2 x) { return FFX_BROADCAST_FLOAT16X2(1.0) - x; @@ -2358,7 +2359,7 @@ FfxFloat16x2 ffxZeroOneNotHalf(FfxFloat16x2 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneNotHalf(FfxFloat16x3 x) { return FFX_BROADCAST_FLOAT16X3(1.0) - x; @@ -2371,7 +2372,7 @@ FfxFloat16x3 ffxZeroOneNotHalf(FfxFloat16x3 x) /// @returns /// Result of the AND OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneNotHalf(FfxFloat16x4 x) { return FFX_BROADCAST_FLOAT16X4(1.0) - x; @@ -2385,7 +2386,7 @@ FfxFloat16x4 ffxZeroOneNotHalf(FfxFloat16x4 x) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneOrHalf(FfxFloat16 x, FfxFloat16 y) { return max(x, y); @@ -2399,7 +2400,7 @@ FfxFloat16 ffxZeroOneOrHalf(FfxFloat16 x, FfxFloat16 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneOrHalf(FfxFloat16x2 x, FfxFloat16x2 y) { return max(x, y); @@ -2413,7 +2414,7 @@ FfxFloat16x2 ffxZeroOneOrHalf(FfxFloat16x2 x, FfxFloat16x2 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneOrHalf(FfxFloat16x3 x, FfxFloat16x3 y) { return max(x, y); @@ -2427,7 +2428,7 @@ FfxFloat16x3 ffxZeroOneOrHalf(FfxFloat16x3 x, FfxFloat16x3 y) /// @returns /// Result of the OR operation. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneOrHalf(FfxFloat16x4 x, FfxFloat16x4 y) { return max(x, y); @@ -2442,7 +2443,7 @@ FfxFloat16x4 ffxZeroOneOrHalf(FfxFloat16x4 x, FfxFloat16x4 y) /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneSelectHalf(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) { FfxFloat16 r = (-x) * z + z; @@ -2458,7 +2459,7 @@ FfxFloat16 ffxZeroOneSelectHalf(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneSelectHalf(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) { FfxFloat16x2 r = (-x) * z + z; @@ -2474,7 +2475,7 @@ FfxFloat16x2 ffxZeroOneSelectHalf(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneSelectHalf(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) { FfxFloat16x3 r = (-x) * z + z; @@ -2490,7 +2491,7 @@ FfxFloat16x3 ffxZeroOneSelectHalf(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z /// @returns /// The selected value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneSelectHalf(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) { FfxFloat16x4 r = (-x) * z + z; @@ -2504,10 +2505,10 @@ FfxFloat16x4 ffxZeroOneSelectHalf(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxZeroOneIsSignedHalf(FfxFloat16 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16(ffxSaturate(x * FFX_BROADCAST_FLOAT16(FFX_NEGATIVE_INFINITY_HALF))); } /// Given a half-precision value, returns 1.0 if less than zero and 0.0 if not. @@ -2517,10 +2518,10 @@ FfxFloat16 ffxZeroOneIsSignedHalf(FfxFloat16 x) /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxZeroOneIsSignedHalf(FfxFloat16x2 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16X2(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16x2(ffxSaturate(x * FFX_BROADCAST_FLOAT16X2(FFX_NEGATIVE_INFINITY_HALF))); } /// Given a half-precision value, returns 1.0 if less than zero and 0.0 if not. @@ -2530,10 +2531,10 @@ FfxFloat16x2 ffxZeroOneIsSignedHalf(FfxFloat16x2 x) /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxZeroOneIsSignedHalf(FfxFloat16x3 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16X3(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16x3(ffxSaturate(x * FFX_BROADCAST_FLOAT16X3(FFX_NEGATIVE_INFINITY_HALF))); } /// Given a half-precision value, returns 1.0 if less than zero and 0.0 if not. @@ -2543,10 +2544,10 @@ FfxFloat16x3 ffxZeroOneIsSignedHalf(FfxFloat16x3 x) /// @returns /// Result of the sign value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x4 ffxZeroOneIsSignedHalf(FfxFloat16x4 x) { - return ffxSaturate(x * FFX_BROADCAST_FLOAT16X4(FFX_NEGATIVE_INFINITY_HALF)); + return FfxFloat16x4(ffxSaturate(x * FFX_BROADCAST_FLOAT16X4(FFX_NEGATIVE_INFINITY_HALF))); } /// Compute a Rec.709 color space. @@ -2562,7 +2563,7 @@ FfxFloat16x4 ffxZeroOneIsSignedHalf(FfxFloat16x4 x) /// @returns /// The color in Rec.709 space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxRec709FromLinearHalf(FfxFloat16 c) { FfxFloat16x3 j = FfxFloat16x3(0.018 * 4.5, 4.5, 0.45); @@ -2583,7 +2584,7 @@ FfxFloat16 ffxRec709FromLinearHalf(FfxFloat16 c) /// @returns /// The color in Rec.709 space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxRec709FromLinearHalf(FfxFloat16x2 c) { FfxFloat16x3 j = FfxFloat16x3(0.018 * 4.5, 4.5, 0.45); @@ -2604,7 +2605,7 @@ FfxFloat16x2 ffxRec709FromLinearHalf(FfxFloat16x2 c) /// @returns /// The color in Rec.709 space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxRec709FromLinearHalf(FfxFloat16x3 c) { FfxFloat16x3 j = FfxFloat16x3(0.018 * 4.5, 4.5, 0.45); @@ -2624,7 +2625,7 @@ FfxFloat16x3 ffxRec709FromLinearHalf(FfxFloat16x3 c) /// @returns /// A value in gamma space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxGammaFromLinearHalf(FfxFloat16 c, FfxFloat16 rcpX) { return pow(c, FFX_BROADCAST_FLOAT16(rcpX)); @@ -2642,7 +2643,7 @@ FfxFloat16 ffxGammaFromLinearHalf(FfxFloat16 c, FfxFloat16 rcpX) /// @returns /// A value in gamma space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxGammaFromLinearHalf(FfxFloat16x2 c, FfxFloat16 rcpX) { return pow(c, FFX_BROADCAST_FLOAT16X2(rcpX)); @@ -2660,7 +2661,7 @@ FfxFloat16x2 ffxGammaFromLinearHalf(FfxFloat16x2 c, FfxFloat16 rcpX) /// @returns /// A value in gamma space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxGammaFromLinearHalf(FfxFloat16x3 c, FfxFloat16 rcpX) { return pow(c, FFX_BROADCAST_FLOAT16X3(rcpX)); @@ -2673,7 +2674,7 @@ FfxFloat16x3 ffxGammaFromLinearHalf(FfxFloat16x3 c, FfxFloat16 rcpX) /// @returns /// A value in SRGB space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxSrgbFromLinearHalf(FfxFloat16 c) { FfxFloat16x3 j = FfxFloat16x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); @@ -2688,7 +2689,7 @@ FfxFloat16 ffxSrgbFromLinearHalf(FfxFloat16 c) /// @returns /// A value in SRGB space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxSrgbFromLinearHalf(FfxFloat16x2 c) { FfxFloat16x3 j = FfxFloat16x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); @@ -2703,7 +2704,7 @@ FfxFloat16x2 ffxSrgbFromLinearHalf(FfxFloat16x2 c) /// @returns /// A value in SRGB space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxSrgbFromLinearHalf(FfxFloat16x3 c) { FfxFloat16x3 j = FfxFloat16x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); @@ -2718,7 +2719,7 @@ FfxFloat16x3 ffxSrgbFromLinearHalf(FfxFloat16x3 c) /// @returns /// A square root of the input value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxSquareRootHalf(FfxFloat16 c) { return sqrt(c); @@ -2731,7 +2732,7 @@ FfxFloat16 ffxSquareRootHalf(FfxFloat16 c) /// @returns /// A square root of the input value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxSquareRootHalf(FfxFloat16x2 c) { return sqrt(c); @@ -2744,7 +2745,7 @@ FfxFloat16x2 ffxSquareRootHalf(FfxFloat16x2 c) /// @returns /// A square root of the input value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxSquareRootHalf(FfxFloat16x3 c) { return sqrt(c); @@ -2757,7 +2758,7 @@ FfxFloat16x3 ffxSquareRootHalf(FfxFloat16x3 c) /// @returns /// A cube root of the input value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxCubeRootHalf(FfxFloat16 c) { return pow(c, FFX_BROADCAST_FLOAT16(1.0 / 3.0)); @@ -2770,7 +2771,7 @@ FfxFloat16 ffxCubeRootHalf(FfxFloat16 c) /// @returns /// A cube root of the input value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxCubeRootHalf(FfxFloat16x2 c) { return pow(c, FFX_BROADCAST_FLOAT16X2(1.0 / 3.0)); @@ -2783,7 +2784,7 @@ FfxFloat16x2 ffxCubeRootHalf(FfxFloat16x2 c) /// @returns /// A cube root of the input value. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxCubeRootHalf(FfxFloat16x3 c) { return pow(c, FFX_BROADCAST_FLOAT16X3(1.0 / 3.0)); @@ -2796,7 +2797,7 @@ FfxFloat16x3 ffxCubeRootHalf(FfxFloat16x3 c) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxLinearFromRec709Half(FfxFloat16 c) { FfxFloat16x3 j = FfxFloat16x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); @@ -2811,7 +2812,7 @@ FfxFloat16 ffxLinearFromRec709Half(FfxFloat16 c) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxLinearFromRec709Half(FfxFloat16x2 c) { FfxFloat16x3 j = FfxFloat16x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); @@ -2826,7 +2827,7 @@ FfxFloat16x2 ffxLinearFromRec709Half(FfxFloat16x2 c) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxLinearFromRec709Half(FfxFloat16x3 c) { FfxFloat16x3 j = FfxFloat16x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); @@ -2844,7 +2845,7 @@ FfxFloat16x3 ffxLinearFromRec709Half(FfxFloat16x3 c) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxLinearFromGammaHalf(FfxFloat16 c, FfxFloat16 x) { return pow(c, FFX_BROADCAST_FLOAT16(x)); @@ -2860,7 +2861,7 @@ FfxFloat16 ffxLinearFromGammaHalf(FfxFloat16 c, FfxFloat16 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxLinearFromGammaHalf(FfxFloat16x2 c, FfxFloat16 x) { return pow(c, FFX_BROADCAST_FLOAT16X2(x)); @@ -2876,7 +2877,7 @@ FfxFloat16x2 ffxLinearFromGammaHalf(FfxFloat16x2 c, FfxFloat16 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxLinearFromGammaHalf(FfxFloat16x3 c, FfxFloat16 x) { return pow(c, FFX_BROADCAST_FLOAT16X3(x)); @@ -2891,7 +2892,7 @@ FfxFloat16x3 ffxLinearFromGammaHalf(FfxFloat16x3 c, FfxFloat16 x) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16 ffxLinearFromSrgbHalf(FfxFloat16 c) { FfxFloat16x3 j = FfxFloat16x3(0.04045 / 12.92, 1.0 / 12.92, 2.4); @@ -2908,7 +2909,7 @@ FfxFloat16 ffxLinearFromSrgbHalf(FfxFloat16 c) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x2 ffxLinearFromSrgbHalf(FfxFloat16x2 c) { FfxFloat16x3 j = FfxFloat16x3(0.04045 / 12.92, 1.0 / 12.92, 2.4); @@ -2925,7 +2926,7 @@ FfxFloat16x2 ffxLinearFromSrgbHalf(FfxFloat16x2 c) /// @returns /// A value in linear space. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxFloat16x3 ffxLinearFromSrgbHalf(FfxFloat16x3 c) { FfxFloat16x3 j = FfxFloat16x3(0.04045 / 12.92, 1.0 / 12.92, 2.4); @@ -2945,7 +2946,7 @@ FfxFloat16x3 ffxLinearFromSrgbHalf(FfxFloat16x3 c) /// @returns /// The remapped 2D coordinates. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxRemapForQuadHalf(FfxUInt32 a) { return FfxUInt16x2(bitfieldExtract(a, 1u, 3u), bitfieldInsertMask(bitfieldExtract(a, 3u, 3u), a, 1u)); @@ -2969,7 +2970,7 @@ FfxUInt16x2 ffxRemapForQuadHalf(FfxUInt32 a) /// @returns /// The remapped 2D coordinates. /// -/// @ingroup GPU +/// @ingroup GPUCore FfxUInt16x2 ffxRemapForWaveReductionHalf(FfxUInt32 a) { return FfxUInt16x2(bitfieldInsertMask(bitfieldExtract(a, 2u, 3u), a, 1u), bitfieldInsertMask(bitfieldExtract(a, 3u, 3u), bitfieldExtract(a, 1u, 2u), 2u)); diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common_half.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common_half.h.meta new file mode 100644 index 0000000..e78eec4 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_gpu_common_half.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 1bdb323791a91a5438ee8e1e63187840 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_hlsl.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_hlsl.h similarity index 86% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_hlsl.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_hlsl.h index ad4ff65..8ea0eea 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_hlsl.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_hlsl.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,188 +19,221 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + +/// @defgroup HLSLCore HLSL Core +/// HLSL core defines and functions +/// +/// @ingroup FfxHLSL + +#define DECLARE_SRV_REGISTER(regIndex) t##regIndex +#define DECLARE_UAV_REGISTER(regIndex) u##regIndex +#define DECLARE_CB_REGISTER(regIndex) b##regIndex +#define FFX_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex)) +#define FFX_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex)) +#define FFX_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex)) + /// A define for abstracting shared memory between shading languages. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_GROUPSHARED groupshared /// A define for abstracting compute memory barriers between shading languages. /// -/// @ingroup GPU -#define FFX_GROUP_MEMORY_BARRIER GroupMemoryBarrierWithGroupSync +/// @ingroup HLSLCore +#define FFX_GROUP_MEMORY_BARRIER() GroupMemoryBarrierWithGroupSync() + +/// A define for abstracting compute atomic additions between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_ATOMIC_ADD(x, y) InterlockedAdd(x, y) /// A define added to accept static markup on functions to aid CPU/GPU portability of code. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_STATIC static /// A define for abstracting loop unrolling between shading languages. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_UNROLL [unroll] /// A define for abstracting a 'greater than' comparison operator between two types. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_GREATER_THAN(x, y) x > y /// A define for abstracting a 'greater than or equal' comparison operator between two types. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_GREATER_THAN_EQUAL(x, y) x >= y /// A define for abstracting a 'less than' comparison operator between two types. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_LESS_THAN(x, y) x < y /// A define for abstracting a 'less than or equal' comparison operator between two types. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_LESS_THAN_EQUAL(x, y) x <= y /// A define for abstracting an 'equal' comparison operator between two types. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_EQUAL(x, y) x == y /// A define for abstracting a 'not equal' comparison operator between two types. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_NOT_EQUAL(x, y) x != y +/// A define for abstracting matrix multiply operations between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_MATRIX_MULTIPLY(a, b) mul(a, b) + +/// A define for abstracting vector transformations between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_TRANSFORM_VECTOR(a, b) mul(a, b) + +/// A define for abstracting modulo operations between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_MODULO(a, b) (fmod(a, b)) + /// Broadcast a scalar value to a 1-dimensional floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_FLOAT32(x) FfxFloat32(x) /// Broadcast a scalar value to a 2-dimensional floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_FLOAT32X2(x) FfxFloat32(x) /// Broadcast a scalar value to a 3-dimensional floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_FLOAT32X3(x) FfxFloat32(x) /// Broadcast a scalar value to a 4-dimensional floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_FLOAT32X4(x) FfxFloat32(x) /// Broadcast a scalar value to a 1-dimensional unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_UINT32(x) FfxUInt32(x) /// Broadcast a scalar value to a 2-dimensional unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_UINT32X2(x) FfxUInt32(x) /// Broadcast a scalar value to a 4-dimensional unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_UINT32X3(x) FfxUInt32(x) /// Broadcast a scalar value to a 4-dimensional unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_UINT32X4(x) FfxUInt32(x) /// Broadcast a scalar value to a 1-dimensional signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_INT32(x) FfxInt32(x) /// Broadcast a scalar value to a 2-dimensional signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_INT32X2(x) FfxInt32(x) /// Broadcast a scalar value to a 3-dimensional signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_INT32X3(x) FfxInt32(x) /// Broadcast a scalar value to a 4-dimensional signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_INT32X4(x) FfxInt32(x) /// Broadcast a scalar value to a 1-dimensional half-precision floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_FLOAT16(a) FFX_MIN16_F(a) /// Broadcast a scalar value to a 2-dimensional half-precision floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_FLOAT16X2(a) FFX_MIN16_F(a) /// Broadcast a scalar value to a 3-dimensional half-precision floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_FLOAT16X3(a) FFX_MIN16_F(a) /// Broadcast a scalar value to a 4-dimensional half-precision floating point vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_FLOAT16X4(a) FFX_MIN16_F(a) /// Broadcast a scalar value to a 1-dimensional half-precision unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_UINT16(a) FFX_MIN16_U(a) /// Broadcast a scalar value to a 2-dimensional half-precision unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_UINT16X2(a) FFX_MIN16_U(a) /// Broadcast a scalar value to a 3-dimensional half-precision unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_UINT16X3(a) FFX_MIN16_U(a) /// Broadcast a scalar value to a 4-dimensional half-precision unsigned integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_UINT16X4(a) FFX_MIN16_U(a) /// Broadcast a scalar value to a 1-dimensional half-precision signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_INT16(a) FFX_MIN16_I(a) /// Broadcast a scalar value to a 2-dimensional half-precision signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_INT16X2(a) FFX_MIN16_I(a) /// Broadcast a scalar value to a 3-dimensional half-precision signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_INT16X3(a) FFX_MIN16_I(a) /// Broadcast a scalar value to a 4-dimensional half-precision signed integer vector. /// -/// @ingroup GPU +/// @ingroup HLSLCore #define FFX_BROADCAST_MIN_INT16X4(a) FFX_MIN16_I(a) /// Pack 2x32-bit floating point values in a single 32bit value. -/// +/// /// This function first converts each component of value into their nearest 16-bit floating /// point representation, and then stores the X and Y components in the lower and upper 16 bits of the /// 32bit unsigned integer respectively. /// /// @param [in] value A 2-dimensional floating point value to convert and pack. -/// +/// /// @returns /// A packed 32bit value containing 2 16bit floating point values. -/// -/// @ingroup HLSL +/// +/// @ingroup HLSLCore FfxUInt32 packHalf2x16(FfxFloat32x2 value) { return f32tof16(value.x) | (f32tof16(value.y) << 16); @@ -213,7 +246,7 @@ FfxUInt32 packHalf2x16(FfxFloat32x2 value) /// @returns /// A 2-dimensional floating point vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxBroadcast2(FfxFloat32 value) { return FfxFloat32x2(value, value); @@ -226,7 +259,7 @@ FfxFloat32x2 ffxBroadcast2(FfxFloat32 value) /// @returns /// A 3-dimensional floating point vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxBroadcast3(FfxFloat32 value) { return FfxFloat32x3(value, value, value); @@ -239,7 +272,7 @@ FfxFloat32x3 ffxBroadcast3(FfxFloat32 value) /// @returns /// A 4-dimensional floating point vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxBroadcast4(FfxFloat32 value) { return FfxFloat32x4(value, value, value, value); @@ -252,7 +285,7 @@ FfxFloat32x4 ffxBroadcast4(FfxFloat32 value) /// @returns /// A 2-dimensional signed integer vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxInt32x2 ffxBroadcast2(FfxInt32 value) { return FfxInt32x2(value, value); @@ -265,7 +298,7 @@ FfxInt32x2 ffxBroadcast2(FfxInt32 value) /// @returns /// A 3-dimensional signed integer vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x3 ffxBroadcast3(FfxInt32 value) { return FfxUInt32x3(value, value, value); @@ -278,7 +311,7 @@ FfxUInt32x3 ffxBroadcast3(FfxInt32 value) /// @returns /// A 4-dimensional signed integer vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxInt32x4 ffxBroadcast4(FfxInt32 value) { return FfxInt32x4(value, value, value, value); @@ -291,7 +324,7 @@ FfxInt32x4 ffxBroadcast4(FfxInt32 value) /// @returns /// A 2-dimensional unsigned integer vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x2 ffxBroadcast2(FfxUInt32 value) { return FfxUInt32x2(value, value); @@ -304,7 +337,7 @@ FfxUInt32x2 ffxBroadcast2(FfxUInt32 value) /// @returns /// A 3-dimensional unsigned integer vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x3 ffxBroadcast3(FfxUInt32 value) { return FfxUInt32x3(value, value, value); @@ -317,7 +350,7 @@ FfxUInt32x3 ffxBroadcast3(FfxUInt32 value) /// @returns /// A 4-dimensional unsigned integer vector with value in each component. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x4 ffxBroadcast4(FfxUInt32 value) { return FfxUInt32x4(value, value, value, value); @@ -342,12 +375,12 @@ FfxUInt32 bitfieldInsertMask(FfxUInt32 src, FfxUInt32 ins, FfxUInt32 bits) /// Interprets the bit pattern of x as an unsigned integer. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as an unsigned integer. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32 ffxAsUInt32(FfxFloat32 x) { return asuint(x); @@ -355,12 +388,12 @@ FfxUInt32 ffxAsUInt32(FfxFloat32 x) /// Interprets the bit pattern of x as an unsigned integer. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as an unsigned integer. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x2 ffxAsUInt32(FfxFloat32x2 x) { return asuint(x); @@ -368,12 +401,12 @@ FfxUInt32x2 ffxAsUInt32(FfxFloat32x2 x) /// Interprets the bit pattern of x as an unsigned integer. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as an unsigned integer. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x3 ffxAsUInt32(FfxFloat32x3 x) { return asuint(x); @@ -381,12 +414,12 @@ FfxUInt32x3 ffxAsUInt32(FfxFloat32x3 x) /// Interprets the bit pattern of x as an unsigned integer. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as an unsigned integer. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x4 ffxAsUInt32(FfxFloat32x4 x) { return asuint(x); @@ -394,12 +427,12 @@ FfxUInt32x4 ffxAsUInt32(FfxFloat32x4 x) /// Interprets the bit pattern of x as a floating-point number. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as a floating-point number. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32 ffxAsFloat(FfxUInt32 x) { return asfloat(x); @@ -407,12 +440,12 @@ FfxFloat32 ffxAsFloat(FfxUInt32 x) /// Interprets the bit pattern of x as a floating-point number. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as a floating-point number. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxAsFloat(FfxUInt32x2 x) { return asfloat(x); @@ -420,12 +453,12 @@ FfxFloat32x2 ffxAsFloat(FfxUInt32x2 x) /// Interprets the bit pattern of x as a floating-point number. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as a floating-point number. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxAsFloat(FfxUInt32x3 x) { return asfloat(x); @@ -433,12 +466,12 @@ FfxFloat32x3 ffxAsFloat(FfxUInt32x3 x) /// Interprets the bit pattern of x as a floating-point number. /// -/// @param [in] value The input value. +/// @param [in] x The input value. /// /// @returns /// The input interpreted as a floating-point number. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxAsFloat(FfxUInt32x4 x) { return asfloat(x); @@ -458,7 +491,7 @@ FfxFloat32x4 ffxAsFloat(FfxUInt32x4 x) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t) { return lerp(x, y, t); @@ -478,7 +511,7 @@ FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32 t) { return lerp(x, y, t); @@ -498,7 +531,7 @@ FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32 t) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 t) { return lerp(x, y, t); @@ -518,7 +551,7 @@ FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 t) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32 t) { return lerp(x, y, t); @@ -538,7 +571,7 @@ FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32 t) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 t) { return lerp(x, y, t); @@ -558,7 +591,7 @@ FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 t) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32 t) { return lerp(x, y, t); @@ -578,7 +611,7 @@ FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32 t) /// @returns /// A linearly interpolated value between x and y according to t. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 t) { return lerp(x, y, t); @@ -591,7 +624,7 @@ FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 t) /// @returns /// The clamped version of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32 ffxSaturate(FfxFloat32 x) { return saturate(x); @@ -604,7 +637,7 @@ FfxFloat32 ffxSaturate(FfxFloat32 x) /// @returns /// The clamped version of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxSaturate(FfxFloat32x2 x) { return saturate(x); @@ -617,7 +650,7 @@ FfxFloat32x2 ffxSaturate(FfxFloat32x2 x) /// @returns /// The clamped version of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxSaturate(FfxFloat32x3 x) { return saturate(x); @@ -630,7 +663,7 @@ FfxFloat32x3 ffxSaturate(FfxFloat32x3 x) /// @returns /// The clamped version of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxSaturate(FfxFloat32x4 x) { return saturate(x); @@ -645,11 +678,11 @@ FfxFloat32x4 ffxSaturate(FfxFloat32x4 x) /// function. /// /// @param [in] x The value to compute the fractional part from. -/// +/// /// @returns /// The fractional part of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32 ffxFract(FfxFloat32 x) { return x - floor(x); @@ -668,7 +701,7 @@ FfxFloat32 ffxFract(FfxFloat32 x) /// @returns /// The fractional part of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxFract(FfxFloat32x2 x) { return x - floor(x); @@ -687,7 +720,7 @@ FfxFloat32x2 ffxFract(FfxFloat32x2 x) /// @returns /// The fractional part of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxFract(FfxFloat32x3 x) { return x - floor(x); @@ -698,7 +731,7 @@ FfxFloat32x3 ffxFract(FfxFloat32x3 x) /// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. /// /// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is -/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic /// function. /// /// @param [in] x The value to compute the fractional part from. @@ -706,7 +739,7 @@ FfxFloat32x3 ffxFract(FfxFloat32x3 x) /// @returns /// The fractional part of x. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxFract(FfxFloat32x4 x) { return x - floor(x); @@ -715,15 +748,15 @@ FfxFloat32x4 ffxFract(FfxFloat32x4 x) /// Compute the maximum of three values. /// /// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. -/// +/// /// @param [in] x The first value to include in the max calculation. /// @param [in] y The second value to include in the max calcuation. /// @param [in] z The third value to include in the max calcuation. -/// +/// /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32 ffxMax3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) { return max(x, max(y, z)); @@ -732,7 +765,7 @@ FfxFloat32 ffxMax3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) /// Compute the maximum of three values. /// /// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. -/// +/// /// @param [in] x The first value to include in the max calculation. /// @param [in] y The second value to include in the max calcuation. /// @param [in] z The third value to include in the max calcuation. @@ -740,7 +773,7 @@ FfxFloat32 ffxMax3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxMax3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) { return max(x, max(y, z)); @@ -749,7 +782,7 @@ FfxFloat32x2 ffxMax3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) /// Compute the maximum of three values. /// /// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. -/// +/// /// @param [in] x The first value to include in the max calculation. /// @param [in] y The second value to include in the max calcuation. /// @param [in] z The third value to include in the max calcuation. @@ -757,7 +790,7 @@ FfxFloat32x2 ffxMax3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxMax3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) { return max(x, max(y, z)); @@ -774,7 +807,7 @@ FfxFloat32x3 ffxMax3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxMax3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) { return max(x, max(y, z)); @@ -791,7 +824,7 @@ FfxFloat32x4 ffxMax3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32 ffxMax3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) { return max(x, max(y, z)); @@ -808,7 +841,7 @@ FfxUInt32 ffxMax3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x2 ffxMax3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) { return max(x, max(y, z)); @@ -825,7 +858,7 @@ FfxUInt32x2 ffxMax3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x3 ffxMax3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) { return max(x, max(y, z)); @@ -842,7 +875,7 @@ FfxUInt32x3 ffxMax3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) /// @returns /// The maximum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x4 ffxMax3(FfxUInt32x4 x, FfxUInt32x4 y, FfxUInt32x4 z) { return max(x, max(y, z)); @@ -859,7 +892,7 @@ FfxUInt32x4 ffxMax3(FfxUInt32x4 x, FfxUInt32x4 y, FfxUInt32x4 z) /// @returns /// The median value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32 ffxMed3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) { return max(min(x, y), min(max(x, y), z)); @@ -876,7 +909,7 @@ FfxFloat32 ffxMed3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) /// @returns /// The median value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxMed3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) { return max(min(x, y), min(max(x, y), z)); @@ -893,7 +926,7 @@ FfxFloat32x2 ffxMed3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) /// @returns /// The median value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxMed3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) { return max(min(x, y), min(max(x, y), z)); @@ -910,7 +943,7 @@ FfxFloat32x3 ffxMed3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) /// @returns /// The median value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxMed3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) { return max(min(x, y), min(max(x, y), z)); @@ -990,7 +1023,7 @@ FfxInt32x4 ffxMed3(FfxInt32x4 x, FfxInt32x4 y, FfxInt32x4 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_I32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. /// @param [in] y The second value to include in the min calcuation. @@ -999,7 +1032,7 @@ FfxInt32x4 ffxMed3(FfxInt32x4 x, FfxInt32x4 y, FfxInt32x4 z) /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32 ffxMin3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) { return min(x, min(y, z)); @@ -1007,7 +1040,7 @@ FfxFloat32 ffxMin3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_I32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. /// @param [in] y The second value to include in the min calcuation. @@ -1016,7 +1049,7 @@ FfxFloat32 ffxMin3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x2 ffxMin3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) { return min(x, min(y, z)); @@ -1024,7 +1057,7 @@ FfxFloat32x2 ffxMin3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_I32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. /// @param [in] y The second value to include in the min calcuation. @@ -1033,7 +1066,7 @@ FfxFloat32x2 ffxMin3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x3 ffxMin3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) { return min(x, min(y, z)); @@ -1041,7 +1074,7 @@ FfxFloat32x3 ffxMin3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. /// @param [in] y The second value to include in the min calcuation. @@ -1050,7 +1083,7 @@ FfxFloat32x3 ffxMin3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxFloat32x4 ffxMin3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) { return min(x, min(y, z)); @@ -1058,7 +1091,7 @@ FfxFloat32x4 ffxMin3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. /// @param [in] y The second value to include in the min calcuation. @@ -1067,7 +1100,7 @@ FfxFloat32x4 ffxMin3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32 ffxMin3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) { return min(x, min(y, z)); @@ -1075,7 +1108,7 @@ FfxUInt32 ffxMin3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. /// @param [in] y The second value to include in the min calcuation. @@ -1084,7 +1117,7 @@ FfxUInt32 ffxMin3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x2 ffxMin3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) { return min(x, min(y, z)); @@ -1092,16 +1125,16 @@ FfxUInt32x2 ffxMin3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. -/// @param [in] y The second value to include in the min calcuation. -/// @param [in] z The third value to include in the min calcuation. +/// @param [in] y The second value to include in the min calculation. +/// @param [in] z The third value to include in the min calculation. /// /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x3 ffxMin3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) { return min(x, min(y, z)); @@ -1109,7 +1142,7 @@ FfxUInt32x3 ffxMin3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) /// Compute the minimum of three values. /// -/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. /// /// @param [in] x The first value to include in the min calculation. /// @param [in] y The second value to include in the min calcuation. @@ -1118,7 +1151,7 @@ FfxUInt32x3 ffxMin3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) /// @returns /// The minimum value of x, y, and z. /// -/// @ingroup HLSL +/// @ingroup HLSLCore FfxUInt32x4 ffxMin3(FfxUInt32x4 x, FfxUInt32x4 y, FfxUInt32x4 z) { return min(x, min(y, z)); @@ -1130,11 +1163,18 @@ FfxUInt32 AShrSU1(FfxUInt32 a, FfxUInt32 b) return FfxUInt32(FfxInt32(a) >> FfxInt32(b)); } +FfxUInt32 ffxPackF32(FfxFloat32x2 v){ + FfxUInt32x2 p = FfxUInt32x2(f32tof16(FfxFloat32x2(v).x), f32tof16(FfxFloat32x2(v).y)); + return p.x | (p.y << 16); +} + +FfxFloat32x2 ffxUnpackF32(FfxUInt32 a){ + return f16tof32(FfxUInt32x2(a & 0xFFFF, a >> 16)); +} + //============================================================================================================================== // HLSL HALF //============================================================================================================================== -#if FFX_HALF - //============================================================================================================================== // Need to use manual unpack to get optimal execution (don't use packed types in buffers directly). // Unpack requires this pattern: https://gpuopen.com/first-steps-implementing-fp16/ @@ -1156,10 +1196,59 @@ FFX_MIN16_U4 ffxUint32x2ToUint16x4(FfxUInt32x2 x) { return FFX_MIN16_U4(ffxUint32ToUint16x2(x.x), ffxUint32ToUint16x2(x.y)); } + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32 ffxInvertSafe(FfxFloat32 v){ + FfxFloat32 s = sign(v); + FfxFloat32 s2 = s*s; + return s2/(v + s2 - 1.0); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x2 ffxInvertSafe(FfxFloat32x2 v){ + FfxFloat32x2 s = sign(v); + FfxFloat32x2 s2 = s*s; + return s2/(v + s2 - FfxFloat32x2(1.0, 1.0)); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x3 ffxInvertSafe(FfxFloat32x3 v){ + FfxFloat32x3 s = sign(v); + FfxFloat32x3 s2 = s*s; + return s2/(v + s2 - FfxFloat32x3(1.0, 1.0, 1.0)); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x4 ffxInvertSafe(FfxFloat32x4 v){ + FfxFloat32x4 s = sign(v); + FfxFloat32x4 s2 = s*s; + return s2/(v + s2 - FfxFloat32x4(1.0, 1.0, 1.0, 1.0)); +} + #define FFX_UINT32_TO_FLOAT16X2(x) ffxUint32ToFloat16x2(FfxUInt32(x)) +#if FFX_HALF + #define FFX_UINT32X2_TO_FLOAT16X4(x) ffxUint32x2ToFloat16x4(FfxUInt32x2(x)) #define FFX_UINT32_TO_UINT16X2(x) ffxUint32ToUint16x2(FfxUInt32(x)) #define FFX_UINT32X2_TO_UINT16X4(x) ffxUint32x2ToUint16x4(FfxUInt32x2(x)) + +FfxUInt32 ffxPackF16(FfxFloat16x2 v){ + FfxUInt32x2 p = FfxUInt32x2(f32tof16(FfxFloat32x2(v).x), f32tof16(FfxFloat32x2(v).y)); + return p.x | (p.y << 16); +} + +FfxFloat16x2 ffxUnpackF16(FfxUInt32 a){ + return FfxFloat16x2(f16tof32(FfxUInt32x2(a & 0xFFFF, a >> 16))); +} + //------------------------------------------------------------------------------------------------------------------------------ FfxUInt32 FFX_MIN16_F2ToUint32(FFX_MIN16_F2 x) { @@ -1182,7 +1271,7 @@ FfxUInt32x2 FFX_MIN16_U4ToUint32x2(FFX_MIN16_U4 x) #define FFX_UINT16X2_TO_UINT32(x) FFX_MIN16_U2ToUint32(FFX_MIN16_U2(x)) #define FFX_UINT16X4_TO_UINT32X2(x) FFX_MIN16_U4ToUint32x2(FFX_MIN16_U4(x)) -#if defined(FFX_HLSL_6_2) && !defined(FFX_NO_16_BIT_CAST) +#if (FFX_HLSL_SM >= 62) && !defined(FFX_NO_16_BIT_CAST) #define FFX_TO_UINT16(x) asuint16(x) #define FFX_TO_UINT16X2(x) asuint16(x) #define FFX_TO_UINT16X3(x) asuint16(x) @@ -1192,9 +1281,9 @@ FfxUInt32x2 FFX_MIN16_U4ToUint32x2(FFX_MIN16_U4 x) #define FFX_TO_UINT16X2(a) FFX_MIN16_U2(FFX_TO_UINT16((a).x), FFX_TO_UINT16((a).y)) #define FFX_TO_UINT16X3(a) FFX_MIN16_U3(FFX_TO_UINT16((a).x), FFX_TO_UINT16((a).y), FFX_TO_UINT16((a).z)) #define FFX_TO_UINT16X4(a) FFX_MIN16_U4(FFX_TO_UINT16((a).x), FFX_TO_UINT16((a).y), FFX_TO_UINT16((a).z), FFX_TO_UINT16((a).w)) -#endif // #if defined(FFX_HLSL_6_2) && !defined(FFX_NO_16_BIT_CAST) +#endif // #if (FFX_HLSL_SM>=62) && !defined(FFX_NO_16_BIT_CAST) -#if defined(FFX_HLSL_6_2) && !defined(FFX_NO_16_BIT_CAST) +#if (FFX_HLSL_SM >= 62) && !defined(FFX_NO_16_BIT_CAST) #define FFX_TO_FLOAT16(x) asfloat16(x) #define FFX_TO_FLOAT16X2(x) asfloat16(x) #define FFX_TO_FLOAT16X3(x) asfloat16(x) @@ -1204,7 +1293,7 @@ FfxUInt32x2 FFX_MIN16_U4ToUint32x2(FFX_MIN16_U4 x) #define FFX_TO_FLOAT16X2(a) FFX_MIN16_F2(FFX_TO_FLOAT16((a).x), FFX_TO_FLOAT16((a).y)) #define FFX_TO_FLOAT16X3(a) FFX_MIN16_F3(FFX_TO_FLOAT16((a).x), FFX_TO_FLOAT16((a).y), FFX_TO_FLOAT16((a).z)) #define FFX_TO_FLOAT16X4(a) FFX_MIN16_F4(FFX_TO_FLOAT16((a).x), FFX_TO_FLOAT16((a).y), FFX_TO_FLOAT16((a).z), FFX_TO_FLOAT16((a).w)) -#endif // #if defined(FFX_HLSL_6_2) && !defined(FFX_NO_16_BIT_CAST) +#endif // #if (FFX_HLSL_SM>=62) && !defined(FFX_NO_16_BIT_CAST) //============================================================================================================================== #define FFX_BROADCAST_FLOAT16(a) FFX_MIN16_F(a) @@ -1480,6 +1569,66 @@ FfxUInt32x4 AWaveXorU1(FfxUInt32x4 v, FfxUInt32 x) { return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); } +FfxBoolean AWaveIsFirstLane() +{ + return WaveIsFirstLane(); +} +FfxUInt32 AWaveLaneIndex() +{ + return WaveGetLaneIndex(); +} +FfxBoolean AWaveReadAtLaneIndexB1(FfxBoolean v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, x); +} +FfxUInt32 AWavePrefixCountBits(FfxBoolean v) +{ + return WavePrefixCountBits(v); +} +FfxUInt32 AWaveActiveCountBits(FfxBoolean v) +{ + return WaveActiveCountBits(v); +} +FfxUInt32 AWaveReadLaneFirstU1(FfxUInt32 v) +{ + return WaveReadLaneFirst(v); +} +FfxUInt32 WaveOr(FfxUInt32 a) +{ + return WaveActiveBitOr(a); +} +FfxFloat32 WaveMin(FfxFloat32 a) +{ + return WaveActiveMin(a); +} +FfxFloat32 WaveMax(FfxFloat32 a) +{ + return WaveActiveMax(a); +} +FfxUInt32 WaveLaneCount() +{ + return WaveGetLaneCount(); +} +FfxBoolean WaveAllTrue(FfxBoolean v) +{ + return WaveActiveAllTrue(v); +} +FfxFloat32 QuadReadX(FfxFloat32 v) +{ + return QuadReadAcrossX(v); +} +FfxFloat32x2 QuadReadX(FfxFloat32x2 v) +{ + return QuadReadAcrossX(v); +} +FfxFloat32 QuadReadY(FfxFloat32 v) +{ + return QuadReadAcrossY(v); +} +FfxFloat32x2 QuadReadY(FfxFloat32x2 v) +{ + return QuadReadAcrossY(v); +} #if FFX_HALF FfxFloat16x2 ffxWaveXorFloat16x2(FfxFloat16x2 v, FfxUInt32 x) @@ -1496,7 +1645,7 @@ FfxUInt16x2 ffxWaveXorUint16x2(FfxUInt16x2 v, FfxUInt32 x) } FfxUInt16x4 ffxWaveXorUint16x4(FfxUInt16x4 v, FfxUInt32 x) { - return AW4_FFX_UINT32(WaveReadLaneAt(FFX_UINT32_AW4(v), WaveGetLaneIndex() ^ x)); + return FFX_UINT32X2_TO_UINT16X4(WaveReadLaneAt(FFX_UINT16X4_TO_UINT32X2(v), WaveGetLaneIndex() ^ x)); } #endif // FFX_HALF #endif // #if defined(FFX_WAVE) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_hlsl.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_hlsl.h.meta new file mode 100644 index 0000000..ff56bee --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_hlsl.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 299f67e8b7e1d1a48a577bf8b328ac92 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_portability.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_portability.h similarity index 94% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_portability.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_portability.h index 45be059..84a62d6 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_core_portability.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_portability.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,6 +19,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + FfxFloat32x3 opAAddOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b) { d = a + ffxBroadcast3(b); diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_portability.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_portability.h.meta new file mode 100644 index 0000000..25ff64b --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_core_portability.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 8d2ace0bd52e0e1438e08ddaccd3ba24 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h similarity index 90% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h index 7bd5892..c425de7 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_ACCUMULATE_H -#define FFX_FSR2_ACCUMULATE_H + +#ifndef FFX_FSR3UPSCALER_ACCUMULATE_H +#define FFX_FSR3UPSCALER_ACCUMULATE_H FfxFloat32 GetPxHrVelocity(FfxFloat32x2 fMotionVector) { @@ -36,9 +37,9 @@ FFX_MIN16_F GetPxHrVelocity(FFX_MIN16_F2 fMotionVector) void Accumulate(const AccumulationPassCommonParams params, FFX_PARAMETER_INOUT FfxFloat32x3 fHistoryColor, FfxFloat32x3 fAccumulation, FFX_PARAMETER_IN FfxFloat32x4 fUpsampledColorAndWeight) { // Aviod invalid values when accumulation and upsampled weight is 0 - fAccumulation = ffxMax(FSR2_EPSILON.xxx, fAccumulation + fUpsampledColorAndWeight.www); + fAccumulation = ffxMax(FSR3UPSCALER_EPSILON.xxx, fAccumulation + fUpsampledColorAndWeight.www); -#if FFX_FSR2_OPTION_HDR_COLOR_INPUT +#if FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT //YCoCg -> RGB -> Tonemap -> YCoCg (Use RGB tonemapper to avoid color desaturation) fUpsampledColorAndWeight.xyz = RGBToYCoCg(Tonemap(YCoCgToRGB(fUpsampledColorAndWeight.xyz))); fHistoryColor = RGBToYCoCg(Tonemap(YCoCgToRGB(fHistoryColor))); @@ -49,7 +50,7 @@ void Accumulate(const AccumulationPassCommonParams params, FFX_PARAMETER_INOUT F fHistoryColor = YCoCgToRGB(fHistoryColor); -#if FFX_FSR2_OPTION_HDR_COLOR_INPUT +#if FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT fHistoryColor = InverseTonemap(fHistoryColor); #endif } @@ -63,20 +64,13 @@ void RectifyHistory( FfxFloat32 fTemporalReactiveFactor, FfxFloat32 fLumaInstabilityFactor) { - FfxFloat32 fScaleFactorInfluence = ffxMin(20.0f, ffxPow(FfxFloat32(1.0f / length(DownscaleFactor().x * DownscaleFactor().y)), 3.0f)); - const FfxFloat32 fVecolityFactor = ffxSaturate(params.fHrVelocity / 20.0f); const FfxFloat32 fBoxScaleT = ffxMax(params.fDepthClipFactor, ffxMax(params.fAccumulationMask, fVecolityFactor)); - FfxFloat32 fBoxScale = ffxLerp(fScaleFactorInfluence, 1.0f, fBoxScaleT); - - FfxFloat32x3 fScaledBoxVec = clippingBox.boxVec * fBoxScale; - FfxFloat32x3 boxMin = clippingBox.boxCenter - fScaledBoxVec; - FfxFloat32x3 boxMax = clippingBox.boxCenter + fScaledBoxVec; - FfxFloat32x3 boxCenter = clippingBox.boxCenter; - FfxFloat32 boxVecSize = length(clippingBox.boxVec); + const FfxFloat32 fBoxScale = ffxLerp(3.0f, 1.0f, fBoxScaleT); - boxMin = ffxMax(clippingBox.aabbMin, boxMin); - boxMax = ffxMin(clippingBox.aabbMax, boxMax); + const FfxFloat32x3 fScaledBoxVec = clippingBox.boxVec * fBoxScale; + const FfxFloat32x3 boxMin = clippingBox.boxCenter - fScaledBoxVec; + const FfxFloat32x3 boxMax = clippingBox.boxCenter + fScaledBoxVec; if (any(FFX_GREATER_THAN(boxMin, fHistoryColor)) || any(FFX_GREATER_THAN(fHistoryColor, boxMax))) { @@ -143,7 +137,7 @@ FfxFloat32 ComputeLumaInstabilityFactor(const AccumulationPassCommonParams param FfxFloat32 fCurrentFrameLuma = clippingBox.boxCenter.x; -#if FFX_FSR2_OPTION_HDR_COLOR_INPUT +#if FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT fCurrentFrameLuma = fCurrentFrameLuma / (1.0f + ffxMax(0.0f, fCurrentFrameLuma)); #endif @@ -157,8 +151,7 @@ FfxFloat32 ComputeLumaInstabilityFactor(const AccumulationPassCommonParams param FfxFloat32 fMin = abs(fDiffs0); - if (fMin >= fUnormThreshold) - { + if (fMin >= fUnormThreshold) { for (int i = N_MINUS_2; i <= N_MINUS_4; i++) { FfxFloat32 fDiffs1 = (fCurrentFrameLuma - fCurrentFrameLumaHistory[i]); @@ -170,7 +163,7 @@ FfxFloat32 ComputeLumaInstabilityFactor(const AccumulationPassCommonParams param } } - const FfxFloat32 fBoxSize = clippingBox.boxVec.x; + const FfxFloat32 fBoxSize = clippingBox.boxVec.x; const FfxFloat32 fBoxSizeFactor = ffxPow(ffxSaturate(fBoxSize / 0.1f), 6.0f); fLumaInstability = FfxFloat32(fMin != abs(fDiffs0)) * fBoxSizeFactor; @@ -202,7 +195,7 @@ FfxFloat32 ComputeTemporalReactiveFactor(const AccumulationPassCommonParams para fNewFactor = params.bIsNewSample ? 1.0f : fNewFactor; if (ffxSaturate(params.fHrVelocity * 10.0f) >= 1.0f) { - fNewFactor = ffxMax(FSR2_EPSILON, fNewFactor) * -1.0f; + fNewFactor = ffxMax(FSR3UPSCALER_EPSILON, fNewFactor) * -1.0f; } return fNewFactor; @@ -286,10 +279,10 @@ void Accumulate(FfxInt32x2 iPxHrPos) StoreInternalColorAndWeight(iPxHrPos, FfxFloat32x4(fHistoryColor, fTemporalReactiveFactor)); // Output final color when RCAS is disabled -#if FFX_FSR2_OPTION_APPLY_SHARPENING == 0 +#if FFX_FSR3UPSCALER_OPTION_APPLY_SHARPENING == 0 WriteUpscaledOutput(iPxHrPos, fHistoryColor); #endif StoreNewLocks(iPxHrPos, 0); } -#endif // FFX_FSR2_ACCUMULATE_H +#endif // FFX_FSR3UPSCALER_ACCUMULATE_H diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h.meta new file mode 100644 index 0000000..08c98e7 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 3fc2f7a2c8c31324a949e1761bf599cc +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h new file mode 100644 index 0000000..c70bc1d --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h @@ -0,0 +1,928 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#include "ffx_fsr3upscaler_resources.h" + +#if defined(FFX_GPU) +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic push +#pragma dxc diagnostic ignored "-Wambig-lit-shift" +#endif //__hlsl_dx_compiler +#include "ffx_core.h" +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic pop +#endif //__hlsl_dx_compiler +#endif // #if defined(FFX_GPU) + +#if defined(FFX_GPU) +#ifndef FFX_PREFER_WAVE64 +#define FFX_PREFER_WAVE64 +#endif // FFX_PREFER_WAVE64 + +#if defined(FFX_GPU) +#pragma warning(disable: 3205) // conversion from larger type to smaller +#endif // #if defined(FFX_GPU) + +#define DECLARE_SRV_REGISTER(regIndex) t##regIndex +#define DECLARE_UAV_REGISTER(regIndex) u##regIndex +#define DECLARE_CB_REGISTER(regIndex) b##regIndex +#define FFX_FSR3UPSCALER_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex)) +#define FFX_FSR3UPSCALER_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex)) +#define FFX_FSR3UPSCALER_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex)) + +#if defined(FSR3UPSCALER_BIND_CB_FSR3UPSCALER) + cbuffer cbFSR3Upscaler : FFX_FSR3UPSCALER_DECLARE_CB(FSR3UPSCALER_BIND_CB_FSR3UPSCALER) + { + FfxInt32x2 iRenderSize; + FfxInt32x2 iMaxRenderSize; + FfxInt32x2 iDisplaySize; + FfxInt32x2 iInputColorResourceDimensions; + FfxInt32x2 iLumaMipDimensions; + FfxInt32 iLumaMipLevelToUse; + FfxInt32 iFrameIndex; + + FfxFloat32x4 fDeviceToViewDepth; + FfxFloat32x2 fJitter; + FfxFloat32x2 fMotionVectorScale; + FfxFloat32x2 fDownscaleFactor; + FfxFloat32x2 fMotionVectorJitterCancellation; + FfxFloat32 fPreExposure; + FfxFloat32 fPreviousFramePreExposure; + FfxFloat32 fTanHalfFOV; + FfxFloat32 fJitterSequenceLength; + FfxFloat32 fDeltaTime; + FfxFloat32 fDynamicResChangeFactor; + FfxFloat32 fViewSpaceToMetersFactor; + + FfxInt32 iDummy; + }; + +#define FFX_FSR3UPSCALER_CONSTANT_BUFFER_1_SIZE (sizeof(cbFSR3Upscaler) / 4) // Number of 32-bit values. This must be kept in sync with the cbFSR3Upscaler size. + +/* Define getter functions in the order they are defined in the CB! */ +FfxInt32x2 RenderSize() +{ + return iRenderSize; +} + +FfxInt32x2 MaxRenderSize() +{ + return iMaxRenderSize; +} + +FfxInt32x2 DisplaySize() +{ + return iDisplaySize; +} + +FfxInt32x2 InputColorResourceDimensions() +{ + return iInputColorResourceDimensions; +} + +FfxInt32x2 LumaMipDimensions() +{ + return iLumaMipDimensions; +} + +FfxInt32 LumaMipLevelToUse() +{ + return iLumaMipLevelToUse; +} + +FfxInt32 FrameIndex() +{ + return iFrameIndex; +} + +FfxFloat32x2 Jitter() +{ + return fJitter; +} + +FfxFloat32x4 DeviceToViewSpaceTransformFactors() +{ + return fDeviceToViewDepth; +} + +FfxFloat32x2 MotionVectorScale() +{ + return fMotionVectorScale; +} + +FfxFloat32x2 DownscaleFactor() +{ + return fDownscaleFactor; +} + +FfxFloat32x2 MotionVectorJitterCancellation() +{ + return fMotionVectorJitterCancellation; +} + +FfxFloat32 PreExposure() +{ + return fPreExposure; +} + +FfxFloat32 PreviousFramePreExposure() +{ + return fPreviousFramePreExposure; +} + +FfxFloat32 TanHalfFoV() +{ + return fTanHalfFOV; +} + +FfxFloat32 JitterSequenceLength() +{ + return fJitterSequenceLength; +} + +FfxFloat32 DeltaTime() +{ + return fDeltaTime; +} + +FfxFloat32 DynamicResChangeFactor() +{ + return fDynamicResChangeFactor; +} + +FfxFloat32 ViewSpaceToMetersFactor() +{ + return fViewSpaceToMetersFactor; +} +#endif // #if defined(FSR3UPSCALER_BIND_CB_FSR3UPSCALER) + +#define FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(p) FFX_FSR3UPSCALER_ROOTSIG_STR(p) +#define FFX_FSR3UPSCALER_ROOTSIG_STR(p) #p +#define FFX_FSR3UPSCALER_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "DescriptorTable(SRV(t0, numDescriptors = " FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "RootConstants(num32BitConstants=" FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(FFX_FSR3UPSCALER_CONSTANT_BUFFER_1_SIZE) ", b0), " \ + "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \ + "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] + +#define FFX_FSR3UPSCALER_CONSTANT_BUFFER_2_SIZE 6 // Number of 32-bit values. This must be kept in sync with max( cbRCAS , cbSPD) size. + +#define FFX_FSR3UPSCALER_CB2_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "DescriptorTable(SRV(t0, numDescriptors = " FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "RootConstants(num32BitConstants=" FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(FFX_FSR3UPSCALER_CONSTANT_BUFFER_1_SIZE) ", b0), " \ + "RootConstants(num32BitConstants=" FFX_FSR3UPSCALER_ROOTSIG_STRINGIFY(FFX_FSR3UPSCALER_CONSTANT_BUFFER_2_SIZE) ", b1), " \ + "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \ + "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] +#if defined(FFX_FSR3UPSCALER_EMBED_ROOTSIG) +#define FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT FFX_FSR3UPSCALER_ROOTSIG +#define FFX_FSR3UPSCALER_EMBED_CB2_ROOTSIG_CONTENT FFX_FSR3UPSCALER_CB2_ROOTSIG +#else +#define FFX_FSR3UPSCALER_EMBED_ROOTSIG_CONTENT +#define FFX_FSR3UPSCALER_EMBED_CB2_ROOTSIG_CONTENT +#endif // #if FFX_FSR3UPSCALER_EMBED_ROOTSIG + +#if defined(FSR3UPSCALER_BIND_CB_AUTOREACTIVE) +cbuffer cbGenerateReactive : FFX_FSR3UPSCALER_DECLARE_CB(FSR3UPSCALER_BIND_CB_AUTOREACTIVE) +{ + FfxFloat32 fTcThreshold; // 0.1 is a good starting value, lower will result in more TC pixels + FfxFloat32 fTcScale; + FfxFloat32 fReactiveScale; + FfxFloat32 fReactiveMax; +}; + +FfxFloat32 TcThreshold() +{ + return fTcThreshold; +} + +FfxFloat32 TcScale() +{ + return fTcScale; +} + +FfxFloat32 ReactiveScale() +{ + return fReactiveScale; +} + +FfxFloat32 ReactiveMax() +{ + return fReactiveMax; +} +#endif // #if defined(FSR3UPSCALER_BIND_CB_AUTOREACTIVE) + +#if defined(FSR3UPSCALER_BIND_CB_RCAS) +cbuffer cbRCAS : FFX_FSR3UPSCALER_DECLARE_CB(FSR3UPSCALER_BIND_CB_RCAS) +{ + FfxUInt32x4 rcasConfig; +}; + +FfxUInt32x4 RCASConfig() +{ + return rcasConfig; +} +#endif // #if defined(FSR3UPSCALER_BIND_CB_RCAS) + + +#if defined(FSR3UPSCALER_BIND_CB_REACTIVE) +cbuffer cbGenerateReactive : FFX_FSR3UPSCALER_DECLARE_CB(FSR3UPSCALER_BIND_CB_REACTIVE) +{ + FfxFloat32 gen_reactive_scale; + FfxFloat32 gen_reactive_threshold; + FfxFloat32 gen_reactive_binaryValue; + FfxUInt32 gen_reactive_flags; +}; + +FfxFloat32 GenReactiveScale() +{ + return gen_reactive_scale; +} + +FfxFloat32 GenReactiveThreshold() +{ + return gen_reactive_threshold; +} + +FfxFloat32 GenReactiveBinaryValue() +{ + return gen_reactive_binaryValue; +} + +FfxUInt32 GenReactiveFlags() +{ + return gen_reactive_flags; +} +#endif // #if defined(FSR3UPSCALER_BIND_CB_REACTIVE) + +#if defined(FSR3UPSCALER_BIND_CB_SPD) +cbuffer cbSPD : FFX_FSR3UPSCALER_DECLARE_CB(FSR3UPSCALER_BIND_CB_SPD) { + + FfxUInt32 mips; + FfxUInt32 numWorkGroups; + FfxUInt32x2 workGroupOffset; + FfxUInt32x2 renderSize; +}; + +FfxUInt32 MipCount() +{ + return mips; +} + +FfxUInt32 NumWorkGroups() +{ + return numWorkGroups; +} + +FfxUInt32x2 WorkGroupOffset() +{ + return workGroupOffset; +} + +FfxUInt32x2 SPD_RenderSize() +{ + return renderSize; +} +#endif // #if defined(FSR3UPSCALER_BIND_CB_SPD) + +// Declare and sample camera buffers as regular textures, unless overridden +#if !defined(UNITY_FSR3_TEX2D) +#define UNITY_FSR3_TEX2D(type) Texture2D +#endif +#if !defined(UNITY_FSR3_RWTEX2D) +#define UNITY_FSR3_RWTEX2D(type) RWTexture2D +#endif +#if !defined(UNITY_FSR3_POS) +#define UNITY_FSR3_POS(pxPos) (pxPos) +#endif +#if !defined(UNITY_FSR3_UV) +#define UNITY_FSR3_UV(uv) (uv) +#endif + +SamplerState s_PointClamp : register(s0); +SamplerState s_LinearClamp : register(s1); + + // SRVs + #if defined FSR3UPSCALER_BIND_SRV_INPUT_COLOR + UNITY_FSR3_TEX2D(FfxFloat32x4) r_input_color_jittered : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_COLOR); + #endif + #if defined FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY + UNITY_FSR3_TEX2D(FfxFloat32x4) r_input_opaque_only : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY); + #endif + #if defined FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS + UNITY_FSR3_TEX2D(FfxFloat32x4) r_input_motion_vectors : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS); + #endif + #if defined FSR3UPSCALER_BIND_SRV_INPUT_DEPTH + UNITY_FSR3_TEX2D(FfxFloat32) r_input_depth : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH); + #endif + #if defined FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE + Texture2D r_input_exposure : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE); + #endif + #if defined FSR3UPSCALER_BIND_SRV_AUTO_EXPOSURE + Texture2D r_auto_exposure : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_AUTO_EXPOSURE); + #endif + #if defined FSR3UPSCALER_BIND_SRV_REACTIVE_MASK + Texture2D r_reactive_mask : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_REACTIVE_MASK); + #endif + #if defined FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK + Texture2D r_transparency_and_composition_mask : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK); + #endif + #if defined FSR3UPSCALER_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH + Texture2D r_reconstructed_previous_nearest_depth : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH); + #endif + #if defined FSR3UPSCALER_BIND_SRV_DILATED_MOTION_VECTORS + Texture2D r_dilated_motion_vectors : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_DILATED_MOTION_VECTORS); + #endif + #if defined FSR3UPSCALER_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS + Texture2D r_previous_dilated_motion_vectors : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS); + #endif + #if defined FSR3UPSCALER_BIND_SRV_DILATED_DEPTH + Texture2D r_dilated_depth : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_DILATED_DEPTH); + #endif + #if defined FSR3UPSCALER_BIND_SRV_INTERNAL_UPSCALED + Texture2D r_internal_upscaled_color : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_INTERNAL_UPSCALED); + #endif + #if defined FSR3UPSCALER_BIND_SRV_LOCK_STATUS + Texture2D r_lock_status : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_LOCK_STATUS); + #endif + #if defined FSR3UPSCALER_BIND_SRV_LOCK_INPUT_LUMA + Texture2D r_lock_input_luma : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_LOCK_INPUT_LUMA); + #endif + #if defined FSR3UPSCALER_BIND_SRV_NEW_LOCKS + Texture2D r_new_locks : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_NEW_LOCKS); + #endif + #if defined FSR3UPSCALER_BIND_SRV_PREPARED_INPUT_COLOR + Texture2D r_prepared_input_color : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_PREPARED_INPUT_COLOR); + #endif + #if defined FSR3UPSCALER_BIND_SRV_LUMA_HISTORY + Texture2D r_luma_history : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_LUMA_HISTORY); + #endif + #if defined FSR3UPSCALER_BIND_SRV_RCAS_INPUT + Texture2D r_rcas_input : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_RCAS_INPUT); + #endif + #if defined FSR3UPSCALER_BIND_SRV_LANCZOS_LUT + Texture2D r_lanczos_lut : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_LANCZOS_LUT); + #endif + #if defined FSR3UPSCALER_BIND_SRV_SCENE_LUMINANCE_MIPS + Texture2D r_imgMips : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_SCENE_LUMINANCE_MIPS); + #endif + #if defined FSR3UPSCALER_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT + Texture2D r_upsample_maximum_bias_lut : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT); + #endif + #if defined FSR3UPSCALER_BIND_SRV_DILATED_REACTIVE_MASKS + Texture2D r_dilated_reactive_masks : FFX_FSR3UPSCALER_DECLARE_SRV(FSR3UPSCALER_BIND_SRV_DILATED_REACTIVE_MASKS); + #endif + + #if defined FSR3UPSCALER_BIND_SRV_PREV_PRE_ALPHA_COLOR + Texture2D r_input_prev_color_pre_alpha : FFX_FSR3UPSCALER_DECLARE_SRV(FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR); + #endif + #if defined FSR3UPSCALER_BIND_SRV_PREV_POST_ALPHA_COLOR + Texture2D r_input_prev_color_post_alpha : FFX_FSR3UPSCALER_DECLARE_SRV(FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR); + #endif + + // UAV declarations + #if defined FSR3UPSCALER_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH + RWTexture2D rw_reconstructed_previous_nearest_depth : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH); + #endif + #if defined FSR3UPSCALER_BIND_UAV_DILATED_MOTION_VECTORS + RWTexture2D rw_dilated_motion_vectors : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_DILATED_MOTION_VECTORS); + #endif + #if defined FSR3UPSCALER_BIND_UAV_DILATED_DEPTH + RWTexture2D rw_dilated_depth : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_DILATED_DEPTH); + #endif + #if defined FSR3UPSCALER_BIND_UAV_INTERNAL_UPSCALED + RWTexture2D rw_internal_upscaled_color : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_INTERNAL_UPSCALED); + #endif + #if defined FSR3UPSCALER_BIND_UAV_LOCK_STATUS + RWTexture2D rw_lock_status : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_LOCK_STATUS); + #endif + #if defined FSR3UPSCALER_BIND_UAV_LOCK_INPUT_LUMA + RWTexture2D rw_lock_input_luma : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_LOCK_INPUT_LUMA); + #endif + #if defined FSR3UPSCALER_BIND_UAV_NEW_LOCKS + RWTexture2D rw_new_locks : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_NEW_LOCKS); + #endif + #if defined FSR3UPSCALER_BIND_UAV_PREPARED_INPUT_COLOR + RWTexture2D rw_prepared_input_color : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_PREPARED_INPUT_COLOR); + #endif + #if defined FSR3UPSCALER_BIND_UAV_LUMA_HISTORY + RWTexture2D rw_luma_history : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_LUMA_HISTORY); + #endif + #if defined FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT + UNITY_FSR3_RWTEX2D(FfxFloat32x4) rw_upscaled_output : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT); + #endif + #if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE + globallycoherent RWTexture2D rw_img_mip_shading_change : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE); + #endif + #if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5 + globallycoherent RWTexture2D rw_img_mip_5 : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5); + #endif + #if defined FSR3UPSCALER_BIND_UAV_DILATED_REACTIVE_MASKS + RWTexture2D rw_dilated_reactive_masks : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_DILATED_REACTIVE_MASKS); + #endif + #if defined FSR3UPSCALER_BIND_UAV_EXPOSURE + RWTexture2D rw_exposure : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_EXPOSURE); + #endif + #if defined FSR3UPSCALER_BIND_UAV_AUTO_EXPOSURE + RWTexture2D rw_auto_exposure : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_AUTO_EXPOSURE); + #endif + #if defined FSR3UPSCALER_BIND_UAV_SPD_GLOBAL_ATOMIC + globallycoherent RWTexture2D rw_spd_global_atomic : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_SPD_GLOBAL_ATOMIC); + #endif + + #if defined FSR3UPSCALER_BIND_UAV_AUTOREACTIVE + RWTexture2D rw_output_autoreactive : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_AUTOREACTIVE); + #endif + #if defined FSR3UPSCALER_BIND_UAV_AUTOCOMPOSITION + RWTexture2D rw_output_autocomposition : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_AUTOCOMPOSITION); + #endif + #if defined FSR3UPSCALER_BIND_UAV_PREV_PRE_ALPHA_COLOR + RWTexture2D rw_output_prev_color_pre_alpha : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_PREV_PRE_ALPHA_COLOR); + #endif + #if defined FSR3UPSCALER_BIND_UAV_PREV_POST_ALPHA_COLOR + RWTexture2D rw_output_prev_color_post_alpha : FFX_FSR3UPSCALER_DECLARE_UAV(FSR3UPSCALER_BIND_UAV_PREV_POST_ALPHA_COLOR); + #endif + +#if defined(FSR3UPSCALER_BIND_SRV_SCENE_LUMINANCE_MIPS) +FfxFloat32 LoadMipLuma(FfxUInt32x2 iPxPos, FfxUInt32 mipLevel) +{ + return r_imgMips.mips[mipLevel][iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_SCENE_LUMINANCE_MIPS) +FfxFloat32 SampleMipLuma(FfxFloat32x2 fUV, FfxUInt32 mipLevel) +{ + return r_imgMips.SampleLevel(s_LinearClamp, fUV, mipLevel); +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH) +FfxFloat32 LoadInputDepth(FfxUInt32x2 iPxPos) +{ + return r_input_depth[UNITY_FSR3_POS(iPxPos)]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INPUT_DEPTH) +FfxFloat32 SampleInputDepth(FfxFloat32x2 fUV) +{ + return r_input_depth.SampleLevel(s_LinearClamp, UNITY_FSR3_UV(fUV), 0).x; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_REACTIVE_MASK) +FfxFloat32 LoadReactiveMask(FfxUInt32x2 iPxPos) +{ + return r_reactive_mask[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_TRANSPARENCY_AND_COMPOSITION_MASK) +FfxFloat32 LoadTransparencyAndCompositionMask(FfxUInt32x2 iPxPos) +{ + return r_transparency_and_composition_mask[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INPUT_COLOR) +FfxFloat32x3 LoadInputColor(FfxUInt32x2 iPxPos) +{ + return r_input_color_jittered[UNITY_FSR3_POS(iPxPos)].rgb; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INPUT_COLOR) +FfxFloat32x3 SampleInputColor(FfxFloat32x2 fUV) +{ + return r_input_color_jittered.SampleLevel(s_LinearClamp, UNITY_FSR3_UV(fUV), 0).rgb; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_PREPARED_INPUT_COLOR) +FfxFloat32x3 LoadPreparedInputColor(FfxUInt32x2 iPxPos) +{ + return r_prepared_input_color[iPxPos].xyz; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INPUT_MOTION_VECTORS) +FfxFloat32x2 LoadInputMotionVector(FfxUInt32x2 iPxDilatedMotionVectorPos) +{ + FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[UNITY_FSR3_POS(iPxDilatedMotionVectorPos)].xy; + + FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); + +#if FFX_FSR3UPSCALER_OPTION_JITTERED_MOTION_VECTORS + fUvMotionVector -= MotionVectorJitterCancellation(); +#endif + + return fUvMotionVector; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INTERNAL_UPSCALED) +FfxFloat32x4 LoadHistory(FfxUInt32x2 iPxHistory) +{ + return r_internal_upscaled_color[iPxHistory]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_LUMA_HISTORY) +void StoreLumaHistory(FfxUInt32x2 iPxPos, FfxFloat32x4 fLumaHistory) +{ + rw_luma_history[iPxPos] = fLumaHistory; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_LUMA_HISTORY) +FfxFloat32x4 SampleLumaHistory(FfxFloat32x2 fUV) +{ + return r_luma_history.SampleLevel(s_LinearClamp, fUV, 0); +} +#endif + +FfxFloat32x4 LoadRCAS_Input(FfxInt32x2 iPxPos) +{ +#if defined(FSR3UPSCALER_BIND_SRV_RCAS_INPUT) + return r_rcas_input[iPxPos]; +#else + return 0.0; +#endif +} + +#if defined(FSR3UPSCALER_BIND_UAV_INTERNAL_UPSCALED) +void StoreReprojectedHistory(FfxUInt32x2 iPxHistory, FfxFloat32x4 fHistory) +{ + rw_internal_upscaled_color[iPxHistory] = fHistory; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_INTERNAL_UPSCALED) +void StoreInternalColorAndWeight(FfxUInt32x2 iPxPos, FfxFloat32x4 fColorAndWeight) +{ + rw_internal_upscaled_color[iPxPos] = fColorAndWeight; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_UPSCALED_OUTPUT) +void StoreUpscaledOutput(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) +{ + rw_upscaled_output[UNITY_FSR3_POS(iPxPos)] = FfxFloat32x4(fColor, 1.f); +} +#endif + +//LOCK_LIFETIME_REMAINING == 0 +//Should make LockInitialLifetime() return a const 1.0f later +#if defined(FSR3UPSCALER_BIND_SRV_LOCK_STATUS) +FfxFloat32x2 LoadLockStatus(FfxUInt32x2 iPxPos) +{ + return r_lock_status[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_LOCK_STATUS) +void StoreLockStatus(FfxUInt32x2 iPxPos, FfxFloat32x2 fLockStatus) +{ + rw_lock_status[iPxPos] = fLockStatus; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_LOCK_INPUT_LUMA) +FfxFloat32 LoadLockInputLuma(FfxUInt32x2 iPxPos) +{ + return r_lock_input_luma[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_LOCK_INPUT_LUMA) +void StoreLockInputLuma(FfxUInt32x2 iPxPos, FfxFloat32 fLuma) +{ + rw_lock_input_luma[iPxPos] = fLuma; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_NEW_LOCKS) +FfxFloat32 LoadNewLocks(FfxUInt32x2 iPxPos) +{ + return r_new_locks[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_NEW_LOCKS) +FfxFloat32 LoadRwNewLocks(FfxUInt32x2 iPxPos) +{ + return rw_new_locks[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_NEW_LOCKS) +void StoreNewLocks(FfxUInt32x2 iPxPos, FfxFloat32 newLock) +{ + rw_new_locks[iPxPos] = newLock; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_PREPARED_INPUT_COLOR) +void StorePreparedInputColor(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 fTonemapped) +{ + rw_prepared_input_color[iPxPos] = fTonemapped; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_PREPARED_INPUT_COLOR) +FfxFloat32 SampleDepthClip(FfxFloat32x2 fUV) +{ + return r_prepared_input_color.SampleLevel(s_LinearClamp, fUV, 0).w; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_LOCK_STATUS) +FfxFloat32x2 SampleLockStatus(FfxFloat32x2 fUV) +{ + FfxFloat32x2 fLockStatus = r_lock_status.SampleLevel(s_LinearClamp, fUV, 0); + return fLockStatus; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_RECONSTRUCTED_PREV_NEAREST_DEPTH) +FfxFloat32 LoadReconstructedPrevDepth(FfxUInt32x2 iPxPos) +{ + return asfloat(r_reconstructed_previous_nearest_depth[iPxPos]); +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH) +void StoreReconstructedDepth(FfxUInt32x2 iPxSample, FfxFloat32 fDepth) +{ + FfxUInt32 uDepth = asuint(fDepth); + + #if FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH + InterlockedMax(rw_reconstructed_previous_nearest_depth[iPxSample], uDepth); + #else + InterlockedMin(rw_reconstructed_previous_nearest_depth[iPxSample], uDepth); // min for standard, max for inverted depth + #endif +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_RECONSTRUCTED_PREV_NEAREST_DEPTH) +void SetReconstructedDepth(FfxUInt32x2 iPxSample, const FfxUInt32 uValue) +{ + rw_reconstructed_previous_nearest_depth[iPxSample] = uValue; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_DILATED_DEPTH) +void StoreDilatedDepth(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 fDepth) +{ + rw_dilated_depth[iPxPos] = fDepth; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_DILATED_MOTION_VECTORS) +void StoreDilatedMotionVector(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 fMotionVector) +{ + rw_dilated_motion_vectors[iPxPos] = fMotionVector; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_DILATED_MOTION_VECTORS) +FfxFloat32x2 LoadDilatedMotionVector(FfxUInt32x2 iPxInput) +{ + return r_dilated_motion_vectors[iPxInput].xy; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_PREVIOUS_DILATED_MOTION_VECTORS) +FfxFloat32x2 LoadPreviousDilatedMotionVector(FfxUInt32x2 iPxInput) +{ + return r_previous_dilated_motion_vectors[iPxInput].xy; +} + +FfxFloat32x2 SamplePreviousDilatedMotionVector(FfxFloat32x2 uv) +{ + return r_previous_dilated_motion_vectors.SampleLevel(s_LinearClamp, uv, 0).xy; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_DILATED_DEPTH) +FfxFloat32 LoadDilatedDepth(FfxUInt32x2 iPxInput) +{ + return r_dilated_depth[iPxInput]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INPUT_EXPOSURE) +FfxFloat32 Exposure() +{ + FfxFloat32 exposure = r_input_exposure[FfxUInt32x2(0, 0)].x; + + if (exposure == 0.0f) { + exposure = 1.0f; + } + + return exposure; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_AUTO_EXPOSURE) +FfxFloat32 AutoExposure() +{ + FfxFloat32 exposure = r_auto_exposure[FfxUInt32x2(0, 0)].x; + + if (exposure == 0.0f) { + exposure = 1.0f; + } + + return exposure; +} +#endif + +FfxFloat32 SampleLanczos2Weight(FfxFloat32 x) +{ +#if defined(FSR3UPSCALER_BIND_SRV_LANCZOS_LUT) + return r_lanczos_lut.SampleLevel(s_LinearClamp, FfxFloat32x2(x / 2, 0.5f), 0); +#else + return 0.f; +#endif +} + +#if defined(FSR3UPSCALER_BIND_SRV_UPSCALE_MAXIMUM_BIAS_LUT) +FfxFloat32 SampleUpsampleMaximumBias(FfxFloat32x2 uv) +{ + // Stored as a SNORM, so make sure to multiply by 2 to retrieve the actual expected range. + return FfxFloat32(2.0) * r_upsample_maximum_bias_lut.SampleLevel(s_LinearClamp, abs(uv) * 2.0, 0); +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_DILATED_REACTIVE_MASKS) +FfxFloat32x2 SampleDilatedReactiveMasks(FfxFloat32x2 fUV) +{ + return r_dilated_reactive_masks.SampleLevel(s_LinearClamp, fUV, 0); +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_DILATED_REACTIVE_MASKS) +FfxFloat32x2 LoadDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos) +{ + return r_dilated_reactive_masks[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_DILATED_REACTIVE_MASKS) +void StoreDilatedReactiveMasks(FFX_PARAMETER_IN FfxUInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 fDilatedReactiveMasks) +{ + rw_dilated_reactive_masks[iPxPos] = fDilatedReactiveMasks; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_INPUT_OPAQUE_ONLY) +FfxFloat32x3 LoadOpaqueOnly(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) +{ + return r_input_opaque_only[UNITY_FSR3_POS(iPxPos)].xyz; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_PREV_PRE_ALPHA_COLOR) +FfxFloat32x3 LoadPrevPreAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) +{ + return r_input_prev_color_pre_alpha[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_SRV_PREV_POST_ALPHA_COLOR) +FfxFloat32x3 LoadPrevPostAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos) +{ + return r_input_prev_color_post_alpha[iPxPos]; +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_AUTOREACTIVE) +#if defined(FSR3UPSCALER_BIND_UAV_AUTOCOMPOSITION) +void StoreAutoReactive(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F2 fReactive) +{ + rw_output_autoreactive[iPxPos] = fReactive.x; + + rw_output_autocomposition[iPxPos] = fReactive.y; +} +#endif +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_PREV_PRE_ALPHA_COLOR) +void StorePrevPreAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F3 color) +{ + rw_output_prev_color_pre_alpha[iPxPos] = color; + +} +#endif + +#if defined(FSR3UPSCALER_BIND_UAV_PREV_POST_ALPHA_COLOR) +void StorePrevPostAlpha(FFX_PARAMETER_IN FFX_MIN16_I2 iPxPos, FFX_PARAMETER_IN FFX_MIN16_F3 color) +{ + rw_output_prev_color_post_alpha[iPxPos] = color; +} +#endif + +FfxFloat32x2 SPD_LoadExposureBuffer() +{ +#if defined FSR3UPSCALER_BIND_UAV_AUTO_EXPOSURE + return rw_auto_exposure[FfxInt32x2(0, 0)]; +#else + return FfxFloat32x2(0.f, 0.f); +#endif // #if defined FSR3UPSCALER_BIND_UAV_AUTO_EXPOSURE +} + +void SPD_SetExposureBuffer(FfxFloat32x2 value) +{ +#if defined FSR3UPSCALER_BIND_UAV_AUTO_EXPOSURE + rw_auto_exposure[FfxInt32x2(0, 0)] = value; +#endif // #if defined FSR3UPSCALER_BIND_UAV_AUTO_EXPOSURE +} + +FfxFloat32x4 SPD_LoadMipmap5(FfxInt32x2 iPxPos) +{ +#if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5 + return FfxFloat32x4(rw_img_mip_5[iPxPos], 0, 0, 0); +#else + return FfxFloat32x4(0.f, 0.f, 0.f, 0.f); +#endif // #if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5 +} + +void SPD_SetMipmap(FfxInt32x2 iPxPos, FfxUInt32 slice, FfxFloat32 value) +{ + switch (slice) + { + case FFX_FSR3UPSCALER_SHADING_CHANGE_MIP_LEVEL: +#if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE + rw_img_mip_shading_change[iPxPos] = value; +#endif // #if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE + break; + case 5: +#if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5 + rw_img_mip_5[iPxPos] = value; +#endif // #if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5 + break; + default: + + // avoid flattened side effect +#if defined(FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_LUMA_CHANGE) + rw_img_mip_shading_change[iPxPos] = rw_img_mip_shading_change[iPxPos]; +#elif defined(FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5) + rw_img_mip_5[iPxPos] = rw_img_mip_5[iPxPos]; +#endif // #if defined FSR3UPSCALER_BIND_UAV_EXPOSURE_MIP_5 + break; + } +} + +void SPD_IncreaseAtomicCounter(inout FfxUInt32 spdCounter) +{ +#if defined FSR3UPSCALER_BIND_UAV_SPD_GLOBAL_ATOMIC + InterlockedAdd(rw_spd_global_atomic[FfxInt32x2(0, 0)], 1, spdCounter); +#endif // #if defined FSR3UPSCALER_BIND_UAV_SPD_GLOBAL_ATOMIC +} + +void SPD_ResetAtomicCounter() +{ +#if defined FSR3UPSCALER_BIND_UAV_SPD_GLOBAL_ATOMIC + rw_spd_global_atomic[FfxInt32x2(0, 0)] = 0; +#endif // #if defined FSR3UPSCALER_BIND_UAV_SPD_GLOBAL_ATOMIC +} + +#endif // #if defined(FFX_GPU) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h.meta new file mode 100644 index 0000000..e060d2c --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: ba849fdeb042e7f458c81408414db834 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_common.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h similarity index 91% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_common.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h index 0c72aa8..1f78a29 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_common.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#if !defined(FFX_FSR2_COMMON_H) -#define FFX_FSR2_COMMON_H + +#if !defined(FFX_FSR3UPSCALER_COMMON_H) +#define FFX_FSR3UPSCALER_COMMON_H #if defined(FFX_CPU) || defined(FFX_GPU) //Locks @@ -29,12 +30,12 @@ #endif // #if defined(FFX_CPU) || defined(FFX_GPU) #if defined(FFX_GPU) -FFX_STATIC const FfxFloat32 FSR2_FP16_MIN = 6.10e-05f; -FFX_STATIC const FfxFloat32 FSR2_FP16_MAX = 65504.0f; -FFX_STATIC const FfxFloat32 FSR2_EPSILON = 1e-03f; -FFX_STATIC const FfxFloat32 FSR2_TONEMAP_EPSILON = 1.0f / FSR2_FP16_MAX; -FFX_STATIC const FfxFloat32 FSR2_FLT_MAX = 3.402823466e+38f; -FFX_STATIC const FfxFloat32 FSR2_FLT_MIN = 1.175494351e-38f; +FFX_STATIC const FfxFloat32 FSR3UPSCALER_FP16_MIN = 6.10e-05f; +FFX_STATIC const FfxFloat32 FSR3UPSCALER_FP16_MAX = 65504.0f; +FFX_STATIC const FfxFloat32 FSR3UPSCALER_EPSILON = 1e-03f; +FFX_STATIC const FfxFloat32 FSR3UPSCALER_TONEMAP_EPSILON = 1.0f / FSR3UPSCALER_FP16_MAX; +FFX_STATIC const FfxFloat32 FSR3UPSCALER_FLT_MAX = 3.402823466e+38f; +FFX_STATIC const FfxFloat32 FSR3UPSCALER_FLT_MIN = 1.175494351e-38f; // treat vector truncation warnings as errors #pragma warning(error: 3206) @@ -128,8 +129,8 @@ void RectificationBoxReset(FFX_PARAMETER_INOUT RectificationBox rectificationBox rectificationBox.boxCenter = FfxFloat32x3(0, 0, 0); rectificationBox.boxVec = FfxFloat32x3(0, 0, 0); - rectificationBox.aabbMin = FfxFloat32x3(FSR2_FLT_MAX, FSR2_FLT_MAX, FSR2_FLT_MAX); - rectificationBox.aabbMax = -FfxFloat32x3(FSR2_FLT_MAX, FSR2_FLT_MAX, FSR2_FLT_MAX); + rectificationBox.aabbMin = FfxFloat32x3(FSR3UPSCALER_FLT_MAX, FSR3UPSCALER_FLT_MAX, FSR3UPSCALER_FLT_MAX); + rectificationBox.aabbMax = -FfxFloat32x3(FSR3UPSCALER_FLT_MAX, FSR3UPSCALER_FLT_MAX, FSR3UPSCALER_FLT_MAX); } #if FFX_HALF void RectificationBoxReset(FFX_PARAMETER_INOUT RectificationBoxMin16 rectificationBox) @@ -138,8 +139,8 @@ void RectificationBoxReset(FFX_PARAMETER_INOUT RectificationBoxMin16 rectificati rectificationBox.boxCenter = FFX_MIN16_F3(0, 0, 0); rectificationBox.boxVec = FFX_MIN16_F3(0, 0, 0); - rectificationBox.aabbMin = FFX_MIN16_F3(FSR2_FP16_MAX, FSR2_FP16_MAX, FSR2_FP16_MAX); - rectificationBox.aabbMax = -FFX_MIN16_F3(FSR2_FP16_MAX, FSR2_FP16_MAX, FSR2_FP16_MAX); + rectificationBox.aabbMin = FFX_MIN16_F3(FSR3UPSCALER_FP16_MAX, FSR3UPSCALER_FP16_MAX, FSR3UPSCALER_FP16_MAX); + rectificationBox.aabbMax = -FFX_MIN16_F3(FSR3UPSCALER_FP16_MAX, FSR3UPSCALER_FP16_MAX, FSR3UPSCALER_FP16_MAX); } #endif @@ -198,7 +199,7 @@ void RectificationBoxAddSample(FfxBoolean bInitialSample, FFX_PARAMETER_INOUT Re void RectificationBoxComputeVarianceBoxData(FFX_PARAMETER_INOUT RectificationBox rectificationBox) { - rectificationBox.fBoxCenterWeight = (abs(rectificationBox.fBoxCenterWeight) > FfxFloat32(FSR2_EPSILON) ? rectificationBox.fBoxCenterWeight : FfxFloat32(1.f)); + rectificationBox.fBoxCenterWeight = (abs(rectificationBox.fBoxCenterWeight) > FfxFloat32(FSR3UPSCALER_EPSILON) ? rectificationBox.fBoxCenterWeight : FfxFloat32(1.f)); rectificationBox.boxCenter /= rectificationBox.fBoxCenterWeight; rectificationBox.boxVec /= rectificationBox.fBoxCenterWeight; FfxFloat32x3 stdDev = sqrt(abs(rectificationBox.boxVec - rectificationBox.boxCenter * rectificationBox.boxCenter)); @@ -207,7 +208,7 @@ void RectificationBoxComputeVarianceBoxData(FFX_PARAMETER_INOUT RectificationBox #if FFX_HALF void RectificationBoxComputeVarianceBoxData(FFX_PARAMETER_INOUT RectificationBoxMin16 rectificationBox) { - rectificationBox.fBoxCenterWeight = (abs(rectificationBox.fBoxCenterWeight) > FFX_MIN16_F(FSR2_EPSILON) ? rectificationBox.fBoxCenterWeight : FFX_MIN16_F(1.f)); + rectificationBox.fBoxCenterWeight = (abs(rectificationBox.fBoxCenterWeight) > FFX_MIN16_F(FSR3UPSCALER_EPSILON) ? rectificationBox.fBoxCenterWeight : FFX_MIN16_F(1.f)); rectificationBox.boxCenter /= rectificationBox.fBoxCenterWeight; rectificationBox.boxVec /= rectificationBox.fBoxCenterWeight; FFX_MIN16_F3 stdDev = sqrt(abs(rectificationBox.boxVec - rectificationBox.boxCenter * rectificationBox.boxCenter)); @@ -339,7 +340,7 @@ FfxFloat32x3 Tonemap(FfxFloat32x3 fRgb) FfxFloat32x3 InverseTonemap(FfxFloat32x3 fRgb) { - return fRgb / ffxMax(FSR2_TONEMAP_EPSILON, 1.f - ffxMax(fRgb.r, ffxMax(fRgb.g, fRgb.b))).xxx; + return fRgb / ffxMax(FSR3UPSCALER_TONEMAP_EPSILON, 1.f - ffxMax(fRgb.r, ffxMax(fRgb.g, fRgb.b))).xxx; } #if FFX_HALF @@ -350,7 +351,7 @@ FFX_MIN16_F3 Tonemap(FFX_MIN16_F3 fRgb) FFX_MIN16_F3 InverseTonemap(FFX_MIN16_F3 fRgb) { - return fRgb / ffxMax(FFX_MIN16_F(FSR2_TONEMAP_EPSILON), FFX_MIN16_F(1.f) - ffxMax(fRgb.r, ffxMax(fRgb.g, fRgb.b))).xxx; + return fRgb / ffxMax(FFX_MIN16_F(FSR3UPSCALER_TONEMAP_EPSILON), FFX_MIN16_F(1.f) - ffxMax(fRgb.r, ffxMax(fRgb.g, fRgb.b))).xxx; } #endif @@ -454,7 +455,7 @@ FfxFloat32 GetViewSpaceDepth(FfxFloat32 fDeviceDepth) { const FfxFloat32x4 fDeviceToViewDepth = DeviceToViewSpaceTransformFactors(); - // fDeviceToViewDepth details found in ffx_fsr2.cpp + // fDeviceToViewDepth details found in ffx_fsr3upscaler.cpp return (fDeviceToViewDepth[1] / (fDeviceDepth - fDeviceToViewDepth[0])); } @@ -483,7 +484,7 @@ FfxFloat32x3 GetViewSpacePositionInMeters(FfxInt32x2 iViewportPos, FfxInt32x2 iV FfxFloat32 GetMaxDistanceInMeters() { -#if FFX_FSR2_OPTION_INVERTED_DEPTH +#if FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH return GetViewSpaceDepth(0.0f) * ViewSpaceToMetersFactor(); #else return GetViewSpaceDepth(1.0f) * ViewSpaceToMetersFactor(); @@ -495,7 +496,7 @@ FfxFloat32x3 PrepareRgb(FfxFloat32x3 fRgb, FfxFloat32 fExposure, FfxFloat32 fPre fRgb /= fPreExposure; fRgb *= fExposure; - fRgb = clamp(fRgb, 0.0f, FSR2_FP16_MAX); + fRgb = clamp(fRgb, 0.0f, FSR3UPSCALER_FP16_MAX); return fRgb; } @@ -562,4 +563,4 @@ FfxFloat32 PointToPlaneDistance(PlaneData plane, FfxFloat32x3 fPoint) #endif // #if defined(FFX_GPU) -#endif //!defined(FFX_FSR2_COMMON_H) +#endif //!defined(FFX_FSR3UPSCALER_COMMON_H) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h.meta new file mode 100644 index 0000000..2ebe2aa --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 6a638bec681caac4fa8e2ca198726694 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h similarity index 85% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h index c63f182..d26cf23 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_compute_luminance_pyramid.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,24 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + FFX_GROUPSHARED FfxUInt32 spdCounter; +void SpdIncreaseAtomicCounter(FfxUInt32 slice) +{ + SPD_IncreaseAtomicCounter(spdCounter); +} + +FfxUInt32 SpdGetAtomicCounter() +{ + return spdCounter; +} + +void SpdResetAtomicCounter(FfxUInt32 slice) +{ + SPD_ResetAtomicCounter(); +} + #ifndef SPD_PACKED_ONLY FFX_GROUPSHARED FfxFloat32 spdIntermediateR[16][16]; FFX_GROUPSHARED FfxFloat32 spdIntermediateG[16][16]; @@ -36,7 +52,7 @@ FfxFloat32x4 SpdLoadSourceImage(FfxFloat32x2 tex, FfxUInt32 slice) fRgb /= PreExposure(); //compute log luma - const FfxFloat32 fLogLuma = log(ffxMax(FSR2_EPSILON, RGBToLuma(fRgb))); + const FfxFloat32 fLogLuma = log(ffxMax(FSR3UPSCALER_EPSILON, RGBToLuma(fRgb))); // Make sure out of screen pixels contribute no value to the end result const FfxFloat32 result = all(FFX_LESS_THAN(tex, RenderSize())) ? fLogLuma : 0.0f; @@ -74,21 +90,6 @@ void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 index, FfxUInt32 } } -void SpdIncreaseAtomicCounter(FfxUInt32 slice) -{ - SPD_IncreaseAtomicCounter(spdCounter); -} - -FfxUInt32 SpdGetAtomicCounter() -{ - return spdCounter; -} - -void SpdResetAtomicCounter(FfxUInt32 slice) -{ - SPD_ResetAtomicCounter(); -} - FfxFloat32x4 SpdLoadIntermediate(FfxUInt32 x, FfxUInt32 y) { return FfxFloat32x4( @@ -112,40 +113,24 @@ FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFl // define fetch and store functions Packed #if FFX_HALF -#error Callback must be implemented FFX_GROUPSHARED FfxFloat16x2 spdIntermediateRG[16][16]; FFX_GROUPSHARED FfxFloat16x2 spdIntermediateBA[16][16]; FfxFloat16x4 SpdLoadSourceImageH(FfxFloat32x2 tex, FfxUInt32 slice) { - return FfxFloat16x4(imgDst[0][FfxFloat32x3(tex, slice)]); + return FfxFloat16x4(0, 0, 0, 0); } + FfxFloat16x4 SpdLoadH(FfxInt32x2 p, FfxUInt32 slice) { - return FfxFloat16x4(imgDst6[FfxUInt32x3(p, slice)]); + return FfxFloat16x4(0, 0, 0, 0); } + void SpdStoreH(FfxInt32x2 p, FfxFloat16x4 value, FfxUInt32 mip, FfxUInt32 slice) { - if (index == LumaMipLevelToUse() || index == 5) - { - imgDst6[FfxUInt32x3(p, slice)] = FfxFloat32x4(value); - return; - } - imgDst[mip + 1][FfxUInt32x3(p, slice)] = FfxFloat32x4(value); -} -void SpdIncreaseAtomicCounter(FfxUInt32 slice) -{ - InterlockedAdd(rw_spd_global_atomic[FfxInt16x2(0, 0)].counter[slice], 1, spdCounter); -} -FfxUInt32 SpdGetAtomicCounter() -{ - return spdCounter; -} -void SpdResetAtomicCounter(FfxUInt32 slice) -{ - rw_spd_global_atomic[FfxInt16x2(0, 0)].counter[slice] = 0; } + FfxFloat16x4 SpdLoadIntermediateH(FfxUInt32 x, FfxUInt32 y) { return FfxFloat16x4( @@ -154,18 +139,20 @@ FfxFloat16x4 SpdLoadIntermediateH(FfxUInt32 x, FfxUInt32 y) spdIntermediateBA[x][y].x, spdIntermediateBA[x][y].y); } + void SpdStoreIntermediateH(FfxUInt32 x, FfxUInt32 y, FfxFloat16x4 value) { spdIntermediateRG[x][y] = value.xy; spdIntermediateBA[x][y] = value.zw; } + FfxFloat16x4 SpdReduce4H(FfxFloat16x4 v0, FfxFloat16x4 v1, FfxFloat16x4 v2, FfxFloat16x4 v3) { return (v0 + v1 + v2 + v3) * FfxFloat16(0.25); } #endif -#include "ffx_spd.h" +#include "spd/ffx_spd.h" void ComputeAutoExposure(FfxUInt32x3 WorkGroupId, FfxUInt32 LocalThreadIndex) { @@ -186,4 +173,4 @@ void ComputeAutoExposure(FfxUInt32x3 WorkGroupId, FfxUInt32 LocalThreadIndex) FfxUInt32(WorkGroupId.z), FfxUInt32x2(WorkGroupOffset())); #endif -} \ No newline at end of file +} diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h.meta new file mode 100644 index 0000000..9f1d2ab --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_compute_luminance_pyramid.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 61bd10363d44ee2478461c9e9efbcb67 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h similarity index 97% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h index fa4c975..53763c8 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_DEPTH_CLIP_H -#define FFX_FSR2_DEPTH_CLIP_H + +#ifndef FFX_FSR3UPSCALER_DEPTH_CLIP_H +#define FFX_FSR3UPSCALER_DEPTH_CLIP_H FFX_STATIC const FfxFloat32 DepthClipBaseScale = 4.0f; @@ -48,7 +49,7 @@ FfxFloat32 ComputeDepthClip(FfxFloat32x2 fUvSample, FfxFloat32 fCurrentDepthSamp if (fDepthDiff > 0.0f) { -#if FFX_FSR2_OPTION_INVERTED_DEPTH +#if FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH const FfxFloat32 fPlaneDepth = ffxMin(fPrevDepthSample, fCurrentDepthSample); #else const FfxFloat32 fPlaneDepth = ffxMax(fPrevDepthSample, fCurrentDepthSample); @@ -243,7 +244,7 @@ void DepthClip(FfxInt32x2 iPxPos) StorePreparedInputColor(iPxPos, FfxFloat32x4(fPreparedYCoCg, fDepthClip)); // Compute dilated reactive mask -#if FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#if FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS FfxInt32x2 iSamplePos = iPxPos; #else FfxInt32x2 iSamplePos = ComputeHrPosFromLrPos(iPxPos); @@ -255,4 +256,4 @@ void DepthClip(FfxInt32x2 iPxPos) PreProcessReactiveMasks(iPxPos, ffxMax(fTemporalMotionDifference, fMotionDivergence)); } -#endif //!defined( FFX_FSR2_DEPTH_CLIPH ) \ No newline at end of file +#endif //!defined( FFX_FSR3UPSCALER_DEPTH_CLIPH ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h.meta new file mode 100644 index 0000000..21fe627 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_depth_clip.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 7c662249d70c4434da4f2da00e432c38 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h similarity index 91% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h index 8347fa8..e1a0d06 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_lock.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,14 +19,15 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_LOCK_H -#define FFX_FSR2_LOCK_H + +#ifndef FFX_FSR3UPSCALER_LOCK_H +#define FFX_FSR3UPSCALER_LOCK_H void ClearResourcesForNextFrame(in FfxInt32x2 iPxHrPos) { if (all(FFX_LESS_THAN(iPxHrPos, FfxInt32x2(RenderSize())))) { -#if FFX_FSR2_OPTION_INVERTED_DEPTH +#if FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH const FfxUInt32 farZ = 0x0; #else const FfxUInt32 farZ = 0x3f800000; @@ -42,7 +43,7 @@ FfxBoolean ComputeThinFeatureConfidence(FfxInt32x2 pos) FfxFloat32 fNucleus = LoadLockInputLuma(pos); FfxFloat32 similar_threshold = 1.05f; - FfxFloat32 dissimilarLumaMin = FSR2_FLT_MAX; + FfxFloat32 dissimilarLumaMin = FSR3UPSCALER_FLT_MAX; FfxFloat32 dissimilarLumaMax = 0; /* @@ -109,7 +110,7 @@ void ComputeLock(FfxInt32x2 iPxLrPos) StoreNewLocks(ComputeHrPosFromLrPos(iPxLrPos), 1.f); } - ClearResourcesForNextFrame(iPxLrPos); + // ClearResourcesForNextFrame(iPxLrPos); } -#endif // FFX_FSR2_LOCK_H +#endif // FFX_FSR3UPSCALER_LOCK_H diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h.meta new file mode 100644 index 0000000..38a5a57 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_lock.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: c7e9f53dd040b2645af5ccd936a94b0e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_postprocess_lock_status.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h similarity index 91% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_postprocess_lock_status.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h index cee9e14..3709113 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_postprocess_lock_status.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_POSTPROCESS_LOCK_STATUS_H -#define FFX_FSR2_POSTPROCESS_LOCK_STATUS_H + +#ifndef FFX_FSR3UPSCALER_POSTPROCESS_LOCK_STATUS_H +#define FFX_FSR3UPSCALER_POSTPROCESS_LOCK_STATUS_H FfxFloat32x4 WrapShadingChangeLuma(FfxInt32x2 iPxSample) { @@ -34,7 +35,7 @@ FFX_MIN16_F4 WrapShadingChangeLuma(FFX_MIN16_I2 iPxSample) } #endif -#if FFX_FSR2_OPTION_POSTPROCESSLOCKSTATUS_SAMPLERS_USE_DATA_HALF && FFX_HALF +#if FFX_FSR3UPSCALER_OPTION_POSTPROCESSLOCKSTATUS_SAMPLERS_USE_DATA_HALF && FFX_HALF DeclareCustomFetchBilinearSamplesMin16(FetchShadingChangeLumaSamples, WrapShadingChangeLuma) #else DeclareCustomFetchBicubicSamples(FetchShadingChangeLumaSamples, WrapShadingChangeLuma) @@ -49,7 +50,7 @@ FfxFloat32 GetShadingChangeLuma(FfxInt32x2 iPxHrPos, FfxFloat32x2 fUvCoord) fShadingChangeLuma = Exposure() * exp(ShadingChangeLumaSample(fUvCoord, LumaMipDimensions()).x); #else - const FfxFloat32 fDiv = FfxFloat32(2 << LumaMipLevelToUse()); + const FfxFloat32 fDiv = FfxFloat32(2u << LumaMipLevelToUse()); FfxInt32x2 iMipRenderSize = FfxInt32x2(RenderSize() / fDiv); fUvCoord = ClampUv(fUvCoord, iMipRenderSize, LumaMipDimensions()); @@ -103,4 +104,4 @@ void UpdateLockStatus(AccumulationPassCommonParams params, fLockContributionThisFrame = ffxSaturate(ffxSaturate(fLifetimeContribution * 4.0f) * fShadingChangeContribution); } -#endif //!defined( FFX_FSR2_POSTPROCESS_LOCK_STATUS_H ) +#endif //!defined( FFX_FSR3UPSCALER_POSTPROCESS_LOCK_STATUS_H ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h.meta new file mode 100644 index 0000000..f8b5616 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_postprocess_lock_status.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 67a8b72ceb93d634f883b086fdccb348 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h similarity index 93% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h index d9006cd..77619a5 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_rcas.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,16 +19,18 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#define GROUP_SIZE 8 +#define GROUP_SIZE 8 #define FSR_RCAS_DENOISE 1 +#include "ffx_core.h" + void WriteUpscaledOutput(FFX_MIN16_U2 iPxHrPos, FfxFloat32x3 fUpscaledColor) { StoreUpscaledOutput(FFX_MIN16_I2(iPxHrPos), fUpscaledColor); } -#define FSR_RCAS_F +#define FSR_RCAS_F 1 FfxFloat32x4 FsrRcasLoadF(FfxInt32x2 p) { FfxFloat32x4 fColor = LoadRCAS_Input(p); @@ -37,11 +39,9 @@ FfxFloat32x4 FsrRcasLoadF(FfxInt32x2 p) return fColor; } - void FsrRcasInputF(inout FfxFloat32 r, inout FfxFloat32 g, inout FfxFloat32 b) {} -#include "ffx_fsr1.h" - +#include "fsr1/ffx_fsr1.h" void CurrFilter(FFX_MIN16_U2 pos) { diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h.meta new file mode 100644 index 0000000..7a53a1f --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_rcas.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 692efb7cec0df67408a583a7ff34146a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h similarity index 91% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h index e9ccc4b..a822dfc 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reconstruct_dilated_velocity_and_previous_depth.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H -#define FFX_FSR2_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H + +#ifndef FFX_FSR3UPSCALER_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H +#define FFX_FSR3UPSCALER_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H void ReconstructPrevDepth(FfxInt32x2 iPxPos, FfxFloat32 fDepth, FfxFloat32x2 fMotionVector, FfxInt32x2 iPxDepthSize) { @@ -83,7 +84,7 @@ void FindNearestDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxIn if (IsOnScreen(iPos, iPxSize)) { FfxFloat32 fNdDepth = depth[iSampleIndex]; -#if FFX_FSR2_OPTION_INVERTED_DEPTH +#if FFX_FSR3UPSCALER_OPTION_INVERTED_DEPTH if (fNdDepth > fNearestDepth) { #else if (fNdDepth < fNearestDepth) { @@ -105,7 +106,7 @@ FfxFloat32 ComputeLockInputLuma(FfxInt32x2 iPxLrPos) fRgb /= PreExposure(); fRgb *= Exposure(); -#if FFX_FSR2_OPTION_HDR_COLOR_INPUT +#if FFX_FSR3UPSCALER_OPTION_HDR_COLOR_INPUT fRgb = Tonemap(fRgb); #endif @@ -122,7 +123,7 @@ void ReconstructAndDilate(FfxInt32x2 iPxLrPos) FindNearestDepth(iPxLrPos, RenderSize(), fDilatedDepth, iNearestDepthCoord); -#if FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#if FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS FfxInt32x2 iSamplePos = iPxLrPos; FfxInt32x2 iMotionVectorPos = iNearestDepthCoord; #else @@ -142,4 +143,4 @@ void ReconstructAndDilate(FfxInt32x2 iPxLrPos) } -#endif //!defined( FFX_FSR2_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H ) +#endif //!defined( FFX_FSR3UPSCALER_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h.meta new file mode 100644 index 0000000..78ced0d --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reconstruct_dilated_velocity_and_previous_depth.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: c8b3854bad30a8b40babc5a9805f294e +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reproject.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h similarity index 77% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reproject.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h index f7f3961..29b7584 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_reproject.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,11 +19,12 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_REPROJECT_H -#define FFX_FSR2_REPROJECT_H -#ifndef FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE -#define FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE 0 // Reference +#ifndef FFX_FSR3UPSCALER_REPROJECT_H +#define FFX_FSR3UPSCALER_REPROJECT_H + +#ifndef FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE +#define FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE 0 // Reference #endif FfxFloat32x4 WrapHistory(FfxInt32x2 iPxSample) @@ -39,12 +40,12 @@ FFX_MIN16_F4 WrapHistory(FFX_MIN16_I2 iPxSample) #endif -#if FFX_FSR2_OPTION_REPROJECT_SAMPLERS_USE_DATA_HALF && FFX_HALF +#if FFX_FSR3UPSCALER_OPTION_REPROJECT_SAMPLERS_USE_DATA_HALF && FFX_HALF DeclareCustomFetchBicubicSamplesMin16(FetchHistorySamples, WrapHistory) -DeclareCustomTextureSampleMin16(HistorySample, FFX_FSR2_GET_LANCZOS_SAMPLER1D(FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchHistorySamples) +DeclareCustomTextureSampleMin16(HistorySample, FFX_FSR3UPSCALER_GET_LANCZOS_SAMPLER1D(FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchHistorySamples) #else DeclareCustomFetchBicubicSamples(FetchHistorySamples, WrapHistory) -DeclareCustomTextureSample(HistorySample, FFX_FSR2_GET_LANCZOS_SAMPLER1D(FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchHistorySamples) +DeclareCustomTextureSample(HistorySample, FFX_FSR3UPSCALER_GET_LANCZOS_SAMPLER1D(FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchHistorySamples) #endif FfxFloat32x4 WrapLockStatus(FfxInt32x2 iPxSample) @@ -63,7 +64,7 @@ FFX_MIN16_F4 WrapLockStatus(FFX_MIN16_I2 iPxSample) #endif #if 1 -#if FFX_FSR2_OPTION_REPROJECT_SAMPLERS_USE_DATA_HALF && FFX_HALF +#if FFX_FSR3UPSCALER_OPTION_REPROJECT_SAMPLERS_USE_DATA_HALF && FFX_HALF DeclareCustomFetchBilinearSamplesMin16(FetchLockStatusSamples, WrapLockStatus) DeclareCustomTextureSampleMin16(LockStatusSample, Bilinear, FetchLockStatusSamples) #else @@ -71,18 +72,18 @@ DeclareCustomFetchBilinearSamples(FetchLockStatusSamples, WrapLockStatus) DeclareCustomTextureSample(LockStatusSample, Bilinear, FetchLockStatusSamples) #endif #else -#if FFX_FSR2_OPTION_REPROJECT_SAMPLERS_USE_DATA_HALF && FFX_HALF +#if FFX_FSR3UPSCALER_OPTION_REPROJECT_SAMPLERS_USE_DATA_HALF && FFX_HALF DeclareCustomFetchBicubicSamplesMin16(FetchLockStatusSamples, WrapLockStatus) -DeclareCustomTextureSampleMin16(LockStatusSample, FFX_FSR2_GET_LANCZOS_SAMPLER1D(FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchLockStatusSamples) +DeclareCustomTextureSampleMin16(LockStatusSample, FFX_FSR3UPSCALER_GET_LANCZOS_SAMPLER1D(FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchLockStatusSamples) #else DeclareCustomFetchBicubicSamples(FetchLockStatusSamples, WrapLockStatus) -DeclareCustomTextureSample(LockStatusSample, FFX_FSR2_GET_LANCZOS_SAMPLER1D(FFX_FSR2_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchLockStatusSamples) +DeclareCustomTextureSample(LockStatusSample, FFX_FSR3UPSCALER_GET_LANCZOS_SAMPLER1D(FFX_FSR3UPSCALER_OPTION_REPROJECT_USE_LANCZOS_TYPE), FetchLockStatusSamples) #endif #endif FfxFloat32x2 GetMotionVector(FfxInt32x2 iPxHrPos, FfxFloat32x2 fHrUv) { -#if FFX_FSR2_OPTION_LOW_RESOLUTION_MOTION_VECTORS +#if FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS FfxFloat32x2 fDilatedMotionVector = LoadDilatedMotionVector(FFX_MIN16_I2(fHrUv * RenderSize())); #else FfxFloat32x2 fDilatedMotionVector = LoadInputMotionVector(iPxHrPos); @@ -133,4 +134,4 @@ LockState ReprojectHistoryLockStatus(const AccumulationPassCommonParams params, return state; } -#endif //!defined( FFX_FSR2_REPROJECT_H ) +#endif //!defined( FFX_FSR3UPSCALER_REPROJECT_H ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h.meta new file mode 100644 index 0000000..ea2e14d --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_reproject.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 9d893016eebb2564f9a66b80afb0849f +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h new file mode 100644 index 0000000..d98cfcc --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h @@ -0,0 +1,104 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#ifndef FFX_FSR3UPSCALER_RESOURCES_H +#define FFX_FSR3UPSCALER_RESOURCES_H + +#if defined(FFX_CPU) || defined(FFX_GPU) +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL 0 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_OPAQUE_ONLY 1 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_COLOR 2 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_MOTION_VECTORS 3 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_DEPTH 4 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_EXPOSURE 5 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_REACTIVE_MASK 6 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INPUT_TRANSPARENCY_AND_COMPOSITION_MASK 7 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_RECONSTRUCTED_PREVIOUS_NEAREST_DEPTH 8 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS 9 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DILATED_DEPTH 10 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR 11 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_STATUS 12 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NEW_LOCKS 13 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREPARED_INPUT_COLOR 14 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LUMA_HISTORY 15 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DEBUG_OUTPUT 16 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LANCZOS_LUT 17 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SPD_ATOMIC_COUNT 18 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_UPSCALED_OUTPUT 19 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_RCAS_INPUT 20 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_STATUS_1 21 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_STATUS_2 22 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR_1 23 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_UPSCALED_COLOR_2 24 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_REACTIVITY 25 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_TRANSPARENCY_AND_COMPOSITION 26 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTITIER_UPSAMPLE_MAXIMUM_BIAS_LUT 27 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_DILATED_REACTIVE_MASKS 28 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE 29 // same as FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0 29 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_1 30 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_2 31 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_3 32 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_4 33 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_5 34 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_6 35 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_7 36 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_8 37 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_9 38 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_10 39 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_11 40 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_12 41 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_INTERNAL_DEFAULT_EXPOSURE 42 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_AUTO_EXPOSURE 43 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_AUTOREACTIVE 44 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_AUTOCOMPOSITION_DEPRECATED 45 + +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR 46 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR 47 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR_1 48 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR_1 49 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_PRE_ALPHA_COLOR_2 50 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREV_POST_ALPHA_COLOR_2 51 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_PREVIOUS_DILATED_MOTION_VECTORS 52 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LUMA_HISTORY_1 53 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LUMA_HISTORY_2 54 +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_LOCK_INPUT_LUMA 55 + +// Shading change detection mip level setting, value must be in the range [FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_0, FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_12] +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_4 +#define FFX_FSR3UPSCALER_SHADING_CHANGE_MIP_LEVEL (FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE_MIPMAP_SHADING_CHANGE - FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_SCENE_LUMINANCE) + +#define FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_COUNT 56 + +#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_FSR3UPSCALER 0 +#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_SPD 1 +#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_RCAS 2 +#define FFX_FSR3UPSCALER_CONSTANTBUFFER_IDENTIFIER_GENREACTIVE 3 + +#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_TONEMAP 1 +#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_INVERSETONEMAP 2 +#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_APPLY_THRESHOLD 4 +#define FFX_FSR3UPSCALER_AUTOREACTIVEFLAGS_USE_COMPONENTS_MAX 8 + +#endif // #if defined(FFX_CPU) || defined(FFX_GPU) + +#endif //!defined( FFX_FSR3UPSCALER_RESOURCES_H ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h.meta new file mode 100644 index 0000000..24cdbd2 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_resources.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: b5a95a38dcfaf3946a5095bbbc42939a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_sample.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h similarity index 96% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_sample.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h index f94f40a..d33f70c 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_sample.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_SAMPLE_H -#define FFX_FSR2_SAMPLE_H + +#ifndef FFX_FSR3UPSCALER_SAMPLE_H +#define FFX_FSR3UPSCALER_SAMPLE_H // suppress warnings #ifdef FFX_HLSL @@ -127,7 +128,7 @@ FFX_MIN16_F4 Bilinear(FetchedBilinearSamplesMin16 BilinearSamples, FFX_MIN16_F2 FfxFloat32 Lanczos2NoClamp(FfxFloat32 x) { const FfxFloat32 PI = 3.141592653589793f; // TODO: share SDK constants - return abs(x) < FSR2_EPSILON ? 1.f : (sin(PI * x) / (PI * x)) * (sin(0.5f * PI * x) / (0.5f * PI * x)); + return abs(x) < FSR3UPSCALER_EPSILON ? 1.f : (sin(PI * x) / (PI * x)) * (sin(0.5f * PI * x) / (0.5f * PI * x)); } FfxFloat32 Lanczos2(FfxFloat32 x) @@ -142,7 +143,7 @@ FfxFloat32 Lanczos2(FfxFloat32 x) FFX_MIN16_F Lanczos2NoClamp(FFX_MIN16_F x) { const FFX_MIN16_F PI = FFX_MIN16_F(3.141592653589793f); // TODO: share SDK constants - return abs(x) < FFX_MIN16_F(FSR2_EPSILON) ? FFX_MIN16_F(1.f) : (sin(PI * x) / (PI * x)) * (sin(FFX_MIN16_F(0.5f) * PI * x) / (FFX_MIN16_F(0.5f) * PI * x)); + return abs(x) < FFX_MIN16_F(FSR3UPSCALER_EPSILON) ? FFX_MIN16_F(1.f) : (sin(PI * x) / (PI * x)) * (sin(FFX_MIN16_F(0.5f) * PI * x) / (FFX_MIN16_F(0.5f) * PI * x)); } #endif @@ -594,12 +595,12 @@ FFX_MIN16_I2 ClampCoord(FFX_MIN16_I2 iPxSample, FFX_MIN16_I2 iPxOffset, FFX_MIN1 return fColorXY; \ } -#define FFX_FSR2_CONCAT_ID(x, y) x ## y -#define FFX_FSR2_CONCAT(x, y) FFX_FSR2_CONCAT_ID(x, y) -#define FFX_FSR2_SAMPLER_1D_0 Lanczos2 -#define FFX_FSR2_SAMPLER_1D_1 Lanczos2LUT -#define FFX_FSR2_SAMPLER_1D_2 Lanczos2Approx +#define FFX_FSR3UPSCALER_CONCAT_ID(x, y) x ## y +#define FFX_FSR3UPSCALER_CONCAT(x, y) FFX_FSR3UPSCALER_CONCAT_ID(x, y) +#define FFX_FSR3UPSCALER_SAMPLER_1D_0 Lanczos2 +#define FFX_FSR3UPSCALER_SAMPLER_1D_1 Lanczos2LUT +#define FFX_FSR3UPSCALER_SAMPLER_1D_2 Lanczos2Approx -#define FFX_FSR2_GET_LANCZOS_SAMPLER1D(x) FFX_FSR2_CONCAT(FFX_FSR2_SAMPLER_1D_, x) +#define FFX_FSR3UPSCALER_GET_LANCZOS_SAMPLER1D(x) FFX_FSR3UPSCALER_CONCAT(FFX_FSR3UPSCALER_SAMPLER_1D_, x) -#endif //!defined( FFX_FSR2_SAMPLE_H ) +#endif //!defined( FFX_FSR3UPSCALER_SAMPLE_H ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h.meta new file mode 100644 index 0000000..1a46376 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_sample.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: dcb900c9deecd06419a8a4c10c305890 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h similarity index 99% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h index 101b75d..2d446bb 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_tcr_autogen.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h @@ -52,7 +52,7 @@ FFX_MIN16_F ComputeAutoTC_01(FFX_MIN16_I2 uDispatchThreadId, FFX_MIN16_I2 iPrevI FFX_MIN16_F retVal = FFX_MIN16_F(ffxSaturate(dot(abs(abs(Y - X) - abs(W - Z)), FfxFloat32x3(1, 1, 1)))); // cleanup very small values - retVal = (retVal < getTcThreshold()) ? FFX_MIN16_F(0.0f) : FFX_MIN16_F(1.f); + retVal = (retVal < TcThreshold()) ? FFX_MIN16_F(0.0f) : FFX_MIN16_F(1.f); return retVal; } diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h.meta new file mode 100644 index 0000000..99d54e7 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_tcr_autogen.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: f01d5a8fbd1f34a4ea8d971755a21b6c +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_upsample.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h similarity index 85% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_upsample.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h index abdb888..47e7ccf 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_upsample.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,8 +19,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifndef FFX_FSR2_UPSAMPLE_H -#define FFX_FSR2_UPSAMPLE_H + +#ifndef FFX_FSR3UPSCALER_UPSAMPLE_H +#define FFX_FSR3UPSCALER_UPSAMPLE_H FFX_STATIC const FfxUInt32 iLanczos2SampleCount = 16; @@ -35,18 +36,18 @@ void Deringing(RectificationBoxMin16 clippingBox, FFX_PARAMETER_INOUT FFX_MIN16_ } #endif -#ifndef FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE -#define FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE 2 // Approximate +#ifndef FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE +#define FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE 2 // Approximate #endif FfxFloat32 GetUpsampleLanczosWeight(FfxFloat32x2 fSrcSampleOffset, FfxFloat32 fKernelWeight) { FfxFloat32x2 fSrcSampleOffsetBiased = fSrcSampleOffset * fKernelWeight.xx; -#if FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 0 // LANCZOS_TYPE_REFERENCE +#if FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 0 // LANCZOS_TYPE_REFERENCE FfxFloat32 fSampleWeight = Lanczos2(length(fSrcSampleOffsetBiased)); -#elif FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 1 // LANCZOS_TYPE_LUT +#elif FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 1 // LANCZOS_TYPE_LUT FfxFloat32 fSampleWeight = Lanczos2_UseLUT(length(fSrcSampleOffsetBiased)); -#elif FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 2 // LANCZOS_TYPE_APPROXIMATE +#elif FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 2 // LANCZOS_TYPE_APPROXIMATE FfxFloat32 fSampleWeight = Lanczos2ApproxSq(dot(fSrcSampleOffsetBiased, fSrcSampleOffsetBiased)); #else #error "Invalid Lanczos type" @@ -58,11 +59,11 @@ FfxFloat32 GetUpsampleLanczosWeight(FfxFloat32x2 fSrcSampleOffset, FfxFloat32 fK FFX_MIN16_F GetUpsampleLanczosWeight(FFX_MIN16_F2 fSrcSampleOffset, FFX_MIN16_F fKernelWeight) { FFX_MIN16_F2 fSrcSampleOffsetBiased = fSrcSampleOffset * fKernelWeight.xx; -#if FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 0 // LANCZOS_TYPE_REFERENCE +#if FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 0 // LANCZOS_TYPE_REFERENCE FFX_MIN16_F fSampleWeight = Lanczos2(length(fSrcSampleOffsetBiased)); -#elif FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 1 // LANCZOS_TYPE_LUT +#elif FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 1 // LANCZOS_TYPE_LUT FFX_MIN16_F fSampleWeight = Lanczos2_UseLUT(length(fSrcSampleOffsetBiased)); -#elif FFX_FSR2_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 2 // LANCZOS_TYPE_APPROXIMATE +#elif FFX_FSR3UPSCALER_OPTION_UPSAMPLE_USE_LANCZOS_TYPE == 2 // LANCZOS_TYPE_APPROXIMATE FFX_MIN16_F fSampleWeight = Lanczos2ApproxSq(dot(fSrcSampleOffsetBiased, fSrcSampleOffsetBiased)); // To Test: Save reciproqual sqrt compute @@ -85,16 +86,16 @@ FfxFloat32 ComputeMaxKernelWeight() { FfxFloat32x4 ComputeUpsampledColorAndWeight(const AccumulationPassCommonParams params, FFX_PARAMETER_INOUT RectificationBox clippingBox, FfxFloat32 fReactiveFactor) { - #if FFX_FSR2_OPTION_UPSAMPLE_SAMPLERS_USE_DATA_HALF && FFX_HALF - #include "ffx_fsr2_force16_begin.h" + #if FFX_FSR3UPSCALER_OPTION_UPSAMPLE_SAMPLERS_USE_DATA_HALF && FFX_HALF + #include "ffx_fsr3upscaler_force16_begin.h" #endif // We compute a sliced lanczos filter with 2 lobes (other slices are accumulated temporaly) FfxFloat32x2 fDstOutputPos = FfxFloat32x2(params.iPxHrPos) + FFX_BROADCAST_FLOAT32X2(0.5f); // Destination resolution output pixel center position FfxFloat32x2 fSrcOutputPos = fDstOutputPos * DownscaleFactor(); // Source resolution output pixel center position FfxInt32x2 iSrcInputPos = FfxInt32x2(floor(fSrcOutputPos)); // TODO: what about weird upscale factors... - #if FFX_FSR2_OPTION_UPSAMPLE_SAMPLERS_USE_DATA_HALF && FFX_HALF - #include "ffx_fsr2_force16_end.h" + #if FFX_FSR3UPSCALER_OPTION_UPSAMPLE_SAMPLERS_USE_DATA_HALF && FFX_HALF + #include "ffx_fsr3upscaler_force16_end.h" #endif FfxFloat32x3 fSamples[iLanczos2SampleCount]; @@ -174,9 +175,9 @@ FfxFloat32x4 ComputeUpsampledColorAndWeight(const AccumulationPassCommonParams p RectificationBoxComputeVarianceBoxData(clippingBox); - fColorAndWeight.w *= FfxFloat32(fColorAndWeight.w > FSR2_EPSILON); + fColorAndWeight.w *= FfxFloat32(fColorAndWeight.w > FSR3UPSCALER_EPSILON); - if (fColorAndWeight.w > FSR2_EPSILON) { + if (fColorAndWeight.w > FSR3UPSCALER_EPSILON) { // Normalize for deringing (we need to compare colors) fColorAndWeight.xyz = fColorAndWeight.xyz / fColorAndWeight.w; fColorAndWeight.w *= fUpsampleLanczosWeightScale; @@ -184,11 +185,11 @@ FfxFloat32x4 ComputeUpsampledColorAndWeight(const AccumulationPassCommonParams p Deringing(clippingBox, fColorAndWeight.xyz); } - #if FFX_FSR2_OPTION_UPSAMPLE_SAMPLERS_USE_DATA_HALF && FFX_HALF - #include "ffx_fsr2_force16_end.h" + #if FFX_FSR3UPSCALER_OPTION_UPSAMPLE_SAMPLERS_USE_DATA_HALF && FFX_HALF + #include "ffx_fsr3upscaler_force16_end.h" #endif return fColorAndWeight; } -#endif //!defined( FFX_FSR2_UPSAMPLE_H ) +#endif //!defined( FFX_FSR3UPSCALER_UPSAMPLE_H ) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h.meta new file mode 100644 index 0000000..e4153a0 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/ffx_fsr3upscaler_upsample.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 3e7832c4a9154414f9eaa125acfe6cd5 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1.meta new file mode 100644 index 0000000..731c94f --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 09438bc445e66204f970dc99ca8dae5a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr1.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h similarity index 97% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr1.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h index 1ac23cf..e780995 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr1.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,9 +19,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wunused-variable" -#endif + +/// @defgroup FfxGPUFsr1 FidelityFX FSR1 +/// FidelityFX Super Resolution 1 GPU documentation +/// +/// @ingroup FfxGPUEffects /// Setup required constant values for EASU (works on CPU or GPU). /// @@ -36,7 +38,7 @@ /// @param [in] outputSizeInPixelsX The display resolution which the input image gets upscaled to in X dimension. /// @param [in] outputSizeInPixelsY The display resolution which the input image gets upscaled to in Y dimension. /// -/// @ingroup FSR1 +/// @ingroup FfxGPUFsr1 FFX_STATIC void ffxFsrPopulateEasuConstants( FFX_PARAMETER_INOUT FfxUInt32x4 con0, FFX_PARAMETER_INOUT FfxUInt32x4 con1, @@ -102,7 +104,7 @@ FFX_STATIC void ffxFsrPopulateEasuConstants( /// @param [in] inputOffsetInPixelsX The input image offset in the X dimension into the resource containing it (useful for dynamic resolution). /// @param [in] inputOffsetInPixelsY The input image offset in the Y dimension into the resource containing it (useful for dynamic resolution). /// -/// @ingroup FSR1 +/// @ingroup FfxGPUFsr1 FFX_STATIC void ffxFsrPopulateEasuConstantsOffset( FFX_PARAMETER_INOUT FfxUInt32x4 con0, FFX_PARAMETER_INOUT FfxUInt32x4 con1, @@ -329,7 +331,7 @@ void ffxFsrEasuFloat( // Normalize with approximation, and cleanup close to zero. FfxFloat32x2 dir2 = dir * dir; FfxFloat32 dirR = dir2.x + dir2.y; - FfxUInt32 zro = dirR < FfxFloat32(1.0 / 32768.0); + FfxBoolean zro = dirR < FfxFloat32(1.0 / 32768.0); dirR = ffxApproximateReciprocalSquareRoot(dirR); dirR = zro ? FfxFloat32(1.0) : dirR; dir.x = zro ? FfxFloat32(1.0) : dir.x; @@ -457,7 +459,7 @@ void FsrEasuSetH( FfxFloat16x2 dirX = lD - lB; dirPX += dirX * w; - lenX = ffxSaturate(abs(dirX) * lenX); + lenX = FfxFloat16x2(ffxSaturate(abs(dirX) * lenX)); lenX *= lenX; lenP += lenX * w; FfxFloat16x2 ec = lE - lC; @@ -466,7 +468,7 @@ void FsrEasuSetH( lenY = ffxReciprocalHalf(lenY); FfxFloat16x2 dirY = lE - lA; dirPY += dirY * w; - lenY = ffxSaturate(abs(dirY) * lenY); + lenY = FfxFloat16x2(ffxSaturate(abs(dirY) * lenY)); lenY *= lenY; lenP += lenY * w; } @@ -526,8 +528,8 @@ void FsrEasuH( dirPY, lenP, ppp, - FfxUInt32(true), - FfxUInt32(false), + FfxBoolean(true), + FfxBoolean(false), FfxFloat16x2(bL, cL), FfxFloat16x2(eL, fL), FfxFloat16x2(fL, gL), @@ -537,8 +539,8 @@ void FsrEasuH( dirPY, lenP, ppp, - FfxUInt32(false), - FfxUInt32(true), + FfxBoolean(false), + FfxBoolean(true), FfxFloat16x2(fL, gL), FfxFloat16x2(iL, jL), FfxFloat16x2(jL, kL), @@ -549,7 +551,7 @@ void FsrEasuH( FfxFloat16x2 dir2 = dir * dir; FfxFloat16 dirR = dir2.x + dir2.y; - FfxBoolean zro = FfxBoolean(dirR < FFX_BROADCAST_FLOAT16(1.0 / 32768.0)); + FfxUInt32 zro = FfxUInt32(dirR < FFX_BROADCAST_FLOAT16(1.0 / 32768.0)); dirR = ffxApproximateReciprocalSquareRootHalf(dirR); dirR = (zro > 0) ? FFX_BROADCAST_FLOAT16(1.0) : dirR; dir.x = (zro > 0) ? FFX_BROADCAST_FLOAT16(1.0) : dir.x; @@ -834,7 +836,7 @@ void FsrEasuH( FfxFloat16 hL=hB*FFX_BROADCAST_FLOAT16(0.5)+(hR*FFX_BROADCAST_FLOAT16(0.5)+hG); // Noise detection. FfxFloat16 nz=FFX_BROADCAST_FLOAT16(0.25)*bL+FFX_BROADCAST_FLOAT16(0.25)*dL+FFX_BROADCAST_FLOAT16(0.25)*fL+FFX_BROADCAST_FLOAT16(0.25)*hL-eL; - nz=ffxSaturate(abs(nz)*ffxApproximateReciprocalMediumHalf(ffxMax3Half(ffxMax3Half(bL,dL,eL),fL,hL)-ffxMin3Half(ffxMin3Half(bL,dL,eL),fL,hL))); + nz=FfxFloat16(ffxSaturate(abs(nz)*ffxApproximateReciprocalMediumHalf(ffxMax3Half(ffxMax3Half(bL,dL,eL),fL,hL)-ffxMin3Half(ffxMin3Half(bL,dL,eL),fL,hL)))); nz=FFX_BROADCAST_FLOAT16(-0.5)*nz+FFX_BROADCAST_FLOAT16(1.0); // Min and max of ring. FfxFloat16 mn4R=min(ffxMin3Half(bR,dR,fR),hR); @@ -1175,7 +1177,7 @@ void FsrEasuH( FfxFloat16x3 b = n + FFX_BROADCAST_FLOAT16X3(1.0 / 255.0); b = b * b; FfxFloat16x3 r = (c - b) * ffxApproximateReciprocalMediumHalf(a - b); - c = ffxSaturate(n + ffxIsGreaterThanZeroHalf(FFX_BROADCAST_FLOAT16X3(dit) - r) * FFX_BROADCAST_FLOAT16X3(1.0 / 255.0)); + c = FfxFloat16x3(ffxSaturate(n + ffxIsGreaterThanZeroHalf(FFX_BROADCAST_FLOAT16X3(dit) - r) * FFX_BROADCAST_FLOAT16X3(1.0 / 255.0))); } //------------------------------------------------------------------------------------------------------------------------------ void FsrTepdC10H(inout FfxFloat16x3 c, FfxFloat16 dit) @@ -1186,7 +1188,7 @@ void FsrEasuH( FfxFloat16x3 b = n + FFX_BROADCAST_FLOAT16X3(1.0 / 1023.0); b = b * b; FfxFloat16x3 r = (c - b) * ffxApproximateReciprocalMediumHalf(a - b); - c = ffxSaturate(n + ffxIsGreaterThanZeroHalf(FFX_BROADCAST_FLOAT16X3(dit) - r) * FFX_BROADCAST_FLOAT16X3(1.0 / 1023.0)); + c = FfxFloat16x3(ffxSaturate(n + ffxIsGreaterThanZeroHalf(FFX_BROADCAST_FLOAT16X3(dit) - r) * FFX_BROADCAST_FLOAT16X3(1.0 / 1023.0))); } //============================================================================================================================== // This computes dither for positions 'p' and 'p+{8,0}'. @@ -1222,9 +1224,9 @@ void FsrEasuH( FfxFloat16x2 rR = (cR - bR) * ffxApproximateReciprocalMediumHalf(aR - bR); FfxFloat16x2 rG = (cG - bG) * ffxApproximateReciprocalMediumHalf(aG - bG); FfxFloat16x2 rB = (cB - bB) * ffxApproximateReciprocalMediumHalf(aB - bB); - cR = ffxSaturate(nR + ffxIsGreaterThanZeroHalf(dit - rR) * FFX_BROADCAST_FLOAT16X2(1.0 / 255.0)); - cG = ffxSaturate(nG + ffxIsGreaterThanZeroHalf(dit - rG) * FFX_BROADCAST_FLOAT16X2(1.0 / 255.0)); - cB = ffxSaturate(nB + ffxIsGreaterThanZeroHalf(dit - rB) * FFX_BROADCAST_FLOAT16X2(1.0 / 255.0)); + cR = FfxFloat16x2(ffxSaturate(nR + ffxIsGreaterThanZeroHalf(dit - rR) * FFX_BROADCAST_FLOAT16X2(1.0 / 255.0))); + cG = FfxFloat16x2(ffxSaturate(nG + ffxIsGreaterThanZeroHalf(dit - rG) * FFX_BROADCAST_FLOAT16X2(1.0 / 255.0))); + cB = FfxFloat16x2(ffxSaturate(nB + ffxIsGreaterThanZeroHalf(dit - rB) * FFX_BROADCAST_FLOAT16X2(1.0 / 255.0))); } //------------------------------------------------------------------------------------------------------------------------------ void FsrTepdC10Hx2(inout FfxFloat16x2 cR,inout FfxFloat16x2 cG,inout FfxFloat16x2 cB,FfxFloat16x2 dit){ @@ -1243,8 +1245,8 @@ void FsrEasuH( FfxFloat16x2 rR=(cR-bR)*ffxApproximateReciprocalMediumHalf(aR-bR); FfxFloat16x2 rG=(cG-bG)*ffxApproximateReciprocalMediumHalf(aG-bG); FfxFloat16x2 rB=(cB-bB)*ffxApproximateReciprocalMediumHalf(aB-bB); - cR=ffxSaturate(nR+ffxIsGreaterThanZeroHalf(dit-rR)*FFX_BROADCAST_FLOAT16X2(1.0/1023.0)); - cG=ffxSaturate(nG+ffxIsGreaterThanZeroHalf(dit-rG)*FFX_BROADCAST_FLOAT16X2(1.0/1023.0)); - cB = ffxSaturate(nB + ffxIsGreaterThanZeroHalf(dit - rB) * FFX_BROADCAST_FLOAT16X2(1.0 / 1023.0)); + cR=FfxFloat16x2(ffxSaturate(nR+ffxIsGreaterThanZeroHalf(dit-rR)*FFX_BROADCAST_FLOAT16X2(1.0/1023.0))); + cG=FfxFloat16x2(ffxSaturate(nG+ffxIsGreaterThanZeroHalf(dit-rG)*FFX_BROADCAST_FLOAT16X2(1.0/1023.0))); + cB=FfxFloat16x2(ffxSaturate(nB + ffxIsGreaterThanZeroHalf(dit - rB) * FFX_BROADCAST_FLOAT16X2(1.0 / 1023.0))); } #endif diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h.meta new file mode 100644 index 0000000..64e4ffa --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/fsr1/ffx_fsr1.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: 628e23510f46ef44bbf0035ce9a63be0 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd.meta new file mode 100644 index 0000000..0b775af --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0f03de1579ac3294595ae4f40106b7a2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_spd.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h similarity index 82% rename from Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_spd.h rename to Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h index b94f46f..6441419 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_spd.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h @@ -1,7 +1,7 @@ // This file is part of the FidelityFX SDK. -// -// Copyright (c) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. -// +// +// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights @@ -10,7 +10,7 @@ // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,22 +19,42 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#ifdef FFX_CPU -FFX_STATIC void SpdSetup(FfxUInt32x2 dispatchThreadGroupCountXY, // CPU side: dispatch thread group count xy - FfxUInt32x2 workGroupOffset, // GPU side: pass in as constant - FfxUInt32x2 numWorkGroupsAndMips, // GPU side: pass in as constant - FfxUInt32x4 rectInfo, // left, top, width, height - FfxInt32 mips) // optional: if -1, calculate based on rect width and height -{ - workGroupOffset[0] = rectInfo[0] / 64; // rectInfo[0] = left - workGroupOffset[1] = rectInfo[1] / 64; // rectInfo[1] = top + +/// @defgroup FfxGPUSpd FidelityFX SPD +/// FidelityFX Single Pass Downsampler 2.0 GPU documentation +/// +/// @ingroup FfxGPUEffects + +/// Setup required constant values for SPD (CPU). +/// +/// @param [out] dispatchThreadGroupCountXY CPU side: dispatch thread group count xy. z is number of slices of the input texture +/// @param [out] workGroupOffset GPU side: pass in as constant +/// @param [out] numWorkGroupsAndMips GPU side: pass in as constant +/// @param [in] rectInfo left, top, width, height +/// @param [in] mips optional: if -1, calculate based on rect width and height +/// +/// @ingroup FfxGPUSpd +#if defined(FFX_CPU) +FFX_STATIC void ffxSpdSetup(FfxUInt32x2 dispatchThreadGroupCountXY, + FfxUInt32x2 workGroupOffset, + FfxUInt32x2 numWorkGroupsAndMips, + FfxUInt32x4 rectInfo, + FfxInt32 mips) +{ + // determines the offset of the first tile to downsample based on + // left (rectInfo[0]) and top (rectInfo[1]) of the subregion. + workGroupOffset[0] = rectInfo[0] / 64; + workGroupOffset[1] = rectInfo[1] / 64; FfxUInt32 endIndexX = (rectInfo[0] + rectInfo[2] - 1) / 64; // rectInfo[0] = left, rectInfo[2] = width FfxUInt32 endIndexY = (rectInfo[1] + rectInfo[3] - 1) / 64; // rectInfo[1] = top, rectInfo[3] = height + // we only need to dispatch as many thread groups as tiles we need to downsample + // number of tiles per slice depends on the subregion to downsample dispatchThreadGroupCountXY[0] = endIndexX + 1 - workGroupOffset[0]; dispatchThreadGroupCountXY[1] = endIndexY + 1 - workGroupOffset[1]; + // number of thread groups per slice numWorkGroupsAndMips[0] = (dispatchThreadGroupCountXY[0]) * (dispatchThreadGroupCountXY[1]); if (mips >= 0) @@ -42,29 +62,37 @@ FFX_STATIC void SpdSetup(FfxUInt32x2 dispatchThreadGroupCountXY, // CPU side numWorkGroupsAndMips[1] = FfxUInt32(mips); } else - { + { // calculate based on rect width and height FfxUInt32 resolution = ffxMax(rectInfo[2], rectInfo[3]); numWorkGroupsAndMips[1] = FfxUInt32((ffxMin(floor(log2(FfxFloat32(resolution))), FfxFloat32(12)))); } } -FFX_STATIC void SpdSetup(FfxUInt32x2 dispatchThreadGroupCountXY, // CPU side: dispatch thread group count xy - FfxUInt32x2 workGroupOffset, // GPU side: pass in as constant - FfxUInt32x2 numWorkGroupsAndMips, // GPU side: pass in as constant - FfxUInt32x4 rectInfo) // left, top, width, height +/// Setup required constant values for SPD (CPU). +/// +/// @param [out] dispatchThreadGroupCountXY CPU side: dispatch thread group count xy. z is number of slices of the input texture +/// @param [out] workGroupOffset GPU side: pass in as constant +/// @param [out] numWorkGroupsAndMips GPU side: pass in as constant +/// @param [in] rectInfo left, top, width, height +/// +/// @ingroup FfxGPUSpd +FFX_STATIC void ffxSpdSetup(FfxUInt32x2 dispatchThreadGroupCountXY, + FfxUInt32x2 workGroupOffset, + FfxUInt32x2 numWorkGroupsAndMips, + FfxUInt32x4 rectInfo) { - SpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo, -1); + ffxSpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo, -1); } -#endif // #ifdef FFX_CPU +#endif // #if defined(FFX_CPU) //============================================================================================================================== // NON-PACKED VERSION //============================================================================================================================== -#ifdef FFX_GPU -#ifdef SPD_PACKED_ONLY -// Avoid compiler error +#if defined(FFX_GPU) +#if defined(FFX_SPD_PACKED_ONLY) +// Avoid compiler errors by including default implementations of these callbacks. FfxFloat32x4 SpdLoadSourceImage(FfxInt32x2 p, FfxUInt32 slice) { return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); @@ -88,18 +116,13 @@ FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFl { return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); } -#endif // #ifdef SPD_PACKED_ONLY +#endif // #if FFX_SPD_PACKED_ONLY //_____________________________________________________________/\_______________________________________________________________ -void SpdWorkgroupShuffleBarrier() +void ffxSpdWorkgroupShuffleBarrier() { -#ifdef FFX_GLSL - barrier(); -#endif -#ifdef FFX_HLSL - GroupMemoryBarrierWithGroupSync(); -#endif + FFX_GROUP_MEMORY_BARRIER(); } // Only last active workgroup should proceed @@ -111,14 +134,14 @@ bool SpdExitWorkgroup(FfxUInt32 numWorkGroups, FfxUInt32 localInvocationIndex, F SpdIncreaseAtomicCounter(slice); } - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); return (SpdGetAtomicCounter() != (numWorkGroups - 1)); } // User defined: FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3); FfxFloat32x4 SpdReduceQuad(FfxFloat32x4 v) { -#if defined(FFX_GLSL) && !defined(SPD_NO_WAVE_OPERATIONS) +#if defined(FFX_GLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) FfxFloat32x4 v0 = v; FfxFloat32x4 v1 = subgroupQuadSwapHorizontal(v); @@ -126,7 +149,7 @@ FfxFloat32x4 SpdReduceQuad(FfxFloat32x4 v) FfxFloat32x4 v3 = subgroupQuadSwapDiagonal(v); return SpdReduce4(v0, v1, v2, v3); -#elif defined(FFX_HLSL) && !defined(SPD_NO_WAVE_OPERATIONS) +#elif defined(FFX_HLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) // requires SM6.0 FfxUInt32 quad = WaveGetLaneIndex() & (~0x3); @@ -196,7 +219,7 @@ FfxFloat32x4 SpdReduceLoadSourceImage4(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt32 FfxFloat32x4 SpdReduceLoadSourceImage(FfxUInt32x2 base, FfxUInt32 slice) { -#ifdef SPD_LINEAR_SAMPLER +#if defined(SPD_LINEAR_SAMPLER) return SpdLoadSourceImage(FfxInt32x2(base), slice); #else return SpdReduceLoadSourceImage4(FfxUInt32x2(base + FfxUInt32x2(0, 0)), FfxUInt32x2(base + FfxUInt32x2(0, 1)), FfxUInt32x2(base + FfxUInt32x2(1, 0)), FfxUInt32x2(base + FfxUInt32x2(1, 1)), slice); @@ -281,13 +304,13 @@ void SpdDownsampleMips_0_1_LDS(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID for (FfxUInt32 i = 0; i < 4; i++) { SpdStoreIntermediate(x, y, v[i]); - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); if (localInvocationIndex < 64) { v[i] = SpdReduceIntermediate(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); SpdStore(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x + (i % 2) * 8, y + (i / 2) * 8), v[i], 1, slice); } - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); } if (localInvocationIndex < 64) @@ -301,7 +324,7 @@ void SpdDownsampleMips_0_1_LDS(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID void SpdDownsampleMips_0_1(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) SpdDownsampleMips_0_1_LDS(x, y, workGroupID, localInvocationIndex, mip, slice); #else SpdDownsampleMips_0_1_Intrinsics(x, y, workGroupID, localInvocationIndex, mip, slice); @@ -311,7 +334,7 @@ void SpdDownsampleMips_0_1(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, Ff void SpdDownsampleMip_2(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 64) { FfxFloat32x4 v = SpdReduceIntermediate(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); @@ -340,7 +363,7 @@ void SpdDownsampleMip_2(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUI void SpdDownsampleMip_3(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 16) { // x 0 x 0 @@ -380,7 +403,7 @@ void SpdDownsampleMip_3(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUI void SpdDownsampleMip_4(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 4) { // x 0 0 0 x 0 0 0 @@ -413,7 +436,7 @@ void SpdDownsampleMip_4(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUI void SpdDownsampleMip_5(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 1) { // x x x x 0 ... @@ -470,48 +493,75 @@ void SpdDownsampleNextFour(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, Ff { if (mips <= baseMip) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_2(x, y, workGroupID, localInvocationIndex, baseMip, slice); if (mips <= baseMip + 1) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_3(x, y, workGroupID, localInvocationIndex, baseMip + 1, slice); if (mips <= baseMip + 2) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_4(x, y, workGroupID, localInvocationIndex, baseMip + 2, slice); if (mips <= baseMip + 3) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_5(workGroupID, localInvocationIndex, baseMip + 3, slice); } +/// Downsamples a 64x64 tile based on the work group id. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// +/// @ingroup FfxGPUSpd void SpdDownsample(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice) { + // compute MIP level 0 and 1 FfxUInt32x2 sub_xy = ffxRemapForWaveReduction(localInvocationIndex % 64); FfxUInt32 x = sub_xy.x + 8 * ((localInvocationIndex >> 6) % 2); FfxUInt32 y = sub_xy.y + 8 * ((localInvocationIndex >> 7)); SpdDownsampleMips_0_1(x, y, workGroupID, localInvocationIndex, mips, slice); + // compute MIP level 2, 3, 4, 5 SpdDownsampleNextFour(x, y, workGroupID, localInvocationIndex, 2, mips, slice); if (mips <= 6) return; + // increase the global atomic counter for the given slice and check if it's the last remaining thread group: + // terminate if not, continue if yes. if (SpdExitWorkgroup(numWorkGroups, localInvocationIndex, slice)) return; + // reset the global atomic counter back to 0 for the next spd dispatch SpdResetAtomicCounter(slice); - // After mip 6 there is only a single workgroup left that downsamples the remaining up to 64x64 texels. + // After mip 5 there is only a single workgroup left that downsamples the remaining up to 64x64 texels. + // compute MIP level 6 and 7 SpdDownsampleMips_6_7(x, y, mips, slice); + // compute MIP level 8, 9, 10, 11 SpdDownsampleNextFour(x, y, FfxUInt32x2(0, 0), localInvocationIndex, 8, mips, slice); } - +/// Downsamples a 64x64 tile based on the work group id and work group offset. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// @param [in] workGroupOffset the work group offset. it's (0,0) in case the entire input texture is downsampled. +/// +/// @ingroup FfxGPUSpd void SpdDownsample(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice, FfxUInt32x2 workGroupOffset) { SpdDownsample(workGroupID + workGroupOffset, localInvocationIndex, mips, numWorkGroups, slice); @@ -528,13 +578,13 @@ void SpdDownsample(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxU FfxFloat16x4 SpdReduceQuadH(FfxFloat16x4 v) { -#if defined(FFX_GLSL) && !defined(SPD_NO_WAVE_OPERATIONS) +#if defined(FFX_GLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) FfxFloat16x4 v0 = v; FfxFloat16x4 v1 = subgroupQuadSwapHorizontal(v); FfxFloat16x4 v2 = subgroupQuadSwapVertical(v); FfxFloat16x4 v3 = subgroupQuadSwapDiagonal(v); return SpdReduce4H(v0, v1, v2, v3); -#elif defined(FFX_HLSL) && !defined(SPD_NO_WAVE_OPERATIONS) +#elif defined(FFX_HLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) // requires SM6.0 FfxUInt32 quad = WaveGetLaneIndex() & (~0x3); FfxFloat16x4 v0 = v; @@ -603,7 +653,7 @@ FfxFloat16x4 SpdReduceLoadSourceImage4H(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt3 FfxFloat16x4 SpdReduceLoadSourceImageH(FfxUInt32x2 base, FfxUInt32 slice) { -#ifdef SPD_LINEAR_SAMPLER +#if defined(SPD_LINEAR_SAMPLER) return SpdLoadSourceImageH(FfxInt32x2(base), slice); #else return SpdReduceLoadSourceImage4H(FfxUInt32x2(base + FfxUInt32x2(0, 0)), FfxUInt32x2(base + FfxUInt32x2(0, 1)), FfxUInt32x2(base + FfxUInt32x2(1, 0)), FfxUInt32x2(base + FfxUInt32x2(1, 1)), slice); @@ -685,16 +735,16 @@ void SpdDownsampleMips_0_1_LDSH(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupI if (mips <= 1) return; - for (FfxInt32 i = 0; i < 4; i++) + for (FfxUInt32 i = 0; i < 4; i++) { SpdStoreIntermediateH(x, y, v[i]); - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); if (localInvocationIndex < 64) { v[i] = SpdReduceIntermediateH(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); SpdStoreH(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x + (i % 2) * 8, y + (i / 2) * 8), v[i], 1, slice); } - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); } if (localInvocationIndex < 64) @@ -708,7 +758,7 @@ void SpdDownsampleMips_0_1_LDSH(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupI void SpdDownsampleMips_0_1H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) SpdDownsampleMips_0_1_LDSH(x, y, workGroupID, localInvocationIndex, mips, slice); #else SpdDownsampleMips_0_1_IntrinsicsH(x, y, workGroupID, localInvocationIndex, mips, slice); @@ -718,7 +768,7 @@ void SpdDownsampleMips_0_1H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, F void SpdDownsampleMip_2H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 64) { FfxFloat16x4 v = SpdReduceIntermediateH(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); @@ -747,7 +797,7 @@ void SpdDownsampleMip_2H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxU void SpdDownsampleMip_3H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 16) { // x 0 x 0 @@ -787,7 +837,7 @@ void SpdDownsampleMip_3H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxU void SpdDownsampleMip_4H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 4) { // x 0 0 0 x 0 0 0 @@ -820,7 +870,7 @@ void SpdDownsampleMip_4H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxU void SpdDownsampleMip_5H(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) { -#ifdef SPD_NO_WAVE_OPERATIONS +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) if (localInvocationIndex < 1) { // x x x x 0 ... @@ -877,53 +927,83 @@ void SpdDownsampleNextFourH(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, F { if (mips <= baseMip) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_2H(x, y, workGroupID, localInvocationIndex, baseMip, slice); if (mips <= baseMip + 1) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_3H(x, y, workGroupID, localInvocationIndex, baseMip + 1, slice); if (mips <= baseMip + 2) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_4H(x, y, workGroupID, localInvocationIndex, baseMip + 2, slice); if (mips <= baseMip + 3) return; - SpdWorkgroupShuffleBarrier(); + ffxSpdWorkgroupShuffleBarrier(); SpdDownsampleMip_5H(workGroupID, localInvocationIndex, baseMip + 3, slice); } +/// Downsamples a 64x64 tile based on the work group id and work group offset. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// Uses half types. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// +/// @ingroup FfxGPUSpd void SpdDownsampleH(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice) { FfxUInt32x2 sub_xy = ffxRemapForWaveReduction(localInvocationIndex % 64); FfxUInt32 x = sub_xy.x + 8 * ((localInvocationIndex >> 6) % 2); FfxUInt32 y = sub_xy.y + 8 * ((localInvocationIndex >> 7)); + // compute MIP level 0 and 1 SpdDownsampleMips_0_1H(x, y, workGroupID, localInvocationIndex, mips, slice); + // compute MIP level 2, 3, 4, 5 SpdDownsampleNextFourH(x, y, workGroupID, localInvocationIndex, 2, mips, slice); if (mips < 7) return; + // increase the global atomic counter for the given slice and check if it's the last remaining thread group: + // terminate if not, continue if yes. if (SpdExitWorkgroup(numWorkGroups, localInvocationIndex, slice)) return; + // reset the global atomic counter back to 0 for the next spd dispatch SpdResetAtomicCounter(slice); - // After mip 6 there is only a single workgroup left that downsamples the remaining up to 64x64 texels. + // After mip 5 there is only a single workgroup left that downsamples the remaining up to 64x64 texels. + // compute MIP level 6 and 7 SpdDownsampleMips_6_7H(x, y, mips, slice); + // compute MIP level 8, 9, 10, 11 SpdDownsampleNextFourH(x, y, FfxUInt32x2(0, 0), localInvocationIndex, 8, mips, slice); } +/// Downsamples a 64x64 tile based on the work group id and work group offset. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// Uses half types. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// @param [in] workGroupOffset the work group offset. it's (0,0) in case the entire input texture is downsampled. +/// +/// @ingroup FfxGPUSpd void SpdDownsampleH(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice, FfxUInt32x2 workGroupOffset) { SpdDownsampleH(workGroupID + workGroupOffset, localInvocationIndex, mips, numWorkGroups, slice); } #endif // #if FFX_HALF -#endif // #ifdef FFX_GPU +#endif // #if defined(FFX_GPU) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h.meta b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h.meta new file mode 100644 index 0000000..8d4e716 --- /dev/null +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR3/shaders/fsr3upscaler/spd/ffx_spd.h.meta @@ -0,0 +1,27 @@ +fileFormatVersion: 2 +guid: face65176ee3b82498bd0b8fed0ddacd +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: