diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-10-18 15:22:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 15:22:14 +0200 |
commit | c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8 (patch) | |
tree | 8b06b4ea8a82f73ae546c288b995a8fc629f7ec3 /src/video_core/host_shaders | |
parent | Merge pull request #11791 from german77/bufferx (diff) | |
parent | Changes based on hardware tests (diff) | |
download | yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar.gz yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar.bz2 yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar.lz yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar.xz yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar.zst yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.zip |
Diffstat (limited to 'src/video_core/host_shaders')
-rw-r--r-- | src/video_core/host_shaders/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/video_core/host_shaders/convert_abgr8_to_d32f.frag | 15 | ||||
-rw-r--r-- | src/video_core/host_shaders/convert_d32f_to_abgr8.frag | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index 8bb429578..cd2549232 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt @@ -19,6 +19,7 @@ set(SHADER_FILES block_linear_unswizzle_2d.comp block_linear_unswizzle_3d.comp convert_abgr8_to_d24s8.frag + convert_abgr8_to_d32f.frag convert_d32f_to_abgr8.frag convert_d24s8_to_abgr8.frag convert_depth_to_float.frag diff --git a/src/video_core/host_shaders/convert_abgr8_to_d32f.frag b/src/video_core/host_shaders/convert_abgr8_to_d32f.frag new file mode 100644 index 000000000..095b910c2 --- /dev/null +++ b/src/video_core/host_shaders/convert_abgr8_to_d32f.frag @@ -0,0 +1,15 @@ +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#version 450 + +layout(binding = 0) uniform sampler2D color_texture; + +void main() { + ivec2 coord = ivec2(gl_FragCoord.xy); + vec4 color = texelFetch(color_texture, coord, 0).abgr; + + float value = color.a * (color.r + color.g + color.b) / 3.0f; + + gl_FragDepth = value; +} diff --git a/src/video_core/host_shaders/convert_d32f_to_abgr8.frag b/src/video_core/host_shaders/convert_d32f_to_abgr8.frag index 04cfef8b5..4e5a9f955 100644 --- a/src/video_core/host_shaders/convert_d32f_to_abgr8.frag +++ b/src/video_core/host_shaders/convert_d32f_to_abgr8.frag @@ -9,6 +9,6 @@ layout(location = 0) out vec4 color; void main() { ivec2 coord = ivec2(gl_FragCoord.xy); - float depth = textureLod(depth_tex, coord, 0).r; + float depth = texelFetch(depth_tex, coord, 0).r; color = vec4(depth, depth, depth, 1.0); } |