D3D12.X: a console sampler keeps its filter and border colour #1875

Open
veyn-sudo wants to merge 2 commits from upstream-pr/1885 into main
veyn-sudo commented 2026-11-24 22:34:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by veyn-sudo on 2026-11-24T22:34:08Z.


CreateSamplerX (device #61) made every sampler anisotropic with a transparent black border, whatever the desc asked for: point samplers filtered linearly, and opaque black and white borders were lost. Both fields are in the console desc and are now taken from it.

What is in it (crates/xcl/src/hle/d3d12x/device_x.rs)

  • the filter: magnification / minification at +4 / +8 (1 bilinear, 2 point, 3 anisotropic), mip at +0xC (1 point, 2 linear); the z filter at +0x10 has no PC field. The desc is built in pc_sampler_desc, so that it can be tested
  • the border colour at +0x44

A maximum anisotropy of 1 gives no anisotropic filter.

Tested

  • RTX 2070 SUPER (driver 617.14), i7-9700K, Windows 11 (26300), Rust 1.99.0; tests in debug, title in release
  • cargo test --workspace -- --test-threads=4 at 5824d212: 961 passed, 0 failed, 43 ignored. SKIPPED lines: 18 no wave64, 3 per-lane f16 / cvt refusals, 1 no heap windows
  • console_samplers_keep_their_filter fails with the mip filter read at +0x10 (D3D12_FILTER(21) instead of 20 for the title's 1 1 1 2 desc) and passes with +0xC; console_samplers_keep_their_border_colour
  • the field order, measured on a retail title (120 s, a temporary log of every distinct desc): 30 descs, 5 point (2 2 1 1), 17 bilinear (2 of them 1 1 1 2, 15 1 1 2 2), 8 anisotropic (3 3 2 2, one with a maximum of 1). +0x10 follows magnification and minification in all 30 (1 for point, 2 otherwise); +0xC does not. 9 use border addressing, one of them with opaque black and one with white. None has a comparison function, a reduction mode at +0x14 or an address mode outside 1–4

Regression run

main:

xcl-smoke v1
commit: c4d37bec1bb4286eb373aea963404a23f13401fa
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 404998dc
seconds: 60
exit: 0x0
frames shown: 1540 (PresentX 1540)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 17711 MB

PR:

xcl-smoke v1
commit: 5824d212ae158f9d9aa65736e32037ec227388e5
gpu: NVIDIA GeForce RTX 2070 SUPER
title: 404998dc
seconds: 60
exit: 0x0
frames shown: 1520 (PresentX 1520)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18079 MB

Not tested

  • a visible difference in the title: none was looked for
  • comparison and minimum / maximum samplers, console-only address modes, mip filter 0: no desc of the title has them. The first three are handled as on main; mip filter 0 is read as point mips
  • AMD, Intel and other NVIDIA GPUs

HANDOFF.md says "#61 CreateSamplerX (0x6C-byte desc → anisotropic PC sampler)": no longer true for every sampler.

AI use

  • Claude Code with Claude Opus 5.5 found the cause, wrote the code, the tests, the measurements and this description, and ran the tests

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5481459821 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885). Originally posted by [veyn-sudo](https://github.com/veyn-sudo) on 2026-11-24T22:34:08Z. --- `CreateSamplerX` (device #61) made every sampler anisotropic with a transparent black border, whatever the desc asked for: point samplers filtered linearly, and opaque black and white borders were lost. Both fields are in the console desc and are now taken from it. **What is in it** (`crates/xcl/src/hle/d3d12x/device_x.rs`) - the filter: magnification / minification at +4 / +8 (1 bilinear, 2 point, 3 anisotropic), mip at +0xC (1 point, 2 linear); the z filter at +0x10 has no PC field. The desc is built in `pc_sampler_desc`, so that it can be tested - the border colour at +0x44 A maximum anisotropy of 1 gives no anisotropic filter. **Tested** - RTX 2070 SUPER (driver 617.14), i7-9700K, Windows 11 (26300), Rust 1.99.0; tests in debug, title in release - `cargo test --workspace -- --test-threads=4` at `5824d212`: 961 passed, 0 failed, 43 ignored. SKIPPED lines: 18 no wave64, 3 per-lane f16 / cvt refusals, 1 no heap windows - `console_samplers_keep_their_filter` fails with the mip filter read at +0x10 (`D3D12_FILTER(21)` instead of `20` for the title's `1 1 1 2` desc) and passes with +0xC; `console_samplers_keep_their_border_colour` - the field order, measured on a retail title (120 s, a temporary log of every distinct desc): 30 descs, 5 point (2 2 1 1), 17 bilinear (2 of them 1 1 1 2, 15 1 1 2 2), 8 anisotropic (3 3 2 2, one with a maximum of 1). +0x10 follows magnification and minification in all 30 (1 for point, 2 otherwise); +0xC does not. 9 use border addressing, one of them with opaque black and one with white. None has a comparison function, a reduction mode at +0x14 or an address mode outside 1–4 **Regression run** main: ``` xcl-smoke v1 commit: c4d37bec1bb4286eb373aea963404a23f13401fa gpu: NVIDIA GeForce RTX 2070 SUPER title: 404998dc seconds: 60 exit: 0x0 frames shown: 1540 (PresentX 1540) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 17711 MB ``` PR: ``` xcl-smoke v1 commit: 5824d212ae158f9d9aa65736e32037ec227388e5 gpu: NVIDIA GeForce RTX 2070 SUPER title: 404998dc seconds: 60 exit: 0x0 frames shown: 1520 (PresentX 1520) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18079 MB ``` **Not tested** - a visible difference in the title: none was looked for - comparison and minimum / maximum samplers, console-only address modes, mip filter 0: no desc of the title has them. The first three are handled as on `main`; mip filter 0 is read as point mips - AMD, Intel and other NVIDIA GPUs `HANDOFF.md` says "#61 CreateSamplerX (0x6C-byte desc → anisotropic PC sampler)": no longer true for every sampler. **AI use** - Claude Code with Claude Opus 5.5 found the cause, wrote the code, the tests, the measurements and this description, and ran the tests 🤖 Generated with [Claude Code](https://claude.com/claude-code)
futurepro62 commented 2026-11-24 23:08:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T22:45:27Z.


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

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, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu: 956 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: console_samplers_keep_their_filter, console_samplers_keep_their_border_colour.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 961 passed, 0 failed, 43 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • On NVIDIA, --skip leaves out five tests where this PR's base has them. They fail on main 689f2db too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. These are heap_window_out_of_memory_falls_back_to_the_switch_form (#1651) and the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests (follow-up on #1651). The AMD run does not set XCL_REQUIRE_GPU.

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.
<!-- greyfinch-sync:ivall/xcl:comment:7146608328 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#issuecomment-7146608328). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T22:45:27Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `b76c075` (on its base `c4d37be`). **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, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu`: **956 passed, 0 failed, 43 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_on_the_gpu`, `coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu`, `cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `console_samplers_keep_their_filter`, `console_samplers_keep_their_border_colour`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **961 passed, 0 failed, 43 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - On NVIDIA, `--skip` leaves out five tests where this PR's base has them. They fail on main `689f2db` too, not because of this PR: under `XCL_REQUIRE_GPU=mesh`, `runner::skip_test` turns their skips into failures. These are `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651) and the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests ([follow-up on #1651](https://github.com/xcl-dev/xcl/issues/1651#issuecomment-7146069648)). The AMD run does not set `XCL_REQUIRE_GPU`. **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.
lewisnic94-max commented 2026-11-24 23:19:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lewisnic94-max on 2026-11-24T23:19:26Z.

Review: COMMENTED


I reviewed b76c075450a3bee4d4d27ad6e9de06d0e308f933. With maximum anisotropy set to one, I crossed four minification encodings, four magnification encodings and three mip encodings. All 48 descriptors selected the expected named D3D12 filter. All four border components retained their input bits, including negative zero. The PR’s tests also exercised maximum anisotropy eight. I found no actionable defect in the descriptor conversion I exercised.

I ran the independent batch002_samplers fixture and the console_samplers_ filter separately with cargo test --offline --locked -j 1 -p xcl --lib <filter> -- --test-threads=1 --nocapture. Across those runs, 3 passed, 0 failed, 0 ignored, and 0 skip notices. Windows 11 build 26200.9974, Ryzen 7 5800X, RTX 3080 driver 616.92, debug MSVC Rust 1.100.0. These CPU-side assertions examined the constructed descriptors. Rendered pixels and console image parity were outside the test.

Codex (GPT-6) traced descriptor creation, wrote the independent matrix and checked the results.

<!-- greyfinch-sync:ivall/xcl:review:6048958953 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#pullrequestreview-6048958953). Originally posted by [lewisnic94-max](https://github.com/lewisnic94-max) on 2026-11-24T23:19:26Z. **Review:** COMMENTED --- I reviewed `b76c075450a3bee4d4d27ad6e9de06d0e308f933`. With maximum anisotropy set to one, I crossed four minification encodings, four magnification encodings and three mip encodings. All 48 descriptors selected the expected named D3D12 filter. All four border components retained their input bits, including negative zero. The PR’s tests also exercised maximum anisotropy eight. I found no actionable defect in the descriptor conversion I exercised. I ran the independent `batch002_samplers` fixture and the `console_samplers_` filter separately with `cargo test --offline --locked -j 1 -p xcl --lib <filter> -- --test-threads=1 --nocapture`. Across those runs, 3 passed, 0 failed, 0 ignored, and 0 skip notices. Windows 11 build 26200.9974, Ryzen 7 5800X, RTX 3080 driver 616.92, debug MSVC Rust 1.100.0. These CPU-side assertions examined the constructed descriptors. Rendered pixels and console image parity were outside the test. Codex (GPT-6) traced descriptor creation, wrote the independent matrix and checked the results.
DavidM1911 commented 2026-11-25 02:09:10 +00:00 (Migrated from github.com)

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


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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7150341179 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#issuecomment-7150341179). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T02:07:17Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
JJAutoCompare commented 2026-11-25 03:05:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T03:00:45Z.


PR #1885 — Intel Arc A770 verification

Tested commit b76c075450a3bee4d4d27ad6e9de06d0e308f933, the fetched PR head.

Environment

STOR-WINLAB, Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X. Intel Arc A770 16 GiB, driver 32.0.101.9175, wave range 8–32, DoublePrecisionFloatShaderOps=0. DXC/DXIL 1.9.2609.5, rustc 1.100.0 (0ef1bc386 2026-11-09). Unoptimized builds with debug info disabled and XCL_ADAPTER=A770.

Tested

  • cargo build --workspace and cargo test --workspace --no-run both succeeded outside the GPU lock.
  • cargo test -p xcl console_samplers_keep -- --nocapture reported 2 passed, 0 failed, 0 ignored. The two CPU tests verify point, linear, mixed and anisotropic filter encoding and preservation of all four border-colour components in the PC descriptor used by CreateSamplerX.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 ran once under the shared Arc lock. Cargo exited 101. pr1885-suite.log contains 20 result blocks totalling 942 passed, 19 failed, 43 ignored, with 22 SKIPPED lines counted separately. Both sampler tests passed in this run too.

Failures and skips

  • 18 library failures. 14 rejected compute PSO creation with 0x80070057, including FP64 cases. Four reported result mismatches in FMA overflow, FP16 high-half preservation, implicit-LOD offset sampling (25.609375 vs 26), and wave64 pixel reductions. The offset-sampling test supplies a sampler from an S# descriptor directly to the GPU runner.
  • One test-title e2e failure. The RSSetDepthBiasX check read blue at the top-right pixel where it expected green.
  • The 22 logged skips were 17 for unavailable wave64, three for refused wave32 per-lane DXIL forms, one for unavailable driver-cache control, and one for unavailable heap windows. They provide no coverage for the skipped paths.

Not tested

GPU rendering via CreateSamplerX, retail titles or a paired main/PR smoke run, other GPUs, and game-data checks gated by unset XCL_SAMPLE_* variables. The debug-layer title check returns early on this host because d3d12SDKLayers.dll is absent.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1885-suite.log and published this report.

<!-- greyfinch-sync:ivall/xcl:comment:7151501361 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#issuecomment-7151501361). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T03:00:45Z. --- # PR #1885 — Intel Arc A770 verification Tested commit `b76c075450a3bee4d4d27ad6e9de06d0e308f933`, the fetched PR head. **Environment** STOR-WINLAB, Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X. Intel Arc A770 16 GiB, driver 32.0.101.9175, wave range 8–32, `DoublePrecisionFloatShaderOps=0`. DXC/DXIL 1.9.2609.5, `rustc 1.100.0 (0ef1bc386 2026-11-09)`. Unoptimized builds with debug info disabled and `XCL_ADAPTER=A770`. **Tested** - `cargo build --workspace` and `cargo test --workspace --no-run` both succeeded outside the GPU lock. - `cargo test -p xcl console_samplers_keep -- --nocapture` reported **2 passed, 0 failed, 0 ignored**. The two CPU tests verify point, linear, mixed and anisotropic filter encoding and preservation of all four border-colour components in the PC descriptor used by `CreateSamplerX`. - `cargo test --workspace --no-fail-fast -- --test-threads=4` ran once under the shared Arc lock. Cargo exited 101. `pr1885-suite.log` contains 20 result blocks totalling **942 passed, 19 failed, 43 ignored**, with **22 `SKIPPED ` lines** counted separately. Both sampler tests passed in this run too. **Failures and skips** - 18 library failures. 14 rejected compute PSO creation with `0x80070057`, including FP64 cases. Four reported result mismatches in FMA overflow, FP16 high-half preservation, implicit-LOD offset sampling (25.609375 vs 26), and wave64 pixel reductions. The offset-sampling test supplies a sampler from an S# descriptor directly to the GPU runner. - One test-title e2e failure. The `RSSetDepthBiasX` check read blue at the top-right pixel where it expected green. - The 22 logged skips were 17 for unavailable wave64, three for refused wave32 per-lane DXIL forms, one for unavailable driver-cache control, and one for unavailable heap windows. They provide no coverage for the skipped paths. **Not tested** GPU rendering via `CreateSamplerX`, retail titles or a paired `main`/PR smoke run, other GPUs, and game-data checks gated by unset `XCL_SAMPLE_*` variables. The debug-layer title check returns early on this host because `d3d12SDKLayers.dll` is absent. **AI use** T3 Code / Codex (`gpt-6.2-sol`, `reasoningEffort: high`) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, `gemini-4-neon`) verified counts against `pr1885-suite.log` and published this report.
github-actions[bot] commented 2026-11-28 08:01:27 +00:00 (Migrated from github.com)

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


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:7236311440 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#issuecomment-7236311440). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T08:01:27Z. --- 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.
Kalmarv commented 2026-11-28 23:39:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-28T23:39:38Z.


A few layout and translation issues spotted in pc_sampler_desc / sampler_x_filter while auditing CreateSamplerX:

  1. Mip filter offset (+0x0C vs +0x10): pc_sampler_desc reads u(0x10) as the mip filter, but in the console extended sampler descriptor +0x0C is FilterMip and +0x10 is FilterZ (volume Z filter). Reading +0x10 causes 2D trilinear samplers whose Z filter is NONE/POINT to silently lose linear mip filtering (and console_sampler in the unit test swaps the two slots as well). Also, when FilterMip == 0 (NONE), clamping MaxLOD = MinLOD preserves disabled mip selection on PC.
  2. Reduction mode (+0x14) and comparison filter bit: sampler_x_filter always emits standard filtering (reduction = 0).
    • +0x14 (FilterMode: 1 = minimum, 2 = maximum) should set the D3D12 minimum (0x100) / maximum (0x180) reduction bits so min/max downsample samplers stay conservative instead of averaging.
    • When +0x40 (ComparisonFunc) is an active comparison (2..=7, LESS..=GREATER_EQUAL) and FilterMode == 0, the comparison reduction bit (0x80) should be set so D3D12_FILTER_COMPARISON_* is produced (and 0 clamped to D3D12_COMPARISON_FUNC_NEVER).
  3. Console texture address modes: +0x18/+0x1C/+0x20 are cast directly to D3D12_TEXTURE_ADDRESS_MODE, which passes console-only address modes 6..=8 (or 0) straight through to PC D3D12 instead of mapping them to valid PC modes (1..=5, e.g. 6 -> BORDER, 7 | 8 -> MIRROR_ONCE, 0 -> WRAP).
  4. Descriptor size check (0x6C vs 0x54): create_sampler_x checks readable(x, 0x6C), which can reject valid 0x5C-byte descriptors from older titles near a page boundary; all fields read by pc_sampler_desc end at +0x54.
<!-- greyfinch-sync:ivall/xcl:comment:7247578574 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#issuecomment-7247578574). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-28T23:39:38Z. --- A few layout and translation issues spotted in `pc_sampler_desc` / `sampler_x_filter` while auditing `CreateSamplerX`: 1. **Mip filter offset (`+0x0C` vs `+0x10`)**: `pc_sampler_desc` reads `u(0x10)` as the mip filter, but in the console extended sampler descriptor `+0x0C` is `FilterMip` and `+0x10` is `FilterZ` (volume Z filter). Reading `+0x10` causes 2D trilinear samplers whose Z filter is `NONE`/`POINT` to silently lose linear mip filtering (and `console_sampler` in the unit test swaps the two slots as well). Also, when `FilterMip == 0` (`NONE`), clamping `MaxLOD = MinLOD` preserves disabled mip selection on PC. 2. **Reduction mode (`+0x14`) and comparison filter bit**: `sampler_x_filter` always emits standard filtering (`reduction = 0`). - `+0x14` (`FilterMode`: `1` = minimum, `2` = maximum) should set the D3D12 minimum (`0x100`) / maximum (`0x180`) reduction bits so min/max downsample samplers stay conservative instead of averaging. - When `+0x40` (`ComparisonFunc`) is an active comparison (`2..=7`, `LESS..=GREATER_EQUAL`) and `FilterMode == 0`, the comparison reduction bit (`0x80`) should be set so `D3D12_FILTER_COMPARISON_*` is produced (and `0` clamped to `D3D12_COMPARISON_FUNC_NEVER`). 3. **Console texture address modes**: `+0x18/+0x1C/+0x20` are cast directly to `D3D12_TEXTURE_ADDRESS_MODE`, which passes console-only address modes `6..=8` (or `0`) straight through to PC D3D12 instead of mapping them to valid PC modes (`1..=5`, e.g. `6 -> BORDER`, `7 | 8 -> MIRROR_ONCE`, `0 -> WRAP`). 4. **Descriptor size check (`0x6C` vs `0x54`)**: `create_sampler_x` checks `readable(x, 0x6C)`, which can reject valid `0x5C`-byte descriptors from older titles near a page boundary; all fields read by `pc_sampler_desc` end at `+0x54`.
veyn-sudo commented 2026-11-29 13:58:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by veyn-sudo on 2026-11-29T13:58:06Z.


@Kalmarv thanks. I measured point 1 and you are right: the mip filter is at +0xC. Fixed in the new head (5824d212).

What I measured: a retail title for 120 s at the old head with a temporary log of every distinct desc CreateSamplerX gets (30 descs):

  • +0x10 follows magnification / minification in all 30: 1 for the 5 point descs, 2 for the 25 bilinear and anisotropic ones.
  • +0xC does not: of the 17 bilinear descs, 2 have 1 and 15 have 2. The pair (+0xC, +0x10) = (2, 1) never occurs.

That is a mip filter at +0xC and a z filter at +0x10 that follows the XY filter. I also logged the shaders' own S#s: their z filter is 0 in all 7, so they could not decide it. The test now has the title's 1 1 1 2 desc as bilinear with point mips, and fails with the old offset (D3D12_FILTER(21) instead of 20).

Points 2–4: in all 30 descs +0x14 is 0, the comparison is 1 (NEVER), the address modes are 1–4 and nothing past +0x50 is non-zero. So this title has no min/max or comparison samplers and no console-only address modes, and I have nothing to test those changes against. They are also how main behaves without this PR. I'd leave them to a separate PR with a title that uses them; #3248 is related too. Mip NONE (0) did not occur either, so I have not changed it.

AI use: Claude Code (Claude Opus 5.5) did the measurement, the change and this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7256937560 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#issuecomment-7256937560). Originally posted by [veyn-sudo](https://github.com/veyn-sudo) on 2026-11-29T13:58:06Z. --- @Kalmarv thanks. I measured point 1 and you are right: the mip filter is at +0xC. Fixed in the new head (`5824d212`). What I measured: a retail title for 120 s at the old head with a temporary log of every distinct desc `CreateSamplerX` gets (30 descs): - +0x10 follows magnification / minification in all 30: 1 for the 5 point descs, 2 for the 25 bilinear and anisotropic ones. - +0xC does not: of the 17 bilinear descs, 2 have 1 and 15 have 2. The pair (+0xC, +0x10) = (2, 1) never occurs. That is a mip filter at +0xC and a z filter at +0x10 that follows the XY filter. I also logged the shaders' own S#s: their z filter is 0 in all 7, so they could not decide it. The test now has the title's `1 1 1 2` desc as bilinear with point mips, and fails with the old offset (`D3D12_FILTER(21)` instead of `20`). Points 2–4: in all 30 descs +0x14 is 0, the comparison is 1 (`NEVER`), the address modes are 1–4 and nothing past +0x50 is non-zero. So this title has no min/max or comparison samplers and no console-only address modes, and I have nothing to test those changes against. They are also how `main` behaves without this PR. I'd leave them to a separate PR with a title that uses them; #3248 is related too. Mip `NONE` (0) did not occur either, so I have not changed it. AI use: Claude Code (Claude Opus 5.5) did the measurement, the change and this comment.
Foniass commented 2026-12-01 07:03:52 +00:00 (Migrated from github.com)

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


Triage (#1607) – head 5824d21

No open or merged PR makes the same change. #3248 changes dev_create_sampler_x (encoding the PC desc into an S#) downstream of create_sampler_x; the two complement each other and do not overlap.
No problems found in the diff: sampler_x_filter encodes the filter the way D3D12_ENCODE_BASIC_FILTER does, and the tests cover point / bilinear / trilinear / anisotropic and the border colour. The filter is still never a comparison filter when +0x40 holds a comparison function (as before this PR).
The Build and test (Windows, no GPU) check is failing on this head.
Recommendation: keep open.

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:7303602827 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1885#issuecomment-7303602827). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:03:52Z. --- **Triage (#1607)** – head 5824d21 No open or merged PR makes the same change. #3248 changes `dev_create_sampler_x` (encoding the PC desc into an S#) downstream of `create_sampler_x`; the two complement each other and do not overlap. No problems found in the diff: `sampler_x_filter` encodes the filter the way `D3D12_ENCODE_BASIC_FILTER` does, and the tests cover point / bilinear / trilinear / anisotropic and the border colour. The filter is still never a comparison filter when +0x40 holds a comparison function (as before this PR). The `Build and test (Windows, no GPU)` check is failing on this head. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1885:upstream-pr/1885'
git switch 'upstream-pr/1885'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1885'
git switch 'upstream-pr/1885'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1885'
git switch 'upstream-pr/1885'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1885'
git switch 'main'
git merge --squash 'upstream-pr/1885'
git switch 'main'
git merge --ff-only 'upstream-pr/1885'
git switch 'main'
git merge 'upstream-pr/1885'
git push origin 'main'
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!1875
No description provided.