Skip to content

Shaders: support static samplers in image_get_lod - #1775

Closed
Flyander wants to merge 1 commit into
xcl-dev:mainfrom
Flyander:codex/image-get-lod-static-sampler
Closed

Flyander wants to merge 1 commit into
xcl-dev:mainfrom
Flyander:codex/image-get-lod-static-sampler

Conversation

@Flyander

@Flyander Flyander commented Nov 24, 2026 •

Copy link
Copy Markdown

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
Flyander marked this pull request as ready for review November 24, 2026 20:35
@Flyander

Copy link
Copy Markdown
Author

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants