DXIL lowering can reuse one static sampler slot for both Sample and SampleCmp #250

Open
opened 2026-11-26 03:39:11 +00:00 by github-bot · 0 comments
Owner

@⁠Bennet0k on GitHub · 2026-11-24 23:00 UTC · original

Source

Static sampler slots are deduplicated by the four sampler words. If a shader uses the same words for a regular sample and a comparison sample, both operations share the slot and comparison use marks that slot as a comparison sampler. In comparison-first order, the ordinary sample then gets a comparison handle. In ordinary-first order, the earlier ordinary handle and final slot metadata disagree. The DXIL validator requires the sampler kind to match the operation.

Proposed fix. Include the comparison flag in the static sampler deduplication key. Add a synthetic shader with both operation orders and verify separate slots with appropriate resource annotations and static sampler kinds. Checked against the lowering code and a model of both orders. No DXIL validation or title regression is claimed here.

Found in an AI-assisted audit of 2119b0e.

**@⁠Bennet0k** on GitHub · 2026-11-24 23:00 UTC · [original](https://github.com/fxceless/victory-fork/issues/250) [Source](https://github.com/fxceless/victory-fork/blob/2119b0e44c53aa9648307b0c5c73590290305b1f/crates/victory-shader/src/emit/lower.rs#L6026-L6043) Static sampler slots are deduplicated by the four sampler words. If a shader uses the same words for a regular sample and a comparison sample, both operations share the slot and comparison use marks that slot as a comparison sampler. In comparison-first order, the ordinary sample then gets a comparison handle. In ordinary-first order, the earlier ordinary handle and final slot metadata disagree. The [DXIL validator](https://github.com/microsoft/DirectXShaderCompiler/blob/main/lib/DxilValidation/DxilValidation.cpp#L416-L428) requires the sampler kind to match the operation. **Proposed fix.** Include the comparison flag in the static sampler deduplication key. Add a synthetic shader with both operation orders and verify separate slots with appropriate resource annotations and static sampler kinds. Checked against the lowering code and a model of both orders. No DXIL validation or title regression is claimed here. Found in an AI-assisted audit of `2119b0e`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:39:11 +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/fxceless--victory-fork#250
No description provided.