shader: pin the GFX10 opcode-name resolution with unit tests (#477) #498
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/498"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T22:18:20Z.
What this changes
Refs #477. Test-only, in
crates/victory-shader/src/gfx10/mod.rs.name(encoding, opcode)was untested, so a table edit could silently rename an instruction; the survey's unnamed-opcode counts and refusal messages read the same names. Pinned now:u16::MAX) resolves to no name, not a neighbour's;"exp"whatever its opcode field holds;0x140=v_fma_legacy_f32(#321) — with the invariant that no VOP3-table entry sits in a shadowed base range.Synthetic opcodes only; no game data, no behaviour change, no new dependencies.
How it was tested
cargo test -p victory-shader— 406 passed (incl. the 4 newgfx10::tests), 0 failedcargo test -p victory-hle -p victory -p victory-gpu -p xtask— pass (RC=0)cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings— pass (RC=0, 0 errors)cargo xtask policy— pass (398 files ok)Checklist
VICTORY_*variable — n/a, none addedImported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T22:19:02Z.
Two pull requests pin #477 — this one and #480 (
vibe/opcode-name-tests-4f9c68, opened 19 minutes earlier). Both are test-only and green. I have closed #480 and kept this one, because it pins more:every_table_entry_resolves_to_its_own_namewalks the tables rather than sampling them, andtables_are_sorted_so_the_binary_search_finds_thempins the invariantname()'s binary search actually depends on, which #480 did not cover at all.Two things worth fixing here before it lands:
flat_offsets_ignore_bit_elevenis a second subject — FLAT offsets are not opcode names — and CONTRIBUTING asks for one change per pull request. It is a good test; it would be a fine PR of its own, or could join afieldssuite (gfx10/fields.rshas no tests at all, and offset decoding is where that test belongs).ir_tests.rs,range_tests.rs,gfx_refusal_tests.rs,emit/lockstep_tests.rs— rather than inline, sogfx10/opcodes_tests.rswould match the neighbourhood. Style only; the module is declared undercfg(test), so either way the build hash is unchanged.For reference, the coverage #480 had that is now only here: one name per encoding table (19 encodings, EXP ignoring its opcode field), the VOP3 bases for VOPC/VOP2/VOP1 with
0x140asv_fma_legacy_f32, and past-the-end opcodes resolving toNone. All three are covered by this PR's tests, which is why closing #480 loses nothing.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T01:36:42Z.
Review: APPROVED
Check report (helping the maintainer clear the queue):
checkandmacos-scriptsgreen on the current head.#[cfg(test)]module). Every GFX10 opcode table is sorted and resolves to its own names. No translator code changes.226645f9) merged with this PR and the other test/docs/tools PRs we're landing in this batch (#397 #399 #422 #467 #471 #475 #479 #481 #486 #489 #494 #498 #505 #511). On it, thevictory-gpu(arm64),victory-shader,victory-backend,victory-metalandvictorytests pass, as do the macOS script tests (rustup-path.sh,run-summary-compare.sh,run-summary.sh --self-test), Windows clippy (-D warnings) andcargo xtask policy. Onevictory-gpurun in four failed main's ownmulti_mip_array_and_placed_depth_twins_preserve_all_subresources_and_remirror_immediately. That test also flakes on main alone, so it isn't from this batch.Thanks @AnastasisKon!