test(rt): BuildTLAS's read barrier makes the build visible to TLAS reads

TLASBuildBarrier drives BuildTlasReadBarrier with no GPU device: the
dependency starts at the acceleration-structure build, reaches the
ray-tracing and compute shader stages, and carries the
acceleration-structure write -> read memory dependency that the old
execution-only barrier lacked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-10-19 03:03:16 +02:00
commit 5d25c1f825
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
2 changed files with 77 additions and 0 deletions

View file

@ -502,6 +502,32 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
tlc.GetInterfacesAndImplementations(ifaces, tlasImpls);
cfg.tests.push_back(std::move(tlasTest));
// The barrier BuildTLAS records after the build carries the
// acceleration-structure memory dependency to the shaders that read
// the TLAS, not just execution order. BuildTlasReadBarrier is pure
// CPU logic, so no GPU device is needed at runtime.
Test tlasBarrierTest;
Configuration& tbc = tlasBarrierTest.config;
tbc.path = cfg.path;
tbc.name = "TLASBuildBarrier";
tbc.outputName = "TLASBuildBarrier";
tbc.type = ConfigurationType::Executable;
tbc.target = cfg.target;
tbc.march = cfg.march;
tbc.mtune = cfg.mtune;
tbc.debug = cfg.debug;
tbc.sysroot = cfg.sysroot;
tbc.dependencies = cfg.dependencies;
tbc.externalDependencies = cfg.externalDependencies;
tbc.compileFlags = cfg.compileFlags;
tbc.linkFlags = cfg.linkFlags;
tbc.defines = cfg.defines;
tbc.cFiles = cfg.cFiles;
std::vector<fs::path> tlasBarrierImpls(impls.begin(), impls.end());
tlasBarrierImpls.emplace_back("tests/TLASBuildBarrier/main");
tbc.GetInterfacesAndImplementations(ifaces, tlasBarrierImpls);
cfg.tests.push_back(std::move(tlasBarrierTest));
// 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