#version 300 es // Fullscreen triangle for the 2D image path (the WebGL port of scene.vert). // WebGL clip space is +Y up, so the vertex position flips Y relative to the // Vulkan shader; the sampled UVs and the image's top-left origin are unchanged. precision highp float; uniform vec4 u_rect; // xy = top-left (0..1), zw = size (0..1) out vec2 v_uv; void main() { vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2)); v_uv = (p - u_rect.xy) / u_rect.zw; gl_Position = vec4(p.x * 2.0 - 1.0, 1.0 - p.y * 2.0, 0.0, 1.0); }