Browse Source

Added compute shaders for all optical flow passes, configured them to compile with DXC and wave operation support.

fsr3framegen
Nico de Poel 2 years ago
parent
commit
280bd41ac8
  1. 30
      Shaders/ffx_opticalflow_compute_luminance_pyramid_pass.compute
  2. 8
      Shaders/ffx_opticalflow_compute_luminance_pyramid_pass.compute.meta
  3. 30
      Shaders/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.compute
  4. 8
      Shaders/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.compute.meta
  5. 30
      Shaders/ffx_opticalflow_compute_scd_divergence_pass.compute
  6. 8
      Shaders/ffx_opticalflow_compute_scd_divergence_pass.compute.meta
  7. 30
      Shaders/ffx_opticalflow_filter_optical_flow_pass_v5.compute
  8. 8
      Shaders/ffx_opticalflow_filter_optical_flow_pass_v5.compute.meta
  9. 30
      Shaders/ffx_opticalflow_generate_scd_histogram_pass.compute
  10. 8
      Shaders/ffx_opticalflow_generate_scd_histogram_pass.compute.meta
  11. 30
      Shaders/ffx_opticalflow_prepare_luma_pass.compute
  12. 8
      Shaders/ffx_opticalflow_prepare_luma_pass.compute.meta
  13. 30
      Shaders/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.compute
  14. 8
      Shaders/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.compute.meta
  15. 4
      Shaders/shaders/opticalflow/ffx_opticalflow_callbacks_hlsl.h
  16. 2
      Shaders/shaders/opticalflow/ffx_opticalflow_compute_luminance_pyramid.h

30
Shaders/ffx_opticalflow_compute_luminance_pyramid_pass.compute

@ -0,0 +1,30 @@
// Copyright (c) 2024 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
// 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.
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma kernel CS
#pragma use_dxc
#pragma require WaveBasic
#include "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_opticalflow_compute_luminance_pyramid_pass.hlsl"

8
Shaders/ffx_opticalflow_compute_luminance_pyramid_pass.compute.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b4c831117e9d7db4f904bd81e05f9def
ComputeShaderImporter:
externalObjects: {}
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

30
Shaders/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.compute

@ -0,0 +1,30 @@
// Copyright (c) 2024 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
// 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.
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma kernel CS
#pragma use_dxc
#pragma require WaveBasic
#include "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.hlsl"

8
Shaders/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.compute.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f480a6ee4cca98544a6f72d0a57caa36
ComputeShaderImporter:
externalObjects: {}
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

30
Shaders/ffx_opticalflow_compute_scd_divergence_pass.compute

@ -0,0 +1,30 @@
// Copyright (c) 2024 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
// 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.
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma kernel CS
#pragma use_dxc
#pragma require WaveBasic
#include "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_opticalflow_compute_scd_divergence_pass.hlsl"

8
Shaders/ffx_opticalflow_compute_scd_divergence_pass.compute.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 06c260b21c4db2c4c88629b23a249e32
ComputeShaderImporter:
externalObjects: {}
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

30
Shaders/ffx_opticalflow_filter_optical_flow_pass_v5.compute

@ -0,0 +1,30 @@
// Copyright (c) 2024 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
// 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.
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma kernel CS
#pragma use_dxc
#pragma require WaveBasic
#include "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_opticalflow_filter_optical_flow_pass_v5.hlsl"

8
Shaders/ffx_opticalflow_filter_optical_flow_pass_v5.compute.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 067af02200e7be2469c7f23a8711fe3c
ComputeShaderImporter:
externalObjects: {}
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

30
Shaders/ffx_opticalflow_generate_scd_histogram_pass.compute

@ -0,0 +1,30 @@
// Copyright (c) 2024 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
// 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.
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma kernel CS
#pragma use_dxc
#pragma require WaveBasic
#include "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_opticalflow_generate_scd_histogram_pass.hlsl"

8
Shaders/ffx_opticalflow_generate_scd_histogram_pass.compute.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f20d1907c158bfe4d85b2f18d497a09f
ComputeShaderImporter:
externalObjects: {}
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

30
Shaders/ffx_opticalflow_prepare_luma_pass.compute

@ -0,0 +1,30 @@
// Copyright (c) 2024 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
// 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.
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma kernel CS
#pragma use_dxc
#pragma require WaveBasic
#include "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_opticalflow_prepare_luma_pass.hlsl"

8
Shaders/ffx_opticalflow_prepare_luma_pass.compute.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3b70bda1db8d2f74396241d4811241ed
ComputeShaderImporter:
externalObjects: {}
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

30
Shaders/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.compute

@ -0,0 +1,30 @@
// Copyright (c) 2024 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
// 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.
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
#pragma kernel CS
#pragma use_dxc
#pragma require WaveBasic
#include "ffx_fsr_unity_common.cginc"
#include "shaders/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.hlsl"

8
Shaders/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.compute.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f25c92e19c76fbb42a3d0d4b5e1316e6
ComputeShaderImporter:
externalObjects: {}
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

4
Shaders/shaders/opticalflow/ffx_opticalflow_callbacks_hlsl.h

@ -28,7 +28,7 @@
#pragma dxc diagnostic push #pragma dxc diagnostic push
#pragma dxc diagnostic ignored "-Wambig-lit-shift" #pragma dxc diagnostic ignored "-Wambig-lit-shift"
#endif //__hlsl_dx_compiler #endif //__hlsl_dx_compiler
#include "ffx_core.h"
#include "../ffx_core.h"
#ifdef __hlsl_dx_compiler #ifdef __hlsl_dx_compiler
#pragma dxc diagnostic pop #pragma dxc diagnostic pop
#endif //__hlsl_dx_compiler #endif //__hlsl_dx_compiler
@ -44,7 +44,7 @@
#undef FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION #undef FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION
#endif #endif
#include "opticalflow/ffx_opticalflow_common.h"
#include "ffx_opticalflow_common.h"
#ifndef FFX_PREFER_WAVE64 #ifndef FFX_PREFER_WAVE64
#define FFX_PREFER_WAVE64 #define FFX_PREFER_WAVE64

2
Shaders/shaders/opticalflow/ffx_opticalflow_compute_luminance_pyramid.h

@ -91,7 +91,7 @@ FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFl
#endif #endif
// https://github.com/GPUOpen-Effects/FidelityFX-SPD/blob/master/docs/FidelityFX_SPD.pdf // https://github.com/GPUOpen-Effects/FidelityFX-SPD/blob/master/docs/FidelityFX_SPD.pdf
#include "spd/ffx_spd.h"
#include "../spd/ffx_spd.h"
void ComputeOpticalFlowInputPyramid(FfxInt32x2 iGroupId, FfxInt32 iLocalIndex) void ComputeOpticalFlowInputPyramid(FfxInt32x2 iGroupId, FfxInt32 iLocalIndex)
{ {

Loading…
Cancel
Save