shader: lower masked pixel resource-selection loops in the direct DXIL frontend #3210

Closed
opened 2026-11-27 21:47:36 +00:00 by R0Y00 · 4 comments
R0Y00 commented 2026-11-27 21:47:36 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T21:47:36Z.


Refs #2413 and #3074. The fixed mesh pixel path needs safe control flow when EXEC-partitioned resource selection introduces backward SCC edges. Existing projections cover forward arms. Keep explicit refusals for loops whose resource identity, forward progress, active lanes, or scalar values at exit cannot be established.

Use a source-built gfx1013 fixture with lanes selecting distinct descriptors, repeated indices, an empty arm, and an implicit-LOD sample whose helper lane matters. Validate generated DXIL, read back color against independent expected values, and add a negative control for an unproven backedge or side effect. Report exception cases and any hardware-only validation. PR target: main.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6654963462 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3210). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T21:47:36Z. --- Refs #2413 and #3074. The fixed mesh pixel path needs safe control flow when EXEC-partitioned resource selection introduces backward SCC edges. Existing projections cover forward arms. Keep explicit refusals for loops whose resource identity, forward progress, active lanes, or scalar values at exit cannot be established. Use a source-built gfx1013 fixture with lanes selecting distinct descriptors, repeated indices, an empty arm, and an implicit-LOD sample whose helper lane matters. Validate generated DXIL, read back color against independent expected values, and add a negative control for an unproven backedge or side effect. Report exception cases and any hardware-only validation. PR target: `main`.
RonLogic commented 2026-11-27 23:23:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T23:23:01Z.


I’ll take this on main. I’ll start from a source-built bounded resource-selection loop with repeated indices and an empty selection, then verify its direct DXIL and fenced colors on the RTX 4070 and WARP. The helper-lane witness will use an implicit gradient, and the refusal control will exercise a backedge without a proven decrease in the pending mask.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7230098147 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3210#issuecomment-7230098147). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-27T23:23:01Z. --- I’ll take this on `main`. I’ll start from a source-built bounded resource-selection loop with repeated indices and an empty selection, then verify its direct DXIL and fenced colors on the RTX 4070 and WARP. The helper-lane witness will use an implicit gradient, and the refusal control will exercise a backedge without a proven decrease in the pending mask.
RonLogic commented 2026-11-27 23:46:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T23:46:14Z.


The fixed-mesh heap path is already implemented in #3091. I verified its a48d39dc compiler with a separate source-built shader. Mixed and empty selections passed for both guest widths on RTX 4070 and WARP, and the helper-only coordinate control selected the wrong mip at (6,0) on both, as intended. The no-progress backedge was refused.

I reported one additional edge case and a tested guard in the #3091 review. The guard rejects implicit samples whose outputs can overwrite a later iteration's gradient inputs. I also have a verified bound-table variant on main for ordinary pixel shaders with a small finite SRV key. I’m keeping that change local while #3091 is open since both touch the same lowering.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7230395381 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3210#issuecomment-7230395381). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-27T23:46:14Z. --- The fixed-mesh heap path is already implemented in #3091. I verified its `a48d39dc` compiler with a separate source-built shader. Mixed and empty selections passed for both guest widths on RTX 4070 and WARP, and the helper-only coordinate control selected the wrong mip at (6,0) on both, as intended. The no-progress backedge was refused. I reported one additional edge case and a tested guard in [the #3091 review](https://github.com/R0Y00/Xbox2Windows/pull/3091#issuecomment-7230393084). The guard rejects implicit samples whose outputs can overwrite a later iteration's gradient inputs. I also have a verified bound-table variant on `main` for ordinary pixel shaders with a small finite SRV key. I’m keeping that change local while #3091 is open since both touch the same lowering.
Leyukaka commented 2026-11-28 21:39:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T21:39:36Z.


@RonLogic, #3091 merged at 13:48 UTC. Is the bound-table variant for ordinary pixel shaders that you kept local still coming? If you have dropped it, I can take it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7246178529 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3210#issuecomment-7246178529). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T21:39:36Z. --- @RonLogic, #3091 merged at 13:48 UTC. Is the bound-table variant for ordinary pixel shaders that you kept local still coming? If you have dropped it, I can take it.
Leyukaka commented 2026-12-02 05:33:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T05:33:25Z.


@RonLogic, there has been no reply to my 11-28 question, so I took the remaining bound-table variant for ordinary pixel shaders: #3823

It reuses the #3091 waterfall detector and accepts a descriptor load from a bound root table. The fixed-mesh heap path is unchanged. The PR includes the DXIL checks, the refusals and a color readback on WARP and hardware with repeated and empty selections and an implicit-LOD sample.

If you still have your local version, I'm happy to compare the two or to add any case yours covers and mine does not.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7336056338 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3210#issuecomment-7336056338). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-02T05:33:25Z. --- @RonLogic, there has been no reply to my 11-28 question, so I took the remaining bound-table variant for ordinary pixel shaders: #3823 It reuses the #3091 waterfall detector and accepts a descriptor load from a bound root table. The fixed-mesh heap path is unchanged. The PR includes the DXIL checks, the refusals and a color readback on WARP and hardware with repeated and empty selections and an implicit-LOD sample. If you still have your local version, I'm happy to compare the two or to add any case yours covers and mine does not.
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#3210
No description provided.