Skip to content

Commit

Permalink
More PR reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
deprilula28 committed Mar 13, 2024
1 parent 6b5630d commit aca4c74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/nbl/video/CVulkanLogicalDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,15 @@ core::smart_refctd_ptr<IDescriptorPool> CVulkanLogicalDevice::createDescriptorPo
return nullptr;
}

// a lot of empirical research went into defining this constant
constexpr uint32_t MaxDescriptorSetAsWrites = 69u;

void CVulkanLogicalDevice::updateDescriptorSets_impl(const SUpdateDescriptorSetsParams& params)
{
// Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of
// VkWriteDescriptorSetAccelerationStructureKHR, VkWriteDescriptorSetAccelerationStructureNV, or VkWriteDescriptorSetInlineUniformBlockEXT
core::vector<VkWriteDescriptorSet> vk_writeDescriptorSets(params.writes.size(),{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,nullptr});
core::vector<VkWriteDescriptorSetAccelerationStructureKHR> vk_writeDescriptorSetAS(69u,{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,nullptr});
core::vector<VkWriteDescriptorSetAccelerationStructureKHR> vk_writeDescriptorSetAS(MaxDescriptorSetAsWrites,{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,nullptr});

core::vector<VkDescriptorBufferInfo> vk_bufferInfos(params.bufferCount);
core::vector<VkDescriptorImageInfo> vk_imageInfos(params.imageCount);
Expand Down Expand Up @@ -735,7 +738,7 @@ void CVulkanLogicalDevice::nullifyDescriptors_impl(const std::span<const IGPUDes
}

core::vector<VkWriteDescriptorSet> vk_writeDescriptorSets(drops.size(),{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,nullptr});
core::vector<VkWriteDescriptorSetAccelerationStructureKHR> vk_writeDescriptorSetAS(69u,{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,nullptr});
core::vector<VkWriteDescriptorSetAccelerationStructureKHR> vk_writeDescriptorSetAS(MaxDescriptorSetAsWrites,{VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,nullptr});

size_t maxSize = 0;
for (auto i = 0; i < drops.size(); i++)
Expand Down Expand Up @@ -791,6 +794,7 @@ void CVulkanLogicalDevice::nullifyDescriptors_impl(const std::span<const IGPUDes
case asset::IDescriptor::EC_ACCELERATION_STRUCTURE:
outWriteAS->accelerationStructureCount = write.count;
outWriteAS->pAccelerationStructures = reinterpret_cast<VkAccelerationStructureKHR*>(nullDescriptors.data());
outWrite->pNext = outWriteAS++;
break;
default:
assert(!"Invalid code path.");
Expand Down
3 changes: 3 additions & 0 deletions src/nbl/video/ILogicalDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ bool ILogicalDevice::nullifyDescriptors(const std::span<const IGPUDescriptorSet:
auto ds = drop.dstSet;
if (!ds || !ds->wasCreatedBy(this))
return false;
// (no binding)
if (ds->getBindingType(drop.binding) == asset::IDescriptor::E_TYPE::ET_COUNT)
return false;
}

for (const auto& drop : dropDescriptors)
Expand Down

0 comments on commit aca4c74

Please sign in to comment.