test(vulkan-rt): spirv-val coverage for the push-constant rewrite (#18)
Adds tests/PushConstantRewrite, a host test that compiles representative ray-generation shaders with glslang, runs the real WorkaroundNvidiaAS::Patch over them, and asserts with spirv-val (the same invocation vkCreateShaderModule uses) that the result is valid and contains exactly one push-constant block — covering both the merge path (shaders that already declare a push constant, including mat4/vec3/uint, a lone uint, and an array layout) and the synthesize path, plus a no-op case (push constant but no AS read). It also checks the published TLAS push offset for each layout. The workaround namespace is exported so the test can drive Patch directly; both go away with the rest of the workaround. project.cpp wires the test as an executable that recompiles the module and requires glslang + spirv-val. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
45ecc91424
commit
471f480c5d
2 changed files with 260 additions and 0 deletions
32
project.cpp
32
project.cpp
|
|
@ -205,6 +205,38 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
|||
cfg.shaders.emplace_back(fs::path("shaders/ui-images.comp.glsl"), std::string("main"), ShaderType::Compute);
|
||||
cfg.shaders.emplace_back(fs::path("shaders/ui-text.comp.glsl"), std::string("main"), ShaderType::Compute);
|
||||
cfg.buildFiles.emplace_back(fs::path("shaders/ui-shared.glsl"));
|
||||
|
||||
// Regression test for issue #18: drive the NVIDIA descriptor-heap
|
||||
// AS-read workaround's SPIR-V rewrite over real compiled shaders and
|
||||
// check the result with spirv-val (one push-constant block, correct
|
||||
// TLAS offset). The test executable recompiles the whole module plus
|
||||
// tests/PushConstantRewrite/main.cpp; Configuration isn't copyable
|
||||
// (it owns the parsed module list), so the shared build settings are
|
||||
// mirrored field by field. glslang and spirv-val are invoked at
|
||||
// runtime, so the test declares them as required tools. Remove with
|
||||
// the rest of the workaround.
|
||||
Test pcTest;
|
||||
Configuration& tc = pcTest.config;
|
||||
tc.path = cfg.path;
|
||||
tc.name = "PushConstantRewrite";
|
||||
tc.outputName = "PushConstantRewrite";
|
||||
tc.type = ConfigurationType::Executable;
|
||||
tc.target = cfg.target;
|
||||
tc.march = cfg.march;
|
||||
tc.mtune = cfg.mtune;
|
||||
tc.debug = cfg.debug;
|
||||
tc.sysroot = cfg.sysroot;
|
||||
tc.dependencies = cfg.dependencies;
|
||||
tc.externalDependencies = cfg.externalDependencies;
|
||||
tc.compileFlags = cfg.compileFlags;
|
||||
tc.linkFlags = cfg.linkFlags;
|
||||
tc.defines = cfg.defines;
|
||||
tc.cFiles = cfg.cFiles;
|
||||
std::vector<fs::path> testImpls(impls.begin(), impls.end());
|
||||
testImpls.emplace_back("tests/PushConstantRewrite/main");
|
||||
tc.GetInterfacesAndImplementations(ifaces, testImpls);
|
||||
pcTest.requires_ = { "tool:glslang", "tool:spirv-val" };
|
||||
cfg.tests.push_back(std::move(pcTest));
|
||||
}
|
||||
|
||||
return cfg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue