2020-10-09 14:33:13 +00:00
|
|
|
// Copyright 2020 Collabora Ltd.
|
|
|
|
// Author: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
|
|
|
|
#version 460
|
|
|
|
|
|
|
|
|
2021-09-22 15:31:38 +00:00
|
|
|
layout (binding = 0, std140) uniform Transformation
|
|
|
|
{
|
|
|
|
mat4 mvp;
|
|
|
|
ivec2 offset;
|
|
|
|
ivec2 extent;
|
|
|
|
bool flip_y;
|
|
|
|
} transformation;
|
2020-10-09 14:33:13 +00:00
|
|
|
|
2021-09-22 15:31:38 +00:00
|
|
|
layout (location = 0) in vec3 position;
|
|
|
|
layout (location = 1) in vec2 uv;
|
2020-10-09 14:33:13 +00:00
|
|
|
layout (location = 0) out vec2 out_uv;
|
|
|
|
|
2021-09-22 15:31:38 +00:00
|
|
|
out gl_PerVertex
|
|
|
|
{
|
|
|
|
vec4 gl_Position;
|
2020-10-09 14:33:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const mat4 mvp = mat4(
|
2021-09-22 15:31:38 +00:00
|
|
|
2, 0, 0, 0,
|
|
|
|
0, 2, 0, 0,
|
|
|
|
0, 0, 1, 0,
|
|
|
|
0, 0, 0, 1
|
2020-10-09 14:33:13 +00:00
|
|
|
);
|
|
|
|
|
2021-09-22 15:31:38 +00:00
|
|
|
|
2020-10-09 14:33:13 +00:00
|
|
|
void main() {
|
2021-09-22 15:31:38 +00:00
|
|
|
gl_Position = mvp * vec4 (position, 1.0f);
|
|
|
|
gl_Position.y = -gl_Position.y;
|
|
|
|
out_uv = uv;
|
2020-10-09 14:33:13 +00:00
|
|
|
|
2021-09-22 15:31:38 +00:00
|
|
|
if (transformation.flip_y) {
|
|
|
|
out_uv.y = 1.0 - out_uv.y;
|
|
|
|
}
|
2020-10-09 14:33:13 +00:00
|
|
|
}
|