Skip to content

Commit 9286a71

Browse files
author
kevyuu
committed
Fix maxShaderGroup calculation
1 parent 44b450e commit 9286a71

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/nbl/video/CVulkanLogicalDevice.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,12 +1441,15 @@ void CVulkanLogicalDevice::createRayTracingPipelines_impl(
14411441
size_t maxShaderStages = 0;
14421442
for (const auto& info : createInfos)
14431443
maxShaderStages += info.shaders.size();
1444+
size_t maxShaderGroups = 0;
1445+
for (const auto& info : createInfos)
1446+
maxShaderGroups += info.shaderGroups.getShaderGroupCount();
14441447
core::vector<VkRayTracingPipelineCreateInfoKHR> vk_createInfos(createInfos.size(), { VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR,nullptr });
14451448
core::vector<VkPipelineShaderStageRequiredSubgroupSizeCreateInfo> vk_requiredSubgroupSize(maxShaderStages,{
14461449
VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO,nullptr
14471450
});
14481451
core::vector<VkPipelineShaderStageCreateInfo> vk_shaderStage(maxShaderStages, { VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, nullptr });
1449-
core::vector<VkRayTracingShaderGroupCreateInfoKHR> vk_shaderGroup(maxShaderStages, { VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, nullptr});
1452+
core::vector<VkRayTracingShaderGroupCreateInfoKHR> vk_shaderGroup(maxShaderGroups, { VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, nullptr});
14501453
core::vector<VkSpecializationInfo> vk_specializationInfos(maxShaderStages, { 0, nullptr, 0, nullptr });
14511454
core::vector<VkSpecializationMapEntry> vk_specializationMapEntry(validation.count);
14521455
core::vector<uint8_t> specializationData(validation.dataSize);
@@ -1458,7 +1461,7 @@ void CVulkanLogicalDevice::createRayTracingPipelines_impl(
14581461
auto outSpecInfo = vk_specializationInfos.data();
14591462
auto outSpecMapEntry = vk_specializationMapEntry.data();
14601463
auto outSpecData = specializationData.data();
1461-
auto getVkShaderIndex = [](uint32_t index) { return index == SShaderGroupParams::ShaderUnused ? VK_SHADER_UNUSED_KHR : index; };
1464+
auto getVkShaderIndex = [](uint32_t index) { return index == SShaderGroupParams::SIndex::Unused ? VK_SHADER_UNUSED_KHR : index; };
14621465
auto getGeneralVkRayTracingShaderGroupCreateInfo = [getVkShaderIndex](SGeneralShaderGroup group) -> VkRayTracingShaderGroupCreateInfoKHR
14631466
{
14641467
return {

0 commit comments

Comments
 (0)