MCPcopy Create free account
hub / github.com/NVIDIA-RTX/NVRHI / buildBottomLevelAccelStruct

Method buildBottomLevelAccelStruct

src/validation/validation-commandlist.cpp:1277–1659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1275 }
1276
1277 void CommandListWrapper::buildBottomLevelAccelStruct(rt::IAccelStruct* as, const rt::GeometryDesc* pGeometries, size_t numGeometries, rt::AccelStructBuildFlags buildFlags)
1278 {
1279 if (!requireOpenState())
1280 return;
1281
1282 if (!requireType(CommandQueue::Compute, "buildBottomLevelAccelStruct"))
1283 return;
1284
1285 rt::IAccelStruct* underlyingAS = as;
1286
1287 AccelStructWrapper* wrapper = dynamic_cast<AccelStructWrapper*>(as);
1288 if (wrapper)
1289 {
1290 underlyingAS = wrapper->getUnderlyingObject();
1291
1292 if (wrapper->isTopLevel)
1293 {
1294 error("Cannot perform buildBottomLevelAccelStruct on a top-level AS");
1295 return;
1296 }
1297
1298 for (size_t i = 0; i < numGeometries; i++)
1299 {
1300 const auto& geom = pGeometries[i];
1301
1302 if (geom.geometryType == rt::GeometryType::Triangles)
1303 {
1304 const auto& triangles = geom.geometryData.triangles;
1305
1306 if (triangles.indexFormat != Format::UNKNOWN)
1307 {
1308 switch (triangles.indexFormat) // NOLINT(clang-diagnostic-switch-enum)
1309 {
1310 case Format::R8_UINT:
1311 if (m_Device->getGraphicsAPI() != GraphicsAPI::VULKAN)
1312 {
1313 std::stringstream ss;
1314 ss << "BLAS " << utils::DebugNameToString(as->getDesc().debugName) << " build geometry " << i
1315 << " has index format R8_UINT which is only supported on Vulkan";
1316 error(ss.str());
1317 return;
1318 }
1319 break;
1320 case Format::R16_UINT:
1321 case Format::R32_UINT:
1322 break;
1323 default: {
1324 std::stringstream ss;
1325 ss << "BLAS " << utils::DebugNameToString(as->getDesc().debugName) << " build geometry " << i
1326 << " has unsupported index format: " << utils::FormatToString(triangles.indexFormat);
1327 error(ss.str());
1328 return;
1329 }
1330 }
1331
1332 if (triangles.indexBuffer == nullptr)
1333 {
1334 std::stringstream ss;

Callers

nothing calls this directly

Calls 6

DebugNameToStringFunction · 0.85
FormatToStringFunction · 0.85
getUnderlyingObjectMethod · 0.80
sizeMethod · 0.80
getGraphicsAPIMethod · 0.45
getDescMethod · 0.45

Tested by

no test coverage detected