parent
21f9cd5251
commit
a369e6ed96
7 changed files with 37 additions and 26 deletions
|
|
@ -337,9 +337,9 @@ public:
|
|||
*/
|
||||
void createShaderBindingTables() {
|
||||
const uint32_t handleSize = rayTracingPipelineProperties.shaderGroupHandleSize;
|
||||
const uint32_t handleAlignment = rayTracingPipelineProperties.shaderGroupHandleAlignment;
|
||||
const uint32_t groupCount = 3 + objectCount;
|
||||
const uint32_t sbtSize = handleSize * groupCount;
|
||||
const uint32_t handleSizeAligned = vks::tools::alignedSize(rayTracingPipelineProperties.shaderGroupHandleSize, rayTracingPipelineProperties.shaderGroupHandleAlignment);
|
||||
const uint32_t groupCount = static_cast<uint32_t>(shaderGroups.size());
|
||||
const uint32_t sbtSize = groupCount * handleSizeAligned;
|
||||
|
||||
std::vector<uint8_t> shaderHandleStorage(sbtSize);
|
||||
VK_CHECK_RESULT(vkGetRayTracingShaderGroupHandlesKHR(device, pipeline, 0, groupCount, sbtSize, shaderHandleStorage.data()));
|
||||
|
|
@ -352,9 +352,9 @@ public:
|
|||
|
||||
// Copy handles
|
||||
memcpy(shaderBindingTables.raygen.mapped, shaderHandleStorage.data(), handleSize);
|
||||
memcpy(shaderBindingTables.miss.mapped, shaderHandleStorage.data() + handleAlignment, handleSize);
|
||||
memcpy(shaderBindingTables.hit.mapped, shaderHandleStorage.data() + handleAlignment * 2, handleSize);
|
||||
memcpy(shaderBindingTables.callable.mapped, shaderHandleStorage.data() + handleAlignment * 3, handleSize * 3);
|
||||
memcpy(shaderBindingTables.miss.mapped, shaderHandleStorage.data() + handleSizeAligned, handleSize);
|
||||
memcpy(shaderBindingTables.hit.mapped, shaderHandleStorage.data() + handleSizeAligned * 2, handleSize);
|
||||
memcpy(shaderBindingTables.callable.mapped, shaderHandleStorage.data() + handleSizeAligned * 3, handleSize * 3);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue