ZaStoGram_desktop/Telegram/shaders/group_frame.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

31 lines
747 B
GLSL

#version 450
layout(location = 0) in vec2 position;
layout(location = 1) in vec2 v_texcoordIn;
layout(location = 2) in vec2 b_texcoordIn;
layout(location = 0) out vec2 v_texcoord;
layout(location = 1) out vec2 b_texcoord;
layout(location = 2) out vec2 v_position;
layout(std140, binding = 0) uniform Params {
vec2 viewport;
float _pad0;
// -1.0 when the NDC Y axis points down (Vulkan), 1.0 otherwise.
float flipY;
vec4 frameBg;
vec4 shadow;
float paused;
vec4 roundRect;
vec2 radiusOutline;
vec4 roundBg;
vec4 outlineFg;
};
void main() {
v_texcoord = v_texcoordIn;
b_texcoord = b_texcoordIn;
v_position = position;
vec2 ndc = vec2(-1.0, -1.0) + 2.0 * position / viewport;
gl_Position = vec4(ndc.x, ndc.y * flipY, 0.0, 1.0);
}