From 1a3d77b2c0c6b57313f0dceaf5ecc3f8cb453497 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Fri, 18 Feb 2022 19:21:01 +0100 Subject: [PATCH] GS-hw: Fix d3d11 depth sample shader. Also adjust some comments to match updated shader names. --- bin/resources/shaders/dx11/tfx.fx | 6 +++--- bin/resources/shaders/opengl/tfx_fs.glsl | 4 ++-- bin/resources/shaders/vulkan/tfx.glsl | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/resources/shaders/dx11/tfx.fx b/bin/resources/shaders/dx11/tfx.fx index 521f025af7..e2c9cfebbc 100644 --- a/bin/resources/shaders/dx11/tfx.fx +++ b/bin/resources/shaders/dx11/tfx.fx @@ -390,7 +390,7 @@ float4 sample_depth(float2 st, float2 pos) } else if (PS_DEPTH_FMT == 1) { - // Based on ps_main11 of convert + // Based on ps_convert_float32_rgba8 of convert // Convert a FLOAT32 depth texture into a RGBA color texture uint d = uint(fetch_c(uv).r * exp2(32.0f)); @@ -398,11 +398,11 @@ float4 sample_depth(float2 st, float2 pos) } else if (PS_DEPTH_FMT == 2) { - // Based on ps_main12 of convert + // Based on ps_convert_float16_rgb5a1 of convert // Convert a FLOAT32 (only 16 lsb) depth into a RGB5A1 color texture uint d = uint(fetch_c(uv).r * exp2(32.0f)); - t = float4(uint4((d & 0x1Fu), ((d >> 5) & 0x1Fu), ((d >> 10) & 0x1Fu), (d >> 15) & 0x01u)); + t = float4(uint4((d & 0x1Fu), ((d >> 5) & 0x1Fu), ((d >> 10) & 0x1Fu), (d >> 15) & 0x01u)) * float4(8.0f, 8.0f, 8.0f, 128.0f); } else if (PS_DEPTH_FMT == 3) { diff --git a/bin/resources/shaders/opengl/tfx_fs.glsl b/bin/resources/shaders/opengl/tfx_fs.glsl index 6862fd4908..33695049a9 100644 --- a/bin/resources/shaders/opengl/tfx_fs.glsl +++ b/bin/resources/shaders/opengl/tfx_fs.glsl @@ -326,13 +326,13 @@ vec4 sample_depth(vec2 st) #elif PS_DEPTH_FMT == 1 - // Based on ps_main11 of convert + // Based on ps_convert_float32_rgba8 of convert // Convert a GL_FLOAT32 depth texture into a RGBA color texture uint d = uint(fetch_c(uv).r * exp2(32.0f)); t = vec4(uvec4((d & 0xFFu), ((d >> 8) & 0xFFu), ((d >> 16) & 0xFFu), (d >> 24))); #elif PS_DEPTH_FMT == 2 - // Based on ps_main12 of convert + // Based on ps_convert_float16_rgb5a1 of convert // Convert a GL_FLOAT32 (only 16 lsb) depth into a RGB5A1 color texture uint d = uint(fetch_c(uv).r * exp2(32.0f)); t = vec4(uvec4((d & 0x1Fu), ((d >> 5) & 0x1Fu), ((d >> 10) & 0x1Fu), (d >> 15) & 0x01u)) * vec4(8.0f, 8.0f, 8.0f, 128.0f); diff --git a/bin/resources/shaders/vulkan/tfx.glsl b/bin/resources/shaders/vulkan/tfx.glsl index 100b531c45..86156c0875 100644 --- a/bin/resources/shaders/vulkan/tfx.glsl +++ b/bin/resources/shaders/vulkan/tfx.glsl @@ -650,7 +650,7 @@ vec4 sample_depth(vec2 st, ivec2 pos) } #elif (PS_DEPTH_FMT == 1) { - // Based on ps_main11 of convert + // Based on ps_convert_float32_rgba8 of convert // Convert a vec32 depth texture into a RGBA color texture uint d = uint(fetch_c(uv).r * exp2(32.0f)); @@ -658,7 +658,7 @@ vec4 sample_depth(vec2 st, ivec2 pos) } #elif (PS_DEPTH_FMT == 2) { - // Based on ps_main12 of convert + // Based on ps_convert_float16_rgb5a1 of convert // Convert a vec32 (only 16 lsb) depth into a RGB5A1 color texture uint d = uint(fetch_c(uv).r * exp2(32.0f));