"a descriptor read only as data": programs read a buffer descriptor's record count and type word (419 shaders) #386

Open
opened 2026-11-27 16:08:54 +00:00 by derz92 · 2 comments
derz92 commented 2026-11-27 16:08:54 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T16:08:54Z.


Summary

"a descriptor read only as data" was the largest refusal cause in a world run on current main (177 distinct shaders on an M5 Max, Series S; table on #4). On a corpus of the 19,173 shaders that run registered, 690 refusals with that reason come from programs reading dword 2 or dword 3 of a buffer descriptor as numbers. The host's view addresses (t1, #306) hold only the base address, so the translator refuses those reads.

What the programs do with them (from the disassembly, not quoted here):

  • size a loop: dword 2 is NUM_RECORDS, which is what GetDimensions reads;
  • make a raw view of a structured buffer: keep dword 0, clear dword 1's stride (and 0xc000ffff), multiply the record count by the stride for the size in bytes (dword 1 bits 16-29 × dword 2), and set OOB_SELECT to raw in dword 3 (and 0xcfffffff, or 0x30000000). That's the same shape as #157's "stride cleared", reached through the view-address path because the program only reads that descriptor as data.

Proposed change

The host writes the console's buffer descriptor words into the view addresses (stride, record count, and a nominal dword 3: identity selects, RESOURCE_LEVEL 1, OOB_SELECT raw or structured), and the translator reads dwords 0-3 of a buffer descriptor from there. I have it working with 0 corpus regressions and will send a PR.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6650050814 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/386). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T16:08:54Z. --- ## Summary "a descriptor read only as data" was the largest refusal cause in a world run on current main (177 distinct shaders on an M5 Max, Series S; table on #4). On a corpus of the 19,173 shaders that run registered, 690 refusals with that reason come from programs reading **dword 2 or dword 3 of a buffer descriptor** as numbers. The host's view addresses (`t1`, #306) hold only the base address, so the translator refuses those reads. What the programs do with them (from the disassembly, not quoted here): - **size a loop:** dword 2 is `NUM_RECORDS`, which is what `GetDimensions` reads; - **make a raw view of a structured buffer:** keep dword 0, clear dword 1's stride (`and 0xc000ffff`), multiply the record count by the stride for the size in bytes (dword 1 bits 16-29 × dword 2), and set OOB_SELECT to raw in dword 3 (`and 0xcfffffff`, `or 0x30000000`). That's the same shape as #157's "stride cleared", reached through the view-address path because the program only reads that descriptor as data. ## Proposed change The host writes the console's buffer descriptor words into the view addresses (stride, record count, and a nominal dword 3: identity selects, RESOURCE_LEVEL 1, OOB_SELECT raw or structured), and the translator reads dwords 0-3 of a buffer descriptor from there. I have it working with 0 corpus regressions and will send a PR.
derz92 commented 2026-11-27 16:08:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-27T16:08:56Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7222913966 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/386#issuecomment-7222913966). Originally posted by [derz92](https://github.com/derz92) on 2026-11-27T16:08:56Z. --- /claim
github-actions[bot] commented 2026-11-27 16:09:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T16:09:07Z.


Claimed by @derz92. Open a draft pull request with Refs #386 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7222917647 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/386#issuecomment-7222917647). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T16:09:07Z. --- Claimed by @derz92. Open a draft pull request with `Refs #386` in its description within 24 hours, or the claim expires.
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
LakshanSivakumar/Native-Victory-macOS#386
No description provided.