vulkan_replay: a KHR TLAS build of instance pointers no longer ends prepare() (RT-REPLAY-KHR-TLAS-POINTERS-RETURN) #2526

Closed
leonida/mandy
Tyrannys wants to merge 0 commits from rt-replay-khr-tlas-pointers-return into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

Tyrannys commented 2026-11-28 00:42:11 +00:00

Claimed in the coordination issue as: RT-REPLAY-KHR-TLAS-POINTERS-RETURN (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7231080379)

What and why

Item 1 of @kevincommits' finding in #1608 (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230685285). Thanks for the repro.

In prepare() (runtime/src/vulkan_replay.h), a KHR TLAS build with instance_pointers (D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS) and instances did return vk.prepare_khr_instances(*build, p.khr_instances);. On success that left the command loop at the build:

  • every later command of the list stayed default-initialized: a dispatch had no pipeline (dropped at emit), a draw had no prepared draw, a later build had no structure;
  • the end-of-list query checks and the statistics and occlusion segment plans did not run.

The XDXR path a few lines above returns only a failure. The KHR path now does the same, with a comment.

Overlap: none found among open PRs touching vulkan_replay.h (#2486 changes KHR BLAS geometry and prebuild sizes, not this branch). Items 2 and 3 of the same finding come as separate PRs (#2523 is item 3).

Tested

Windows 11, MSVC (VS 18), RelWithDebInfo, on main 431ceba4f. CPU only.

  • New replay_khr_tlas_pointers_test (fake structures, buffers and pipeline):
    • kevincommits' repro: the TLAS build, then a dispatch and a BLAS build. prepare() succeeds, the instances are staged once (khr_instances set), the dispatch has its pipeline and the BLAS build its structure;
    • a staging that fails still fails the list with its own result.
  • With main's vulkan_replay.h, the two "later command" checks fail; all pass with the change.
  • ctest -R "^(replay_khr_tlas_pointers|replay_khr_as_copy_postbuild)$": 2/2 pass.
  • scripts/check_no_game_data.py: clean.

Not tested: a real KHR TLAS build on a GPU, and a game boot.

GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11 (CPU tests only)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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. (n/a: no translator change)

🤖 Generated with Claude Code

Claimed in the coordination issue as: RT-REPLAY-KHR-TLAS-POINTERS-RETURN (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7231080379) ### What and why Item 1 of @kevincommits' finding in #1608 (https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230685285). Thanks for the repro. In `prepare()` (`runtime/src/vulkan_replay.h`), a KHR TLAS build with `instance_pointers` (`D3D12_ELEMENTS_LAYOUT_ARRAY_OF_POINTERS`) and instances did `return vk.prepare_khr_instances(*build, p.khr_instances);`. On success that left the command loop at the build: - every later command of the list stayed default-initialized: a dispatch had no pipeline (dropped at emit), a draw had no prepared draw, a later build had no structure; - the end-of-list query checks and the statistics and occlusion segment plans did not run. The XDXR path a few lines above returns only a failure. The KHR path now does the same, with a comment. Overlap: none found among open PRs touching `vulkan_replay.h` (#2486 changes KHR BLAS geometry and prebuild sizes, not this branch). Items 2 and 3 of the same finding come as separate PRs (#2523 is item 3). ### Tested Windows 11, MSVC (VS 18), RelWithDebInfo, on `main` 431ceba4f. CPU only. - New `replay_khr_tlas_pointers_test` (fake structures, buffers and pipeline): - kevincommits' repro: the TLAS build, then a dispatch and a BLAS build. `prepare()` succeeds, the instances are staged once (`khr_instances` set), the dispatch has its pipeline and the BLAS build its structure; - a staging that fails still fails the list with its own result. - With `main`'s `vulkan_replay.h`, the two "later command" checks fail; all pass with the change. - `ctest -R "^(replay_khr_tlas_pointers|replay_khr_as_copy_postbuild)$"`: 2/2 pass. - `scripts/check_no_game_data.py`: clean. Not tested: a real KHR TLAS build on a GPU, and a game boot. GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11 (CPU tests only) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] 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. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timbot103 commented 2026-11-28 01:34:09 +00:00

Reviewed at head 2e3464a51 on Windows 11 (MSVC 2022 19.44).

Verification

  • Built replay_khr_tlas_pointers_test and gta6rt.
  • replay_khr_tlas_pointers_test: ok.

Notes

  • Removing the premature return after KHR TLAS instance-pointer staging (vulkan_replay.h:4192-4204) lets prepare() continue through subsequent commands and end-of-list validation, while staging failure still propagates its exact ReplayResult.
  • Emission binds the staged pointer array with arrayOfPointers (vulkan_replay.h:5445-5453), and vulkan_backend.h properly recycles abandoned stages on error and submitted stages after retirement (3217-3225, 4294-4303). The test verifies both the later dispatch/BLAS handle and the staging failure path.

Approve.

AI-assisted review + local MSVC verification.

Reviewed at head `2e3464a51` on Windows 11 (MSVC 2022 `19.44`). ### Verification - Built `replay_khr_tlas_pointers_test` and `gta6rt`. - `replay_khr_tlas_pointers_test`: **ok**. ### Notes - Removing the premature `return` after KHR TLAS instance-pointer staging (`vulkan_replay.h:4192-4204`) lets `prepare()` continue through subsequent commands and end-of-list validation, while staging failure still propagates its exact `ReplayResult`. - Emission binds the staged pointer array with `arrayOfPointers` (`vulkan_replay.h:5445-5453`), and `vulkan_backend.h` properly recycles abandoned stages on error and submitted stages after retirement (`3217-3225`, `4294-4303`). The test verifies both the later dispatch/BLAS handle and the staging failure path. Approve. AI-assisted review + local MSVC verification.
zmasi commented 2026-11-28 07:18:23 +00:00

#2526 | head 2e3464a511b4031ced58c0db9966e93e70401893 (merged cleanly with main 09c153948386fd658fe2f999f6176efbaa8c8345) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^(replay_khr_tlas_pointers|replay_khr_as_copy_postbuild|xbox_bvh_builder)$" --output-on-failure (LEONIDA_VK_VALIDATION=1) | red on main: replay_khr_tlas_pointers_test fails (2 failure(s): prepare() returned immediately after prepare_khr_instances(), leaving the subsequent dispatch's pipeline null and subsequent BLAS build's accel_dst unprepared) | green on PR+main: 3/3 CTests pass (replay_khr_tlas_pointers in 0.07s, replay_khr_as_copy_postbuild in 0.06s, and xbox_bvh_builder 26/26 checks on RTX 3090 in 1.80s with LEONIDA_VK_VALIDATION=1 and 0 Khronos validation errors); check_no_game_data.py 0 violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes

#2526 | head 2e3464a511b4031ced58c0db9966e93e70401893 (merged cleanly with main 09c153948386fd658fe2f999f6176efbaa8c8345) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^(replay_khr_tlas_pointers|replay_khr_as_copy_postbuild|xbox_bvh_builder)$" --output-on-failure` (`LEONIDA_VK_VALIDATION=1`) | red on main: `replay_khr_tlas_pointers_test` fails (`2 failure(s)`: `prepare()` returned immediately after `prepare_khr_instances()`, leaving the subsequent dispatch's `pipeline` null and subsequent BLAS build's `accel_dst` unprepared) | green on PR+main: `3/3` CTests pass (`replay_khr_tlas_pointers` in `0.07s`, `replay_khr_as_copy_postbuild` in `0.06s`, and `xbox_bvh_builder` `26/26` checks on RTX 3090 in `1.80s` with `LEONIDA_VK_VALIDATION=1` and `0` Khronos validation errors); `check_no_game_data.py` `0` violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes
DadaCap commented 2026-11-28 07:39:35 +00:00

Thanks for this! Closing it as a duplicate of #599 after a maintainer check that compared the two diffs commit by commit, not just the titles.

This is the same one-line fix in vulkan_replay.h prepare() as #599, which is older. We tested #599 locally (its test fails on main and passes with it) and are keeping it; it still needs a rebase on main. If #599 can't land, this one can be reopened as the fallback.

If you think something here is not covered by #599, say so and we'll reopen it.

AI-assisted (Claude Code), posted for DadaCap (maintainer).

Thanks for this! Closing it as a duplicate of #599 after a maintainer check that compared the two diffs commit by commit, not just the titles. This is the same one-line fix in `vulkan_replay.h` `prepare()` as #599, which is older. We tested #599 locally (its test fails on main and passes with it) and are keeping it; it still needs a rebase on main. If #599 can't land, this one can be reopened as the fallback. If you think something here is not covered by #599, say so and we'll reopen it. _AI-assisted (Claude Code), posted for DadaCap (maintainer)._
Sign in to join this conversation.
No description provided.