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

21 lines
536 B
GLSL

#version 450
layout(location = 0) in vec2 v_texcoord;
layout(location = 1) in vec2 o_texcoord;
layout(location = 0) out vec4 fragColor;
layout(binding = 1) uniform sampler2D s_texture;
layout(std140, binding = 0) uniform Params {
vec2 viewport;
float g_opacity;
float _flipY; // Used by the vertex stage only.
float o_opacity;
};
void main() {
vec4 result = texture(s_texture, v_texcoord);
vec4 over = texture(s_texture, o_texcoord);
result = result * (1.0 - o_opacity) + over * o_opacity;
fragColor = result * g_opacity;
}