Skip to content

d3d12: validate DXR acceleration-structure prebuild and recording inputs - #6825

Merged
shayderrr merged 1 commit into
ItsNotRexed:mainfrom
DenRakEiw:fix/d3d12-dxr-as-validation-parity
Nov 23, 2026
Merged

shayderrr merged 1 commit into
ItsNotRexed:mainfrom
DenRakEiw:fix/d3d12-dxr-as-validation-parity

Conversation

@DenRakEiw

Copy link
Copy Markdown
Contributor

Claim: #6603 (comment)

Summary

Hardens DXR acceleration-structure prebuild and command-list recording validation (100% generic standard D3D12 API parity, zero game data, disjoint from #5252 queue-type checks):

  1. **
    untime/shims/d3d12_com.cpp** (BuildRaytracingAccelerationStructure, EmitRaytracingAccelerationStructurePostbuildInfo, CopyRaytracingAccelerationStructure):
    • Reject postbuild_count > 0 && postbuild == nullptr instead of silently ignoring postbuild descriptors.
    • Reject unknown Inputs.Type (neither TOP_LEVEL nor BOTTOM_LEVEL) and unknown Inputs.DescsLayout (neither ARRAY nor ARRAY_OF_POINTERS) instead of falling into the else branch.
    • Reject out-of-range InfoType (outside

@Bj0rnis

Bj0rnis commented Nov 23, 2026

Copy link
Copy Markdown

Verified on Windows 11 (MSVC 19.44 / Ninja, Vulkan SDK 1.4.363.0) at 2ed3c6f1 with LEONIDA_VK_VALIDATION=1:

  • NVIDIA GeForce RTX 5070 Ti: 6/6 PASS (command_list, d3d12_com, d3d12_vulkan_device, d3d12_dxr_validation, d3d12_descriptor, d3d12_draw; 11.99 s, 0 Vulkan validation errors).
  • AMD Radeon(TM) Graphics (iGPU): 6/6 PASS (5.75 s, 0 Vulkan validation errors).

@devnull34 devnull34 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hardware & Environment

  • Host: Windows 11 Build 26300 x64
  • GPU: AMD Radeon RX 7900 GRE (16 GB VRAM, RDNA3 gfx1100, Vulkan 1.3.296)
  • Toolchain: MSVC 19.44 (Visual Studio 2022), CMake 4.4, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0

Verification Summary

Targets compiled with MSVC 19.44 and executed natively on AMD Radeon RX 7900 GRE:

  1. **\command_list_test.exe**:

    • Passed with zero errors.
  2. **\d3d12_dxr_validation_test.exe**:


    • ative WARP (tier=11): valid prebuild, GPU BLAS+TLAS build, and recording parity OK\

    • ative HW (AMD Radeon RX 7900 GRE) (tier=11): valid prebuild, GPU BLAS+TLAS build, and recording parity OK\
    • \Leonida Vulkan (tier=0): valid prebuild, GPU BLAS+TLAS build, and all strict validation checks OK\
    • Verified DXR acceleration structure prebuild info validation:
      • Null desc pointer checks.
      • Type validation (TopLevel vs BottomLevel).
      • Geometry counts, vertex/index format combinations, stride alignment, transform buffer alignment.
      • Destination and scratch address 256-byte alignment and overlap guards.
      • Direct and Compute command list type checks; rejection on Copy lists.
      • Post-close command list state immutability.
  3. CTest Suite:

    • \command_list: Passed (0.01s)
    • \d3d12_dxr_validation: Passed (0.31s)
    • \d3d12_dxr_validation_khr: Passed (0.81s)
    • Total: 3/3 passed (100%).
  4. Hygiene & Compliance:

    • Clean-room compliant: pure synthetic unit tests; zero game assets or proprietary code.
    • \git diff HEAD~1..HEAD --check: Clean.

LGTM!

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

d3d12_com.cpp:GraphicsCommandList now rejects null postbuild arrays, invalid InfoTypes, unknown Inputs.Type/DescsLayout, and invalid copy modes via new valid_postbuild_info_type()/valid_copy_mode() helpers. d3d12_vulkan_device.cpp:GetRaytracingAccelerationStructurePrebuildInfo validates desc, type/layout and geometry-descriptor pointers. command_list.h adds 256-byte AS/scratch alignment checks, aligned update sources, and mode <= 4 / type <= 3 bounds. New d3d12_dxr_validation_test.cpp and CMake targets cover both RT backends.

Why merge

Brings DXR prebuild/record validation to parity with standard D3D12, stopping malformed descriptors before they reach Vulkan and giving executable-analysis runs a trustworthy DXR shim.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary

d3d12_com.cpp:GraphicsCommandList now rejects null postbuild arrays, invalid InfoTypes, unknown Inputs.Type/DescsLayout, and invalid copy modes via new valid_postbuild_info_type()/valid_copy_mode() helpers. d3d12_vulkan_device.cpp:GetRaytracingAccelerationStructurePrebuildInfo validates desc, type/layout and geometry-descriptor pointers. command_list.h adds 256-byte AS/scratch alignment checks, aligned update sources, and mode <= 4 / type <= 3 bounds. New d3d12_dxr_validation_test.cpp and CMake targets cover both RT backends.

Why merge

Brings DXR prebuild/record validation to parity with standard D3D12, stopping malformed descriptors before they reach Vulkan and giving executable-analysis runs a trustworthy DXR shim.

Verdict: Approve

@shayderrr
shayderrr merged commit 2c72b0d into ItsNotRexed:main Nov 23, 2026
@0xTehuti

Copy link
Copy Markdown
Contributor

Tested 2ed3c6f18 on NVIDIA GeForce RTX 2070 SUPER (Driver 595.79, Vulkan 1.4, Windows 11 Pro 24H2 Build 26100): pass.

  • Environment: MSVC 2022 Community (19.44), Ninja 1.13, CMake 4.4.
  • d3d12_dxr_validation_test.exe:
    • native WARP (tier=11): valid prebuild, GPU BLAS+TLAS build, and recording parity OK.
    • native HW (NVIDIA GeForce RTX 2070 SUPER) (tier=12): valid prebuild, GPU BLAS+TLAS build, and recording parity OK.
    • Leonida Vulkan (tier=0): valid prebuild, GPU BLAS+TLAS build, and all strict validation checks OK.
    • Direct hardware telemetry: Vulkan device: NVIDIA GeForce RTX 2070 SUPER (maxPushConstantsSize: 256 bytes), subgroup size 32, GPU address arena peak 1.1 MiB / 5 allocations / 0 refused.
  • CTest suite:
    • command_list: Passed (0.04s).
    • d3d12_dxr_validation: Passed (1.04s).
    • d3d12_dxr_validation_khr: Passed (1.10s).
    • 3/3 tests passed (100%).

Synthetic tests only, zero game files used. AI-assisted.

@rideinstead

Copy link
Copy Markdown

ℹ️ Automated security review: SCAN-ONLY (commit 2ed3c6f1)

  • No findings.

Scope: static analysis of added diff lines only; no code was executed. Please review findings manually.

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