| 1435 | } |
| 1436 | |
| 1437 | BindingLayoutHandle DeviceWrapper::createBindlessLayout(const BindlessLayoutDesc& desc) |
| 1438 | { |
| 1439 | std::stringstream errorStream; |
| 1440 | bool anyErrors = false; |
| 1441 | |
| 1442 | if (desc.visibility == ShaderType::None) |
| 1443 | { |
| 1444 | errorStream << "Cannot create a bindless layout with visibility = None" << std::endl; |
| 1445 | anyErrors = true; |
| 1446 | } |
| 1447 | |
| 1448 | if (desc.registerSpaces.empty() && desc.layoutType == BindlessLayoutDesc::LayoutType::Immutable) |
| 1449 | { |
| 1450 | errorStream << "Bindless layout has no register spaces assigned" << std::endl; |
| 1451 | anyErrors = true; |
| 1452 | } |
| 1453 | |
| 1454 | if (!desc.registerSpaces.empty() && desc.layoutType != BindlessLayoutDesc::LayoutType::Immutable) |
| 1455 | { |
| 1456 | errorStream << "Bindless mutable layout has register spaces assigned" << std::endl; |
| 1457 | anyErrors = true; |
| 1458 | } |
| 1459 | |
| 1460 | if (desc.maxCapacity == 0) |
| 1461 | { |
| 1462 | errorStream << "Bindless layout has maxCapacity = 0" << std::endl; |
| 1463 | anyErrors = true; |
| 1464 | } |
| 1465 | |
| 1466 | for (const BindingLayoutItem& item : desc.registerSpaces) |
| 1467 | { |
| 1468 | switch (item.type) |
| 1469 | { |
| 1470 | case ResourceType::Texture_SRV: |
| 1471 | case ResourceType::TypedBuffer_SRV: |
| 1472 | case ResourceType::StructuredBuffer_SRV: |
| 1473 | case ResourceType::RawBuffer_SRV: |
| 1474 | case ResourceType::RayTracingAccelStruct: |
| 1475 | case ResourceType::ConstantBuffer: |
| 1476 | case ResourceType::Texture_UAV: |
| 1477 | case ResourceType::TypedBuffer_UAV: |
| 1478 | case ResourceType::StructuredBuffer_UAV: |
| 1479 | case ResourceType::RawBuffer_UAV: |
| 1480 | continue; |
| 1481 | case ResourceType::VolatileConstantBuffer: |
| 1482 | errorStream << "Volatile CBs cannot be placed into a bindless layout (slot " << item.slot << ")" << std::endl; |
| 1483 | anyErrors = true; |
| 1484 | break; |
| 1485 | case ResourceType::Sampler: |
| 1486 | errorStream << "Bindless samplers are not implemented (slot " << item.slot << ")" << std::endl; |
| 1487 | anyErrors = true; |
| 1488 | break; |
| 1489 | case ResourceType::PushConstants: |
| 1490 | errorStream << "Push constants cannot be placed into a bindless layout (slot " << item.slot << ")" << std::endl; |
| 1491 | anyErrors = true; |
| 1492 | break; |
| 1493 | |
| 1494 | case ResourceType::None: |