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

Closed
mastrr9 wants to merge 1 commit from upstream-pr/1939 into main
mastrr9 commented 2026-11-24 23:43:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by mastrr9 on 2026-11-24T23:43:54Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:5482269795 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1939). Originally posted by [mastrr9](https://github.com/mastrr9) on 2026-11-24T23:43:54Z. --- 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.
upipibi commented 2026-11-25 00:09:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by upipibi on 2026-11-24T23:49:53Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7147842935 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1939#issuecomment-7147842935). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-24T23:49:53Z. --- 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.
DavidM1911 commented 2026-11-25 03:05:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T02:41:10Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7151045215 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1939#issuecomment-7151045215). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T02:41:10Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
github-actions[bot] commented 2026-11-28 08:01:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:01:23Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7236310715 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1939#issuecomment-7236310715). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T08:01:23Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 07:08:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:08:09Z.


Triage (#1607) – head 8eef6e4

#3408 makes the same change in gpu/dxil/lower_image.rs: it passes cl instead of if dim == 3 { None } else { cl } to sample_cmp, sample_bias and sample. #3408 also has a validator test and a GPU test. It merges into main, its CI is green, and it was run on a GPU. This PR was opened first, but it is a draft whose head was never built, and it conflicts with main.
One thing #3408 lacks is this PR's TRANSLATOR_VERSION bump in gpu/dxil/kernel.rs (main is at 12 now, so 8 is stale). Without it, cached direct translations of cube _cl samples stay wrong. That belongs in #3408.
Recommendation: close (duplicate of #3408).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303685896 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1939#issuecomment-7303685896). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:08:09Z. --- **Triage (#1607)** – head 8eef6e4 #3408 makes the same change in `gpu/dxil/lower_image.rs`: it passes `cl` instead of `if dim == 3 { None } else { cl }` to `sample_cmp`, `sample_bias` and `sample`. #3408 also has a validator test and a GPU test. It merges into main, its CI is green, and it was run on a GPU. This PR was opened first, but it is a draft whose head was never built, and it conflicts with main. One thing #3408 lacks is this PR's `TRANSLATOR_VERSION` bump in `gpu/dxil/kernel.rs` (main is at 12 now, so 8 is stale). Without it, cached direct translations of cube `_cl` samples stay wrong. That belongs in #3408. Recommendation: close (duplicate of #3408). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
throny commented 2026-12-01 15:58:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T15:58:05Z.


Closing as superseded: the same change is in #3408 (open, mergeable, required checks green). From Foniass's rechecked close list on #1607, checked again by script just now. If something here is still missing, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7316814304 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1939#issuecomment-7316814304). Originally posted by [throny](https://github.com/throny) on 2026-12-01T15:58:05Z. --- Closing as superseded: the same change is in #3408 (open, mergeable, required checks green). From Foniass's rechecked close list on #1607, checked again by script just now. If something here is still missing, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5).

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!1929
No description provided.