feat(webgpu-rt): add intersection stage, procedural hit group, AABB BLAS API
Extends the cross-backend RT type surface for procedural geometry + any-hit on the WebGPU path: - RTShaderGroupType::ProceduralHitGroup + RTShaderGroup::intersectionShader (mirror VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR). - WebGPURTStage::Intersection for AABB intersection shaders. - Mesh::BuildProcedural(span<RTAabb>, opaque) — the WebGPU analog of a VK_GEOMETRY_TYPE_AABBS_KHR geometry. - wgpuRegisterMeshBLAS gains geomType / opaqueFlag / primCount. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
d7b9a41b4f
commit
321fe596a7
4 changed files with 66 additions and 15 deletions
|
|
@ -60,24 +60,33 @@ export namespace Crafter {
|
|||
inline constexpr std::uint8_t kRTGeometryInstanceForceOpaque = 0x4;
|
||||
inline constexpr std::uint8_t kRTGeometryInstanceForceNoOpaque = 0x8;
|
||||
|
||||
// Hit-group identification. Matches VkRayTracingShaderGroupTypeKHR for
|
||||
// the two types we actually support (general + triangles-hit).
|
||||
// Hit-group identification. Matches VkRayTracingShaderGroupTypeKHR.
|
||||
// General — raygen / miss / callable
|
||||
// TrianglesHitGroup — closest-hit/any-hit over triangle geometry
|
||||
// ProceduralHitGroup — closest-hit/any-hit + an intersection shader
|
||||
// over AABB (VK_GEOMETRY_TYPE_AABBS_KHR) geometry
|
||||
enum class RTShaderGroupType : std::uint8_t {
|
||||
General = 0, // raygen / miss / callable
|
||||
TrianglesHitGroup = 1,
|
||||
General = 0, // raygen / miss / callable
|
||||
TrianglesHitGroup = 1,
|
||||
ProceduralHitGroup = 2,
|
||||
};
|
||||
|
||||
// Cross-backend description of one entry in the shader-group array
|
||||
// passed to PipelineRT::Init. Mirrors the meaningful subset of
|
||||
// VkRayTracingShaderGroupCreateInfoKHR: per group, the type and the
|
||||
// indices (into the SBT's shader array) for general / closestHit /
|
||||
// anyHit, with kRTShaderUnused == VK_SHADER_UNUSED_KHR for "none".
|
||||
// anyHit / intersection, with kRTShaderUnused == VK_SHADER_UNUSED_KHR
|
||||
// for "none". `intersectionShader` is only consulted for
|
||||
// ProceduralHitGroup; it names the shader run for each AABB the ray
|
||||
// enters (the analog of VkRayTracingShaderGroupCreateInfoKHR::
|
||||
// intersectionShader).
|
||||
inline constexpr std::uint32_t kRTShaderUnused = 0xFFFFFFFFu;
|
||||
|
||||
struct RTShaderGroup {
|
||||
RTShaderGroupType type = RTShaderGroupType::General;
|
||||
std::uint32_t generalShader = kRTShaderUnused;
|
||||
std::uint32_t closestHitShader = kRTShaderUnused;
|
||||
std::uint32_t anyHitShader = kRTShaderUnused;
|
||||
RTShaderGroupType type = RTShaderGroupType::General;
|
||||
std::uint32_t generalShader = kRTShaderUnused;
|
||||
std::uint32_t closestHitShader = kRTShaderUnused;
|
||||
std::uint32_t anyHitShader = kRTShaderUnused;
|
||||
std::uint32_t intersectionShader = kRTShaderUnused;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue