fxaa.vert 851 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #version 460
  4. out gl_PerVertex {
  5. vec4 gl_Position;
  6. };
  7. const vec2 vertices[3] =
  8. vec2[3](vec2(-1,-1), vec2(3,-1), vec2(-1, 3));
  9. layout (location = 0) out vec4 posPos;
  10. #ifdef VULKAN
  11. #define BINDING_COLOR_TEXTURE 0
  12. #define VERTEX_ID gl_VertexIndex
  13. #else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
  14. #define BINDING_COLOR_TEXTURE 0
  15. #define VERTEX_ID gl_VertexID
  16. #endif
  17. layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
  18. const float FXAA_SUBPIX_SHIFT = 0;
  19. void main() {
  20. vec2 vertex = vertices[VERTEX_ID];
  21. gl_Position = vec4(vertex, 0.0, 1.0);
  22. vec2 vert_tex_coord = (vertex + 1.0) / 2.0;
  23. posPos.xy = vert_tex_coord;
  24. posPos.zw = vert_tex_coord - (0.5 + FXAA_SUBPIX_SHIFT) / textureSize(input_texture, 0);
  25. }