Skip to content

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

Open
veyn-sudo wants to merge 2 commits into
xcl-dev:mainfrom
veyn-sudo:pr/sampler-filter
Open

veyn-sudo wants to merge 2 commits into
xcl-dev:mainfrom
veyn-sudo:pr/sampler-filter

Conversation

@veyn-sudo

Copy link
Copy Markdown

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, mip at +0x10, numbered as in an S# (the z filter at +0xC 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. Anisotropic point (2) is point, as #1117 reads it in an S#.

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: 961 passed, 0 failed, 43 ignored. SKIPPED lines: 18 no wave64, 1 no heap windows, 3 per-lane f16 refusals
  • new tests console_samplers_keep_their_filter, console_samplers_keep_their_border_colour
  • the 30 different descs a retail title makes up to its first screen: 5 point (2 2 1 1), 17 bilinear (1 1 1 2, 1 1 2 2), 8 anisotropic (3 3 2 2, one with a maximum of 1). 9 use border addressing, one of them with opaque black and one with white. None has a comparison function

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): 60 60 60
device removals: 0
crashes: 0
peak commit: 17766 MB

PR:

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

Not tested

  • a visible difference in the title: none was looked for
  • the field meanings are read from these descs and the S# numbering; +0xC as z and +0x10 as mip rests on the S# field order and the two descs where they differ
  • AMD, Intel and other NVIDIA GPUs; comparison samplers (none seen, not modelled, as before)

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

veyn-sudo and others added 2 commits November 24, 2026 23:27
CreateSamplerX made every sampler anisotropic, so point samplers filtered linearly. The desc has
the filters at +4 / +8 (magnification, minification), +0xC (z) and +0x10 (mip), numbered as in an
S#.

Of the 30 different descs a retail title makes up to its first screen, 5 are point (2 2 1 1), 17
bilinear (1 1 1 2, 1 1 2 2) and 8 anisotropic (3 3 2 2; one of them with a maximum of 1). None has
a comparison function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CreateSamplerX gave every sampler a transparent black border. The desc has the colour at +0x44: of
a retail title's 9 descs with border addressing, one asks for opaque black and one for white.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@veyn-sudo
veyn-sudo marked this pull request as ready for review November 24, 2026 22:35
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #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.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026

@lewisnic94-max lewisnic94-max left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

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

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

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.

IvyNotFound added a commit to IvyNotFound/xcl that referenced this pull request Nov 25, 2026
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.

5 participants