Skip to content

test(d3d12): verify heap and static POINT/LINEAR samplers in M2 - #4192

Open
oguzhanozfe wants to merge 6 commits into
ItsNotRexed:mainfrom
oguzhanozfe:test/m2-static-filter
Open

oguzhanozfe wants to merge 6 commits into
ItsNotRexed:mainfrom
oguzhanozfe:test/m2-static-filter

Conversation

@oguzhanozfe

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue: #4084 (comment)

Depends on: #3494 (register root-signature static samplers) and #3717 (heap POINT/LINEAR CPU reference). The incremental test change is ce46667.

What and why

Render the same M2 quad four ways: heap POINT, heap LINEAR, static POINT and static LINEAR. The static root signatures each declare one sampler. The original assembly fixture receives its S# by value through root constants and loads only the SRV from a descriptor table. Only the SRV heap is bound for the static draws.

Check each static S# lookup before and after root-signature creation, before creating any heap samplers or the corresponding PSO. Static keys use MaxLOD zero and therefore differ from the heap sampler keys even though all sample the same single mip. All four readbacks are compared independently against the same CPU nearest and bilinear reference functions. LINEAR allows one RGBA8 quantization level.

Tested

Clean GitHub checkout of ce46667, Windows, MSVC, GeForce RTX 3090 driver 621.24, Vulkan validation enabled. Built target d3d12_m2_textured_test and ran:

ctest --test-dir build-m2 -V -R "^d3d12_m2_textured$"

All 4096 pixels matched for each of the four draws, with zero maximum channel error. The separate addressing control still differed from the plain scene at 1536 pixels as expected. All four original shader fixtures translated and passed spirv-val. A local negative control that supplied the static POINT key for the LINEAR draw failed at pixel (4,0), red 0 versus expected 2. The GPU-runner Python unit suite passed 40 tests.

Checklist

  • No game data, keys or decryption, including in logs and reports.
  • No translator rule changed.

kotorvr and others added 6 commits November 22, 2026 20:27
…lers

The Vulkan device parsed a root signature's static samplers and dropped them,
so a shader holding one's S# by value missed in the hash table and sampled
through the fallback sampler. Each one now gets a sampler in set 0 and a key in
the hash table at root-signature creation, encoded as CreateSampler2 encodes
the same description (1.0, 1.1 and 1.2 blobs, the static border-colour enum,
the 1.2 flags).

d3d12_descriptor_test checks the key before and after for four root
signatures and samples with three of them on the GPU. docs/d3d12_vulkan.md no
longer says both that they are registered and that they are not.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@whattheflop

Copy link
Copy Markdown
Contributor

Added Radeon iGPU verification at 82ef2f1. All four stock sampler draws matched 4,096/4,096 pixels each with zero channel error, and the addressing control passed. Zero core or synchronization validation errors. AI-assisted.

@Kam471 Kam471 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.

Built and ran d3d12_m2_textured_test at 82ef2f1f on Windows 11, RTX 5070 Ti (Vulkan 1.4.357, LLVM_MC from LLVM 21, SDK spirv-as/spirv-val):

  • Translator: 4 shaders, 4 translated, 4 pass spirv-val (including ps_m2_static.asm).
  • M2 heap: POINT exact, LINEAR maximum RGBA8 error 0 over 4096 pixels each.
  • M2 static: POINT exact, LINEAR maximum RGBA8 error 0 over 4096 pixels each.
  • The original heap path still matches: 4096/4096 pixels error 0, sampler control WRAP left / CLAMP right differs on 1536 pixels, 2 image entries + 1 sampler entry in the hash table.
  • ctest -R '^d3d12_m2_textured$' -> 1/1 passed (0.22 s).

The static draws use only CreateRootSignature, SetGraphicsRoot32BitConstants and the SRV heap (no sampler heap), so the zero error confirms that CreateRootSignature alone registers the static sampler's S# in the hash table while the heap POINT/LINEAR paths stay correct in the same draw. This also exercises #3494's registration and #3717's CPU reference as stacked here. No blocking issue.

@requiemsnkrp

Copy link
Copy Markdown

Tested 82ef2f1f (merged onto main aa2988cc; the branch includes #3494 and #3717) on NVIDIA GeForce RTX 3060, driver 32.0.16.1714, Windows 11, MSVC 19.51, Vulkan SDK 1.4.363.0: pass.

  • With LEONIDA_VK_VALIDATION=1 (llvm-mc 21 build):
    • d3d12_m2_textured ... Passed: M2 heap: POINT exact, LINEAR maximum RGBA8 error 0 over 4096 pixels each and M2 static: POINT exact, LINEAR maximum RGBA8 error 0 over 4096 pixels each.
    • d3d12_descriptor ... Passed: static samplers: 4 of 4 root signatures registered their S#, and root signatures 1.0, 1.1 and 1.2 each give 64/64 texels wrapped.
  • Full ctest (-E "present|swapchain|frame_pacer"): 100% tests passed, 0 tests failed out of 148 (9 skipped/disabled, same set as main: shader_library_corpus, bink_decode, bink_play_headless, fsr_dispatch, bvh_builder, bink_audio, gameinput, d3d12_rgb9e5_rtv, d3d12_first_light).

AI-assisted (Claude). No game files.

@dcastell1

Copy link
Copy Markdown
Contributor

Tested 82ef2f1 on RTX 5090, 621.24, Windows 11: pass. Built the runtime from this tree and ran the two tests it touches:

d3d12_descriptor      Passed
d3d12_m2_textured     Passed  0.35 s
100% tests passed, 0 tests failed out of 2

So the static POINT/LINEAR samplers reach the M2 textured quad with the expected pixels and the heap checks still pass.

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.

6 participants