summaryrefslogtreecommitdiffstats
path: root/src/video_core/host_shaders/vulkan_present.vert
blob: 249c9675a243e229fb0ced238ac31e791ba3a4b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#version 460 core

layout (location = 0) out vec2 frag_tex_coord;

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() {
    ScreenRectVertex vertex = GetVertex(gl_VertexIndex);
    gl_Position = modelview_matrix * vec4(vertex.position, 0.0, 1.0);
    frag_tex_coord = vertex.tex_coord;
}