Skip to content

d3d12_texture_tiles: run the native half on the layer's adapter - #6645

Open
caltr98 wants to merge 1 commit into
ItsNotRexed:mainfrom
caltr98:fix-texture-tiles-layer-adapter
Open

caltr98 wants to merge 1 commit into
ItsNotRexed:mainfrom
caltr98:fix-texture-tiles-layer-adapter

Conversation

@caltr98

@caltr98 caltr98 commented Nov 23, 2026

Copy link
Copy Markdown

Item: new, claimed in #6603. Same cause as D3D-596 (d3d12_buffer_tiles, now on main), in the other tiles test.

What

d3d12_texture_tiles fails on main (1cc6e3c) on a laptop with an RTX 5080 and an Intel iGPU. Its native_device() takes the first hardware adapter with tiled resources tier 2, which is the iGPU, and the iGPU's D3D12 driver fails the 256 x 240 case while the layer passes:

Native D3D12: Intel(R) Graphics, tiled resources tier 4
Vulkan replay: 256 x 256, linear offset 4, ... gated remap
Native D3D12 matched all 262144 verified pixels
Vulkan replay: 256 x 240, linear offset 1, ... gated remap
alias tile 0 at (0,0): got 0x1cc0200, expected 0xcc020000
line 239: compare_pixel(result, read_pixel(image_bytes + tiled), aliased, "alias", tile, x, y)

(The Vulkan replay line for 256 x 240 prints before the native run, so the failing run is the native one.) native_device() now first tries the adapter behind the layer's device (GetAdapterLuid()), as d3d12_buffer_tiles does on main, and keeps the old loop as the fallback. The tier check moved into a small tiled_device() helper. Test-only change. Unlike d3d12_buffer_tiles, this test does not read LEONIDA_HOST_ADAPTER; I left that out to keep the change small.

Tested

NVIDIA GeForce RTX 5080 Laptop GPU (driver 621.14) + Intel(R) Graphics, Windows 11 (build 26300), MSVC 14.44, RelWithDebInfo, on main 1cc6e3c:

  • before: fails at line 239 (native half on Intel(R) Graphics)
  • after: passes; native half on the RTX 5080, all four cases matched (262144, 245760, 222720 and 262144 pixels, the last with the COPY-to-DIRECT handoff)

Not tested: a single-GPU PC (takes the same adapter as before) and a PC where the layer's adapter lacks tier 2 (takes the unchanged fallback).

Full ctest on main here, for reference: 247 of 250 pass; the other two failures are d3d12_heap_properties (fixed by #4877) and d3d12_indirect_dispatch_count (I am checking #5792 for it).

AI-assisted (Claude).

🤖 Generated with Claude Code

native_device() took the first hardware adapter with tiled resources tier 2. On a laptop with an
RTX 5080 (NVIDIA 621.14) and an Intel iGPU that is the iGPU, whose driver fails the 256 x 240
"alias" check (0x01cc0200 for 0xcc020000) while the layer passes, so the test failed on main.
It now tries the adapter behind the layer's device (GetAdapterLuid) first, as d3d12_buffer_tiles
does, and keeps the old loop as the fallback. With the NVIDIA host all four cases match.

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

Copy link
Copy Markdown

Independent Windows check of c72b85ab. RTX 3080 Ti, NVIDIA 621.35, MSVC 19.44, Vulkan SDK 1.4.363.0. Vulkan enumerated one GPU, and both the native D3D12 and Vulkan paths selected the RTX 3080 Ti.

Stock d3d12_texture_tiles passed with zero skips. All 992,768 pixel comparisons matched across the four replays, including the copy-to-direct queue handoff. Khronos core and synchronization validation reported zero errors.

AI-assisted.

@0xTehuti 0xTehuti 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.

Verified on a single-GPU desktop PC (answering the author's note on the single-GPU path).

Hardware & Environment

  • GPU: NVIDIA GeForce RTX 2070 SUPER (TU104 Turing, 8192 MB VRAM, Driver 595.79, Vulkan 1.4)
  • OS: Windows 11 Pro x64 (Build 26100)
  • Toolchain: MSVC 19.44 (VS 2022 Community), CMake 4.4, Ninja 1.13, Windows SDK 10.0.26100.0
  • Validation: LEONIDA_VK_VALIDATION=1 active with VK_LAYER_KHRONOS_validation

Single-GPU Verification & Behavior

  • tiled_device() correctly resolves and queries vulkan->GetAdapterLuid() on single-GPU desktop hardware:
    [rt] d3d12: Vulkan device: NVIDIA GeForce RTX 2070 SUPER (maxPushConstantsSize: 256 bytes)
    Native D3D12: NVIDIA GeForce RTX 2070 SUPER, tiled resources tier 4
    
  • All four test cases passed with exact pixel matches between Vulkan replay and native D3D12:
    • Case 1 (256 x 256, linear offset 4): 262,144 / 262,144 verified pixels matched (0 mismatches)
    • Case 2 (256 x 240, linear offset 1): 245,760 / 245,760 verified pixels matched (0 mismatches)
    • Case 3 (240 x 240, linear offset 3): 222,720 / 222,720 verified pixels matched (0 mismatches)
    • Case 4 (256 x 256, linear offset 4, COPY-to-DIRECT handoff): 262,144 / 262,144 verified pixels matched (0 mismatches)
  • CTest suite run: 1/1 Test #153: d3d12_texture_tiles .............. Passed 1.03 sec
  • Vulkan validation layer: 0 validation errors, 0 VUID errors.

Code Audit

  • Refactoring the tier-2 verification into the helper tiled_device(IDXGIAdapter1* adapter) keeps the adapter acquisition DRY and cleanly mirrors d3d12_buffer_tiles.
  • Retaining factory->EnumAdapters1(i, ...) loop as fallback ensures backwards compatibility on systems where EnumAdapterByLuid might fail.
  • Clean-room compliance confirmed: test-only modification, zero game files or copyrighted assets used.

AI-assisted review.

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.

3 participants