Skip to content

Tests: a compute dispatch that samples through set 0 (d3d12_set0_compute_test) - #1698

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
aslan2142:set0-compute-test-main
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
aslan2142:set0-compute-test-main

Conversation

@aslan2142

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: finding + claim (no item ID yet)

What and why

Since #1489 the layer binds the bindless set 0 at dispatches as well as at draws, but no test runs a D3D12 compute dispatch through set 0:

  • d3d12_compute_test takes the binding-free index entry on purpose.
  • d3d12_descriptor_test samples through set 0 with a Vulkan pipeline of its own, not through CreateComputePipelineState and Dispatch.
  • d3d12_m2_textured_test covers the bind at draws only.

So the bind at dispatches can be removed without any test noticing (measured, see "Mutation" below).

This adds d3d12_set0_compute_test. No layer code changes: the test passes on main as it is.

  • PSO: a compute PSO whose index entry lists set-0 bindings. The shader is test/glsl/cs_set0_sample.comp, GLSL written to the translator's contract.
  • Four dispatches through D3D12 alone:
    • two SRVs, each texel for texel, so the T# decides the image;
    • 32 bytes no view was made for, which give the fallback image;
    • a clamping sampler, which gives the texture's right edge, so the S# decides the sampler.
  • Refusal: a device without the bindless set refuses the PSO.
  • Build and docs: registered with ctest like its neighbours (exit 77 is a skip); one entry each in runtime/README.md and docs/d3d12_vulkan.md.

Why it matters: 2,255 of the 2,689 compute shaders in the corpus declare set-0 bindings. That is a count over my own copy, from the translator's index.json.

Tested

Commit 705a40b on main a0acd33. Linux 7.3.5, Mesa 26.3.1 (RADV; llvmpipe on LLVM 23.1.5), Vulkan 1.4.363, GCC 16.2.1. The Windows-only tests are cross-built with mingw-w64 (GCC 16.2.0) and run under Wine 11.22 with the Khronos validation layer on the host side.

RX 7900 XTX (RDNA3, RADV) Ryzen 9 7950X3D iGPU (RDNA2, RADV) llvmpipe
d3d12_set0_compute_test pass, 4 × 64 texels exact pass, 4 × 64 texels exact pass, 4 × 64 texels exact
d3d12_m2_textured_test, d3d12_translated_draw_test, d3d12_compute_test, d3d12_draw_test pass pass pass
All D3D12 tests under Wine 21 pass, 8 skip (29 run ¹) 21 pass, 8 skip, 4 fail ² 21 pass, 8 skip, 4 fail ²
Linux ctest 27/27 27/27 27/27
  • No validation errors in any passing run.
  • ¹ On the RX 7900 XTX I ran only the tests that pass on the other two devices.
  • ² d3d12_clear_test, d3d12_descriptor_test (line 477), d3d12_fence_timing_test and d3d12_present_test (line 414, the GDI screen pixel). They are limits of mingw and Wine: this PR touches neither them nor the layer, and the same four failed on main 99f9989 here.
  • Three tests do not link in my mingw setup: d3d12_copy_xfmt_test, d3d12_m3_frame_test and d3d12_vulkan_device_test.
  • scripts/run_gpu_tests.py was not run: the change touches neither the translator nor the test tools.
  • tests/test_ctest_registration.py: pass.

Mutation (llvmpipe only, because an unbound set is invalid GPU work), on this commit:

Removed from vulkan_replay.h d3d12_set0_compute_test d3d12_m2_textured_test The other 31 tests
the set-0 bind at dispatches fails passes same pass, fail and skip as unmodified
the set-0 bind at draws passes fails not run
  • "Fails" means the validation layer reports VUID-vkCmdDispatch-None-08600 or VUID-vkCmdDrawIndexed-None-08600 and the test process crashes in llvmpipe.

Not tested

  • MSVC. The test has never been built with MSVC (/W4 /permissive-); CI's windows job is its first such build.
  • A Windows run on a native driver.
  • Under Wine the test opens its SPIR-V through a path compiled in at build time, like its neighbours; TEST-240 is about that pattern.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator change.)

AI-assisted (Claude Code, Claude Fable 5.2).

🤖 Generated with Claude Code

…ute_test)

Since ItsNotRexed#1489 the layer binds the device's bindless set at every dispatch as well as at every draw, but only the
draw has a test (d3d12_m2_textured_test): d3d12_compute_test takes the binding-free index entry on purpose, and
d3d12_descriptor_test samples through set 0 with a Vulkan pipeline of its own.

This test covers the compute bind point through D3D12 alone: a compute PSO whose index entry lists set-0
bindings, two SRVs, bytes no view was made for, and a wrapping and a clamping sampler. Four dispatches of
test/glsl/cs_set0_sample.comp (GLSL written to the translator's contract) load the T# and the S# from the
descriptor tables, find them in the hash table and sample: the two textures texel for texel, the fallback image
for the unknown bytes, and the right edge with the clamping sampler. A device without the bindless set refuses
the PSO. Registered with ctest like its neighbours (exit 77 is a skip).

With the vkCmdBindDescriptorSets call of the compute bind point removed from replay, this test fails
(VUID-vkCmdDispatch-None-08600, on llvmpipe).

Checked with a mingw-w64 build under Wine on llvmpipe, an RDNA2 integrated GPU and an RX 7900 XTX (RADV), with
the validation layer: exact, no validation errors. Not built with MSVC.

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

Copy link
Copy Markdown
Contributor

Independent native Windows verification (AI-assisted). I checked the open head 705a40bda920994f9198ad0166584142a19edc45 against its base and live upstream main, both a0acd33d77babe67a28e398b2936a9f735a50f5d. Both refs still matched immediately before posting.

The stock d3d12_set0_compute_test built on Windows 11 Pro (26200) with MSVC 19.38.33145 x64, /W4 /permissive-, WinSDK 10.0.26100.0, CMake 4.4.4, Ninja 1.13.2 and uv-managed Python 3.12.13. glslangValidator 16.6.0 compiled the shader, and independent SPIRV-Tools spirv-val v2026.4 passed with --target-env vulkan1.3. CTest registered d3d12_set0_compute with SKIP_RETURN_CODE=77. The stock binary returned 77 with an empty ICD directory and CTest showed Skipped. The stock descriptor_table, shader_library, and bindless_sizing CPU tests passed, as did all three checks in tests/test_ctest_registration.py.

For GPU verification I used a disposable valid-only fixture with the same production runtime, byte-identical shader module, ordinary D3D12 compute PSO and four dispatches through the Xbox-ABI device proxy. I omitted the deliberate PSO refusal and did not run any missing-bind mutation. Before submission I checked that both SRV keys and both ordinary sampler keys resolved to distinct nonzero indices, and the eight initialized dwords in the third view slot resolved to index 0. The fallback is a bound 1x1 RGBA8_UNORM view in GENERAL, cleared to zero and made visible before replay. That dispatch uses the registered wrapping sampler. The clamp case uses the second ordinary sampler and the first SRV.

Dispatch RTX 3080 Radeon iGPU First → last RGBA8 on both
SRV 0, wrap 64/64 64/64 (0,0,255,255) → (252,252,31,255)
SRV 1, wrap 64/64 64/64 (252,252,31,255) → (0,0,255,255)
Initialized key miss, fallback image 64/64 64/64 (0,0,0,0) → (0,0,0,0)
SRV 0, clamp 64/64 64/64 (252,0,143,255) → (252,252,31,255)

Both exited 0 with 256/256 exact texels and zero validation errors. Readback also confirmed that changing only the SRV or only the sampler changed the output. Runs were serial, each with one process-local ICD and an empty implicit-layer directory. VK_LAYER_KHRONOS_validation 1.4.363 reported Synchronization enabled in both startup logs. Windows driver versions were 32.0.16.1664 (RTX 3080, Vulkan 1.4.351) and 32.0.21030.2001 (AMD Radeon(TM) Graphics, Vulkan 1.4.315). This is headless synthetic coverage of the valid dispatch path and the stock no-ICD skip.

@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Independently verified commit 705a40bd on native Windows 11 with MSVC (19.44, Ninja, VK_LOADER_LAYERS_DISABLE=~implicit~, synthetic scene):

  • Build: d3d12_set0_compute_test compiled cleanly under MSVC with zero warnings.
  • NVIDIA GeForce RTX 5080 (driver 616.92, Vulkan 1.4.351): PASS (exit=0) — set 0 from compute: four dispatches sampled through the bindless set the layer bound; 64 texels matched for each of two SRVs and for a clamping sampler, and bytes no view was made for gave the fallback image.
  • AMD Radeon(TM) Graphics (driver 26.10.1, Vulkan 1.4.315): PASS (exit=0) — exact same 4×64 texel match and no-bindless-set refusal.
  • Note: VK_LAYER_KHRONOS_validation is not installed locally.

AI Assisted.

@Capi360

Capi360 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 705a40bda920994f9198ad0166584142a19edc45 on native Windows 11 (build 26200) with an NVIDIA GeForce RTX 3060 Ti, driver 616.56, Vulkan 1.4.351, MSVC 19.44 and Windows SDK 10.0.28000.0. All three focused CTests passed with Khronos core and synchronization validation enabled and zero validation errors.

  • d3d12_set0_compute matched all 64 texels in each of the four dispatches. The unknown descriptor returned the fallback image, and the PSO was refused when bindless set 0 was unavailable.
  • d3d12_compute and d3d12_descriptor also passed.

Synthetic inputs only. AI-assisted testing.

@Yourrespawn

Copy link
Copy Markdown
Contributor

Tested 705a40bd on NVIDIA GeForce RTX 4080 (Ada), driver 617.14, Vulkan API 1.4.351, Windows 11 Pro 10.0.26200: pass.

  • d3d12_set0_compute_test with LEONIDA_VK_VALIDATION=1 (Core + Synchronization): PASS — four dispatches sampled through the bindless set the layer bound; 64 texels matched for each of two SRVs and for a clamping sampler; bytes no view was made for gave the fallback image; 0 validation errors
  • ctest RelWithDebInfo: 94/94 (SDL3 present, so gameinput runs too)
  • run_gpu_tests.py: 125/163 passed, 38 skipped (native wave64, expected on this 32-lane GPU)

AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine.

@kapitche

Copy link
Copy Markdown
Contributor

Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass. ctest: 96/96 on the RTX 4080 SUPER, and the new d3d12_set0_compute passes on the Intel UHD 770 too. The Intel UHD 770 failures are the known ones in #1548: d3d12_vulkan_device, d3d12_descriptor, d3d12_present, d3d12_m3_frame and d3d12_copy_xfmt.

@ItsNotRexed
ItsNotRexed merged commit 464cff7 into ItsNotRexed:main Nov 22, 2026
7 of 10 checks passed
@aslan2142
aslan2142 deleted the set0-compute-test-main branch November 22, 2026 14:14
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.

7 participants