diff options
author | Liam <byteslice@airmail.cc> | 2024-01-18 17:44:13 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-31 17:27:21 +0100 |
commit | 9bdf09bd768f73073e9d1cbc65febfd7f7955db3 (patch) | |
tree | 7d29d4c4f61f4c0272056af2370a2c75a769f7d6 /src/video_core/host_shaders/vulkan_present.vert | |
parent | renderer_opengl: split up blit screen resources into antialias and window adapt passes (diff) | |
download | yuzu-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 '')
-rw-r--r-- | src/video_core/host_shaders/vulkan_present.vert | 33 |
1 files changed, 27 insertions, 6 deletions
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; } |