Shaders: SP3 text gives a message only the fields it has #283

Closed
github-bot wants to merge 1 commit from gh-pr/283/head into gh-pr/283/base
Owner

@⁠SkippySteve on GitHub · 2026-11-24 02:02 UTC · original
SkippySteve/victory-pr-own-next14 → main · +69 −12 · 1 files · 1 commits · closed without merging

gfx10/sp3.rs wrote every s_sendmsg operand as if it were a GS message, with a GS operation and a stream. So the mesh/NGG stage's allocation request appeared in shader dumps as sendmsg(MSG_GS_ALLOC_REQ, GS_OP_NOP, 0), and only four of the GFX10 message ids had names (MSG_GS, MSG_GS_DONE, MSG_ORDERED_PS_DONE, MSG_GS_ALLOC_REQ).

Messages are now spelled the way LLVM's AMDGPU assembler spells them:

  • The operation is written only for MSG_GS, MSG_GS_DONE and MSG_SYSMSG (SYSMSG_OP_*).
  • The stream is written only for a GS emit or cut.
  • Every GFX10 id has a name: INTERRUPT, SAVEWAVE, STALL_WAVE_GEN, HALT_WAVES, EARLY_PRIM_DEALLOC, GET_DOORBELL, GET_DDID and SYSMSG.
  • If an operand has bits that no field accounts for, it stays as raw hex so those bits are not lost. That covers an unknown id, a stream on a NOP, an operation on a message that has none, and bits above the stream.

Before → after:

imm before after
0x0009 sendmsg(MSG_GS_ALLOC_REQ, GS_OP_NOP, 0) sendmsg(MSG_GS_ALLOC_REQ)
0x0008 sendmsg(8, GS_OP_NOP, 0) sendmsg(MSG_EARLY_PRIM_DEALLOC)
0x002F sendmsg(15, GS_OP_EMIT, 0) sendmsg(MSG_SYSMSG, SYSMSG_OP_REG_RD)
0x0122 sendmsg(MSG_GS, GS_OP_EMIT, 1) unchanged
0x0019 sendmsg(MSG_GS_ALLOC_REQ, GS_OP_CUT, 0) 0x0019

Only shader dumps use this text (victory shader listing via Instruction::text). Translation matches on the opcode and reads the raw immediate, so its behaviour does not change.

The new test sendmsg_names_only_the_fields_a_message_has decodes synthetic s_sendmsg words and needs no game data.

Testing on Linux:

  • cargo test -p victory-shader: 57 passed.
  • cargo clippy -p victory-shader --all-targets: no new warnings. The only warning is the existing unused constant_color in emit/mod.rs, which is on main too.
  • cargo fmt --check -p victory-shader: clean.
  • cargo xtask policy: ok.
**@⁠SkippySteve** on GitHub · 2026-11-24 02:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/283) `SkippySteve/victory-pr-own-next14` → `main` · +69 −12 · 1 files · 1 commits · closed without merging `gfx10/sp3.rs` wrote every `s_sendmsg` operand as if it were a GS message, with a GS operation and a stream. So the mesh/NGG stage's allocation request appeared in shader dumps as `sendmsg(MSG_GS_ALLOC_REQ, GS_OP_NOP, 0)`, and only four of the GFX10 message ids had names (MSG_GS, MSG_GS_DONE, MSG_ORDERED_PS_DONE, MSG_GS_ALLOC_REQ). Messages are now spelled the way LLVM's AMDGPU assembler spells them: - The operation is written only for `MSG_GS`, `MSG_GS_DONE` and `MSG_SYSMSG` (`SYSMSG_OP_*`). - The stream is written only for a GS emit or cut. - Every GFX10 id has a name: INTERRUPT, SAVEWAVE, STALL_WAVE_GEN, HALT_WAVES, EARLY_PRIM_DEALLOC, GET_DOORBELL, GET_DDID and SYSMSG. - If an operand has bits that no field accounts for, it stays as raw hex so those bits are not lost. That covers an unknown id, a stream on a NOP, an operation on a message that has none, and bits above the stream. Before → after: | imm | before | after | |-----|--------|-------| | `0x0009` | `sendmsg(MSG_GS_ALLOC_REQ, GS_OP_NOP, 0)` | `sendmsg(MSG_GS_ALLOC_REQ)` | | `0x0008` | `sendmsg(8, GS_OP_NOP, 0)` | `sendmsg(MSG_EARLY_PRIM_DEALLOC)` | | `0x002F` | `sendmsg(15, GS_OP_EMIT, 0)` | `sendmsg(MSG_SYSMSG, SYSMSG_OP_REG_RD)` | | `0x0122` | `sendmsg(MSG_GS, GS_OP_EMIT, 1)` | unchanged | | `0x0019` | `sendmsg(MSG_GS_ALLOC_REQ, GS_OP_CUT, 0)` | `0x0019` | Only shader dumps use this text (`victory` shader listing via `Instruction::text`). Translation matches on the opcode and reads the raw immediate, so its behaviour does not change. The new test `sendmsg_names_only_the_fields_a_message_has` decodes synthetic `s_sendmsg` words and needs no game data. Testing on Linux: - `cargo test -p victory-shader`: 57 passed. - `cargo clippy -p victory-shader --all-targets`: no new warnings. The only warning is the existing unused `constant_color` in `emit/mod.rs`, which is on `main` too. - `cargo fmt --check -p victory-shader`: clean. - `cargo xtask policy`: ok.
The disassembler wrote every s_sendmsg as if it were a GS message, with a
GS operation and a stream, so the mesh stage's allocation request read
"sendmsg(MSG_GS_ALLOC_REQ, GS_OP_NOP, 0)", and only four of the GFX10
message ids had names.

Now messages are spelled the way LLVM's AMDGPU assembler spells them: the
operation only for GS, GS_DONE and SYSMSG, the stream only for a GS emit or
cut, and every GFX10 message id named. An operand whose bits no field
accounts for (an unknown id, a stream on a NOP, an operation on a message
that has none, bits above the stream) stays as raw hex instead of losing
those bits. The text is only used for shader dumps; translation does not
read it.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:51 +00:00
github-bot closed this pull request 2026-11-26 03:57:51 +00:00
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 02:29 UTC · original

superseded by #326 (combined shader DX/parser robustness)

**@⁠SkippySteve** on GitHub · 2026-11-24 02:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/283#issuecomment-7120198002) superseded by #326 (combined shader DX/parser robustness)

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!283
No description provided.