skyline/app/src/main/shaders/blit.vert
Billy Laws 395f665a13 Implement a system for helper shaders together with a simple blit shader
It is desirable for us to use a shader for blits to allow easily emulating out of bounds blits and blits between different swizzled colour formats. The helper shader infrastructure is designed to be generic so it can be reused by any other helper shaders that we may  need in the future.
2022-08-08 17:40:35 +01:00

23 lines
486 B
GLSL

#version 460
layout (location = 0) out vec2 dstPosition;
layout (push_constant) uniform constants {
vec2 dstOriginClipSpace;
vec2 dstDimensionsClipSpace;
} PC;
void main() {
const vec2 lut[6] = vec2[6](
vec2(1, 0),
vec2(1, 1),
vec2(0, 1),
vec2(0, 1),
vec2(0, 0),
vec2(1, 0)
);
dstPosition = lut[gl_VertexIndex];
gl_Position = vec4(PC.dstOriginClipSpace + PC.dstDimensionsClipSpace * lut[gl_VertexIndex], 0, 1);
}