D3D12.X: clamp translated sampler LOD bias #1384

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

@⁠hajduzsolt on GitHub · 2026-11-24 15:28 UTC · original
hajduzsolt:fix/sampler-lod-bias → main · +19 −1 · 1 files · 1 commits · open

What is in it

  • Clamp the decoded LOD bias and test the extrema and adjacent fixed-point values for ordinary and comparison samplers.

Tested

  • Windows 11 Pro x64 build 26300, Ryzen 7 9800X3D, Radeon RX 9070 XT, driver 32.0.32029.2010; Rust 1.98.1 MSVC, debug.
  • cargo test -p xcl --lib sampler_lod_bias_stays_within_d3d12_limits: 1 passed.
  • cargo test --workspace -- --test-threads=4 --nocapture: 752 passed, 0 failed, 41 ignored. The reported passes include tests that returned early.
  • SKIPPED: test_title_draws_with_a_root_signature_under_the_debug_layer and uploads_start_from_each_subresources_state, because the D3D12 debug layer is unavailable.

Regression run

main:

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1675 (PresentX 1675)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14837 MB

PR:

xcl-smoke v1
commit: e15ddb2dffdbf54df8944d2b71fa78165861686b
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1676 (PresentX 1676)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14840 MB

Not tested

  • Retail titles, debug-layer validation, and adapters other than the one above. No claim is made about actual title usage of extreme bias values.

AI use

  • Codex, GPT-6: investigation, implementation, synthetic test, and validation.
**@⁠hajduzsolt** on GitHub · 2026-11-24 15:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1384) `hajduzsolt:fix/sampler-lod-bias` → `main` · +19 −1 · 1 files · 1 commits · open **What is in it** - Clamp the decoded LOD bias and test the extrema and adjacent fixed-point values for ordinary and comparison samplers. **Tested** - Windows 11 Pro x64 build 26300, Ryzen 7 9800X3D, Radeon RX 9070 XT, driver 32.0.32029.2010; Rust 1.98.1 MSVC, debug. - `cargo test -p xcl --lib sampler_lod_bias_stays_within_d3d12_limits`: 1 passed. - `cargo test --workspace -- --test-threads=4 --nocapture`: 752 passed, 0 failed, 41 ignored. The reported passes include tests that returned early. - SKIPPED: `test_title_draws_with_a_root_signature_under_the_debug_layer` and `uploads_start_from_each_subresources_state`, because the D3D12 debug layer is unavailable. **Regression run** main: ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1675 (PresentX 1675) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14837 MB ``` PR: ``` xcl-smoke v1 commit: e15ddb2dffdbf54df8944d2b71fa78165861686b gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1676 (PresentX 1676) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14840 MB ``` **Not tested** - Retail titles, debug-layer validation, and adapters other than the one above. No claim is made about actual title usage of extreme bias values. **AI use** - Codex, GPT-6: investigation, implementation, synthetic test, and validation.
Keep console sampler bias within the D3D12 range so static samplers remain valid at extreme values.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:52:37 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 15:34 UTC · original · edited 2026-11-24 15:36 UTC

Full-suite run, since this PR has no test report yet. Tested exact head e15ddb2 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: sampler_lod_bias_stays_within_d3d12_limits.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 752 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 15:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1384#issuecomment-7136261351) · edited 2026-11-24 15:36 UTC Full-suite run, since this PR has no test report yet. Tested exact head `e15ddb2` (on its base `930e8b4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `sampler_lod_bias_stays_within_d3d12_limits`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **752 passed, 0 failed, 41 ignored**, no skips. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 16:55 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 16:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1384#issuecomment-7138416782) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. Thanks!
Author
Owner

@⁠afpruivo on GitHub · 2026-11-26 12:18 UTC · original

Tested e15ddb2 on an RTX 3090, as part of a batch merged onto main b49be18: no failures, no regression.

  • Batch: #1384 e15ddb2, #1594 6ea563b, #1621 39788e8, #1653 69f70c1. They touch no common file and merged cleanly onto b49be18 (local commit 1e3fb07). Check posted in #1607: B21, #1607.
  • Hardware: RTX 3090 24 GB, driver 621.40, Windows 11 26300, Rust stable MSVC.
  • Suite: cargo test --workspace -- --test-threads=4 (debug): 1,439 passed, 0 failed, 47 ignored. 26 SKIPPED GPU tests, mostly no wave64 on this card; they are not coverage.
  • Smoke: scripts/smoke.ps1, 60 s, retail 1.0.2.1 (title: 3c290c16), release. Peak commit was lower on the batch.
commit frames shown presents per 2 s (last 3) device removals crashes peak commit
main b49be18 1,649 60 60 60 0 0 17,023 MB
batch 1e3fb07 1,627 60 60 60 0 0 15,516 MB
  • I read the diff. The clamp is in sampler_d3d12, so comparison and plain samplers both get it, and the new test covers the edges on both sides (0x2000–0x2fff to the minimum, 0x0ffe–0x1fff to the maximum).

Not tested: a run that reaches this change on purpose (the smoke title only shows that nothing regresses); AMD.

AI use: Claude Code (Claude Opus 5.5) ran the commands on my machine and drafted this. Checked by me before posting.

**@⁠afpruivo** on GitHub · 2026-11-26 12:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1384#issuecomment-7191829949) **Tested `e15ddb2` on an RTX 3090, as part of a batch merged onto `main` `b49be18`: no failures, no regression.** - **Batch:** #1384 `e15ddb2`, #1594 `6ea563b`, #1621 `39788e8`, #1653 `69f70c1`. They touch no common file and merged cleanly onto `b49be18` (local commit `1e3fb07`). Check posted in #1607: B21, https://git.gtahub.st/github/xcl-dev--xcl/issues/1607. - **Hardware:** RTX 3090 24 GB, driver 621.40, Windows 11 26300, Rust stable MSVC. - **Suite:** `cargo test --workspace -- --test-threads=4` (debug): 1,439 passed, 0 failed, 47 ignored. 26 `SKIPPED` GPU tests, mostly no wave64 on this card; they are not coverage. - **Smoke:** `scripts/smoke.ps1`, 60 s, retail 1.0.2.1 (`title: 3c290c16`), release. Peak commit was lower on the batch. | | commit | frames shown | presents per 2 s (last 3) | device removals | crashes | peak commit | |---|---|---|---|---|---|---| | `main` | `b49be18` | 1,649 | 60 60 60 | 0 | 0 | 17,023 MB | | batch | `1e3fb07` | 1,627 | 60 60 60 | 0 | 0 | 15,516 MB | - I read the diff. The clamp is in `sampler_d3d12`, so comparison and plain samplers both get it, and the new test covers the edges on both sides (`0x2000`–`0x2fff` to the minimum, `0x0ffe`–`0x1fff` to the maximum). **Not tested:** a run that reaches this change on purpose (the smoke title only shows that nothing regresses); AMD. **AI use:** Claude Code (Claude Opus 5.5) ran the commands on my machine and drafted this. Checked by me before posting.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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