Merge pull request 'perf(tlas): dirty-track the per-frame TLAS instance+metadata upload (#118)' (#140) from claude/issue-118 into master

This commit is contained in:
catbot 2026-06-18 15:07:44 +02:00
commit 2783e47674
5 changed files with 437 additions and 12 deletions

View file

@ -359,6 +359,39 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
tlc.GetInterfacesAndImplementations(ifaces, tlasImpls);
cfg.tests.push_back(std::move(tlasTest));
// Issue #118: the per-frame TLAS instance+metadata host rebuild copies
// (and flushes) only the slots whose element's host-authored data
// changed, tracked via RenderingElement3D::hostDataVersion against the
// per-frame uploadedVersion record; untracked elements (version 0) keep
// the always-copy behaviour. Drives the real AS-build path — a cube
// BLAS plus BuildTLAS at a sequence of marks/mutations — and reads back
// the host-mapped buffers to assert that clean slots are skipped, dirty
// slots re-uploaded, and relocation on the refit path re-uploads exactly
// the moved slots, with the validation layer reporting no errors over
// the ranged FlushDevice the dirty span feeds. Needs a Vulkan RT device
// at runtime, so it shares the native build settings.
Test tlasDirtyTest;
Configuration& tld = tlasDirtyTest.config;
tld.path = cfg.path;
tld.name = "TLASInstanceDirtyTracking";
tld.outputName = "TLASInstanceDirtyTracking";
tld.type = ConfigurationType::Executable;
tld.target = cfg.target;
tld.march = cfg.march;
tld.mtune = cfg.mtune;
tld.debug = cfg.debug;
tld.sysroot = cfg.sysroot;
tld.dependencies = cfg.dependencies;
tld.externalDependencies = cfg.externalDependencies;
tld.compileFlags = cfg.compileFlags;
tld.linkFlags = cfg.linkFlags;
tld.defines = cfg.defines;
tld.cFiles = cfg.cFiles;
std::vector<fs::path> tlasDirtyImpls(impls.begin(), impls.end());
tlasDirtyImpls.emplace_back("tests/TLASInstanceDirtyTracking/main");
tld.GetInterfacesAndImplementations(ifaces, tlasDirtyImpls);
cfg.tests.push_back(std::move(tlasDirtyTest));
// Issue #51: FontAtlas only re-uploads the dirty sub-rect now,
// tracked via FontAtlas::DirtyRect. The accumulation/clamp math is
// pure CPU, so this test drives it directly — no GPU device needed