10 pixel programs stop with "a hardware SGPR input": they use ordered pixel shading (POPS); a translation needs rasterizer-ordered views #721

Closed
opened 2026-11-26 03:49:42 +00:00 by github-bot · 1 comment
Owner

@⁠JRamos1993 on GitHub · 2026-11-25 05:38 UTC · original

10 pixel programs of the retail pack stop with emit: a hardware SGPR input. All 10 use ordered pixel shading (POPS), and a faithful translation needs rasterizer-ordered views.

Where: main 310c6eb, offline victory translate --validate --list over the title's shader pack. These are the 10 "a hardware SGPR input" programs in the census tables on #279.

What the SGPR is: in all 10 it is s18, read on entry. That is past the root signature's user data, which is s8–s16 in these programs. Lower::inputs has no input for it, and initialized_sgprs is unknown for a pixel program.

What the 10 programs do with it. The pattern is the same in all 10:

  1. Read s18 as bitfields: s_bfe_u32 of bits 0–9, 16–25 and 28–29, and s_lshr_b32 …, 31. That is the layout of the POPS collision-wave-ID SGPR: two wave IDs, the packer ID, and a flag for an overlap with earlier waves.
  2. Write HW_REG_POPS_PACKER with s_setreg_b32.
  3. Wait in a loop on src_pops_exiting_wave_id, until the overlapping earlier waves have left.
  4. Read and write 2D textures, 5 image_store and image_load … glc dlc. This is the ordered section.
  5. End the section with s_sendmsg sendmsg(MSG_ORDERED_PS_DONE).

So these are read-modify-write passes that rely on per-pixel primitive order.

What a translation needs. In D3D12 terms this is rasterizer-ordered access:

  • The ordered section's textures as ROVs: the views read and written there declared as RasterizerOrderedTexture2D (the DXIL resource with the ROV flag). D3D12 then orders the accesses per pixel, as the console's packer does.
  • The prologue and epilogue as no-ops:
    • s18 read as 0 (bit 31 clear: nothing to wait for);
    • the POPS_PACKER write ignored;
    • src_pops_exiting_wave_id given a value that ends the loop at once;
    • MSG_ORDERED_PS_DONE dropped.

A shortcut with the prologue dropped but no ROVs would translate the 10 programs, but would leave overlapping pixels' read-modify-write unordered. That gives flicker or wrong blends where primitives overlap. It would still beat dropping the draws only if the maintainers accept that trade-off.

Not done: I have not written either version. I have not checked which views the ordered section touches beyond the instruction counts above. These programs are not reached in the scene my save gets to, so nothing was checked in game.

AI use: Claude Code with Claude Opus 5.5 found the class on the retail pack, read the programs' disassembly on my machine and wrote this. No title bytes, names or offsets are included.

**@⁠JRamos1993** on GitHub · 2026-11-25 05:38 UTC · [original](https://github.com/fxceless/victory-fork/issues/721) **10 pixel programs of the retail pack stop with `emit: a hardware SGPR input`. All 10 use ordered pixel shading (POPS), and a faithful translation needs rasterizer-ordered views.** **Where:** `main` `310c6eb`, offline `victory translate --validate --list` over the title's shader pack. These are the 10 "a hardware SGPR input" programs in the census tables on #279. **What the SGPR is:** in all 10 it is `s18`, read on entry. That is past the root signature's user data, which is `s8`–`s16` in these programs. `Lower::inputs` has no input for it, and `initialized_sgprs` is unknown for a pixel program. **What the 10 programs do with it.** The pattern is the same in all 10: 1. **Read `s18` as bitfields:** `s_bfe_u32` of bits 0–9, 16–25 and 28–29, and `s_lshr_b32 …, 31`. That is the layout of the POPS collision-wave-ID SGPR: two wave IDs, the packer ID, and a flag for an overlap with earlier waves. 2. **Write `HW_REG_POPS_PACKER`** with `s_setreg_b32`. 3. **Wait** in a loop on `src_pops_exiting_wave_id`, until the overlapping earlier waves have left. 4. **Read and write 2D textures**, 5 `image_store` and `image_load … glc dlc`. This is the ordered section. 5. **End the section** with `s_sendmsg sendmsg(MSG_ORDERED_PS_DONE)`. So these are read-modify-write passes that rely on per-pixel primitive order. **What a translation needs.** In D3D12 terms this is rasterizer-ordered access: - **The ordered section's textures as ROVs:** the views read and written there declared as `RasterizerOrderedTexture2D` (the DXIL resource with the ROV flag). D3D12 then orders the accesses per pixel, as the console's packer does. - **The prologue and epilogue as no-ops:** - `s18` read as 0 (bit 31 clear: nothing to wait for); - the `POPS_PACKER` write ignored; - `src_pops_exiting_wave_id` given a value that ends the loop at once; - `MSG_ORDERED_PS_DONE` dropped. A shortcut with the prologue dropped but no ROVs would translate the 10 programs, but would leave overlapping pixels' read-modify-write unordered. That gives flicker or wrong blends where primitives overlap. It would still beat dropping the draws only if the maintainers accept that trade-off. **Not done:** I have not written either version. I have not checked which views the ordered section touches beyond the instruction counts above. These programs are not reached in the scene my save gets to, so nothing was checked in game. AI use: Claude Code with Claude Opus 5.5 found the class on the retail pack, read the programs' disassembly on my machine and wrote this. No title bytes, names or offsets are included.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:49:42 +00:00
Author
Owner

@⁠JRamos1993 on GitHub · 2026-11-25 06:11 UTC · original

Closing: #215 already lowers the ordered section as rasterizer-ordered UAVs. I missed it when I checked (I searched issues, not pull requests). Measured on the retail pack, #215 merged onto main 310c6eb validates all 10 of these programs and loses none: #215

**@⁠JRamos1993** on GitHub · 2026-11-25 06:11 UTC · [original](https://github.com/fxceless/victory-fork/issues/721#issuecomment-7154537715) Closing: #215 already lowers the ordered section as rasterizer-ordered UAVs. I missed it when I checked (I searched issues, not pull requests). Measured on the retail pack, #215 merged onto `main` `310c6eb` validates all 10 of these programs and loses none: https://git.gtahub.st/github/fxceless--victory-fork/pulls/215
This discussion has been locked. Commenting is limited to contributors.
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/fxceless--victory-fork#721
No description provided.