dxil: keep the LOD clamp of image_sample_*_cl on cubes #1939

Open
github-bot wants to merge 1 commit from github-bot/gh-1939 into main AGit
Owner

@⁠mastrr9 on GitHub · 2026-11-24 23:43 UTC · original
mastrr9:fix/dxil-image-sample-cl-cube → main · +88 −4 · 3 files · 1 commits · draft

In a pixel shader the direct translator dropped the clamp operand of image_sample_cl / _b_cl / _c_cl when the T# is a cube, so it sampled below the clamp. The HLSL path passes it for cubes like any other dimension.

TRANSLATOR_VERSION goes from 7 to 8. #1793 and other changes to the direct translator also set 8; identical edits merge silently, so whichever lands later should take the next free number.

Draft: the head commit has not been built or tested yet.

What is in it

  • gpu/dxil/lower_image.rs: keep the clamp for cubes
  • gpu/dxil/kernel.rs: TRANSLATOR_VERSION 8
  • gpu/recomp/tests.rs: gpu_ps_image_sample_cl_cube_on_both_backends

Tested
These runs are from before the final rebase, on a combined branch (376f968, based on main 689f2db; it holds this change, both halves of the differential mode and five other direct-translator parity fixes; this change's code is the same there), not on this PR's head commit.

  • Windows 11 x64, NVIDIA GeForce RTX 5080 16 GB, cargo test debug build. Driver, CPU and Rust versions were not recorded.
  • cargo test -p xcl --lib gpu_ps_image_sample_cl_cube_on_both_backends -- --nocapture --test-threads=1: passed.

Regression run
Not run: there are no xcl-smoke blocks for this change.

Not tested

  • The head commit (rebased onto main f5136a6) has not been built or tested: it was rebased on macOS, with no Rust toolchain.
  • cargo test --workspace was not run for this change on its own.
  • AMD and Intel GPUs; release build.
  • A run of the new test without the fix.
  • The _b_cl and _c_cl cube forms are built on both backends by the test but not drawn.
  • #1900 has changed lower_image.rs (MSAA loads) since the tested base; it merged without conflict.

AI use

  • Code and tests: written by Claude Opus 5.5 in an agent session (Duet) with no Windows or GPU.
  • RTX 5080 test runs above: a Claude Sonnet 5.5 agent.
  • Overlap check, rebase and this description: Claude Code, Claude Sonnet 5.5; it also trimmed one outdated sentence from the commit message.
**@⁠mastrr9** on GitHub · 2026-11-24 23:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1939) `mastrr9:fix/dxil-image-sample-cl-cube` → `main` · +88 −4 · 3 files · 1 commits · draft In a pixel shader the direct translator dropped the clamp operand of `image_sample_cl` / `_b_cl` / `_c_cl` when the T# is a cube, so it sampled below the clamp. The HLSL path passes it for cubes like any other dimension. `TRANSLATOR_VERSION` goes from 7 to 8. #1793 and other changes to the direct translator also set 8; identical edits merge silently, so whichever lands later should take the next free number. Draft: the head commit has not been built or tested yet. **What is in it** - `gpu/dxil/lower_image.rs`: keep the clamp for cubes - `gpu/dxil/kernel.rs`: `TRANSLATOR_VERSION` 8 - `gpu/recomp/tests.rs`: `gpu_ps_image_sample_cl_cube_on_both_backends` **Tested** These runs are from before the final rebase, on a **combined branch** ([`376f968`](https://github.com/mastrr9/xcl/commit/376f968), based on main `689f2db`; it holds this change, both halves of the differential mode and five other direct-translator parity fixes; this change's code is the same there), **not on this PR's head commit**. - Windows 11 x64, NVIDIA GeForce RTX 5080 16 GB, `cargo test` debug build. Driver, CPU and Rust versions were not recorded. - `cargo test -p xcl --lib gpu_ps_image_sample_cl_cube_on_both_backends -- --nocapture --test-threads=1`: passed. **Regression run** Not run: there are no `xcl-smoke` blocks for this change. **Not tested** - The head commit (rebased onto main `f5136a6`) has not been built or tested: it was rebased on macOS, with no Rust toolchain. - `cargo test --workspace` was not run for this change on its own. - AMD and Intel GPUs; release build. - A run of the new test without the fix. - The `_b_cl` and `_c_cl` cube forms are built on both backends by the test but not drawn. - #1900 has changed `lower_image.rs` (MSAA loads) since the tested base; it merged without conflict. **AI use** - Code and tests: written by Claude Opus 5.5 in an agent session (Duet) with no Windows or GPU. - RTX 5080 test runs above: a Claude Sonnet 5.5 agent. - Overlap check, rebase and this description: Claude Code, Claude Sonnet 5.5; it also trimmed one outdated sentence from the commit message.
The direct translator dropped the clamp operand of sample, sample_b and
sample_c (the implicit-LOD forms in a pixel shader) when the T# is a
cube, so image_sample_cl / _b_cl / _c_cl on a cube sampled below the
clamp. The HLSL path passes the clamp for cubes as for every other
dimension (TextureCubeArray Sample / SampleBias / SampleCmp with a
clamp, no offset), and the hardware applies the minimum LOD whatever
the dimension. No validator rule is known to forbid a clamp on a cube.

TRANSLATOR_VERSION 7 -> 8: the emitted containers change for these
programs. Open PR #1793 also bumps TRANSLATOR_VERSION. Identical
edits merge silently in git, so check the bump by hand at merge time:
the later change takes the next free number, or the pipeline cache
could serve containers of another translator under the same version.
The test draws a pixel shader sampling a mipped cube at zero
derivatives with clamp 2.0 through both backends, and builds the
_b_cl and _c_cl cube forms on both backends (not drawn).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:37 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 23:49 UTC · original

NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, 8eef6e4 merged onto main 20cf130. gpu_ps_image_sample_cl_cube_on_both_backends passes, with and without XCL_DIRECT_DXIL=1.

AI-assisted (Claude Code). Synthetic tests only.

**@⁠upipibi** on GitHub · 2026-11-24 23:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/1939#issuecomment-7147842935) NVIDIA run: RTX 3070 8 GB, driver 616.56, Windows 11, debug, `8eef6e4` merged onto `main` `20cf130`. `gpu_ps_image_sample_cl_cube_on_both_backends` passes, with and without `XCL_DIRECT_DXIL=1`. AI-assisted (Claude Code). Synthetic tests only.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 02:41 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-25 02:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1939#issuecomment-7151045215) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/dxil/kernel.rs
  • crates/xcl/src/gpu/dxil/lower_image.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1939/head:github-bot/gh-1939'
git switch 'github-bot/gh-1939'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1939'
git switch 'github-bot/gh-1939'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1939'
git switch 'github-bot/gh-1939'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1939'
git switch 'main'
git merge --squash 'github-bot/gh-1939'
git switch 'main'
git merge --ff-only 'github-bot/gh-1939'
git switch 'main'
git merge 'github-bot/gh-1939'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.