SpiecsEngine
 
Loading...
Searching...
No Matches

◆ UpdateDescriptorSet() [3/5]

void Spices::VulkanDescriptorSet::UpdateDescriptorSet ( ImageInfo & imageInfo,
BufferInfo & bufferInfo,
const VkAccelerationStructureKHR & accel = VK_NULL_HANDLE ) const

Update this descriptor set.

Parameters
[in]imageInfoImageInfo.
[in]bufferInfoBufferInfo.
[in]accelVkAccelerationStructureKHR.

Instance a VkWriteDescriptorSet.

Update DescriptorSet.

Instance a VkWriteDescriptorSet.

Update DescriptorSet.

Definition at line 307 of file VulkanDescriptor.cpp.

312 {
314
315 for(auto& pair : m_Bindings)
316 {
320 VkWriteDescriptorSet write{};
321 write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
322 write.dstBinding = pair.first;
323 write.dstSet = m_DescriptorSet;
324 write.descriptorType = pair.second.descriptorType;
325
326 switch(write.descriptorType)
327 {
328 case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
329 case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
330 case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
331 write.pImageInfo = imageInfo[pair.first].data();
332 write.descriptorCount = static_cast<uint32_t>(imageInfo[pair.first].size());
333 break;
334 case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
335 case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
336 write.pBufferInfo = &bufferInfo[pair.first];
337 write.descriptorCount = 1;
338 break;
339 case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR:
340 VkWriteDescriptorSetAccelerationStructureKHR descASInfo {};
341 descASInfo.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR;
342 descASInfo.accelerationStructureCount = 1;
343 descASInfo.pAccelerationStructures = &accel;
344
345 write.pNext = &descASInfo;
346 write.descriptorCount = 1;
347 break;
348 }
349
353 vkUpdateDescriptorSets(m_VulkanState.m_Device, 1, &write, 0, nullptr);
354 }
355 }
#define SPICES_PROFILE_ZONE
std::unordered_map< uint32_t, VkDescriptorSetLayoutBinding > m_Bindings
The bindings this descriptor set in use.
VkDescriptorSet m_DescriptorSet
The VkDescriptorSet this class handled.
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.