91df2beee3
Add the necessary CMake code to copy the contents in a string source shader (GLSL or GLASM) to a header file then consumed by video_core files. This allows editting GLSL in its own files without having to maintain them in source files. For now, only OpenGL presentation shaders are moved, but we can add GLASM presentation shaders and static SPIR-V generation through glslangValidator in the future.
24 lines
933 B
GLSL
24 lines
933 B
GLSL
#version 430 core
|
|
|
|
out gl_PerVertex {
|
|
vec4 gl_Position;
|
|
};
|
|
|
|
layout (location = 0) in vec2 vert_position;
|
|
layout (location = 1) in vec2 vert_tex_coord;
|
|
layout (location = 0) out vec2 frag_tex_coord;
|
|
|
|
// 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]
|
|
layout (location = 0) uniform mat3x2 modelview_matrix;
|
|
|
|
void main() {
|
|
// 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;
|
|
}
|