ci: shader gate bakes with qsb >= 6.9 and mirrors build.rs's -b rule

The GLSL 1.20 variant must stay in plasma/ambient's packs: Qt's OpenGL
RHI selects 120/130/140 on desktop GL <= 3.1 and the renderer tier does
not exclude that hardware, so dropping it (the previous attempt) was a
regression for old GL — caught in review. qsb 6.8 cannot lower those
shaders' uint hash constants for 1.20 while 6.9+ can, and the committed
.qsb were baked with 6.11: the bake toolchain is therefore pinned apart
from the 6.8 runtime floor (vars.QT_VERSION_SHADERTOOLS, default 6.9.3).
The gate also passes -b only to vertex shaders without the no-batch
marker, exactly like build.rs.

cc
This commit is contained in:
vicrodh committed 2026-08-27 11:11:50 -06:00
1 parent eada3bd12e
commit a712284306
2 files changed
+24 -6

No files matched your search

+15 -2
View File
@@ -14,6 +14,15 @@
# The release/test builds themselves run WITHOUT qsb on PATH so they ship the
# committed .qsb deterministically; this gate is where shader health is judged.
#
# WHICH qsb: the committed .qsb are baked with qsb >= 6.9. plasma.frag and
# ambient.frag hash with 32-bit uint constants that qsb 6.8 refuses to lower
# for the GLSL 1.20 variant ("Tried to convert uint literal into int") while
# 6.9+ lowers them fine — and that 1.20 variant MUST exist: Qt's OpenGL RHI
# selects 120/130/140 on desktop GL <= 3.1 and the app's renderer tier does
# not exclude that hardware (reviewed 2026-08-27). So the bake toolchain is
# pinned separately from the runtime floor: runtime Qt 6.8 loads these packs,
# baking them needs 6.9+. CI passes its own qsb; locally use any >= 6.9.
#
# Usage: scripts/qml-audits/shader_bake_gate.sh [path/to/qsb]
set -euo pipefail
cd "$(dirname "$0")/../.."
@@ -25,13 +34,17 @@ glsl_noes="$(grep -oE 'const SHADER_GLSL_NO_ES100: &str = "[^"]+"' $CRATE/build.
hlsl="$(grep -oE 'const SHADER_HLSL: &str = "[^"]+"' $CRATE/build.rs | sed 's/.*= "//; s/"$//')"
msl="$(grep -oE 'const SHADER_MSL: &str = "[^"]+"' $CRATE/build.rs | sed 's/.*= "//; s/"$//')"
marker="$(grep -oE 'const NO_ES100_MARKER: &str = "[^"]+"' $CRATE/build.rs | sed 's/.*= "//; s/"$//')"
[[ -n "$glsl_all" && -n "$glsl_noes" && -n "$hlsl" && -n "$msl" && -n "$marker" ]] || { echo "shader_bake_gate: could not read the target lists from $CRATE/build.rs"; exit 2; }
nobatch="$(grep -oE 'const NO_BATCH_MARKER: &str = "[^"]+"' $CRATE/build.rs | sed 's/.*= "//; s/"$//')"
[[ -n "$glsl_all" && -n "$glsl_noes" && -n "$hlsl" && -n "$msl" && -n "$marker" && -n "$nobatch" ]] || { echo "shader_bake_gate: could not read the target lists from $CRATE/build.rs"; exit 2; }
tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
fail=0; n=0
for src in $CRATE/qml/assets/shaders/*.frag $CRATE/qml/assets/shaders/*.vert; do
n=$((n+1))
if grep -q "$marker" "$src"; then glsl="$glsl_noes"; else glsl="$glsl_all"; fi
if ! "$QSB" --glsl "$glsl" --hlsl "$hlsl" --msl "$msl" -b -o "$tmp/$(basename "$src").qsb" "$src" > "$tmp/err" 2>&1; then
# build.rs passes the batching rewrite (-b) to VERTEX shaders only, unless
# they carry the no-batch marker (custom QQuickRhiItem vertex layouts).
batch=(); [[ "$src" == *.vert ]] && ! grep -q "$nobatch" "$src" && batch=(-b)
if ! "$QSB" --glsl "$glsl" --hlsl "$hlsl" --msl "$msl" "${batch[@]}" -o "$tmp/$(basename "$src").qsb" "$src" > "$tmp/err" 2>&1; then
echo "FAIL $src [glsl: $glsl]"; sed 's/^/ /' "$tmp/err" | head -3; fail=$((fail+1))
fi
done