Skip to content

test(d3d12): compare POINT and LINEAR M2 draws against CPU pixels - #3717

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
oguzhanozfe:test/m2-point-linear
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
oguzhanozfe:test/m2-point-linear

Conversation

@oguzhanozfe

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #3574 (comment)

What and why

The existing M2 draw verifies point sampling and wrap/clamp addressing. This adds a LINEAR/CLAMP sampler slot and draws the same two scissored halves again with the same pipeline, UVs, textures and root tables. The two results are read back separately. The CPU computes the four clamped taps at each pixel center and rounds the blend to RGBA8. POINT and the wrap/clamp control retain their exact comparisons. LINEAR allows one UNORM level per channel.

Tested

Fresh Windows checkout at 9cae273, MSVC, NVIDIA GeForce RTX 3090, driver 621.24, Vulkan validation enabled. Built the d3d12_m2_textured_test target with the repository's three hand-written shader fixtures. All three translated and passed spirv-val.

ctest --test-dir build-m2 -V -R "^d3d12_m2_textured$" passed. All 4096 POINT pixels and all 4096 LINEAR pixels matched the CPU exactly (maximum observed channel error 0). The existing addressing control still differed at its expected 1536 pixels. Forcing the POINT slot for the LINEAR draw in a local negative control failed at (4, 0), red 0 versus expected 2.

Checklist

  • No game data, keys or decryption, including in logs and reports.
  • Translator contract: no translator change.

@kacper-serewis kacper-serewis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

9cae273 on RTX 5070 driver 616.56, Windows MSVC 19.50: POINT and LINEAR each matched all 4096 pixels exactly, wrap/clamp differed at the expected 1536. Substituting POINT in the LINEAR descriptor failed first at (4,0); restoring it reproduced the pass. Three synthetic shaders passed spirv-val. AI-assisted.

@whattheflop

Copy link
Copy Markdown
Contributor

Independent Radeon Windows verification of the unchanged 9cae273 M2 test passed with #3045 in scratch. POINT and LINEAR each matched all 4,096 pixels exactly, the addressing control differed at the expected 1,536, and core/synchronization validation reported zero warnings/errors. Configuration and GPU report. AI-assisted.

@Desamodeth Desamodeth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested 9cae273 on Windows 11, MSVC Release, RTX 5070 (621.24), Vulkan validation on. LLVM 23.1.5 assembled the three M2 fixtures; all three translated and passed spirv-val. Both POINT and LINEAR matched the CPU on all 4,096 pixels, with maximum channel error 0. The addressing control differed on the expected 1,536 pixels. As a separate negative control I changed only the LINEAR sampler U address mode from CLAMP to WRAP: the test failed at (0, 0), red 110 instead of 0. Restoring CLAMP passed again. Synthetic draws only. AI-assisted.

@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 9cae273 on NVIDIA GeForce RTX 4090 (Ada), 621.14 (Vulkan 1.4.357), Windows 11 (26200): pass. A second NVIDIA generation next to the author's RTX 3090 / 621.24.

MSVC 19.44 (VS 2022), Ninja, RelWithDebInfo; the branch is on main f847748. llvm-mc 21.1.8 for the three shader fixtures.

d3d12_m2_textured_test result
normal run exit 0: M2 LINEAR: 4096 pixels, maximum RGBA8 channel error 0; the POINT pass still "matched all 4096 pixels (error 0 ...)" and the WRAP/CLAMP control still differs at 1536 pixels
LEONIDA_VK_VALIDATION=1 (output says validation on) exit 0, same LINEAR line
ctest -R "^d3d12_m2" --repeat until-fail:5 d3d12_m2_textured and d3d12_m2_formats 5/5

So bilinear filtering through the layer matches the CPU's four-tap blend exactly on this driver as well, without needing the one-level tolerance. I did not repeat the PR's negative control (forcing the POINT slot). No game files. AI-assisted check (Claude Code).

@MatyEjsr

Copy link
Copy Markdown

Tested 9cae273a on NVIDIA GeForce RTX 3090 (Ampere, driver 32.0.16.1742 / 617.42), Windows 11 (10.0.26200), VS 2022 Build Tools (MSVC 19.44.35230.0, Ninja RelWithDebInfo), Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0: pass.

  • Clean scripts\build_runtime.ps1 build: exit 0.
  • Targeted ctest -R ^(d3d12_m2_textured|d3d12_m2_formats)$ (validation off): 2/2 pass (d3d12_m2_textured 0.31s: M2 LINEAR: 4096 pixels, maximum RGBA8 channel error 0; d3d12_m2_formats 0.30s).
  • Targeted ctest -R ^(vk_sync_validation|d3d12_m2_textured|d3d12_m2_formats)$ with LEONIDA_VK_VALIDATION=1 and VK_LOADER_LAYERS_DISABLE=~implicit~: 3/3 pass, vk_sync_validation confirmed active, 0 validation errors, M2 LINEAR: 4096 pixels, maximum RGBA8 channel error 0 (d3d12_m2_textured 0.28s).
  • Full ctest (validation off, no game files): 132 passed, 8 skipped, 1 disabled (gameinput), 0 failed (116.1s).

Code read of runtime/test/d3d12_m2_textured_test.cpp looks clean: linear_clamp matches pixel-center bilinear filtering with clamped taps and <= 1 UNORM channel tolerance while keeping exact byte-for-byte POINT and wrap/clamp control checks.

AI-assisted.

@ddm-j

ddm-j commented Nov 22, 2026

Copy link
Copy Markdown

Tested 9cae273 under Wine 11.21 (Fedora 45) on AMD Radeon 610M iGPU (RDNA2 gfx1036, RADV Mesa 26.2.6) and NVIDIA RTX 4070 Ti (615.78.08): pass. This is the first run on RADV and on a Linux driver; the earlier checks are AMD and NVIDIA on Windows.

  • d3d12_m2_textured on both GPUs: M2 LINEAR: 4096 pixels, maximum RGBA8 channel error 0. POINT matched all 4096 pixels (error 0), and the WRAP/CLAMP control differs at the expected 1536 pixels. RADV's LINEAR blend is exact too, so the one-level tolerance isn't needed on any device tested so far.
  • d3d12_m2_formats: 12/12 cases, 0 of 4096 pixels differ, on both GPUs.
  • Full ctest on this head: 120 passed, 18 skipped, 0 failed (of 138) on both GPUs, the same counts as base f847748 on this machine earlier today. I didn't rebuild the base for this run because the PR changes only the test file.

Not run: d3d12_present (hangs on a real GPU under Xvfb) and device_proxy (no host D3D12 in Fedora's Wine). There's no Vulkan validation layer in the Wine prefix.

AI-assisted (Claude Code); numbers copied from the run logs.

@requiemsnkrp

Copy link
Copy Markdown

Tested 9cae273a (merged onto main f847748c) on NVIDIA GeForce RTX 3060, driver 32.0.16.1714, Windows 11, MSVC 19.51, Vulkan SDK 1.4.363.0: pass.

  • Configured with llvm-mc (LLVM 21, AMDGPU target) so the M2 shaders translate; d3d12_m2_textured with LEONIDA_VK_VALIDATION=1 (device: NVIDIA GeForce RTX 3060 (validation on)): Passed 0.35 sec, output M2 LINEAR: 4096 pixels, maximum RGBA8 channel error 0 and M2: a textured quad ... matched all 4096 pixels (error 0, and the sampler control: WRAP left, CLAMP right, 1536 pixels differ from the plain pass). No validation errors printed.
  • Full ctest (-E "present|swapchain|frame_pacer", llvm-mc build): 100% tests passed, 0 tests failed out of 135 (8 skipped/disabled, same set as main: shader_library_corpus, bink_decode, fsr_dispatch, bvh_builder, bink_audio, gameinput, d3d12_rgb9e5_rtv, d3d12_first_light).

AI-assisted (Claude). No game files.

@ricardotanaka

Copy link
Copy Markdown

Also tested 9cae273a (merged onto main f847748c) on AMD Radeon RX 7600 (RDNA3), AMD driver 26.11.2, Windows 11 26200.9457, MSVC 19.44 RelWithDebInfo: pass, same as the checks above. d3d12_m2_textured: POINT and LINEAR 4096 pixels each, maximum channel error 0, the WRAP/CLAMP control differs at 1536; same with LEONIDA_VK_VALIDATION=1; full ctest 140/140.

No game files. AI-assisted (Claude Code).

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.

10 participants