2014-08-21 09:27:53 +02:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace GLShaders {
|
|
|
|
|
2014-08-28 20:21:54 +02:00
|
|
|
const char g_vertex_shader[] = R"(
|
2014-08-28 10:37:07 +02:00
|
|
|
#version 150 core
|
2014-08-21 09:27:53 +02:00
|
|
|
|
2014-08-28 20:21:54 +02:00
|
|
|
in vec2 vert_position;
|
|
|
|
in vec2 vert_tex_coord;
|
|
|
|
out vec2 frag_tex_coord;
|
2014-08-21 09:27:53 +02:00
|
|
|
|
2014-08-28 20:21:54 +02:00
|
|
|
// This is a truncated 3x3 matrix for 2D transformations:
|
|
|
|
// The upper-left 2x2 submatrix performs scaling/rotation/mirroring.
|
|
|
|
// The third column performs translation.
|
|
|
|
// The third row could be used for projection, which we don't need in 2D. It hence is assumed to
|
|
|
|
// implicitly be [0, 0, 1]
|
|
|
|
uniform mat3x2 modelview_matrix;
|
2014-08-21 09:27:53 +02:00
|
|
|
|
|
|
|
void main() {
|
2014-08-28 20:21:54 +02:00
|
|
|
// Multiply input position by the rotscale part of the matrix and then manually translate by
|
|
|
|
// the last column. This is equivalent to using a full 3x3 matrix and expanding the vector
|
|
|
|
// to `vec3(vert_position.xy, 1.0)`
|
|
|
|
gl_Position = vec4(mat2(modelview_matrix) * vert_position + modelview_matrix[2], 0.0, 1.0);
|
|
|
|
frag_tex_coord = vert_tex_coord;
|
|
|
|
}
|
|
|
|
)";
|
2014-08-21 09:27:53 +02:00
|
|
|
|
2014-08-28 20:21:54 +02:00
|
|
|
const char g_fragment_shader[] = R"(
|
2014-08-28 10:37:07 +02:00
|
|
|
#version 150 core
|
2014-08-28 20:21:54 +02:00
|
|
|
|
|
|
|
in vec2 frag_tex_coord;
|
|
|
|
out vec4 color;
|
|
|
|
|
|
|
|
uniform sampler2D color_texture;
|
2014-08-21 09:27:53 +02:00
|
|
|
|
|
|
|
void main() {
|
2014-08-28 20:21:54 +02:00
|
|
|
color = texture(color_texture, frag_tex_coord);
|
|
|
|
}
|
|
|
|
)";
|
2014-08-21 09:27:53 +02:00
|
|
|
|
|
|
|
}
|