Files
qbz/crates/qbz-qt/qml/assets/shaders/scene_pack.vert
T
vicrodh e6c058c2f2 feat(qt): immersive shader scenes — RHI items, scene menu, GL link pairing
Port the immersive GPU scenes: Plasma, Tunnel, Aurora, Ambient, Spectral
Ribbon and Line Bed as QQuickRhiItems/ShaderEffects under a pulse-driven
ShaderSceneLayer, plus the Qt-only Tunnel Flow (Tauri Canvas2D port) fed
by the Viz16 stream. Scene rows live in the header view menu (no Off row);
g cycles the ring. A fresh immersive open defaults to Split > Lyrics
(owner ruling).

OpenGL link fix (owner smoke: Tunnel black with "uniform _22 declared as
type buf and type buf"): every ShaderEffect fragment with its own uniform
layout now ships a paired vertex stage declaring the identical block —
the shared spectrum.vert only ever linked under Vulkan.

RHI hardening: render pass descriptors on the ping-pong targets (the
Tunnel Flow segfault / Plasma dead window), mirrorVertically tied to the
backend (!== OpenGL), ribbon sub-uploads carry setSourceSize.

km
2026-08-16 08:22:57 -06:00

46 lines
1.4 KiB
GLSL

#version 440
// PAIRED with tunnel.frag AND aurora.frag (their uniform layouts are
// identical, so one vertex stage serves both).
//
// THE PAIRING RULE (2026-08-15 black-Tunnel report): a ShaderEffect's two
// stages are LINKED into one program under the OpenGL RHI backend, and GLSL
// refuses one block name with two layouts ("uniform `_22' declared as type
// `buf' and type `buf'"). Vulkan never links stages, so the shared
// spectrum.vert (block = qt_Matrix + qt_Opacity) paired with these wider
// fragment blocks rendered fine there and died only on GL. The fix is Qt's
// own documented pattern: BOTH stages declare the SAME block, member for
// member, in the same order — the vertex stage simply never reads the
// fragment-only fields. Keep this block byte-identical to tunnel.frag's.
layout(location = 0) in vec4 qt_Vertex;
layout(location = 1) in vec2 qt_MultiTexCoord0;
layout(location = 0) out vec2 qt_TexCoord0;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
vec4 primary;
vec4 secondary;
vec4 accent;
vec4 energyLo;
vec4 energyHi;
vec4 bandsLo;
vec4 bandsHi;
float qt_Opacity;
float time;
float phase;
float beat;
float level;
float resX;
float resY;
float levelSmooth;
float transientAmp;
};
out gl_PerVertex { vec4 gl_Position; };
void main() {
qt_TexCoord0 = qt_MultiTexCoord0;
gl_Position = qt_Matrix * qt_Vertex;
}