diff --git a/.github/workflows/test-crates.yml b/.github/workflows/test-crates.yml index 4e354d590..53d5f156a 100644 --- a/.github/workflows/test-crates.yml +++ b/.github/workflows/test-crates.yml @@ -90,18 +90,23 @@ jobs: ./scripts/cargo-test.sh echo "cargo test wall time: $(( $(date +%s) - START ))s" - # Every shader must bake with the pinned qsb. Separate job so qsb is never - # on PATH while cargo runs (see qt-gate). + # Every shader must bake. Separate job so qsb is never on PATH while cargo + # runs (see qt-gate). The BAKE toolchain is pinned apart from the runtime + # floor: the committed .qsb need qsb >= 6.9 (plasma/ambient's uint hash + # constants vs the GLSL 1.20 variant, which desktop GL <= 3.1 selects at + # runtime, so it must stay in the pack) — see shader_bake_gate.sh. shader-gate: name: shader bake gate runs-on: ubuntu-24.04 timeout-minutes: 15 + env: + QT_SHADERTOOLS_VERSION: ${{ vars.QT_VERSION_SHADERTOOLS || '6.9.3' }} steps: - uses: actions/checkout@v7 - - name: Install Qt ${{ env.QT_VERSION }} + shader tools + - name: Install Qt ${{ env.QT_SHADERTOOLS_VERSION }} + shader tools uses: jurplel/install-qt-action@v4 with: - version: ${{ env.QT_VERSION }} + version: ${{ env.QT_SHADERTOOLS_VERSION }} host: linux target: desktop arch: linux_gcc_64 diff --git a/scripts/qml-audits/shader_bake_gate.sh b/scripts/qml-audits/shader_bake_gate.sh index 44bca8a82..7971f21b5 100755 --- a/scripts/qml-audits/shader_bake_gate.sh +++ b/scripts/qml-audits/shader_bake_gate.sh @@ -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