startup: 1D image sampling refuses the explicit-level forms (2 of 29 loading-screen shader refusals) #1714

Closed
opened 2026-11-24 17:49:14 +00:00 by triggered02 · 0 comments
triggered02 commented 2026-11-24 17:49:14 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T17:49:14Z.


Found while triaging the refusals in the first main-game loading-screen shader cache (#870). 2 of 29 refused shaders.

Problem

A 1D image has one coordinate, and image_sample_lz / image_sample_l carry the explicit level in the next address dword. The translator accepted 1D only for the implicit-level image_sample:

image_sample_lz v[4:7], v0, s[8:15], s[12:15] dmask:0xf dim:SQ_RSRC_IMG_1D
-> REFUSED: unverified 1D image sample address or modifiers

Cause: Stage.image() refused every 1D form except sample, even though the lowering already builds a single float location for a 1D sample and Texture1D.SampleLevel takes exactly that.

Measured

MIMG encodings built in the test (0b111100 prefix, opcode [24:18]/bit 0, dmask [11:8], dimension [5:3]), main at deeef352:

form before after
image_sample_lz … dim:SQ_RSRC_IMG_1D dmask:0xf refused t = r0.SampleLevel(smp0, F(v0), 0);
image_sample_l … dim:SQ_RSRC_IMG_1D dmask:0x7 refused t = r0.SampleLevel(smp0, F(v0), F(v1));
image_sample … dim:SQ_RSRC_IMG_1D t = r0.Sample(smp0, F(v0)); unchanged
image_sample_lz … dim:SQ_RSRC_IMG_2D float2(F(v0), F(v1)) unchanged
image_load … dim:SQ_RSRC_IMG_1D refused stays refused
1D sample_lz with two address dwords refused stays refused
1D sample_lz with unorm refused stays refused

Census A/B over the local cache (aggregates only): refusals grouped as SQ_RSRC_IMG_1D go 1 → 0 (the current cache holds one; the stored census had two), and that shader progresses to v_readfirstlane_b32 requires a proven uniform source.

Done when

  • 1D image_sample_lz and image_sample_l lower, with the level from the address (zero for lz).
  • The implicit-level 1D form and every 2D form emit exactly what they did before.
  • A 1D image_load, extra address dwords, and layout-changing modifiers (unorm, r128, a16, d16, …) stay refused by name.
  • A ctest starts from synthetic encoded instructions, decodes, then translates, and fails if the 1D guard is restored.
  • docs/experiments.md records the accepted forms.

Not in this slice: 1D image_load address packing, 1D array/gather forms, and proving the loading screen gets further (counts are aggregates only).

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6587975963 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1721). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T17:49:14Z. --- Found while triaging the refusals in the first main-game loading-screen shader cache (#870). **2 of 29** refused shaders. ## Problem A 1D image has one coordinate, and `image_sample_lz` / `image_sample_l` carry the explicit level in the next address dword. The translator accepted 1D only for the implicit-level `image_sample`: ``` image_sample_lz v[4:7], v0, s[8:15], s[12:15] dmask:0xf dim:SQ_RSRC_IMG_1D -> REFUSED: unverified 1D image sample address or modifiers ``` Cause: `Stage.image()` refused every 1D form except `sample`, even though the lowering already builds a single float location for a 1D sample and `Texture1D.SampleLevel` takes exactly that. ## Measured MIMG encodings built in the test (`0b111100` prefix, opcode `[24:18]`/bit 0, dmask `[11:8]`, dimension `[5:3]`), `main` at `deeef352`: | form | before | after | |---|---|---| | `image_sample_lz … dim:SQ_RSRC_IMG_1D dmask:0xf` | refused | `t = r0.SampleLevel(smp0, F(v0), 0);` | | `image_sample_l … dim:SQ_RSRC_IMG_1D dmask:0x7` | refused | `t = r0.SampleLevel(smp0, F(v0), F(v1));` | | `image_sample … dim:SQ_RSRC_IMG_1D` | `t = r0.Sample(smp0, F(v0));` | unchanged | | `image_sample_lz … dim:SQ_RSRC_IMG_2D` | `float2(F(v0), F(v1))` | unchanged | | `image_load … dim:SQ_RSRC_IMG_1D` | refused | stays refused | | 1D `sample_lz` with two address dwords | refused | stays refused | | 1D `sample_lz` with `unorm` | refused | stays refused | Census A/B over the local cache (aggregates only): refusals grouped as `SQ_RSRC_IMG_1D` go **1 → 0** (the current cache holds one; the stored census had two), and that shader progresses to `v_readfirstlane_b32 requires a proven uniform source`. ## Done when - 1D `image_sample_lz` and `image_sample_l` lower, with the level from the address (zero for lz). - The implicit-level 1D form and every 2D form emit exactly what they did before. - A 1D `image_load`, extra address dwords, and layout-changing modifiers (`unorm`, `r128`, `a16`, `d16`, …) stay refused by name. - A ctest starts from **synthetic** encoded instructions, decodes, then translates, and fails if the 1D guard is restored. - `docs/experiments.md` records the accepted forms. Not in this slice: 1D `image_load` address packing, 1D array/gather forms, and proving the loading screen gets further (counts are aggregates only). AI-assisted (Claude Code).
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#1714
No description provided.