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

Closed
opened 2026-11-26 23:28:49 +00:00 by github-bot · 0 comments
Owner

@⁠triggered02 on GitHub · 2026-11-24 17:49 UTC · original

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).

**@⁠triggered02** on GitHub · 2026-11-24 17:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/1721) 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).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:28:49 +00:00
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#1721
No description provided.