summaryrefslogtreecommitdiff
path: root/src/video_core/host_shaders
diff options
context:
space:
mode:
authorGravatar Liam2024-01-18 11:44:13 -0500
committerGravatar Liam2024-01-31 11:27:21 -0500
commit9bdf09bd768f73073e9d1cbc65febfd7f7955db3 (patch)
tree7d29d4c4f61f4c0272056af2370a2c75a769f7d6 /src/video_core/host_shaders
parentrenderer_opengl: split up blit screen resources into antialias and window ada... (diff)
downloadyuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar.gz
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar.xz
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.zip
renderer_vulkan: implement layer stack composition
Diffstat (limited to 'src/video_core/host_shaders')
-rw-r--r--src/video_core/host_shaders/opengl_present_scaleforce.frag12
-rw-r--r--src/video_core/host_shaders/present_bicubic.frag12
-rw-r--r--src/video_core/host_shaders/present_gaussian.frag12
-rw-r--r--src/video_core/host_shaders/vulkan_present.frag2
-rw-r--r--src/video_core/host_shaders/vulkan_present.vert33
-rw-r--r--src/video_core/host_shaders/vulkan_present_scaleforce_fp16.frag1
-rw-r--r--src/video_core/host_shaders/vulkan_present_scaleforce_fp32.frag2
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
39layout (location = 0) in vec2 tex_coord; 29layout (location = 0) in vec2 tex_coord;
40 30
41layout (location = 0) out vec4 frag_color; 31layout (location = 0) out vec4 frag_color;
42 32
43layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture; 33layout (binding = 0) uniform sampler2D input_texture;
44 34
45const bool ignore_alpha = true; 35const 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
17layout (location = 0) in vec2 frag_tex_coord; 7layout (location = 0) in vec2 frag_tex_coord;
18 8
19layout (location = 0) out vec4 color; 9layout (location = 0) out vec4 color;
20 10
21layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D color_texture; 11layout (binding = 0) uniform sampler2D color_texture;
22 12
23vec4 cubic(float v) { 13vec4 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
20layout(location = 0) in vec2 frag_tex_coord; 10layout(location = 0) in vec2 frag_tex_coord;
21 11
22layout(location = 0) out vec4 color; 12layout(location = 0) out vec4 color;
23 13
24layout(binding = BINDING_COLOR_TEXTURE) uniform sampler2D color_texture; 14layout(binding = 0) uniform sampler2D color_texture;
25 15
26const float offset[3] = float[](0.0, 1.3846153846, 3.2307692308); 16const float offset[3] = float[](0.0, 1.3846153846, 3.2307692308);
27const float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); 17const 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
8layout (location = 0) out vec4 color; 8layout (location = 0) out vec4 color;
9 9
10layout (binding = 1) uniform sampler2D color_texture; 10layout (binding = 0) uniform sampler2D color_texture;
11 11
12void main() { 12void 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
6layout (location = 0) in vec2 vert_position;
7layout (location = 1) in vec2 vert_tex_coord;
8
9layout (location = 0) out vec2 frag_tex_coord; 6layout (location = 0) out vec2 frag_tex_coord;
10 7
11layout (set = 0, binding = 0) uniform MatrixBlock { 8struct ScreenRectVertex {
9 vec2 position;
10 vec2 tex_coord;
11};
12
13layout (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.
21ScreenRectVertex 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
15void main() { 35void 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"