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

Closed
SkippySteve wants to merge 1 commit from upstream-pr/283 into main
SkippySteve commented 2026-11-24 02:02:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:02:12Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6572912419 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/283). Originally posted by [SkippySteve](https://github.com/SkippySteve) on 2026-11-24T02:02:12Z. --- `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.
upstream-sync closed this pull request 2026-11-24 06:52:13 +00:00
SkippySteve commented 2026-11-24 06:55:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:29:33Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120198002 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/283#issuecomment-7120198002). Originally posted by [SkippySteve](https://github.com/SkippySteve) on 2026-11-24T02:29:33Z. --- superseded by #326 (combined shader DX/parser robustness)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!283
No description provided.