Skip to content

Commit 68582ea

Browse files
committed
Work on having descriptor set match with its sub allocator
1 parent e0e91ff commit 68582ea

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

include/nbl/video/alloc/SubAllocatedDescriptorSet.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
6767
};
6868
MultiTimelineEventHandlerST<DeferredFreeFunctor> eventHandler;
6969
std::map<uint32_t, SubAllocDescriptorSetRange> m_allocatableRanges = {};
70+
core::smart_refctd_ptr<video::IGPUDescriptorSet> m_descriptorSet;
7071

7172
#ifdef _NBL_DEBUG
7273
std::recursive_mutex stAccessVerfier;
@@ -79,8 +80,9 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
7980

8081
// constructors
8182
template<typename... Args>
82-
inline SubAllocatedDescriptorSet(video::IGPUDescriptorSetLayout* layout)
83+
inline SubAllocatedDescriptorSet(video::IGPUDescriptorSet* descriptorSet)
8384
{
85+
auto layout = descriptorSet->getLayout();
8486
for (uint32_t descriptorType = 0; descriptorType < static_cast<uint32_t>(asset::IDescriptor::E_TYPE::ET_COUNT); descriptorType++)
8587
{
8688
auto descType = static_cast<asset::IDescriptor::E_TYPE>(descriptorType);
@@ -111,6 +113,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
111113
}
112114
}
113115
}
116+
m_descriptorSet = core::smart_refctd_ptr(descriptorSet);
114117
}
115118

116119
~SubAllocatedDescriptorSet()
@@ -161,6 +164,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
161164
continue;
162165

163166
outAddresses[i] = allocator->alloc_addr(1,1);
167+
// TODO: should also write something to the descriptor set (or probably leave that to the caller?)
164168
}
165169
}
166170
inline void multi_deallocate(uint32_t binding, size_type count, const size_type* addr)
@@ -174,6 +178,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
174178
continue;
175179

176180
allocator->free_addr(addr[i],1);
181+
// TODO: should also write something to the descriptor sets
177182
}
178183
}
179184
//!
@@ -187,7 +192,7 @@ class SubAllocatedDescriptorSet : public core::IReferenceCounted
187192
inline void multi_deallocate(uint32_t binding, uint32_t count, const value_type* addr, const ISemaphore::SWaitInfo& futureWait) noexcept
188193
{
189194
if (futureWait.semaphore)
190-
multi_deallocate(futureWait, DeferredFreeFunctor(&m_composed, binding, count, addr));
195+
multi_deallocate(futureWait, DeferredFreeFunctor(&this, binding, count, addr));
191196
else
192197
multi_deallocate(binding, count, addr);
193198
}

0 commit comments

Comments
 (0)