| 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; |
nothing calls this directly
no test coverage detected