#version 300 es precision highp float; /* Composes a packed multi-display atlas into the guest's virtual desktop. * * Unlike the desktop shader, the texture coordinate is supplied per vertex * rather than derived from the position: a display's place in the atlas has * nothing to do with its place on the desktop, so the two cannot be tied * together. */ layout(location = 0) in vec2 vertex; // position in view pixels layout(location = 1) in vec2 texture; // source position in atlas pixels out vec2 uv; uniform vec2 viewSize; uniform vec2 atlasSize; void main() { /* View pixels to clip space. * * Y is deliberately not flipped. This shader renders into a framebuffer * whose texture is then sampled by the desktop shader, which treats row 0 * of the image as the top, matching the order rows arrive in the frame. * Writing clip Y directly keeps the composed texture in that same order; * flipping here would hand the next stage an upside down desktop. */ gl_Position = vec4(vertex / viewSize * 2.0 - 1.0, 0.0, 1.0); uv = texture / atlasSize; }