diff options
| author | 2021-11-22 00:00:01 +0100 | |
|---|---|---|
| committer | 2021-11-22 00:00:01 +0100 | |
| commit | 853284943901560081f6ff992b6c04b7c33f0d21 (patch) | |
| tree | 841c26186ab3c572851a612d2fc52407ab797d6f /src/video_core/host_shaders | |
| parent | VulkanTexturECache: Use reinterpret on D32_S8 formats. (diff) | |
| download | yuzu-853284943901560081f6ff992b6c04b7c33f0d21.tar.gz yuzu-853284943901560081f6ff992b6c04b7c33f0d21.tar.xz yuzu-853284943901560081f6ff992b6c04b7c33f0d21.zip | |
TextureCache: Simplify blitting of D24S8 formats and fix bugs.
Diffstat (limited to 'src/video_core/host_shaders')
5 files changed, 0 insertions, 104 deletions
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index 1c91999d7..fd3e41434 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt | |||
| @@ -11,13 +11,9 @@ set(SHADER_FILES | |||
| 11 | block_linear_unswizzle_2d.comp | 11 | block_linear_unswizzle_2d.comp |
| 12 | block_linear_unswizzle_3d.comp | 12 | block_linear_unswizzle_3d.comp |
| 13 | convert_abgr8_to_d24s8.frag | 13 | convert_abgr8_to_d24s8.frag |
| 14 | convert_b10g11r11_to_d24s8.frag | ||
| 15 | convert_d24s8_to_abgr8.frag | 14 | convert_d24s8_to_abgr8.frag |
| 16 | convert_d24s8_to_b10g11r11.frag | ||
| 17 | convert_d24s8_to_r16g16.frag | ||
| 18 | convert_depth_to_float.frag | 15 | convert_depth_to_float.frag |
| 19 | convert_float_to_depth.frag | 16 | convert_float_to_depth.frag |
| 20 | convert_r16g16_to_d24s8.frag | ||
| 21 | full_screen_triangle.vert | 17 | full_screen_triangle.vert |
| 22 | fxaa.frag | 18 | fxaa.frag |
| 23 | fxaa.vert | 19 | fxaa.vert |
diff --git a/src/video_core/host_shaders/convert_b10g11r11_to_d24s8.frag b/src/video_core/host_shaders/convert_b10g11r11_to_d24s8.frag deleted file mode 100644 index 11bdd861d..000000000 --- a/src/video_core/host_shaders/convert_b10g11r11_to_d24s8.frag +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #version 450 | ||
| 6 | #extension GL_ARB_shader_stencil_export : require | ||
| 7 | |||
| 8 | layout(binding = 0) uniform sampler2D color_texture; | ||
| 9 | |||
| 10 | uint conv_from_float(float value_f, uint mantissa_bits) { | ||
| 11 | uint value = floatBitsToInt(value_f); | ||
| 12 | uint exp = (value >> 23) & 0x1Fu; | ||
| 13 | uint mantissa_shift = 32u - mantissa_bits; | ||
| 14 | uint mantissa = (value << 9u) >> mantissa_shift; | ||
| 15 | return (exp << mantissa_bits) | mantissa; | ||
| 16 | } | ||
| 17 | |||
| 18 | void main() { | ||
| 19 | ivec2 coord = ivec2(gl_FragCoord.xy); | ||
| 20 | vec4 color = texelFetch(color_texture, coord, 0).rgba; | ||
| 21 | uint depth_stencil_unorm = (conv_from_float(color.r, 6u) << 21) | ||
| 22 | | (conv_from_float(color.g, 6u) << 10) | ||
| 23 | | conv_from_float(color.b, 5u); | ||
| 24 | |||
| 25 | gl_FragDepth = float(depth_stencil_unorm & 0x00FFFFFFu) / (exp2(24.0) - 1.0f); | ||
| 26 | gl_FragStencilRefARB = int(depth_stencil_unorm >> 24); | ||
| 27 | } | ||
diff --git a/src/video_core/host_shaders/convert_d24s8_to_b10g11r11.frag b/src/video_core/host_shaders/convert_d24s8_to_b10g11r11.frag deleted file mode 100644 index c2d935fcd..000000000 --- a/src/video_core/host_shaders/convert_d24s8_to_b10g11r11.frag +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #version 450 | ||
| 6 | |||
| 7 | layout(binding = 0) uniform sampler2D depth_tex; | ||
| 8 | layout(binding = 1) uniform isampler2D stencil_tex; | ||
| 9 | |||
| 10 | layout(location = 0) out vec4 color; | ||
| 11 | |||
| 12 | float conv_to_float(uint value, uint mantissa_bits) { | ||
| 13 | uint exp = (value >> mantissa_bits) & 0x1Fu; | ||
| 14 | uint mantissa_shift = 32u - mantissa_bits; | ||
| 15 | uint mantissa = (value << mantissa_shift) >> mantissa_shift; | ||
| 16 | return uintBitsToFloat((exp << 23) | (mantissa << (23 - mantissa_bits))); | ||
| 17 | } | ||
| 18 | |||
| 19 | void main() { | ||
| 20 | ivec2 coord = ivec2(gl_FragCoord.xy); | ||
| 21 | uint depth = uint(textureLod(depth_tex, coord, 0).r * (exp2(32.0) - 1.0f)); | ||
| 22 | uint stencil = uint(textureLod(stencil_tex, coord, 0).r); | ||
| 23 | uint depth_stencil = (stencil << 24) | (depth >> 8); | ||
| 24 | uint red_int = (depth_stencil >> 21) & 0x07FF; | ||
| 25 | uint green_int = (depth_stencil >> 10) & 0x07FF; | ||
| 26 | uint blue_int = depth_stencil & 0x03FF; | ||
| 27 | |||
| 28 | color.r = conv_to_float(red_int, 6u); | ||
| 29 | color.g = conv_to_float(green_int, 6u); | ||
| 30 | color.b = conv_to_float(blue_int, 5u); | ||
| 31 | color.a = 1.0f; | ||
| 32 | } | ||
diff --git a/src/video_core/host_shaders/convert_d24s8_to_r16g16.frag b/src/video_core/host_shaders/convert_d24s8_to_r16g16.frag deleted file mode 100644 index c48a7ac66..000000000 --- a/src/video_core/host_shaders/convert_d24s8_to_r16g16.frag +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #version 450 | ||
| 6 | |||
| 7 | layout(binding = 0) uniform sampler2D depth_tex; | ||
| 8 | layout(binding = 1) uniform isampler2D stencil_tex; | ||
| 9 | |||
| 10 | layout(location = 0) out vec4 color; | ||
| 11 | |||
| 12 | void main() { | ||
| 13 | ivec2 coord = ivec2(gl_FragCoord.xy); | ||
| 14 | uint depth = uint(textureLod(depth_tex, coord, 0).r * (exp2(32.0) - 1.0f)); | ||
| 15 | uint stencil = uint(textureLod(stencil_tex, coord, 0).r); | ||
| 16 | uint depth_stencil = (stencil << 24) | (depth >> 8); | ||
| 17 | |||
| 18 | color.r = float(depth_stencil & 0x0000FFFFu) / (exp2(16) - 1.0); | ||
| 19 | color.g = float(depth_stencil >> 16) / (exp2(16) - 1.0); | ||
| 20 | color.b = 0.0f; | ||
| 21 | color.a = 1.0f; | ||
| 22 | } | ||
diff --git a/src/video_core/host_shaders/convert_r16g16_to_d24s8.frag b/src/video_core/host_shaders/convert_r16g16_to_d24s8.frag deleted file mode 100644 index beb2d1284..000000000 --- a/src/video_core/host_shaders/convert_r16g16_to_d24s8.frag +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | // Copyright 2021 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #version 450 | ||
| 6 | #extension GL_ARB_shader_stencil_export : require | ||
| 7 | |||
| 8 | layout(binding = 0) uniform sampler2D color_texture; | ||
| 9 | |||
| 10 | void main() { | ||
| 11 | ivec2 coord = ivec2(gl_FragCoord.xy); | ||
| 12 | vec4 color = texelFetch(color_texture, coord, 0).rgba; | ||
| 13 | uvec2 bytes = uvec2(color.rg * (exp2(16) - 1.0f)) << uvec2(0, 16); | ||
| 14 | uint depth_stencil_unorm = | ||
| 15 | uint(color.r * (exp2(16) - 1.0f)) | (uint(color.g * (exp2(16) - 1.0f)) << 16); | ||
| 16 | |||
| 17 | gl_FragDepth = float(depth_stencil_unorm & 0x00FFFFFFu) / (exp2(24.0) - 1.0f); | ||
| 18 | gl_FragStencilRefARB = int(depth_stencil_unorm >> 24); | ||
| 19 | } | ||