diff options
| -rw-r--r-- | src/video_core/host_shaders/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/video_core/host_shaders/convert_depth_to_float.frag | 13 | ||||
| -rw-r--r-- | src/video_core/host_shaders/convert_float_to_depth.frag | 13 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index 338bf9eec..faf298f1c 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | set(SHADER_FILES | 1 | set(SHADER_FILES |
| 2 | block_linear_unswizzle_2d.comp | 2 | block_linear_unswizzle_2d.comp |
| 3 | block_linear_unswizzle_3d.comp | 3 | block_linear_unswizzle_3d.comp |
| 4 | convert_depth_to_float.frag | ||
| 5 | convert_float_to_depth.frag | ||
| 4 | full_screen_triangle.vert | 6 | full_screen_triangle.vert |
| 5 | opengl_copy_bc4.comp | 7 | opengl_copy_bc4.comp |
| 6 | opengl_present.frag | 8 | opengl_present.frag |
diff --git a/src/video_core/host_shaders/convert_depth_to_float.frag b/src/video_core/host_shaders/convert_depth_to_float.frag new file mode 100644 index 000000000..624c58509 --- /dev/null +++ b/src/video_core/host_shaders/convert_depth_to_float.frag | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | // Copyright 2020 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_texture; | ||
| 8 | layout(location = 0) out float output_color; | ||
| 9 | |||
| 10 | void main() { | ||
| 11 | ivec2 coord = ivec2(gl_FragCoord.xy); | ||
| 12 | output_color = texelFetch(depth_texture, coord, 0).r; | ||
| 13 | } | ||
diff --git a/src/video_core/host_shaders/convert_float_to_depth.frag b/src/video_core/host_shaders/convert_float_to_depth.frag new file mode 100644 index 000000000..d86c795f4 --- /dev/null +++ b/src/video_core/host_shaders/convert_float_to_depth.frag | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | // Copyright 2020 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 color_texture; | ||
| 8 | |||
| 9 | void main() { | ||
| 10 | ivec2 coord = ivec2(gl_FragCoord.xy); | ||
| 11 | float color = texelFetch(color_texture, coord, 0).r; | ||
| 12 | gl_FragDepth = color; | ||
| 13 | } | ||