summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/host_shaders/CMakeLists.txt1
-rw-r--r--src/video_core/host_shaders/full_screen_triangle.vert29
2 files changed, 30 insertions, 0 deletions
diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt
index 1983e7dc9..5770c4761 100644
--- a/src/video_core/host_shaders/CMakeLists.txt
+++ b/src/video_core/host_shaders/CMakeLists.txt
@@ -1,6 +1,7 @@
1set(SHADER_FILES 1set(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 full_screen_triangle.vert
4 opengl_present.frag 5 opengl_present.frag
5 opengl_present.vert 6 opengl_present.vert
6 pitch_unswizzle.comp 7 pitch_unswizzle.comp
diff --git a/src/video_core/host_shaders/full_screen_triangle.vert b/src/video_core/host_shaders/full_screen_triangle.vert
new file mode 100644
index 000000000..452ad6502
--- /dev/null
+++ b/src/video_core/host_shaders/full_screen_triangle.vert
@@ -0,0 +1,29 @@
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#ifdef VULKAN
8#define BEGIN_PUSH_CONSTANTS layout(push_constant) uniform PushConstants {
9#define END_PUSH_CONSTANTS };
10#define UNIFORM(n)
11#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
12#define BEGIN_PUSH_CONSTANTS
13#define END_PUSH_CONSTANTS
14#define UNIFORM(n) layout (location = n) uniform
15#endif
16
17BEGIN_PUSH_CONSTANTS
18UNIFORM(0) vec2 tex_scale;
19UNIFORM(1) vec2 tex_offset;
20END_PUSH_CONSTANTS
21
22layout(location = 0) out vec2 texcoord;
23
24void main() {
25 float x = float((gl_VertexIndex & 1) << 2);
26 float y = float((gl_VertexIndex & 2) << 1);
27 gl_Position = vec4(x - 1.0, y - 1.0, 0.0, 1.0);
28 texcoord = fma(vec2(x, y) / 2.0, tex_scale, tex_offset);
29}