Skip to content

Commit a2e2be4

Browse files
Forgot that the nullification needs to be done between event-wait and allocation
1 parent 2c35289 commit a2e2be4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

include/nbl/video/alloc/SubAllocatedDescriptorSet.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
147147

148148
inline ~SubAllocatedDescriptorSet()
149149
{
150+
static_assert(false, "should nullify/destroy/poll the event deferred handler to completion, then as we iterate through `m_allocatableRanges` assert that the allocators have no allocations/everything is free");
150151
for (uint32_t i = 0; i < m_allocatableRanges.size(); i++)
151152
{
152153
auto& range = m_allocatableRanges[i];
@@ -227,18 +228,20 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
227228

228229
// then try to wait at least once and allocate
229230
auto& eventHandler = range->second.eventHandler;
230-
core::vector<IGPUDescriptorSet::SDropDescriptorSet> nulls(m_totalDeferredFrees);
231-
auto outNulls = nulls.data();
231+
core::vector<IGPUDescriptorSet::SDropDescriptorSet> nulls;
232232
do
233233
{
234+
// FUTURE TODO: later we could only nullify the descriptors we don't end up reallocating if without robustness features
235+
nulls.resize(m_totalDeferredFrees);
236+
auto outNulls = nulls.data();
234237
eventHandler.wait(maxWaitPoint, unallocatedSize, outNulls);
238+
m_logicalDevice->nullifyDescriptors({nulls.data(),outNulls});
235239

236240
// always call with the same parameters, otherwise this turns into a mess with the non invalid_address gaps
237241
unallocatedSize = try_multi_allocate(binding,count,outAddresses);
238242
if (!unallocatedSize)
239243
break;
240244
} while(Clock::now()<maxWaitPoint);
241-
m_logicalDevice->nullifyDescriptors({nulls.data(),outNulls});
242245

243246
return unallocatedSize;
244247
}

0 commit comments

Comments
 (0)