ZaStoGram_desktop/Telegram/shaders/pip_controls.vert
Ilya Fedin 4f47efdb02 [qrhi] Added Vulkan support with the NDC Y axis flip.
Vulkan is the only backend with the Y axis pointing down in normalized
device coordinates, while all the geometry here is built in the
bottom-left based system of OpenGL. The vertex shaders computing clip
space from pixel coordinates now negate Y by a flipY uniform, kept at
offset 12 in every block they share, and the clip space quads computed
on our side, in PiP and in the offscreen passes of the group call
viewport, are negated directly. The 3D renderers already handle this
with clipSpaceCorrMatrix().

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 16:50:35 +03:00

23 lines
589 B
GLSL

#version 450
layout(location = 0) in vec2 position;
layout(location = 1) in vec2 v_texcoordIn;
layout(location = 2) in vec2 o_texcoordIn;
layout(location = 0) out vec2 v_texcoord;
layout(location = 1) out vec2 o_texcoord;
layout(std140, binding = 0) uniform Params {
vec2 viewport;
float g_opacity;
// -1.0 when the NDC Y axis points down (Vulkan), 1.0 otherwise.
float flipY;
float o_opacity;
};
void main() {
v_texcoord = v_texcoordIn;
o_texcoord = o_texcoordIn;
vec2 ndc = vec2(-1.0, -1.0) + 2.0 * position / viewport;
gl_Position = vec4(ndc.x, ndc.y * flipY, 0.0, 1.0);
}