aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/OpenGL/FbVtxShader.glsl
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-02-23 18:48:27 -0300
committergdkchan <gab.dark.100@gmail.com>2018-02-23 18:48:27 -0300
commit2ed733b1d5addad027f48acfdd407e64b71427fc (patch)
tree1254df3ab2bace8de561b5a3549f668fabcf4aa9 /Ryujinx.Graphics/Gal/OpenGL/FbVtxShader.glsl
parenteafc58c9f2e2e0c19d22f0da2a93ab5372aeef29 (diff)
Somewhat better NvFlinger (I guess) (fixes #30)
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/FbVtxShader.glsl')
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/FbVtxShader.glsl26
1 files changed, 26 insertions, 0 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/FbVtxShader.glsl b/Ryujinx.Graphics/Gal/OpenGL/FbVtxShader.glsl
new file mode 100644
index 00000000..933fa6aa
--- /dev/null
+++ b/Ryujinx.Graphics/Gal/OpenGL/FbVtxShader.glsl
@@ -0,0 +1,26 @@
+#version 330 core
+
+precision highp float;
+
+uniform vec2 window_size;
+uniform mat2 transform;
+
+layout(location = 0) in vec2 in_position;
+layout(location = 1) in vec2 in_tex_coord;
+
+out vec2 tex_coord;
+
+// Have a fixed aspect ratio, fit the image within the available space.
+vec2 get_scale_ratio(void) {
+ vec2 native_size = vec2(1280, 720);
+ vec2 ratio = vec2(
+ (window_size.y * native_size.x) / (native_size.y * window_size.x),
+ (window_size.x * native_size.y) / (native_size.x * window_size.y)
+ );
+ return min(ratio, 1);
+}
+
+void main(void) {
+ tex_coord = in_tex_coord;
+ gl_Position = vec4((transform * in_position) * get_scale_ratio(), 0, 1);
+} \ No newline at end of file