summaryrefslogtreecommitdiffstats
path: root/src/video_core/host_shaders/opengl_present.vert
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-08-27 04:57:39 +0200
committerGitHub <noreply@github.com>2020-08-27 04:57:39 +0200
commit1bb8c27a70657eb36cc6b4860f9285cbff736a00 (patch)
tree5fbdf8680a0fe31b95c1f6be00fdb5548086011e /src/video_core/host_shaders/opengl_present.vert
parentMerge pull request #4555 from ReinUsesLisp/fix-primitive-topology (diff)
parentvideo_core/host_shaders: Add CMake integration for string shaders (diff)
downloadyuzu-1bb8c27a70657eb36cc6b4860f9285cbff736a00.tar
yuzu-1bb8c27a70657eb36cc6b4860f9285cbff736a00.tar.gz
yuzu-1bb8c27a70657eb36cc6b4860f9285cbff736a00.tar.bz2
yuzu-1bb8c27a70657eb36cc6b4860f9285cbff736a00.tar.lz
yuzu-1bb8c27a70657eb36cc6b4860f9285cbff736a00.tar.xz
yuzu-1bb8c27a70657eb36cc6b4860f9285cbff736a00.tar.zst
yuzu-1bb8c27a70657eb36cc6b4860f9285cbff736a00.zip
Diffstat (limited to 'src/video_core/host_shaders/opengl_present.vert')
-rw-r--r--src/video_core/host_shaders/opengl_present.vert24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/video_core/host_shaders/opengl_present.vert b/src/video_core/host_shaders/opengl_present.vert
new file mode 100644
index 000000000..2235d31a4
--- /dev/null
+++ b/src/video_core/host_shaders/opengl_present.vert
@@ -0,0 +1,24 @@
+#version 430 core
+
+out gl_PerVertex {
+ vec4 gl_Position;
+};
+
+layout (location = 0) in vec2 vert_position;
+layout (location = 1) in vec2 vert_tex_coord;
+layout (location = 0) out vec2 frag_tex_coord;
+
+// This is a truncated 3x3 matrix for 2D transformations:
+// The upper-left 2x2 submatrix performs scaling/rotation/mirroring.
+// The third column performs translation.
+// The third row could be used for projection, which we don't need in 2D. It hence is assumed to
+// implicitly be [0, 0, 1]
+layout (location = 0) uniform mat3x2 modelview_matrix;
+
+void main() {
+ // Multiply input position by the rotscale part of the matrix and then manually translate by
+ // the last column. This is equivalent to using a full 3x3 matrix and expanding the vector
+ // to `vec3(vert_position.xy, 1.0)`
+ gl_Position = vec4(mat2(modelview_matrix) * vert_position + modelview_matrix[2], 0.0, 1.0);
+ frag_tex_coord = vert_tex_coord;
+}