diff options
author | Fernando S <fsahmkow27@gmail.com> | 2021-11-28 12:16:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-28 12:16:31 +0100 |
commit | 3031223153d2b11d089acf5c50718372b5c24b6b (patch) | |
tree | cc459170f6a363e3e25a9bcf9d95316ec66093f7 /src/video_core/host_shaders/convert_abgr8_to_d24s8.frag | |
parent | Merge pull request #7438 from german77/homebrew2 (diff) | |
parent | Texture Cache: Secure insertions against deletions. (diff) | |
download | yuzu-3031223153d2b11d089acf5c50718372b5c24b6b.tar yuzu-3031223153d2b11d089acf5c50718372b5c24b6b.tar.gz yuzu-3031223153d2b11d089acf5c50718372b5c24b6b.tar.bz2 yuzu-3031223153d2b11d089acf5c50718372b5c24b6b.tar.lz yuzu-3031223153d2b11d089acf5c50718372b5c24b6b.tar.xz yuzu-3031223153d2b11d089acf5c50718372b5c24b6b.tar.zst yuzu-3031223153d2b11d089acf5c50718372b5c24b6b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/host_shaders/convert_abgr8_to_d24s8.frag | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/video_core/host_shaders/convert_abgr8_to_d24s8.frag b/src/video_core/host_shaders/convert_abgr8_to_d24s8.frag index 4e4ab6a26..ea055ddad 100644 --- a/src/video_core/host_shaders/convert_abgr8_to_d24s8.frag +++ b/src/video_core/host_shaders/convert_abgr8_to_d24s8.frag @@ -9,9 +9,10 @@ layout(binding = 0) uniform sampler2D color_texture; void main() { ivec2 coord = ivec2(gl_FragCoord.xy); - uvec4 color = uvec4(texelFetch(color_texture, coord, 0).rgba * (exp2(8) - 1.0f)); - uint depth_unorm = (color.r << 16) | (color.g << 8) | color.b; + uvec4 color = uvec4(texelFetch(color_texture, coord, 0).abgr * (exp2(8) - 1.0f)); + uvec4 bytes = color << uvec4(24, 16, 8, 0); + uint depth_stencil_unorm = bytes.x | bytes.y | bytes.z | bytes.w; - gl_FragDepth = float(depth_unorm) / (exp2(24.0) - 1.0f); - gl_FragStencilRefARB = int(color.a); + gl_FragDepth = float(depth_stencil_unorm & 0x00FFFFFFu) / (exp2(24.0) - 1.0f); + gl_FragStencilRefARB = int(depth_stencil_unorm >> 24); } |