shader: translate mesh image_load through a full table descriptor #3758

Merged
lambirou merged 6 commits from upstream-pr/3758 into main 2026-12-02 18:43:13 +00:00
lambirou commented 2026-12-01 16:26:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T16:26:46Z.


The slot 57 capture req_72e1909e13df6f66.m57 contains
image_load v[19:21], v11, s[56:63] dmask:0x7 dim:SQ_RSRC_IMG_1D unorm at +0x700, fed by the eight-dword resource-heap fetch at +0x614. That is a complete guest V#, not a texture heap slot-map record, so the slot-map branch refuses it.

This adds a mesh image branch for the full-V# form when !layout.texture_heap_slot_map: op 0, 1D, dmask 0x7, UNORM, no LWE/TFE/R128/reserved bits, eight contiguous descriptor words sharing one fetch pc and a destination inside the VGPR range. The words stay symbolic; the fetch is identified by heap_fetches or heap_descriptor_slots. createHandleFromHeap(slot) is annotated Texture1D { 1, 1033 } and textureLoad.f32 reads mip 0 at the VGPR coordinate. Four channels, other dimensions, missing UNORM and an overwritten word keep refusing.

Boundary. On the real capture, #3754's corrected head refuses at +0x69c: unbound numeric SGPR s57: s_bfe_u32 s22, s57, 0x2001e reads descriptor word 1 to build the image coordinate. The full-V# branch is covered by source-built fixtures with a constant coordinate; reaching +0x700 needs a contract that supplies the real V# field bits. The earlier +0x7c0 observation belonged to the slot-materialising draft and no longer applies.

Tests: mesh-image-full-descriptor (root selector), mesh-image-full-descriptor-root, -gpu, mesh-image-four-channel-without-map and mesh-image-unsupported-dimension; the descriptor-word reads still refuse as unbound numeric SGPR s33 / s37.

Validation on b4c5697a (based on #3754 6102db88):

  • cmake --build --preset release --target compile_dxil
  • python -B tests/native_direct_mesh_check.py ... — pass.
  • ctest --preset release --no-tests=error -R '^native_direct' — 2/2 passed.
  • Real capture: +0x69c: unbound numeric SGPR s57.

Refs #3497

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5589881014 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3758). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-01T16:26:46Z. --- The slot 57 capture `req_72e1909e13df6f66.m57` contains `image_load v[19:21], v11, s[56:63] dmask:0x7 dim:SQ_RSRC_IMG_1D unorm` at `+0x700`, fed by the eight-dword resource-heap fetch at `+0x614`. That is a complete guest V#, not a texture heap slot-map record, so the slot-map branch refuses it. This adds a mesh image branch for the full-V# form when `!layout.texture_heap_slot_map`: op 0, 1D, dmask 0x7, UNORM, no LWE/TFE/R128/reserved bits, eight contiguous descriptor words sharing one fetch pc and a destination inside the VGPR range. The words stay symbolic; the fetch is identified by `heap_fetches` or `heap_descriptor_slots`. `createHandleFromHeap(slot)` is annotated Texture1D `{ 1, 1033 }` and `textureLoad.f32` reads mip 0 at the VGPR coordinate. Four channels, other dimensions, missing UNORM and an overwritten word keep refusing. **Boundary.** On the real capture, #3754's corrected head refuses at `+0x69c: unbound numeric SGPR s57`: `s_bfe_u32 s22, s57, 0x2001e` reads descriptor word 1 to build the image coordinate. The full-V# branch is covered by source-built fixtures with a constant coordinate; reaching `+0x700` needs a contract that supplies the real V# field bits. The earlier `+0x7c0` observation belonged to the slot-materialising draft and no longer applies. Tests: `mesh-image-full-descriptor` (root selector), `mesh-image-full-descriptor-root`, `-gpu`, `mesh-image-four-channel-without-map` and `mesh-image-unsupported-dimension`; the descriptor-word reads still refuse as `unbound numeric SGPR s33` / `s37`. Validation on `b4c5697a` (based on #3754 `6102db88`): - `cmake --build --preset release --target compile_dxil` - `python -B tests/native_direct_mesh_check.py ...` — pass. - `ctest --preset release --no-tests=error -R '^native_direct'` — 2/2 passed. - Real capture: `+0x69c: unbound numeric SGPR s57`. Refs #3497
R0Y00 commented 2026-12-01 17:05:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-01T17:05:20Z.


The current head's Windows build/test job failed in Configure, build and run PC tests, while both Linux jobs passed. This also depends on #3754. Please refresh the branch after the descriptor-load change is resolved and rerun Windows CI.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7318733177 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3758#issuecomment-7318733177). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-01T17:05:20Z. --- The current head's Windows build/test job failed in `Configure, build and run PC tests`, while both Linux jobs passed. This also depends on #3754. Please refresh the branch after the descriptor-load change is resolved and rerun Windows CI.
lambirou commented 2026-12-01 22:44:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T22:44:33Z.


Rebased onto #3754's corrected head 6102db88.

The descriptor words stay symbolic: #3754 records only bytes >> 5 for an op 3 fetch, and this branch identifies the fetch through heap_fetches (root-proven) or heap_descriptor_slots (GPU-selected). The image branch no longer requires projected_numeric, and the eight-word equality check keeps offsets 0, 4, ..., 28 without inventing field bits.

The dmask-0x7 root and GPU-selected forms now lower (mesh-image-full-descriptor, -root, -gpu); four channels, 2D and an overwritten word keep refusing. Descriptor-word reads still refuse as unbound numeric SGPR s33 / s37.

Validation on 92b0a153:

  • python -B tests/native_direct_mesh_check.py ... — pass.
  • ctest --preset release --no-tests=error -R '^native_direct' — 2/2 passed.
  • The head is based on 6102db88, not the old 4dd116c4.

The Windows job should now run against the corrected stack; I'll check the result.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7328269695 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3758#issuecomment-7328269695). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-01T22:44:33Z. --- Rebased onto #3754's corrected head `6102db88`. The descriptor words stay symbolic: #3754 records only `bytes >> 5` for an op 3 fetch, and this branch identifies the fetch through `heap_fetches` (root-proven) or `heap_descriptor_slots` (GPU-selected). The image branch no longer requires `projected_numeric`, and the eight-word equality check keeps offsets 0, 4, ..., 28 without inventing field bits. The dmask-0x7 root and GPU-selected forms now lower (`mesh-image-full-descriptor`, `-root`, `-gpu`); four channels, 2D and an overwritten word keep refusing. Descriptor-word reads still refuse as `unbound numeric SGPR s33` / `s37`. Validation on `92b0a153`: - `python -B tests/native_direct_mesh_check.py ...` — pass. - `ctest --preset release --no-tests=error -R '^native_direct'` — 2/2 passed. - The head is based on `6102db88`, not the old `4dd116c4`. The Windows job should now run against the corrected stack; I'll check the result. AI-assisted.
R0Y00 commented 2026-12-02 01:51:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T01:51:10Z.


Current CI is green. Before merging this stack, please add a runtime binding control for the unmapped createHandleFromHeap path. The GPU-derived selector path records no mesh_heap_reads; slot 57's direct-heap path currently requires a nonempty guard list. The root-derived path records a slot guard, but the fixture needs to establish that the runtime supplies a compatible Texture1D descriptor rather than only validating offline DXIL.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7332181115 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3758#issuecomment-7332181115). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T01:51:10Z. --- Current CI is green. Before merging this stack, please add a runtime binding control for the unmapped `createHandleFromHeap` path. The GPU-derived selector path records no `mesh_heap_reads`; slot 57's direct-heap path currently requires a nonempty guard list. The root-derived path records a slot guard, but the fixture needs to establish that the runtime supplies a compatible Texture1D descriptor rather than only validating offline DXIL.
lambirou commented 2026-12-02 14:45:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-02T14:45:11Z.

Review: COMMENTED


Reviewed b4c5697a against #3754; read the mesh image branch and its source-built controls, not built here.

Verdict: approve. The full-V# branch is deliberately narrow: 1D, UNORM, dmask 0x7, no modifiers, eight contiguous symbolic descriptor words from one fetch, a destination inside the VGPR range, and either a root-proven or GPU-selected heap slot. The four-channel and 2D controls still refuse, and the symbolic descriptor-word refusals are preserved.

  • SHOULD The emitted handle is annotated Texture1D { 1, 1033 } without inspecting the guest V# format words. The branch accepts any symbolic eight-word descriptor with the right fetch shape, so a different UNORM 1D format would get the wrong DXIL annotation. Either check the descriptor format words once the contract supplies them, or name the exact format as a precondition of this profile and refuse the rest.
  • NIT The branch requires a destination i.dst <= 252 for three channels, which is correct; make the comment say three destination VGPRs so a later four-channel extension does not copy the wrong bound.
  • Checked, no finding: the eight words must be the same symbol with offsets 0..28 and no overwrite; the fetch must be recorded in heap_fetches or heap_descriptor_slots; a root selector requires an unmasked root value and a GPU selector uses the stored slot; textureLoad.f32 reads mip 0 at the coordinate and writes three integer channels. The controls cover root, GPU-selected, four-channel and 2D refusals.

The PR is stacked on #3754 and currently conflicts with main; the translation itself remains a slice with the stated descriptor-contract limit.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6153060686 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3758#pullrequestreview-6153060686). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-02T14:45:11Z. **Review:** COMMENTED --- Reviewed `b4c5697a` against #3754; read the mesh image branch and its source-built controls, not built here. **Verdict: approve.** The full-V# branch is deliberately narrow: 1D, UNORM, dmask 0x7, no modifiers, eight contiguous symbolic descriptor words from one fetch, a destination inside the VGPR range, and either a root-proven or GPU-selected heap slot. The four-channel and 2D controls still refuse, and the symbolic descriptor-word refusals are preserved. - **SHOULD** The emitted handle is annotated `Texture1D { 1, 1033 }` without inspecting the guest V# format words. The branch accepts any symbolic eight-word descriptor with the right fetch shape, so a different UNORM 1D format would get the wrong DXIL annotation. Either check the descriptor format words once the contract supplies them, or name the exact format as a precondition of this profile and refuse the rest. - **NIT** The branch requires a destination `i.dst <= 252` for three channels, which is correct; make the comment say three destination VGPRs so a later four-channel extension does not copy the wrong bound. - Checked, no finding: the eight words must be the same symbol with offsets 0..28 and no overwrite; the fetch must be recorded in `heap_fetches` or `heap_descriptor_slots`; a root selector requires an unmasked root value and a GPU selector uses the stored slot; `textureLoad.f32` reads mip 0 at the coordinate and writes three integer channels. The controls cover root, GPU-selected, four-channel and 2D refusals. The PR is stacked on #3754 and currently conflicts with main; the translation itself remains a slice with the stated descriptor-contract limit.
R0Y00 commented 2026-12-02 15:49:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T15:49:18Z.

Review: COMMENTED


#3754 has landed. Merging the current stacked branch into main conflicts in tests/native_direct_mesh_check.py. I applied only the #3758 delta (3fc816da..1587d78a) to f09547cd in an isolated checkout. It applied cleanly across the three owned files and ctest --preset dev --no-tests=error -j 1 -R '^native_direct_mesh$' --output-on-failure passed 1/1 on MSVC Debug. Please update this PR with only the two #3758 commits on current main and remove the extra blank line at the end of docs/experiments/native-mesh-image-load.md. The tested tree was local; the PR branch is unchanged.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6154243936 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3758#pullrequestreview-6154243936). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T15:49:18Z. **Review:** COMMENTED --- #3754 has landed. Merging the current stacked branch into main conflicts in `tests/native_direct_mesh_check.py`. I applied only the #3758 delta (`3fc816da..1587d78a`) to `f09547cd` in an isolated checkout. It applied cleanly across the three owned files and `ctest --preset dev --no-tests=error -j 1 -R '^native_direct_mesh$' --output-on-failure` passed 1/1 on MSVC Debug. Please update this PR with only the two #3758 commits on current main and remove the extra blank line at the end of `docs/experiments/native-mesh-image-load.md`. The tested tree was local; the PR branch is unchanged.
R0Y00 commented 2026-12-02 18:43:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T18:43:05Z.

Review: APPROVED


Re-reviewed 12e869e6 after the main update. The three-file change keeps the full-descriptor path restricted to the proven 1D UNORM dmask 0x7 case and preserves the selected-descriptor refusal control with the updated diagnostic. Independent Windows/MSVC Debug cmake --build --preset dev --target compile_dxil and ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^native_direct_mesh$' passed (1/1, source-built compiler checks). The trial merge into 78cee9cb was clean.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6156723881 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3758#pullrequestreview-6156723881). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T18:43:05Z. **Review:** APPROVED --- Re-reviewed 12e869e6 after the main update. The three-file change keeps the full-descriptor path restricted to the proven 1D UNORM dmask 0x7 case and preserves the selected-descriptor refusal control with the updated diagnostic. Independent Windows/MSVC Debug `cmake --build --preset dev --target compile_dxil` and `ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^native_direct_mesh$'` passed (1/1, source-built compiler checks). The trial merge into 78cee9cb was clean.
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
R0Y00/Xbox2Windows!3758
No description provided.