fxaa.vert 900 B

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