Shaders: support static samplers in image_get_lod #1765

Closed
Flyander wants to merge 1 commit from upstream-pr/1775 into main
Flyander commented 2026-11-24 20:34:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Flyander on 2026-11-24T20:34:14Z.


Adds direct DXIL lowering for pixel IMAGE_GET_LOD instructions whose sampler is static. The direct backend now binds and reuses that root-signature sampler instead of refusing the instruction. This complements the HLSL-path coverage in #1562. Part of #1269.

What is in it

  • lower_image.rs: calculate clamped and unclamped LOD with the discovered static sampler.
  • kernel.rs: increment the direct translator cache version.
  • runner.rs and tests.rs: draw with a graphics root signature containing static samplers and verify the direct pixel result on the GPU.

Tested

  • RTX 5070 Ti (driver 621.40), Ryzen 7 5800X3D, 31.9 GB RAM, Windows 11 Pro 26300, Rust 1.100.0, DXC/DXIL 1.9.2602.17.
  • scripts/test.ps1: 890 passed, 0 failed, 42 ignored; GPU skips: 2 no wave64, 1 no heap windows.
  • cargo test -p xcl --lib gpu_direct_image_get_lod_static_sampler -- --nocapture: 1 passed on the RTX 5070 Ti.
  • xcl shaders shaders.rpf --direct --sample 0 --threads 8 --timeout 30 --validate --top 50 on the same local retail 1.0.2.1 pack at base and head: translated programs rose from 22,029/22,445 to 22,055/22,445. Pixel shaders rose from 9,485/9,511 to 9,511/9,511. The 26 static-sampler LOD refusals are gone; validator errors, panics, and timeouts were 0. 4,253 records over the 16,384-byte default cap were skipped; 390 geometry-mode GS programs remain unsupported.
  • xcl shaders shaders.rpf --direct --sample 0 --max-bytes 1048576 --threads 8 --timeout 120 --validate --top 50: all 26,698 programs from 26,503 records validated in 406.8 s; no records over 1,048,576 bytes were skipped. CS 2,689/2,689, MS 9,282/9,282, PS 12,101/12,101, VS 2,236/2,236. Only the 390 geometry-mode GS programs remain unsupported; validator errors, panics, and timeouts were 0.
  • Both regression runs used XCL_DIRECT_DXIL=all for 60 seconds; see the blocks below.

Regression run

main:

xcl-smoke v1
commit: b9b6ea62080cc62fc19e212033372d01c6214e5c
gpu: NVIDIA GeForce RTX 5070 Ti
title: xcl-smoke-retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1061 (PresentX 1061)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15479 MB

PR:

xcl-smoke v1
commit: cce55296c854bebcc283bbdb95c6e61a23791d00
gpu: NVIDIA GeForce RTX 5070 Ti
title: xcl-smoke-retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1113 (PresentX 1113)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15470 MB

Not tested

  • AMD GPUs or 64-lane wave hardware. The title smoke does not prove it executed one of the newly supported shader variants; the synthetic pixel test exercises the changed path.
  • Shader records above 16,384 bytes.

AI use

  • Omitted.
<!-- greyfinch-sync:ivall/xcl:issue:6590874682 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1775). Originally posted by [Flyander](https://github.com/Flyander) on 2026-11-24T20:34:14Z. --- Adds direct DXIL lowering for pixel `IMAGE_GET_LOD` instructions whose sampler is static. The direct backend now binds and reuses that root-signature sampler instead of refusing the instruction. This complements the HLSL-path coverage in #1562. Part of #1269. **What is in it** - `lower_image.rs`: calculate clamped and unclamped LOD with the discovered static sampler. - `kernel.rs`: increment the direct translator cache version. - `runner.rs` and `tests.rs`: draw with a graphics root signature containing static samplers and verify the direct pixel result on the GPU. **Tested** - RTX 5070 Ti (driver 621.40), Ryzen 7 5800X3D, 31.9 GB RAM, Windows 11 Pro 26300, Rust 1.100.0, DXC/DXIL 1.9.2602.17. - `scripts/test.ps1`: 890 passed, 0 failed, 42 ignored; GPU skips: 2 `no wave64`, 1 `no heap windows`. - `cargo test -p xcl --lib gpu_direct_image_get_lod_static_sampler -- --nocapture`: 1 passed on the RTX 5070 Ti. - `xcl shaders shaders.rpf --direct --sample 0 --threads 8 --timeout 30 --validate --top 50` on the same local retail 1.0.2.1 pack at base and head: translated programs rose from 22,029/22,445 to 22,055/22,445. Pixel shaders rose from 9,485/9,511 to 9,511/9,511. The 26 static-sampler LOD refusals are gone; validator errors, panics, and timeouts were 0. 4,253 records over the 16,384-byte default cap were skipped; 390 geometry-mode GS programs remain unsupported. - `xcl shaders shaders.rpf --direct --sample 0 --max-bytes 1048576 --threads 8 --timeout 120 --validate --top 50`: all 26,698 programs from 26,503 records validated in 406.8 s; no records over 1,048,576 bytes were skipped. CS 2,689/2,689, MS 9,282/9,282, PS 12,101/12,101, VS 2,236/2,236. Only the 390 geometry-mode GS programs remain unsupported; validator errors, panics, and timeouts were 0. - Both regression runs used `XCL_DIRECT_DXIL=all` for 60 seconds; see the blocks below. **Regression run** main: ``` xcl-smoke v1 commit: b9b6ea62080cc62fc19e212033372d01c6214e5c gpu: NVIDIA GeForce RTX 5070 Ti title: xcl-smoke-retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1061 (PresentX 1061) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15479 MB ``` PR: ``` xcl-smoke v1 commit: cce55296c854bebcc283bbdb95c6e61a23791d00 gpu: NVIDIA GeForce RTX 5070 Ti title: xcl-smoke-retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1113 (PresentX 1113) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15470 MB ``` **Not tested** - AMD GPUs or 64-lane wave hardware. The title smoke does not prove it executed one of the newly supported shader variants; the synthetic pixel test exercises the changed path. - Shader records above 16,384 bytes. **AI use** - Omitted.
Flyander commented 2026-11-24 21:09:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Flyander on 2026-11-24T21:04:30Z.


Closing this as a duplicate of #1806, which now implements static-sampler support for IMAGE_GET_LOD and includes the full-pack sweep. The distinct addition here is a runtime GPU regression checking clamped and unclamped LOD with a static sampler; I have mentioned that coverage on #1806 as a possible focused follow-up.

<!-- greyfinch-sync:ivall/xcl:comment:7144440743 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1775#issuecomment-7144440743). Originally posted by [Flyander](https://github.com/Flyander) on 2026-11-24T21:04:30Z. --- Closing this as a duplicate of #1806, which now implements static-sampler support for IMAGE_GET_LOD and includes the full-pack sweep. The distinct addition here is a runtime GPU regression checking clamped and unclamped LOD with a static sampler; I have mentioned that coverage on #1806 as a possible focused follow-up.
upstream-sync closed this pull request 2026-11-24 21:29:34 +00:00
DavidM1911 commented 2026-11-25 00:08:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T23:24:34Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main in crates/xcl/src/gpu/dxil/lower_image.rs — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7147365746 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1775#issuecomment-7147365746). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T23:24:34Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** in `crates/xcl/src/gpu/dxil/lower_image.rs` — needs a rebase before it can be tested.

Pull request closed

Sign in to join this conversation.
No reviewers
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
xcl-dev/xcl!1765
No description provided.