Adapting to buildTlas changes, fix validation warnings, members initializations
This commit is contained in:
parent
d66243800c
commit
1c9be00cec
26 changed files with 197 additions and 176 deletions
|
|
@ -668,16 +668,17 @@ void HelloVulkan::createBottomLevelAS()
|
|||
|
||||
void HelloVulkan::createTopLevelAS()
|
||||
{
|
||||
std::vector<nvvk::RaytracingBuilderKHR::Instance> tlas;
|
||||
std::vector<VkAccelerationStructureInstanceKHR> tlas;
|
||||
tlas.reserve(m_gltfScene.m_nodes.size());
|
||||
for(auto& node : m_gltfScene.m_nodes)
|
||||
{
|
||||
nvvk::RaytracingBuilderKHR::Instance rayInst;
|
||||
rayInst.transform = node.worldMatrix;
|
||||
rayInst.instanceCustomId = node.primMesh; // gl_InstanceCustomIndexEXT: to find which primitive
|
||||
rayInst.blasId = node.primMesh;
|
||||
rayInst.flags = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR;
|
||||
rayInst.hitGroupId = 0; // We will use the same hit group for all objects
|
||||
VkAccelerationStructureInstanceKHR rayInst;
|
||||
rayInst.transform = nvvk::toTransformMatrixKHR(node.worldMatrix);
|
||||
rayInst.instanceCustomIndex = node.primMesh; // gl_InstanceCustomIndexEXT: to find which primitive
|
||||
rayInst.accelerationStructureReference = m_rtBuilder.getBlasDeviceAddress(node.primMesh);
|
||||
rayInst.flags = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR;
|
||||
rayInst.instanceShaderBindingTableRecordOffset = 0; // We will use the same hit group for all objects
|
||||
rayInst.mask = 0xFF;
|
||||
tlas.emplace_back(rayInst);
|
||||
}
|
||||
m_rtBuilder.buildTlas(tlas, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue