summaryrefslogtreecommitdiffstats
path: root/src/video_core/host_shaders
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-01-18 17:44:13 +0100
committerLiam <byteslice@airmail.cc>2024-01-31 17:27:21 +0100
commit9bdf09bd768f73073e9d1cbc65febfd7f7955db3 (patch)
tree7d29d4c4f61f4c0272056af2370a2c75a769f7d6 /src/video_core/host_shaders
parentrenderer_opengl: split up blit screen resources into antialias and window adapt passes (diff)
downloadyuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar.gz
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar.bz2
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar.lz
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar.xz
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.tar.zst
yuzu-9bdf09bd768f73073e9d1cbc65febfd7f7955db3.zip
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 @@
#endif
-#ifdef VULKAN
-
-#define BINDING_COLOR_TEXTURE 1
-
-#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
-
-#define BINDING_COLOR_TEXTURE 0
-
-#endif
-
layout (location = 0) in vec2 tex_coord;
layout (location = 0) out vec4 frag_color;
-layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
+layout (binding = 0) uniform sampler2D input_texture;
const bool ignore_alpha = true;
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 @@
#version 460 core
-#ifdef VULKAN
-
-#define BINDING_COLOR_TEXTURE 1
-
-#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
-
-#define BINDING_COLOR_TEXTURE 0
-
-#endif
-
layout (location = 0) in vec2 frag_tex_coord;
layout (location = 0) out vec4 color;
-layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D color_texture;
+layout (binding = 0) uniform sampler2D color_texture;
vec4 cubic(float v) {
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 @@
#version 460 core
-#ifdef VULKAN
-
-#define BINDING_COLOR_TEXTURE 1
-
-#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
-
-#define BINDING_COLOR_TEXTURE 0
-
-#endif
-
layout(location = 0) in vec2 frag_tex_coord;
layout(location = 0) out vec4 color;
-layout(binding = BINDING_COLOR_TEXTURE) uniform sampler2D color_texture;
+layout(binding = 0) uniform sampler2D color_texture;
const float offset[3] = float[](0.0, 1.3846153846, 3.2307692308);
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;
layout (location = 0) out vec4 color;
-layout (binding = 1) uniform sampler2D color_texture;
+layout (binding = 0) uniform sampler2D color_texture;
void main() {
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 @@
#version 460 core
-layout (location = 0) in vec2 vert_position;
-layout (location = 1) in vec2 vert_tex_coord;
-
layout (location = 0) out vec2 frag_tex_coord;
-layout (set = 0, binding = 0) uniform MatrixBlock {
+struct ScreenRectVertex {
+ vec2 position;
+ vec2 tex_coord;
+};
+
+layout (push_constant) uniform PushConstants {
mat4 modelview_matrix;
+ ScreenRectVertex vertices[4];
};
+// Vulkan spec 15.8.1:
+// Any member of a push constant block that is declared as an
+// array must only be accessed with dynamically uniform indices.
+ScreenRectVertex GetVertex(int index) {
+ switch (index) {
+ case 0:
+ default:
+ return vertices[0];
+ case 1:
+ return vertices[1];
+ case 2:
+ return vertices[2];
+ case 3:
+ return vertices[3];
+ }
+}
+
void main() {
- gl_Position = modelview_matrix * vec4(vert_position, 0.0, 1.0);
- frag_tex_coord = vert_tex_coord;
+ ScreenRectVertex vertex = GetVertex(gl_VertexIndex);
+ gl_Position = modelview_matrix * vec4(vertex.position, 0.0, 1.0);
+ frag_tex_coord = vertex.tex_coord;
}
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 @@
#extension GL_GOOGLE_include_directive : enable
+#define VERSION 1
#define YUZU_USE_FP16
#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 @@
#extension GL_GOOGLE_include_directive : enable
+#define VERSION 1
+
#include "opengl_present_scaleforce.frag"