Skip to content

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

Closed
SkippySteve wants to merge 1 commit into
Marvisak:mainfrom
SkippySteve:SkippySteve/victory-pr-own-next14
Closed

SkippySteve wants to merge 1 commit into
Marvisak:mainfrom
SkippySteve:SkippySteve/victory-pr-own-next14

Conversation

@SkippySteve

@SkippySteve SkippySteve commented Nov 24, 2026 •

Copy link
Copy Markdown

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.
@SkippySteve

Copy link
Copy Markdown
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant