Skip to content

vulkan: use the explicit DXR update source - #8416

Open
Raxstreams wants to merge 1 commit into
ItsNotRexed:mainfrom
Raxstreams:codex/xdxr-explicit-update-source
Open

Raxstreams wants to merge 1 commit into
ItsNotRexed:mainfrom
Raxstreams:codex/xdxr-explicit-update-source

Conversation

@Raxstreams

Copy link
Copy Markdown

Claimed in the coordination issue as: #8186 (comment) (XDXR replay source cleanup, no item ID assigned).

What and why

Command-list recording requires an aligned, nonzero source address for PERFORM_UPDATE. XDXR replay now uses that address directly, and KHR replay resolves the source for every update. For an in-place refit the caller supplies the destination address as the source. DirectX Raytracing functional specification.

Tested

AI-assisted: yes (Codex).

Checklist

  • No game data, keys or decryption. The first-byte check passed on both changed files.
  • Translator contract table entry (inapplicable to this runtime-only change).

@Raxstreams
Raxstreams marked this pull request as ready for review November 23, 2026 18:45
@iurysf

iurysf commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested ba1a774 on Windows 11, RTX 4070 (driver 621.01), Vulkan SDK 1.4.363.1, LEONIDA_VK_VALIDATION=1, RelWithDebInfo: pass.

ctest -R '^(command_list|vk_command_replay|d3d12_xdxr_rt|d3d12_xdxr_rt_check|d3d12_dxr_validation|d3d12_dxr_validation_khr)$': 6/6 passed, 25.95 s (0.04, 0.50, 1.28, 21.23, 1.73, 1.15). Replay log: validation on; sections A–J completed, including 360 sync pairs, the D32 roundtrip and the overlapping-copy rejection, with no validation errors on D/G/H/I. DXR validation: native WARP tier=11 OK, RTX 4070 tier=12 OK, Leonida Vulkan tier=0 strict checks OK.

Negative control: both headers reverted to HEAD^ and rebuilt. The same six CTests still passed (6/6, 28.76 s). They do not tell the explicit source from the old replay. Recording already rejects a zero or misaligned update source in command_list.h, which this PR does not change.

Merged onto origin/main c7b44489b (vulkan_replay.h auto-merged, then discarded): 6/6 passed.

AI-assisted (OpenBot team)

@h0useadv

Copy link
Copy Markdown

Tested ba1a774e8 (base eea34639f) on AMD Radeon RX 9070 XT (RDNA4), AMD Windows driver 32.0.32029.2010, Windows 11 Pro build 26300: pass, no new failures. Built with clang-cl 23.1.6 + lld-link against an xwin splat (MSVC 14.44, SDK 10.0.26100), RelWithDebInfo; synthetic, no game files; no Khronos validation layer installed.

  • The tests named in the description pass: command_list, d3d12_dxr_validation, d3d12_dxr_validation_khr, d3d12_xdxr_rt, d3d12_xdxr_rt_check, vk_command_replay; also xdxr_build, xdxr_build_check, xdxr_descs, xdxr_build_output.
  • Full ctest -j8, failures rerun with -j1: 262/268; the 6 that fail are the ones main fails on this GPU, plus d3d12_indirect_dispatch_count, which fails because this base predates its fix.

AI-assisted (Claude Code).

@Raxstreams

Copy link
Copy Markdown
Author

@iurysf @h0useadv Thanks for the independent runs and the negative control. The six integration checks exercise valid recorded commands, so the previous and updated replay agree on them. The removed fallback only mattered for a zero-source update, which CommandList::build_acceleration_structure already rejects before recording. An in-place update records the destination address as its explicit source. AI-assisted (Codex).

@MartinIndra02

Copy link
Copy Markdown

Independent build + test: PASS

AI-assisted (Claude Code). Windows 11 x64, MSVC 19.44.35220, Ninja RelWithDebInfo, NVIDIA GeForce RTX 3080 driver 621.24 / 32.0.16.2124 (Vulkan layer, XDXR and KHR paths).

Head ba1a774e8, merged locally with current main 867d922f0 (vulkan_replay.h auto-merged).

ctest (PR merged) Result
command_list, vk_command_replay, xdxr_build, xdxr_build_check (102.7 s), d3d12_xdxr_rt, d3d12_xdxr_rt_check (23.1 s), d3d12_dxr_validation, d3d12_dxr_validation_khr 8/8 passed

I checked the premise: command_list.h:884 already refuses build.update && (!build.src_va || build.src_va % 256) when the command is recorded. So the src_va ? src_va : dst_va fallback in vulkan_backend.h, and skipping the source resolve in prepare(), could never be reached, and removing them changes no accepted input. An in-place refit still works with source == destination, which the RT tests cover. No issues found.

@alisonsilvabt

Copy link
Copy Markdown

Tested ba1a774 on NVIDIA GeForce RTX 4060 (Ada), driver 32.0.16.1692, Windows 11 (10.0.26300), MSVC 19.44.35230 (VS 2022 Build Tools), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, RelWithDebInfo, LEONIDA_VK_VALIDATION=1: pass (no regression). No game files.

test this PR merge base eea34639
command_list pass pass
vk_command_replay pass pass
d3d12_xdxr_rt pass pass
d3d12_xdxr_rt_check pass pass
d3d12_dxr_validation pass pass
d3d12_dxr_validation_khr pass pass
d3d12_indirect_rt fail fail (same)

d3d12_indirect_rt fails identically with and without the change: ExecuteCommandLists failed: invalid copy or resolve, then FAIL: RayQueryKHR ARRAY expected hit=1 miss=0, got hit=0 miss=0. This is the known ARRAY_OF_POINTERS staging refusal (#4301; also reported on main in #8414 and TEST-1698), not this PR.

  • Merges cleanly onto current main 867d922f (git merge-tree exit 0).
  • python -I scripts/check_no_game_data.py on both changed files: exit 0.

Code read: the change matches the recorder. runtime/src/command_list.h:884 already refuses a build with update and !src_va (or a misaligned source), so neither replay path could see an update with a zero source. The removed src_va ? src_va : dst_va fallback in vulkan_backend.h and the && build->src_va guard in vulkan_replay.h were unreachable, and behaviour is unchanged for any list that records. In-place refits still work, because the caller passes the destination as the source, as the DXR spec requires.

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.

6 participants