summaryrefslogtreecommitdiffstats
path: root/src/video_core/host_shaders/fxaa.vert
diff options
context:
space:
mode:
authorMarshall Mohror <mohror64@gmail.com>2021-10-21 01:36:06 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 22:11:32 +0100
commit48cf3764626e1ed30450d15e00befb75a4eae329 (patch)
treed05aa128a7b07349ceb09ebbf515682036fbea9c /src/video_core/host_shaders/fxaa.vert
parentFrontend: Add anti-aliasing method setting (diff)
downloadyuzu-48cf3764626e1ed30450d15e00befb75a4eae329.tar
yuzu-48cf3764626e1ed30450d15e00befb75a4eae329.tar.gz
yuzu-48cf3764626e1ed30450d15e00befb75a4eae329.tar.bz2
yuzu-48cf3764626e1ed30450d15e00befb75a4eae329.tar.lz
yuzu-48cf3764626e1ed30450d15e00befb75a4eae329.tar.xz
yuzu-48cf3764626e1ed30450d15e00befb75a4eae329.tar.zst
yuzu-48cf3764626e1ed30450d15e00befb75a4eae329.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/host_shaders/fxaa.vert40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/video_core/host_shaders/fxaa.vert b/src/video_core/host_shaders/fxaa.vert
new file mode 100644
index 000000000..715fce462
--- /dev/null
+++ b/src/video_core/host_shaders/fxaa.vert
@@ -0,0 +1,40 @@
+// Copyright 2019 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#version 460
+
+out gl_PerVertex {
+ vec4 gl_Position;
+};
+
+const vec2 vertices[4] =
+ vec2[4](vec2(-1.0, 1.0), vec2(1.0, 1.0), vec2(-1.0, -1.0), vec2(1.0, -1.0));
+
+layout (location = 0) out vec4 posPos;
+
+#ifdef VULKAN
+
+#define BINDING_COLOR_TEXTURE 1
+
+#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
+
+#define BINDING_COLOR_TEXTURE 0
+
+#endif
+
+layout (binding = BINDING_COLOR_TEXTURE) uniform sampler2D input_texture;
+
+const float FXAA_SUBPIX_SHIFT = 0;
+
+void main() {
+#ifdef VULKAN
+ vec2 vertex = vertices[gl_VertexIndex];
+#else
+ vec2 vertex = vertices[gl_VertexID];
+#endif
+ gl_Position = vec4(vertex, 0.0, 1.0);
+ vec2 vert_tex_coord = (vertex + 1.0) / 2.0;
+ posPos.xy = vert_tex_coord;
+ posPos.zw = vert_tex_coord - (0.5 + FXAA_SUBPIX_SHIFT) / textureSize(input_texture, 0);
+}