blob: c0e6e85372c9a3689f8e7a72f61924397ce8245e (
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
|
// 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) {
if (index < 1) {
return vertices[0];
} else if (index < 2) {
return vertices[1];
} else if (index < 3) {
return vertices[2];
} else {
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;
}
|