summaryrefslogtreecommitdiff
path: root/src/video_core/host_shaders
diff options
context:
space:
mode:
authorGravatar liamwhite2023-10-18 09:22:14 -0400
committerGravatar GitHub2023-10-18 09:22:14 -0400
commitc5f1ec8040f951f35d0d965c26fe3c953d2a8cc8 (patch)
tree8b06b4ea8a82f73ae546c288b995a8fc629f7ec3 /src/video_core/host_shaders
parentMerge pull request #11791 from german77/bufferx (diff)
parentChanges based on hardware tests (diff)
downloadyuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar.gz
yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.tar.xz
yuzu-c5f1ec8040f951f35d0d965c26fe3c953d2a8cc8.zip
Merge pull request #11795 from Squall-Leonhart/D32FToOther
[Vulkan]Implement missing copy formats for D32, ARGB8_SRGB and BGRA8_Unorm/SRGB
Diffstat (limited to 'src/video_core/host_shaders')
-rw-r--r--src/video_core/host_shaders/CMakeLists.txt1
-rw-r--r--src/video_core/host_shaders/convert_abgr8_to_d32f.frag15
-rw-r--r--src/video_core/host_shaders/convert_d32f_to_abgr8.frag2
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
19 block_linear_unswizzle_2d.comp 19 block_linear_unswizzle_2d.comp
20 block_linear_unswizzle_3d.comp 20 block_linear_unswizzle_3d.comp
21 convert_abgr8_to_d24s8.frag 21 convert_abgr8_to_d24s8.frag
22 convert_abgr8_to_d32f.frag
22 convert_d32f_to_abgr8.frag 23 convert_d32f_to_abgr8.frag
23 convert_d24s8_to_abgr8.frag 24 convert_d24s8_to_abgr8.frag
24 convert_depth_to_float.frag 25 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 @@
1// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#version 450
5
6layout(binding = 0) uniform sampler2D color_texture;
7
8void main() {
9 ivec2 coord = ivec2(gl_FragCoord.xy);
10 vec4 color = texelFetch(color_texture, coord, 0).abgr;
11
12 float value = color.a * (color.r + color.g + color.b) / 3.0f;
13
14 gl_FragDepth = value;
15}
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;
9 9
10void main() { 10void main() {
11 ivec2 coord = ivec2(gl_FragCoord.xy); 11 ivec2 coord = ivec2(gl_FragCoord.xy);
12 float depth = textureLod(depth_tex, coord, 0).r; 12 float depth = texelFetch(depth_tex, coord, 0).r;
13 color = vec4(depth, depth, depth, 1.0); 13 color = vec4(depth, depth, depth, 1.0);
14} 14}