example(RTVolume): GPU-written device-buffer procedural AABBs (#37)
A compute shader (aabbs.comp.{glsl,wgsl}) writes the procedural box into a
device buffer that BuildProcedural consumes by device address/handle with no
host copy; the WebGPU path also refits from it each frame so the box breathes.
Verified rendering on both Vulkan (native) and WebGPU (browser).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
8fefb2caef
commit
0d1312ac09
4 changed files with 173 additions and 13 deletions
|
|
@ -42,6 +42,9 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
|||
cfg.files.emplace_back(fs::path("closesthit.wgsl"));
|
||||
cfg.files.emplace_back(fs::path("miss.wgsl"));
|
||||
cfg.files.emplace_back(fs::path("resolve.wgsl"));
|
||||
// GPU producer for the AABB build input (issue #37): writes the
|
||||
// procedural boxes into a device buffer fed straight to BuildProcedural.
|
||||
cfg.files.emplace_back(fs::path("aabbs.comp.wgsl"));
|
||||
EnableWasiBrowserRuntime(cfg);
|
||||
} else {
|
||||
cfg.shaders.emplace_back(fs::path("raygen.glsl"), std::string("main"), ShaderType::RayGen);
|
||||
|
|
@ -49,6 +52,9 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
|||
cfg.shaders.emplace_back(fs::path("closesthit.glsl"), std::string("main"), ShaderType::ClosestHit);
|
||||
cfg.shaders.emplace_back(fs::path("anyhit.glsl"), std::string("main"), ShaderType::AnyHit);
|
||||
cfg.shaders.emplace_back(fs::path("intersection.glsl"), std::string("main"), ShaderType::Intersect);
|
||||
// GPU producer for the AABB build input (issue #37): writes the
|
||||
// procedural boxes into a device buffer fed straight to BuildProcedural.
|
||||
cfg.shaders.emplace_back(fs::path("aabbs.comp.glsl"), std::string("main"), ShaderType::Compute);
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue