vulkan_present.vert 945 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #version 460 core
  4. layout (location = 0) out vec2 frag_tex_coord;
  5. struct ScreenRectVertex {
  6. vec2 position;
  7. vec2 tex_coord;
  8. };
  9. layout (push_constant) uniform PushConstants {
  10. mat4 modelview_matrix;
  11. ScreenRectVertex vertices[4];
  12. };
  13. // Vulkan spec 15.8.1:
  14. // Any member of a push constant block that is declared as an
  15. // array must only be accessed with dynamically uniform indices.
  16. ScreenRectVertex GetVertex(int index) {
  17. if (index < 1) {
  18. return vertices[0];
  19. } else if (index < 2) {
  20. return vertices[1];
  21. } else if (index < 3) {
  22. return vertices[2];
  23. } else {
  24. return vertices[3];
  25. }
  26. }
  27. void main() {
  28. ScreenRectVertex vertex = GetVertex(gl_VertexIndex);
  29. gl_Position = modelview_matrix * vec4(vertex.position, 0.0, 1.0);
  30. frag_tex_coord = vertex.tex_coord;
  31. }