Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions tools/MATERIAL-PROBE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Standalone material pixel probe (issue #454)

This host-side packaging recipe pins the diagnostic source and shaders to
draft #463 (including #462), and the embedded shader generator to draft
#460. The original mode remains pinned to commit 300ee383. Optional
`--sparse` mode pins commit 3a02f78a, with the sparse-binding fragment oracle. Neither mode merges those PRs,
changes driver capabilities, or contacts a device. Fetch their branches first if the pinned objects are absent. They
must remain available in the local Git object database.

Use glibc GCC or a glibc cross compiler, Python 3, SPIRV-Tools, and Vulkan
headers. The output directory must exist and the output file must not.

```sh
mkdir -p probe-out
tools/build-material-probe.sh third_party/mesa/include probe-out/material-native
CC=/path/to/aarch64-glibc-cc tools/build-material-probe.sh \
third_party/mesa/include probe-out/material-aarch64
readelf -h probe-out/material-aarch64
sha256sum probe-out/material-aarch64
```

Run the two independent cases against the intended native ICD:

```sh
probe-out/material-native --direct /path/to/icd.so --only material_ubo --spv-dir @embedded
probe-out/material-native --direct /path/to/icd.so --only material_ubo_template --spv-dir @embedded
```

For the sparse-binding regression (#457), build a separate executable:

```sh
tools/build-material-probe.sh --sparse third_party/mesa/include probe-out/sparse-native
CC=/path/to/aarch64-glibc-cc tools/build-material-probe.sh --sparse \
third_party/mesa/include probe-out/sparse-aarch64
probe-out/sparse-native --direct /path/to/icd.so --only material_sparse --spv-dir @embedded
probe-out/sparse-native --direct /path/to/icd.so --only material_sparse_template --spv-dir @embedded
```

The sparse cases first verify a defined blue control, then verify both
halves of four frames. In a controlled baseline/candidate comparison, a
baseline failure is evidence of the specific bug only if the spill
assertion reports blue after the first binding and initial control pass.
Other failures are not accepted as reproduction. The candidate must
pass both selectors. Each probe embeds only the shaders for its mode;
the two modes are not interchangeable.

Each must report the expected device, four iterations, ok:true and pass:true.
A fake backend submission is not a pixel pass. For a phone, use the owner
worker and its approved guarded single-file diagnostic path only. Verify the
AArch64 ELF and both artifact hashes before any session, record each result
and verify restoration; stop on refusal. Never contact an owner-held phone.
These cases test shader consumption, not the original material writer,
Megabonk correctness or presentation rate.
35 changes: 35 additions & 0 deletions tools/build-material-probe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# Build a standalone diagnostic from the pinned draft sources.
set -euo pipefail
draw=300ee38314ae6b226abc57dd448c043b8a259dce
fragment=material_ubo.frag
if [[ "${1:-}" == --sparse ]]; then
draw=3a02f78a407109c8b3f931f7d50b44de2ec0ebb7
fragment=material_sparse.frag
shift
fi
if [[ $# != 2 || "$1" == -* ]]; then
echo "usage: $0 [--sparse] <Vulkan-include-dir> <new-output-path>" >&2
exit 2
fi
include=$(realpath "$1")
output=$(realpath "$(dirname "$2")")/$(basename "$2")
[[ -f "$include/vulkan/vulkan.h" && ! -e "$output" && ! -L "$output" ]] || {
echo "missing Vulkan headers or output already exists" >&2; exit 2;
}
root=$(git -C "$(dirname "$0")" rev-parse --show-toplevel)
embed=1473409217dcee72e6eabcc61c3980480e9e06fa
tmp=$(mktemp -d "$(dirname "$output")/.material-probe.XXXXXXXX")
trap 'rm -rf -- "$tmp"' EXIT
git -C "$root" show "$draw:vk/tests/t_vk_draw.c" > "$tmp/draw.c"
git -C "$root" show "$embed:tools/embed-probe-spv.py" > "$tmp/embed.py"
for shader in rot.vert "$fragment"; do
git -C "$root" show "$draw:vk/shader/$shader.spv" > "$tmp/$shader.spv"
spirv-val "$tmp/$shader.spv"
done
python3 "$tmp/embed.py" "$tmp/rot.vert.spv" "$tmp/$fragment.spv" > "$tmp/embed.c"
"${CC:-cc}" -std=gnu11 -O2 -ffile-prefix-map="$tmp"=. -Wall -Wextra -I"$include" "$tmp/draw.c" "$tmp/embed.c" \
-Wl,--wrap=fopen -ldl -lm -pthread -o "$tmp/probe"
ln -T -- "$tmp/probe" "$output"
sha256sum "$output"