@@ -1632,12 +1632,12 @@ inline created_gpu_object_array<asset::ICPUDescriptorSet> IGPUObjectFromAssetCon
1632
1632
for (uint32_t t = 0u ; t < static_cast <uint32_t >(asset::IDescriptor::E_TYPE::ET_COUNT); ++t)
1633
1633
{
1634
1634
const auto type = static_cast <asset::IDescriptor::E_TYPE>(t);
1635
- if (! cpuds->getDescriptorInfoStorage (type))
1635
+ if (cpuds->getDescriptorInfoStorage (type). empty ( ))
1636
1636
continue ;
1637
1637
1638
1638
for (uint32_t d = 0u ; d < cpuds->getLayout ()->getTotalDescriptorCount (type); ++d)
1639
1639
{
1640
- auto * info = cpuds->getDescriptorInfoStorage (type) + d;
1640
+ auto * info = cpuds->getDescriptorInfoStorage (type). begin () + d;
1641
1641
auto descriptor = info->desc .get ();
1642
1642
if (isBufferDesc (type))
1643
1643
{
@@ -1722,13 +1722,16 @@ inline created_gpu_object_array<asset::ICPUDescriptorSet> IGPUObjectFromAssetCon
1722
1722
write_it->binding = cpuds->getLayout ()->getDescriptorRedirect (type).getBindingNumber (b).data ;
1723
1723
write_it->arrayElement = 0u ;
1724
1724
1725
- uint32_t descriptorCount = cpuds->getLayout ()->getDescriptorRedirect (type).getCount (b);
1725
+ const uint32_t descriptorCount = cpuds->getLayout ()->getDescriptorRedirect (type).getCount (b);
1726
1726
write_it->count = descriptorCount;
1727
1727
write_it->descriptorType = type;
1728
1728
write_it->info = &(*info);
1729
1729
1730
1730
const uint32_t offset = cpuds->getLayout ()->getDescriptorRedirect (type).getStorageOffset (b).data ;
1731
1731
1732
+ // It is better to use getDescriptorInfoStorage over getDescriptorInfos, because the latter does a binary search
1733
+ // over the bindings, which is not really required given we have the index of binding number (since we're iterating
1734
+ // over all the declared bindings).
1732
1735
auto descriptorInfos = cpuds->getDescriptorInfoStorage (type);
1733
1736
1734
1737
// Iterate through each descriptor in this binding to fill the info structs
@@ -1741,8 +1744,8 @@ inline created_gpu_object_array<asset::ICPUDescriptorSet> IGPUObjectFromAssetCon
1741
1744
if (buffer)
1742
1745
{
1743
1746
info->desc = core::smart_refctd_ptr<video::IGPUBuffer>(buffer->getBuffer ());
1744
- info->info .buffer .offset = descriptorInfos[offset + d].info .buffer .offset + buffer->getOffset ();
1745
- info->info .buffer .size = descriptorInfos[offset+d].info .buffer .size ;
1747
+ info->info .buffer .offset = descriptorInfos. begin () [offset+ d].info .buffer .offset + buffer->getOffset ();
1748
+ info->info .buffer .size = descriptorInfos. begin () [offset+d].info .buffer .size ;
1746
1749
}
1747
1750
else
1748
1751
{
@@ -1774,7 +1777,7 @@ inline created_gpu_object_array<asset::ICPUDescriptorSet> IGPUObjectFromAssetCon
1774
1777
const auto imageFormat = static_cast <asset::ICPUImageView*>(info->desc .get ())->getCreationParameters ().format ;
1775
1778
info->info .image .imageLayout = isDepthOrStencilFormat (imageFormat) ? asset::IImage::EL_DEPTH_STENCIL_READ_ONLY_OPTIMAL : asset::IImage::EL_SHADER_READ_ONLY_OPTIMAL;
1776
1779
1777
- if (descriptorInfos[offset + d].info .image .sampler )
1780
+ if (descriptorInfos. begin () [offset + d].info .image .sampler )
1778
1781
info->info .image .sampler = gpuSamplers->operator [](smplrRedirs[si++]);
1779
1782
}
1780
1783
}
0 commit comments