startup: pixel-stage raw buffer loads through the structured-to-raw descriptor conversion are refused as "modified descriptor" since #2910 #3064

Open
opened 2026-11-27 13:23:43 +00:00 by SimSalabimse · 0 comments
SimSalabimse commented 2026-11-27 13:23:43 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T13:23:43Z.


Since #2910 (Stage.load_descriptor()), a non-indexed MUBUF load in a pixel stage through a descriptor that went through the standard structured-to-raw conversion is refused with buffer load through a modified descriptor:

  • s_and_b32 sX, w1, 0xc000ffff (stride 0)
  • s_mul_i32 sY, w2, <stride from s_bfe_u32 w1, 0xe0010> (byte count)
  • s_and_b32 sZ, w3, 0xcfffffff then s_or_b32 sZ, sZ, 0x30000000 (OOB_SELECT raw)

load_descriptor() already accepts this shape (stride0_ok / raw_conversion_ok), but raw_descriptor_alu() is only consulted for kind in ('cs', 'vs'). In a pixel stage the same edits take the generic path, which marks the key in other_modified, so the load is refused even when the conversion is exact. Compute stores (#2546) and vertex stores (#2570) got this conversion earlier. The pixel stage is the remaining gap.

Local capture at main 35f7197e (counts and instruction shapes only; the inputs are private and not attached):

  • 293 of 536 ordinary VS/PS pipeline requests stop first at this refusal. 292 of them make these edits in the pixel stage.
  • If 'ps' is added to the raw_descriptor_alu kind gate, 257 pass the load check. 36 are still refused because the words the load reads form only part of the conversion (stride 0 and OOB raw, with word 2 not the scaled byte count).
  • On their own, these changes complete no pipelines in this set. The next refusals are wave reduction in a program with branches (107), pixel DPP outside the entry prefix (45) and others. This fix moves a gate that every one of those later fixes has to pass first.

Claiming: I'll make the pixel-stage fix in tools/startup/gfx2hlsl.py:

  1. Track the four conversion words in the pixel stage, as is already done for compute and vertex stages.
  2. Lower the load as a raw byte-address read bounded by NUM_RECORDS * stride.
  3. Leave in-place rewrites, partial shapes and idxen loads refused under their current messages.

Tests (source-built only):

  • A pixel program that converts a table descriptor and reads it with buffer_load_dword ... offen. A draw readback is compared against a CPU model, on WARP and on a hardware adapter.
  • Negative controls, each refused by name: byte count missing, OOB step missing, in-place word rewrite, and an idxen load.
  • A mutant that drops 'ps' from the gate must turn the fixture red.
  • Windows ctest --preset dev --no-tests=error -j 1 on the affected startup_gfx2hlsl_* entries.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6647317224 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3064). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-27T13:23:43Z. --- Since #2910 (`Stage.load_descriptor()`), a non-indexed MUBUF load in a **pixel** stage through a descriptor that went through the standard structured-to-raw conversion is refused with `buffer load through a modified descriptor`: - `s_and_b32 sX, w1, 0xc000ffff` (stride 0) - `s_mul_i32 sY, w2, <stride from s_bfe_u32 w1, 0xe0010>` (byte count) - `s_and_b32 sZ, w3, 0xcfffffff` then `s_or_b32 sZ, sZ, 0x30000000` (OOB_SELECT raw) `load_descriptor()` already accepts this shape (`stride0_ok` / `raw_conversion_ok`), but `raw_descriptor_alu()` is only consulted for `kind in ('cs', 'vs')`. In a pixel stage the same edits take the generic path, which marks the key in `other_modified`, so the load is refused even when the conversion is exact. Compute stores (#2546) and vertex stores (#2570) got this conversion earlier. The pixel stage is the remaining gap. **Local capture at main `35f7197e` (counts and instruction shapes only; the inputs are private and not attached):** - 293 of 536 ordinary VS/PS pipeline requests stop first at this refusal. 292 of them make these edits in the pixel stage. - If `'ps'` is added to the `raw_descriptor_alu` kind gate, 257 pass the load check. 36 are still refused because the words the load reads form only part of the conversion (stride 0 and OOB raw, with word 2 not the scaled byte count). - On their own, these changes complete no pipelines in this set. The next refusals are `wave reduction in a program with branches` (107), pixel DPP outside the entry prefix (45) and others. This fix moves a gate that every one of those later fixes has to pass first. **Claiming:** I'll make the pixel-stage fix in `tools/startup/gfx2hlsl.py`: 1. Track the four conversion words in the pixel stage, as is already done for compute and vertex stages. 2. Lower the load as a raw byte-address read bounded by `NUM_RECORDS * stride`. 3. Leave in-place rewrites, partial shapes and `idxen` loads refused under their current messages. **Tests (source-built only):** - A pixel program that converts a table descriptor and reads it with `buffer_load_dword ... offen`. A draw readback is compared against a CPU model, on WARP and on a hardware adapter. - Negative controls, each refused by name: byte count missing, OOB step missing, in-place word rewrite, and an `idxen` load. - A mutant that drops `'ps'` from the gate must turn the fixture red. - Windows `ctest --preset dev --no-tests=error -j 1` on the affected `startup_gfx2hlsl_*` entries. AI-Assisted
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#3064
No description provided.