gfx2hlsl: three image-path refusals are not reached by any check #1870

Closed
opened 2026-11-24 19:58:18 +00:00 by ChazY11 · 3 comments
ChazY11 commented 2026-11-24 19:58:18 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T19:58:18Z.


Three refusals in the image path of tools/startup/gfx2hlsl.py are unreachable from every check that exists, so a change to them is invisible.

How I know

For each site I replaced the raise with pass and ran the four image checks plus the model checks:

out/pe-env/Scripts/python.exe -B tests/startup_image_3d_check.py
out/pe-env/Scripts/python.exe -B tests/startup_image_2d_array_check.py
out/pe-env/Scripts/python.exe -B tests/startup_image_load_mip_check.py
out/pe-env/Scripts/python.exe -B tests/startup_image_sample_l_check.py
site (this commit) condition after replacing the raise with pass
line 867 len(dims) != 1 or len(masks) != 1 all four checks green
line 807 len(cs) != (4 if three else 3) in image_sample_l all four green
line 889 words is None — sampler is not a constant run all four green

Compare a control that is covered, image dimension %s at line 781: replacing it turns image_3d, image_2d_array and
image_sample_l red. So the harness sees these files; the three above are simply not exercised.

What a fixture would need

  • line 867: an image_sample/image_load word whose modifier list has two dim: entries or none. The checks build their
    words from a known-good encoding and flip flag bits, so a zeroed or doubled dim field is a small extension of that pattern.
  • line 807: image_sample_l with the wrong number of address registers — the fixture already has a legal sample_l case to
    shrink or extend by one register.
  • line 889: a sampler operand that is not a constant run of four words (a descriptor load, for example). The
    through a sampler heap refusal two lines above it is covered by startup_sampler_heap_check, so the difference between the
    two branches can presumably be shown in the same fixture.

Why it matters

These three are the "the file you gave me is not what I can lower" boundary. If one of them silently stopped firing, a
malformed pipeline would reach the emitter and produce HLSL that means something else instead of a named Unsupported, which
is the failure mode the refusals exist to prevent.

Scope

Testing only. No behaviour change proposed here; splitting it into three one-case PRs is fine, or one PR with three cases.

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590243586 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1877). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T19:58:18Z. --- Three refusals in the image path of `tools/startup/gfx2hlsl.py` are unreachable from every check that exists, so a change to them is invisible. ## How I know For each site I replaced the `raise` with `pass` and ran the four image checks plus the model checks: ```powershell out/pe-env/Scripts/python.exe -B tests/startup_image_3d_check.py out/pe-env/Scripts/python.exe -B tests/startup_image_2d_array_check.py out/pe-env/Scripts/python.exe -B tests/startup_image_load_mip_check.py out/pe-env/Scripts/python.exe -B tests/startup_image_sample_l_check.py ``` | site (this commit) | condition | after replacing the raise with `pass` | |---|---|---| | line 867 | `len(dims) != 1 or len(masks) != 1` | all four checks **green** | | line 807 | `len(cs) != (4 if three else 3)` in `image_sample_l` | all four **green** | | line 889 | `words is None` — sampler is not a constant run | all four **green** | Compare a control that *is* covered, `image dimension %s` at line 781: replacing it turns `image_3d`, `image_2d_array` and `image_sample_l` red. So the harness sees these files; the three above are simply not exercised. ## What a fixture would need - **line 867**: an `image_sample`/`image_load` word whose modifier list has two `dim:` entries or none. The checks build their words from a known-good encoding and flip flag bits, so a zeroed or doubled dim field is a small extension of that pattern. - **line 807**: `image_sample_l` with the wrong number of address registers — the fixture already has a legal `sample_l` case to shrink or extend by one register. - **line 889**: a sampler operand that is not a constant run of four words (a descriptor load, for example). The `through a sampler heap` refusal two lines above it is covered by `startup_sampler_heap_check`, so the difference between the two branches can presumably be shown in the same fixture. ## Why it matters These three are the "the file you gave me is not what I can lower" boundary. If one of them silently stopped firing, a malformed pipeline would reach the emitter and produce HLSL that means something else instead of a named `Unsupported`, which is the failure mode the refusals exist to prevent. ## Scope Testing only. No behaviour change proposed here; splitting it into three one-case PRs is fine, or one PR with three cases. - AI-assisted.
ChazY11 commented 2026-11-24 21:01:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T20:02:31Z.


All three sites now have a case; splitting them across PRs so each one is a single behaviour:

site PR case
line 867, without exactly one dim and dmask #1878 no dim, no dmask, two dims, plus a legal list that must get past the guard
line 807, image_sample_l with N address registers #1879 two and four registers refused, three accepted
line 889, with a sampler that is not constant #1880 unresolved sampler refused, four constant words get past

Each was verified the same way: replace the raise with pass, confirm the new case turns red, then revert. Two extra
mutations per case keep the equality of the conditions under test (!= 1 → < 1, (4 if three else 3) → 5 if three,
any → all), and all of those also fail.

The issue can be closed once the three are merged; nothing else in the image path came up uncovered in the same sweep.

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7142957842 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1877#issuecomment-7142957842). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T20:02:31Z. --- All three sites now have a case; splitting them across PRs so each one is a single behaviour: | site | PR | case | |---|---|---| | line 867, `without exactly one dim and dmask` | #1878 | no dim, no dmask, two dims, plus a legal list that must get past the guard | | line 807, `image_sample_l with N address registers` | #1879 | two and four registers refused, three accepted | | line 889, `with a sampler that is not constant` | #1880 | unresolved sampler refused, four constant words get past | Each was verified the same way: replace the `raise` with `pass`, confirm the new case turns red, then revert. Two extra mutations per case keep the *equality* of the conditions under test (`!= 1` → `< 1`, `(4 if three else 3)` → `5 if three`, `any` → `all`), and all of those also fail. The issue can be closed once the three are merged; nothing else in the image path came up uncovered in the same sweep. - AI-assisted.
ChazY11 commented 2026-11-24 21:01:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T20:15:39Z.


All three are on main now: #1878 (without exactly one dim and dmask), #1879 (image_sample_l address count) and #1880
(sampler that is not constant). Each was verified by replacing the raise with pass and confirming the new case turns red,
plus a second mutation per case that changes the equality of the condition (!= 1 → < 1, (4 if three else 3) → 5 if three, any → all) — all of those fail too.

Nothing else in the image path came up uncovered in the same sweep, so this can be closed.

  • AI-assisted.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143265870 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1877#issuecomment-7143265870). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T20:15:39Z. --- All three are on `main` now: #1878 (`without exactly one dim and dmask`), #1879 (`image_sample_l` address count) and #1880 (sampler that is not constant). Each was verified by replacing the `raise` with `pass` and confirming the new case turns red, plus a second mutation per case that changes the *equality* of the condition (`!= 1` → `< 1`, `(4 if three else 3)` → `5 if three`, `any` → `all`) — all of those fail too. Nothing else in the image path came up uncovered in the same sweep, so this can be closed. - AI-assisted.
R0Y00 commented 2026-11-24 21:01:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T20:32:52Z.


Completed by #1878, #1879 and #1880. The three independent controls cover the comparison sample modifiers, explicit LOD operand count, and unresolved sampler. The author verified that suppressing each refusal makes the corresponding test fail.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143713332 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1877#issuecomment-7143713332). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T20:32:52Z. --- Completed by #1878, #1879 and #1880. The three independent controls cover the comparison sample modifiers, explicit LOD operand count, and unresolved sampler. The author verified that suppressing each refusal makes the corresponding test fail.
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#1870
No description provided.