Skip to content

Runtime: M2 formats test (BC1/BC7 mip chains and a 2D array through a PSO) (D3D-212) - #1996

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Joaovitor404silva:m2-formats
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Joaovitor404silva:m2-formats

Conversation

@Joaovitor404silva

@Joaovitor404silva Joaovitor404silva commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: D3D-212 (claim, tracked in #313)

What and why

Closes M2's open item "texture formats other than R8G8B8A8_UNORM, mips and arrays through a PSO" (docs/d3d12_vulkan.md, milestone table, M2 row).

New d3d12_m2_formats_test uses the same path as d3d12_m2_textured_test: the proxy, the D3D12 API only, heap start handles from slots 9/10, CreateShaderResourceView, CreateSampler, two root descriptor tables, and the translated vs_m2/ps_m2. It samples:

  • an 8×8 BC1 texture and an 8×8 BC7 texture, each with 4 mips, with every subresource uploaded at its GetCopyableFootprints layout via CopyTextureRegion;
  • each mip level, pinned by POINT samplers with MinLOD = MaxLOD;
  • a view that starts at mip 1 (MostDetailedMip);
  • an R8G8B8A8_UNORM 2D array of 3 slices through two array views (slices 0..2 and 1..2), read by the new ps_m2_array.asm (SQ_RSRC_IMG_2D_ARRAY, slice 1.0).

The CPU reference is computed from the synthetic block data. No layer change was needed. The M2 row in the doc now says what this test covers, and run_gpu_tests.py maps ps_m2_array to the new test.

Tested

  • d3d12_m2_formats_test: all 12 cases match the CPU reference with error 0 (0 of 4096 pixels differ in each). It passes with LEONIDA_VK_VALIDATION=1 with no validation errors.
  • d3d12_m2_textured_test still passes.
  • tests/test_gpu_*.py and python -m compileall -q scripts tools pass.
  • GPU: NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.24, Windows 11, MSVC. Rebased on main at 4eb6155.

Checklist

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01PiKMETzszqwfnV8QQyzocY

… PSO)

Closes M2's open item "texture formats other than R8G8B8A8_UNORM, mips and arrays
through a PSO". d3d12_m2_formats_test samples, through the M2 descriptor path
(heap slots 9/10, CreateShaderResourceView, CreateSampler, two root tables,
translated vs_m2/ps_m2): an 8x8 BC1 and an 8x8 BC7 texture with 4 mips each and
an R8G8B8A8 2D array of 3 slices (new ps_m2_array.asm). Every subresource is
uploaded at its GetCopyableFootprints layout; POINT samplers with MinLOD = MaxLOD
pin each level; a view from mip 1 and two array views check that level and slice
are relative to the view. Blocks use endpoint colours only, so all 12 cases are
compared with the CPU byte for byte (error 0). Validation clean on RTX 4070 Ti
SUPER; no layer change was needed. Synthetic data only, no game files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01PiKMETzszqwfnV8QQyzocY
@whattheflop

Copy link
Copy Markdown
Contributor

Independent Windows GPU verification for D3D-212 (AI-assisted with Codex). I tested the exact open head 502c1ce5137f6e76a08a93753397f377a41376f5 against base and live main 4eb6155d3ac4f9d3fadb0d095c4ce13e76783615. These runs add Radeon and RTX 3080 coverage to the author's RTX 4070 Ti SUPER result.

GPU Driver / Vulkan API Stock d3d12_m2_formats at head Stock d3d12_m2_textured at base
Ryzen 7 9800X3D Radeon iGPU (1002:13c0) AMD 25.10.30.02 (Windows 32.0.21030.2001) / 1.4.315 12/12 cases, 0/49,152 pixels differed PASS
GeForce RTX 3080 (10de:2216) NVIDIA 616.64 / 1.4.351 12/12 cases, 0/49,152 pixels differed PASS

Each device matched 4,096/4,096 pixels in each of the 12 readbacks. That covers BC1 and BC7 with POINT LOD pinned at each of the four levels (8×8, 4×4, 2×2, 1×1), the BC1 view with MostDetailedMip = 1 (view LOD 0 and 2 read resource mip 1 and 3), and the RGBA8 2D-array views of slices 0–2 and 1–2 (shader slice 1 reads resource slice 1 and 2). The base control matched all 4,096 pixels in both passes on each device and reported the expected 1,536-pixel change between plain and WRAP/CLAMP passes.

Before running the fixture, read-only Vulkan queries on each ICD confirmed textureCompressionBC, graphics and bindless descriptor indexing, shader Int64, buffer device address, timeline semaphores, separate depth/stencil layouts, dynamic rendering and synchronization2. Optimal-tiling queries passed for sampled/transfer-src/transfer-dst BC1 RGBA, BC7 and RGBA8 at the fixture's mip and layer counts, plus color attachment usage for the single-sample RGBA8 target.

Native Windows 11 x64 (build 26200), MSVC 19.38.33145, WinSDK 10.0.26100.0, Ninja 1.13.2, uv-managed CPython 3.12.13 and Vulkan SDK 1.4.363.0. WSL LLVM 21.1.8 supplied only the AMDGPU assembler. Independent spirv-val --target-env vulkan1.2 passed for all three modules in each fixture. I verified the CTest entries and ran the stock offscreen tests through CTest. Each run used a single process-local VK_DRIVER_FILES manifest and an empty VK_IMPLICIT_LAYER_PATH, with implicit layers disabled. Loader diagnostics confirmed the selected ICD and insertion of VK_LAYER_KHRONOS_validation at instance and device creation. LEONIDA_VK_VALIDATION=1 enables synchronization validation in the test helper. All four runs had zero validation warnings and errors. Synthetic fixtures only.

One portability gap from source review: the fixture gates on bindless support but doesn't check d.bc or the required compressed-format usage before creating the BC textures. A capability skip would make it safe to include in CTest on Vulkan devices that lack those capabilities. Both adapters passed those checks here.

@Rainmaker33

Copy link
Copy Markdown

Tested 502c1ce on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass.

The PR's diff applied cleanly to main 4eb6155. VS 2022, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8; overlay layers off. Runtime built with scripts�uild_runtime.ps1 (CMake, RelWithDebInfo, LLVM_MC set).

  • d3d12_m2_formats with LEONIDA_VK_VALIDATION=1: passed, no VUIDs. "d3d12_m2_formats: PASS (12 cases)"
  • d3d12_m2_textured: still passes.

@JavierBlanco23

Copy link
Copy Markdown
Contributor

Tested 502c1ce5 on NVIDIA GeForce RTX 5080, driver 616.56, Windows 11 (MSVC 19.44, Ninja): pass.

  • cmake --build runtime/build --target d3d12_m2_formats_test (3 shaders: 3 translated, 3 pass spirv-val)
  • d3d12_m2_formats_test.exe: d3d12_m2_formats: PASS (12 cases) -- all 4 BC1 mips, 4 BC7 mips, 2 sub-mip BC1 views, and 2 2D-array slice views matched with 0 of 4096 pixels differing.

@TricksterG

Copy link
Copy Markdown
Contributor

Tested 502c1ce on RTX 5090 (Blackwell, driver 621.24), Windows 11 Pro 26300, MSVC 14.44 (VS 2022), Vulkan SDK 1.4.363.0 with validation layers, VS generator, Release, -DLEONIDA_SDL3=OFF: pass.

AI-assisted (Claude Code): it built the branch, ran the tests and wrote this comment.

Build: no warnings from the new test's own code. The build shows 127 warnings, mostly C4456 in runtime/src/vulkan_replay.h (also two in this test through that header), but they come from main, not from this PR.

@carlcdx

carlcdx commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 502c1ce5 on Windows 11 (26300, MSVC 19.44, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8, VK_LOADER_LAYERS_DISABLE=~implicit~): pass on two physical AMD GPUs (standard and LEONIDA_VK_VALIDATION=1).

Build & shaders:

  • vs_m2, ps_m2, ps_m2_array: 3/3 translated, 3/3 pass spirv-val.

Results:

  • AMD Radeon RX 9070 XT (RDNA 4, Adrenalin 26.10.44 LLPC, driverVersion 2.0.395, Vulkan 1.4.349, VRAM upload heaps / ReBAR):
    • d3d12_m2_textured: Passed (0.27 sec)
    • d3d12_m2_formats: Passed (0.27 sec) — 12/12 cases exact (0 of 4096 pixels differ across BC1 mips 0–3, BC7 mips 0–3, BC1 mip-1 view lod 0/2, and 2D array views 0..2 / 1..2)
    • d3d12_m2_formats (LEONIDA_VK_VALIDATION=1): Passed (0.22 sec, validation on, 0 VUIDs)
  • AMD Radeon(TM) Graphics (Ryzen 7 9800X3D RDNA 2 iGPU, AMD 24.30.18 SC, driverVersion 2.0.331, Vulkan 1.3.302, system-memory upload heaps):
    • d3d12_m2_textured: Passed (0.21 sec)
    • d3d12_m2_formats: Passed (0.18 sec) — 12/12 cases exact
    • d3d12_m2_formats (LEONIDA_VK_VALIDATION=1): Passed (0.16 sec, validation on, 0 VUIDs)

Synthetic tests only; no game files. AI-assisted.

@ezwinxdlmao

Copy link
Copy Markdown
Contributor

Tested 502c1ce on an NVIDIA GeForce RTX 3050 Laptop GPU, driver 32.0.16.2101, Windows 11, native MSVC (VS 2022 Build Tools, Ninja, RelWithDebInfo), with llvm-mc 21.1.8 (AMDGPU, built by scripts/build_llvm_mc.ps1): pass.

  • d3d12_m2_formats_test: 12/12 cases, 0 of 4096 pixels differ in each (BC1/BC7 mip-chain views and the 2D-array slice views). With LEONIDA_VK_VALIDATION=1 it also exits 0.
  • ctest -R "m2|m3|translated|subgroup": 6/6 pass (d3d12_translated_draw, d3d12_m2_textured, d3d12_m2_formats, d3d12_m3_frame, d3d12_subgroup, subgroup_size).
  • Full ctest -j3: 116/117. The one failure is d3d12_draw (bundle blend pixel 127,0,127,255; TEST-266), which fails identically on unmodified main 4eb6155d (this PR's base) on the same GPU.
  • No build warnings in the new test.

AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit a47749b into ItsNotRexed:main Nov 22, 2026
ItsNotRexed pushed a commit that referenced this pull request Nov 22, 2026
…_TOOLS, not PATH

The rule added with the M2 formats test (#1996) ran build.py through
cmake -E env "PATH=${LEONIDA_SPIRV_TOOLS_NATIVE};$ENV{PATH}". The ;s in
that string make it a CMake list, so on Windows cmake -E env received
each PATH entry as its own argument and tried to run one as the command:
"no such file or directory" (MSB8066) at "Translating vs_m2, ps_m2 and
ps_m2_array", which stopped every Windows build that has llvm-mc. The
sibling rules pass LEONIDA_SPIRV_TOOLS, which build.py prepends to PATH;
this one does the same now.

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.

8 participants