From ed566a8beb8a8e16a04d9adfeb9e4794072af161 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sun, 22 Dec 2024 12:58:30 +0100 Subject: [PATCH] Empirically determined the best setup for motion vectors in OpenGL, though it still doesn't make a whole lot of sense. Added opt-in debug symbols line to the upscale shaders to make analysis easier. --- .../Upscaling/SGSR2/Shaders/2_pass_cs/sgsr2_upscale.compute | 1 + .../Upscaling/SGSR2/Shaders/3_pass_cs/sgsr2_upscale.compute | 1 + .../Runtime/Effects/Upscaling/SGSR2/Shaders/sgsr2_birp.hlsl | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/2_pass_cs/sgsr2_upscale.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/2_pass_cs/sgsr2_upscale.compute index b84cf7f..a73bdf1 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/2_pass_cs/sgsr2_upscale.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/2_pass_cs/sgsr2_upscale.compute @@ -1,4 +1,5 @@ #pragma kernel CS +//#pragma enable_d3d11_debug_symbols #include "../sgsr2_birp.hlsl" #include "../sgsr2_common.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/3_pass_cs/sgsr2_upscale.compute b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/3_pass_cs/sgsr2_upscale.compute index 8c87124..d96307d 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/3_pass_cs/sgsr2_upscale.compute +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/3_pass_cs/sgsr2_upscale.compute @@ -1,4 +1,5 @@ #pragma kernel CS +//#pragma enable_d3d11_debug_symbols #include "../sgsr2_birp.hlsl" #include "../sgsr2_common.hlsl" diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/sgsr2_birp.hlsl b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/sgsr2_birp.hlsl index 9c7711f..19823cd 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/sgsr2_birp.hlsl +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/sgsr2_birp.hlsl @@ -22,5 +22,9 @@ SamplerState s_LinearClamp : register(s1); inline float2 decodeVelocityFromTexture(float2 ev) { // Nothing much to do, motion vectors are not encoded +#if UNITY_UV_STARTS_AT_TOP return -ev; +#else + return ev; +#endif }