Shaders: lower a single texture size dword read #69

Open
Artking175 wants to merge 2 commits from upstream-pr/69 into main
Artking175 commented 2026-11-25 09:08:54 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Artking175 on 2026-11-25T08:10:54Z.


A shader can read dword 2 of an eight-dword 2D texture descriptor with a single s_load_dword. The full-descriptor reload case already reconstructs this word from the host view's dimensions. A single-dword read used to miss that path.

Match the read to a proven 2D image use at the same traced address, including its root and computed term. Recover the base of the view from the scalar load's own operands, even if the full descriptor is loaded later. The existing image path reconstructs the upper width bits and height. An unrelated heap entry still gets the original refusal.

The synthetic shader reproduced “a descriptor read only as data” before the change. With the change it emits identical DXIL to a full reload at heap slots 0 and 1. A second test keeps the refusal for an unrelated entry. The Windows dispatch test uses two textures of different sizes and checks both the packed dimensions and the texel from the selected view.

Related to the diagnostic in #38 and #55. The logs do not establish that the title's reported shaders use this specific read.

Verified on macOS with 172 shader tests and 43 tests in the supporting crates. The diagnostics application and tests cross-check for Windows x64, and Windows-target Clippy is clean for the shader crate with all targets and features. The Windows dispatch test was compiled but not run.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6600098145 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/69). Originally posted by [Artking175](https://github.com/Artking175) on 2026-11-25T08:10:54Z. --- A shader can read dword 2 of an eight-dword 2D texture descriptor with a single `s_load_dword`. The full-descriptor reload case already reconstructs this word from the host view's dimensions. A single-dword read used to miss that path. Match the read to a proven 2D image use at the same traced address, including its root and computed term. Recover the base of the view from the scalar load's own operands, even if the full descriptor is loaded later. The existing image path reconstructs the upper width bits and height. An unrelated heap entry still gets the original refusal. The synthetic shader reproduced “a descriptor read only as data” before the change. With the change it emits identical DXIL to a full reload at heap slots 0 and 1. A second test keeps the refusal for an unrelated entry. The Windows dispatch test uses two textures of different sizes and checks both the packed dimensions and the texel from the selected view. Related to the diagnostic in #38 and #55. The logs do not establish that the title's reported shaders use this specific read. Verified on macOS with 172 shader tests and 43 tests in the supporting crates. The diagnostics application and tests cross-check for Windows x64, and Windows-target Clippy is clean for the shader crate with all targets and features. The Windows dispatch test was compiled but not run.
Bullet18x commented 2026-11-25 09:08:57 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Bullet18x on 2026-11-25T08:24:24Z.


Tested on an RTX 5090, stacked with #68, #36, #35 and #33. All three new texture_size_word_* tests pass on the card.

In game, these two pixel shaders still fail with the PR merged:

stage="pixel" hash=6b6db9f1a526daeb at 0x49dc: a descriptor read only as data is not supported
stage="pixel" hash=7d0f14ce44746d7e at 0x5204: a descriptor read only as data is not supported

Four more from the same family on main (2fd01fca16993001, 8660e9822ebe4b62, abc6a80d46edc294, c8df7216c69cecbd) weren't reached in the shorter run, so they're untested either way.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7156985694 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/69#issuecomment-7156985694). Originally posted by [Bullet18x](https://github.com/Bullet18x) on 2026-11-25T08:24:24Z. --- Tested on an RTX 5090, stacked with #68, #36, #35 and #33. All three new `texture_size_word_*` tests pass on the card. In game, these two pixel shaders still fail with the PR merged: ``` stage="pixel" hash=6b6db9f1a526daeb at 0x49dc: a descriptor read only as data is not supported stage="pixel" hash=7d0f14ce44746d7e at 0x5204: a descriptor read only as data is not supported ``` Four more from the same family on `main` (`2fd01fca16993001`, `8660e9822ebe4b62`, `abc6a80d46edc294`, `c8df7216c69cecbd`) weren't reached in the shorter run, so they're untested either way.
iGoldenNinja commented 2026-11-25 09:08:58 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by iGoldenNinja on 2026-11-25T08:45:48Z.


I reproduced this on an RTX 5080 with driver 617.14, Windows 11 Pro 25H2 build 26200.9974. Clean head 0cad4faaaebe1b504d464aa9c7bcb269432cb53e passed all three texture_size_word tests, including the D3D12 readback with no adapter skips.

With clean main 90b529f as the control, I translated the two exact pixel programs from Bullet18x's report on both revisions. 6b6db9f1a526daeb and 7d0f14ce44746d7e both reached I/O analysis and were refused during emission with a descriptor read only as data on both revisions. I used offline translation for this comparison.

The same two programs previously emitted, validated and created pipelines with the NVIDIA fork's broader PR 203 descriptor-data lowering. The report links the earlier comparison for anyone tracing these refusals. Pinned RTX 5080 report

<!-- greyfinch-sync:Zettrox/ztrx:comment:7157439050 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/69#issuecomment-7157439050). Originally posted by [iGoldenNinja](https://github.com/iGoldenNinja) on 2026-11-25T08:45:48Z. --- I reproduced this on an RTX 5080 with driver 617.14, Windows 11 Pro 25H2 build 26200.9974. Clean head `0cad4faaaebe1b504d464aa9c7bcb269432cb53e` passed all three `texture_size_word` tests, including the D3D12 readback with no adapter skips. With clean main `90b529f` as the control, I translated the two exact pixel programs from Bullet18x's report on both revisions. `6b6db9f1a526daeb` and `7d0f14ce44746d7e` both reached I/O analysis and were refused during emission with `a descriptor read only as data` on both revisions. I used offline translation for this comparison. The same two programs previously emitted, validated and created pipelines with the NVIDIA fork's broader PR 203 descriptor-data lowering. The report links the earlier comparison for anyone tracing these refusals. [Pinned RTX 5080 report](https://github.com/iGoldenNinja/victory-fork/blob/27fedf8edbb39302950a81e80b3a9ed40eb11d1e/docs/ztrx-pr69-5080.md)
Artking175 commented 2026-11-25 09:08:58 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Artking175 on 2026-11-25T08:59:41Z.


@iGoldenNinja Thanks for the clean-head comparison on the RTX 5080 and the link to victory-fork #203. The update in 811d2ca handles the reported full eight-dword pixel descriptor load used for dimensions without an image access. It reuses the 2D size reconstruction when the load is traced to a resource heap or table and the metadata, when present, identifies an eight-dword SRV.

Could you rerun the same offline comparison against this head for 6b6db9f1a526daeb and 7d0f14ce44746d7e? The useful result for each hash is whether it emits, validates, and creates a D3D12 pipeline, or the new error and offset.

The combined retest branch also has VICTORY_REFUSAL_CONTEXT=1 for text-only notes about the source load if the refusal persists. No shader files are needed in the reply.

Locally, the new synthetic case reproduced the old refusal on the previous PR head and emitted after the fix. The shader suite passed 174 tests with 2 ignored, and Windows x64 Clippy passed. The two title shaders still need your offline check.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7157733893 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/69#issuecomment-7157733893). Originally posted by [Artking175](https://github.com/Artking175) on 2026-11-25T08:59:41Z. --- @iGoldenNinja Thanks for the clean-head comparison on the RTX 5080 and the link to [victory-fork #203](https://github.com/fxceless/victory-fork/pull/203). The update in `811d2ca` handles the reported full eight-dword pixel descriptor load used for dimensions without an image access. It reuses the 2D size reconstruction when the load is traced to a resource heap or table and the metadata, when present, identifies an eight-dword SRV. Could you rerun the same offline comparison against this head for `6b6db9f1a526daeb` and `7d0f14ce44746d7e`? The useful result for each hash is whether it emits, validates, and creates a D3D12 pipeline, or the new error and offset. The [combined retest branch](https://github.com/Artking175/ztrx/tree/shader-refusal-retest) also has `VICTORY_REFUSAL_CONTEXT=1` for text-only notes about the source load if the refusal persists. No shader files are needed in the reply. Locally, the new synthetic case reproduced the old refusal on the previous PR head and emitted after the fix. The shader suite passed 174 tests with 2 ignored, and Windows x64 Clippy passed. The two title shaders still need your offline check.
iGoldenNinja commented 2026-11-25 09:08:58 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by iGoldenNinja on 2026-11-25T09:08:31Z.


@Artking175 I reran the requested offline comparison on clean 811d2ca654a9f3b0f4947fd79a9ac185691cdf03. RTX 5080, driver 617.14, Windows 11 Pro 25H2 build 26200.9974. I used the same two shader inputs and translate --jobs 1 --validate --pipelines --list.

Program Emitted DXIL Validated D3D12 pipeline
6b6db9f1a526daeb Yes Yes Created
7d0f14ce44746d7e Yes Yes Created

Both programs were refused during emission on the prior head 0cad4fa. All five descriptor_tests passed on the new head, including the hardware and WARP readback fixture with no skips. This retest reached offline pipeline creation. Updated pinned comparison

<!-- greyfinch-sync:Zettrox/ztrx:comment:7157929762 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/69#issuecomment-7157929762). Originally posted by [iGoldenNinja](https://github.com/iGoldenNinja) on 2026-11-25T09:08:31Z. --- @Artking175 I reran the requested offline comparison on clean `811d2ca654a9f3b0f4947fd79a9ac185691cdf03`. RTX 5080, driver 617.14, Windows 11 Pro 25H2 build 26200.9974. I used the same two shader inputs and `translate --jobs 1 --validate --pipelines --list`. | Program | Emitted DXIL | Validated | D3D12 pipeline | | --- | --- | --- | --- | | `6b6db9f1a526daeb` | Yes | Yes | Created | | `7d0f14ce44746d7e` | Yes | Yes | Created | Both programs were refused during emission on the prior head `0cad4fa`. All five `descriptor_tests` passed on the new head, including the hardware and WARP readback fixture with no skips. This retest reached offline pipeline creation. [Updated pinned comparison](https://github.com/iGoldenNinja/victory-fork/blob/c639e4918f1b7eef0dde32e8762f1f93db8fe2e4/docs/ztrx-pr69-5080.md)
Artking175 commented 2026-11-25 16:13:09 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Artking175 on 2026-11-25T16:08:38Z.


Offline retest on RTX 2060 (driver 531.41), with app-local Agility SDK 1.608.2 and DXIL validator from DXC 1.8.2505.32. I ran translate --jobs 1 --validate --pipelines --list on the same local 1.0.2.1 shader archive.

All six PS_PuddleDetect containers were refused at emission on main (90b529f) with a descriptor read only as data. On the exact PR revision 811d2ca, all six emitted DXIL, passed validation and created D3D12 PSOs.

  • Previously reported on RTX 5080 and now reproduced on RTX 2060 — 6b6db9f1a526daeb, 7d0f14ce44746d7e.
  • Four additional confirmed inputs — 2fd01fca16993001, 8660e9822ebe4b62, abc6a80d46edc294, c8df7216c69cecbd.
<!-- greyfinch-sync:Zettrox/ztrx:comment:7167630907 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/69#issuecomment-7167630907). Originally posted by [Artking175](https://github.com/Artking175) on 2026-11-25T16:08:38Z. --- Offline retest on RTX 2060 (driver 531.41), with app-local Agility SDK 1.608.2 and DXIL validator from DXC 1.8.2505.32. I ran `translate --jobs 1 --validate --pipelines --list` on the same local 1.0.2.1 shader archive. All six `PS_PuddleDetect` containers were refused at emission on `main` (`90b529f`) with `a descriptor read only as data`. On the exact PR revision `811d2ca`, all six emitted DXIL, passed validation and created D3D12 PSOs. - Previously reported on RTX 5080 and now reproduced on RTX 2060 — `6b6db9f1a526daeb`, `7d0f14ce44746d7e`. - Four additional confirmed inputs — `2fd01fca16993001`, `8660e9822ebe4b62`, `abc6a80d46edc294`, `c8df7216c69cecbd`.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/69:upstream-pr/69'
git switch 'upstream-pr/69'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/69'
git switch 'upstream-pr/69'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/69'
git switch 'upstream-pr/69'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/69'
git switch 'main'
git merge --squash 'upstream-pr/69'
git switch 'main'
git merge --ff-only 'upstream-pr/69'
git switch 'main'
git merge 'upstream-pr/69'
git push origin 'main'
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
Zettrox/ztrx!69
No description provided.