diff options
Diffstat (limited to 'src/video_core/host_shaders')
7 files changed, 34 insertions, 40 deletions
diff --git a/src/video_core/host_shaders/opengl_present_scaleforce.frag b/src/video_core/host_shaders/opengl_present_scaleforce.frag index a780373e3..1598575a1 100644 --- a/src/video_core/host_shaders/opengl_present_scaleforce.frag +++ b/src/video_core/host_shaders/opengl_present_scaleforce.frag | |||
| @@ -26,21 +26,11 @@ | |||
| 26 | 26 | ||
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | #ifdef VULKAN | ||
| 30 | |||
| 31 | #define BINDING_COLOR_TEXTURE 1 | ||
| 32 | |||
| 33 | #else // ^^^ Vulkan ^^^ // vvv OpenGL vvv | ||
| 34 | |||
| 35 | #define BINDING_COLOR_TEXTURE 0 | ||
| 36 | |||
| 37 | #endif | ||
| 38 | |||
| 39 | layout (location = 0) in vec2 tex_coord; | 29 | layout (location = 0) in vec2 tex_coord; |
| 40 | 30 | ||
| 41 | layout (location = 0) out vec4 frag_color; | 31 | layout (location = 0) out vec4 frag_color; |
| 42 | 32 | ||
| 43 | layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture; | 33 | layout (binding = 0) uniform sampler2D input_texture; |
| 44 | 34 | ||
| 45 | const bool ignore_alpha = true; | 35 | const bool ignore_alpha = true; |
| 46 | 36 | ||
diff --git a/src/video_core/host_shaders/present_bicubic.frag b/src/video_core/host_shaders/present_bicubic.frag index c57dd2851..c814629cf 100644 --- a/src/video_core/host_shaders/present_bicubic.frag +++ b/src/video_core/host_shaders/present_bicubic.frag | |||
| @@ -3,22 +3,12 @@ | |||
| 3 | 3 | ||
| 4 | #version 460 core | 4 | #version 460 core |
| 5 | 5 | ||
| 6 | #ifdef VULKAN | ||
| 7 | |||
| 8 | #define BINDING_COLOR_TEXTURE 1 | ||
| 9 | |||
| 10 | #else // ^^^ Vulkan ^^^ // vvv OpenGL vvv | ||
| 11 | |||
| 12 | #define BINDING_COLOR_TEXTURE 0 | ||
| 13 | |||
| 14 | #endif | ||
| 15 | |||
| 16 | 6 | ||
| 17 | layout (location = 0) in vec2 frag_tex_coord; | 7 | layout (location = 0) in vec2 frag_tex_coord; |
| 18 | 8 | ||
| 19 | layout (location = 0) out vec4 color; | 9 | layout (location = 0) out vec4 color; |
| 20 | 10 | ||
| 21 | layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D color_texture; | 11 | layout (binding = 0) uniform sampler2D color_texture; |
| 22 | 12 | ||
| 23 | vec4 cubic(float v) { | 13 | vec4 cubic(float v) { |
| 24 | vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v; | 14 | vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v; |
diff --git a/src/video_core/host_shaders/present_gaussian.frag b/src/video_core/host_shaders/present_gaussian.frag index 5f54b71b6..ad9bb76a4 100644 --- a/src/video_core/host_shaders/present_gaussian.frag +++ b/src/video_core/host_shaders/present_gaussian.frag | |||
| @@ -7,21 +7,11 @@ | |||
| 7 | 7 | ||
| 8 | #version 460 core | 8 | #version 460 core |
| 9 | 9 | ||
| 10 | #ifdef VULKAN | ||
| 11 | |||
| 12 | #define BINDING_COLOR_TEXTURE 1 | ||
| 13 | |||
| 14 | #else // ^^^ Vulkan ^^^ // vvv OpenGL vvv | ||
| 15 | |||
| 16 | #define BINDING_COLOR_TEXTURE 0 | ||
| 17 | |||
| 18 | #endif | ||
| 19 | |||
| 20 | layout(location = 0) in vec2 frag_tex_coord; | 10 | layout(location = 0) in vec2 frag_tex_coord; |
| 21 | 11 | ||
| 22 | layout(location = 0) out vec4 color; | 12 | layout(location = 0) out vec4 color; |
| 23 | 13 | ||
| 24 | layout(binding = BINDING_COLOR_TEXTURE) uniform sampler2D color_texture; | 14 | layout(binding = 0) uniform sampler2D color_texture; |
| 25 | 15 | ||
| 26 | const float offset[3] = float[](0.0, 1.3846153846, 3.2307692308); | 16 | const float offset[3] = float[](0.0, 1.3846153846, 3.2307692308); |
| 27 | const float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); | 17 | const float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); |
diff --git a/src/video_core/host_shaders/vulkan_present.frag b/src/video_core/host_shaders/vulkan_present.frag index 97e098ced..adada9411 100644 --- a/src/video_core/host_shaders/vulkan_present.frag +++ b/src/video_core/host_shaders/vulkan_present.frag | |||
| @@ -7,7 +7,7 @@ layout (location = 0) in vec2 frag_tex_coord; | |||
| 7 | 7 | ||
| 8 | layout (location = 0) out vec4 color; | 8 | layout (location = 0) out vec4 color; |
| 9 | 9 | ||
| 10 | layout (binding = 1) uniform sampler2D color_texture; | 10 | layout (binding = 0) uniform sampler2D color_texture; |
| 11 | 11 | ||
| 12 | void main() { | 12 | void main() { |
| 13 | color = texture(color_texture, frag_tex_coord); | 13 | color = texture(color_texture, frag_tex_coord); |
diff --git a/src/video_core/host_shaders/vulkan_present.vert b/src/video_core/host_shaders/vulkan_present.vert index 89dc80468..249c9675a 100644 --- a/src/video_core/host_shaders/vulkan_present.vert +++ b/src/video_core/host_shaders/vulkan_present.vert | |||
| @@ -3,16 +3,37 @@ | |||
| 3 | 3 | ||
| 4 | #version 460 core | 4 | #version 460 core |
| 5 | 5 | ||
| 6 | layout (location = 0) in vec2 vert_position; | ||
| 7 | layout (location = 1) in vec2 vert_tex_coord; | ||
| 8 | |||
| 9 | layout (location = 0) out vec2 frag_tex_coord; | 6 | layout (location = 0) out vec2 frag_tex_coord; |
| 10 | 7 | ||
| 11 | layout (set = 0, binding = 0) uniform MatrixBlock { | 8 | struct ScreenRectVertex { |
| 9 | vec2 position; | ||
| 10 | vec2 tex_coord; | ||
| 11 | }; | ||
| 12 | |||
| 13 | layout (push_constant) uniform PushConstants { | ||
| 12 | mat4 modelview_matrix; | 14 | mat4 modelview_matrix; |
| 15 | ScreenRectVertex vertices[4]; | ||
| 13 | }; | 16 | }; |
| 14 | 17 | ||
| 18 | // Vulkan spec 15.8.1: | ||
| 19 | // Any member of a push constant block that is declared as an | ||
| 20 | // array must only be accessed with dynamically uniform indices. | ||
| 21 | ScreenRectVertex GetVertex(int index) { | ||
| 22 | switch (index) { | ||
| 23 | case 0: | ||
| 24 | default: | ||
| 25 | return vertices[0]; | ||
| 26 | case 1: | ||
| 27 | return vertices[1]; | ||
| 28 | case 2: | ||
| 29 | return vertices[2]; | ||
| 30 | case 3: | ||
| 31 | return vertices[3]; | ||
| 32 | } | ||
| 33 | } | ||
| 34 | |||
| 15 | void main() { | 35 | void main() { |
| 16 | gl_Position = modelview_matrix * vec4(vert_position, 0.0, 1.0); | 36 | ScreenRectVertex vertex = GetVertex(gl_VertexIndex); |
| 17 | frag_tex_coord = vert_tex_coord; | 37 | gl_Position = modelview_matrix * vec4(vertex.position, 0.0, 1.0); |
| 38 | frag_tex_coord = vertex.tex_coord; | ||
| 18 | } | 39 | } |
diff --git a/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag b/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag index 3dc9c0df5..79ea817c2 100644 --- a/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag +++ b/src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #extension GL_GOOGLE_include_directive : enable | 6 | #extension GL_GOOGLE_include_directive : enable |
| 7 | 7 | ||
| 8 | #define VERSION 1 | ||
| 8 | #define YUZU_USE_FP16 | 9 | #define YUZU_USE_FP16 |
| 9 | 10 | ||
| 10 | #include "opengl_present_scaleforce.frag" | 11 | #include "opengl_present_scaleforce.frag" |
diff --git a/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag b/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag index 77ed07552..9605bb58b 100644 --- a/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag +++ b/src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag | |||
| @@ -5,4 +5,6 @@ | |||
| 5 | 5 | ||
| 6 | #extension GL_GOOGLE_include_directive : enable | 6 | #extension GL_GOOGLE_include_directive : enable |
| 7 | 7 | ||
| 8 | #define VERSION 1 | ||
| 9 | |||
| 8 | #include "opengl_present_scaleforce.frag" | 10 | #include "opengl_present_scaleforce.frag" |