mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #485] [MERGED] XDXR-BUILDER-PREVALIDATE: pre-validate XdxrBuilder inputs and avoid 32-bit workgroup overflow #535
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#535
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/485
Author: @xroneyaa
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/xdxr-builder-validation📝 Commits (1)
d2f6033xdxr_build: pre-validate build inputs and avoid 32-bit workgroup overflow📊 Changes
3 files changed (+198 additions, -4 deletions)
View changed files
📝
runtime/CMakeLists.txt(+5 -0)📝
runtime/src/xdxr_build.h(+10 -4)➕
runtime/test/xdxr_builder_validation_test.cpp(+183 -0)📄 Description
Claimed in the coordination issue as: XDXR-BUILDER-PREVALIDATE
What and why
XdxrBuilder::record_blas()previously recordedbegin()/refit_begin()and allmode_trianglesdispatches intoVkCommandBuffer cbbefore checkingfirst != layout.elements, leaving partial dispatches incbon mismatch, and accumulatedfirstinstd::uint32_t(which could overflow back tolayout.elements). Bothrecord_blas()andrecord_tlas()also did not check for uncomputed layouts (layout.size == 0) or nulldst/scratchaddresses before recording, andXdxrBuilder::dispatch()computed(threads + 63) / 64in 32 bits.This pre-validates
!layout.size || !dst || !scratch, sums geometry triangle counts instd::uint64_tup front inrecord_blas(), checks(layout.elements && !instances)up front inrecord_tlas(), and widens(std::uint64_t(threads) + 63u) / 64uindispatch(). Adds CPU-only unit testruntime/test/xdxr_builder_validation_test.cppregistered asxdxr_builder_validationinruntime/CMakeLists.txt.Tested
xdxr_builder_validation_test,vk_xdxr_build_test, andd3d12_xdxr_rt_testwith MSVC 19.50 / Ninja (0 warnings in touched files)ctest --test-dir runtime/build -R "^(xdxr_builder_validation|xdxr_build|xdxr_build_check|d3d12_xdxr_rt)$" --output-on-failure(withVK_LOADER_LAYERS_DISABLE=~implicit~) -> 4/4 Passed (xdxr_builder_validation0.01 s,xdxr_build0.30 s,xdxr_build_check72.71 s,d3d12_xdxr_rt0.71 s)python -I scripts/check_no_game_data.py runtime/src/xdxr_build.h runtime/test/xdxr_builder_validation_test.cpp runtime/CMakeLists.txt-> exit 0GPUs tested: NVIDIA GeForce RTX 3060 Ti, driver 610.88, Windows 11 (
xdxr_build,xdxr_build_check,d3d12_xdxr_rt);xdxr_builder_validationruns CPU-only with a mock Vulkan dispatch tableAI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed (n/a — no translator rule added).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.