startup: pixel-stage resource-heap image record in gfx2hlsl (translator and manifest) #2753

Closed
tedin7 wants to merge 2 commits from upstream-pr/2761 into main
tedin7 commented 2026-11-26 06:32:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T06:32:49Z.


Part of #1723

What this unblocks: a pixel program that loads an image descriptor through the resource heap (s_load_dwordx8 at index << 5) now translates, with the record named in the manifest instead of refused. The translator and manifest only: the draw-time binding of that record is a separate slice, so no draw uses it yet.
Source: AMD "RDNA 2" Instruction Set Architecture reference guide, SMEM instruction S_LOAD_DWORDX8 (image resource descriptor load); Microsoft DirectX-Specs, D3D12 resource binding specification, descriptor heaps.

What changed (tools/startup/gfx2hlsl.py):

  • heap_record now serves the pixel stage: eight dwords (the image record) there, four (the buffer record) in compute. Other widths and the vertex stage keep their refusals.
  • The index may be a root constant word with an alignment mask (s_and_b32 word, -16) before it becomes a byte offset of an s_buffer_load from a table buffer. The mark carries through a literal s_add; an s_mul of a masked word is not named. Pixel stage only, because the compute dispatch does not read a mask.
  • The manifest word mask M is written by a shared heap_where helper (graphics and compute use the same text). Two-hop index chains (an index read from a non-table buffer) stay refused by name.

Tests: new startup_gfx2hlsl_pixel_heap_image (x8 record, x4 and compute-x8 refusals, mask marks, multiply refusal, manifest words) and an updated control in startup_gfx2hlsl_heap_record.

Verification (Linux only, no Win2025 run yet):

  • python3 -B tests/startup_gfx2hlsl_pixel_heap_image_check.py: PASS
  • python3 -B tests/startup_gfx2hlsl_heap_record_check.py: PASS
  • python3 -B tests/startup_gfx2hlsl_heap_word_check.py: PASS
  • 173 existing translation shapes compared against origin/main: all unchanged
  • remote_pycheck.sh --compare origin/main: no new failures

Draft until an independent review and a Win2025 run.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6620977487 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2761). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T06:32:49Z. --- Part of #1723 What this unblocks: a pixel program that loads an image descriptor through the resource heap (`s_load_dwordx8` at index << 5) now translates, with the record named in the manifest instead of refused. The translator and manifest only: the draw-time binding of that record is a separate slice, so no draw uses it yet. Source: AMD "RDNA 2" Instruction Set Architecture reference guide, SMEM instruction S_LOAD_DWORDX8 (image resource descriptor load); Microsoft DirectX-Specs, D3D12 resource binding specification, descriptor heaps. What changed (`tools/startup/gfx2hlsl.py`): - `heap_record` now serves the pixel stage: eight dwords (the image record) there, four (the buffer record) in compute. Other widths and the vertex stage keep their refusals. - The index may be a root constant word with an alignment mask (`s_and_b32 word, -16`) before it becomes a byte offset of an `s_buffer_load` from a table buffer. The mark carries through a literal `s_add`; an `s_mul` of a masked word is not named. Pixel stage only, because the compute dispatch does not read a mask. - The manifest word `mask M` is written by a shared `heap_where` helper (graphics and compute use the same text). Two-hop index chains (an index read from a non-table buffer) stay refused by name. Tests: new `startup_gfx2hlsl_pixel_heap_image` (x8 record, x4 and compute-x8 refusals, mask marks, multiply refusal, manifest words) and an updated control in `startup_gfx2hlsl_heap_record`. Verification (Linux only, no Win2025 run yet): - `python3 -B tests/startup_gfx2hlsl_pixel_heap_image_check.py`: PASS - `python3 -B tests/startup_gfx2hlsl_heap_record_check.py`: PASS - `python3 -B tests/startup_gfx2hlsl_heap_word_check.py`: PASS - 173 existing translation shapes compared against `origin/main`: all unchanged - `remote_pycheck.sh --compare origin/main`: no new failures Draft until an independent review and a Win2025 run. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 11:02:45 +00:00
tedin7 commented 2026-11-26 11:02:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T10:12:43Z.


Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7189057754 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2761#issuecomment-7189057754). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T10:12:43Z. --- Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.

Pull request closed

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!2753
No description provided.