You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//! Constructor. TODO: remove, alloc can fail, should be a static create method instead!
39
35
/** @param sizeInBytes Size in bytes. If `dat` argument is present, it denotes size of data pointed by `dat`, otherwise - size of data to be allocated.
// FIXME: ONLY SWAP FOR COMPATIBLE ALLOCATORS! OTHERWISE MEMCPY!
115
109
if (willBeRestoredFrom(_other))
116
110
std::swap(data, other->data);
117
111
}
118
112
113
+
// REMEMBER TO CALL FROM DTOR!
114
+
// TODO: idea, make the `ICPUBuffer` an ADT, and use the default allocator CCPUBuffer instead for consistency
115
+
// TODO: idea make a macro for overriding all `delete` operators of a class to enforce a finalizer that runs in reverse order to destructors (to allow polymorphic cleanups)
116
+
virtualvoidfreeData()
117
+
{
118
+
if (data)
119
+
_NBL_ALIGNED_FREE(data);
120
+
data = nullptr;
121
+
m_creationParams.size = 0ull;
122
+
}
123
+
119
124
void* data;
120
125
};
121
126
@@ -140,42 +145,37 @@ using CDummyCPUBuffer = CCustomAllocatorCPUBuffer<core::null_allocator<uint8_t>,
140
145
*/
141
146
142
147
template<typename Allocator>
143
-
classCCustomAllocatorCPUBuffer<Allocator,true> : public ICPUBuffer
148
+
classCCustomAllocatorCPUBuffer<Allocator,true> : public ICPUBuffer
144
149
{
145
150
static_assert(sizeof(typename Allocator::value_type) == 1u, "Allocator::value_type must be of size 1");
// TODO: idea make a macro for overriding all `delete` operators of a class to enforce a finalizer that runs in reverse order to destructors (to allow polymorphic cleanups)
135
+
inlinevoidout_of_order_dtor()
132
136
{
133
137
// Only release the resources if the parent pool has not been reset because if it has been then the resources will already be released.
134
138
if (!checkForParentPoolReset())
135
-
{
136
139
releaseResourcesBackToPool();
137
-
}
138
140
}
139
141
140
142
system::logger_opt_smart_ptr m_logger;
@@ -252,9 +254,7 @@ class NBL_API2 IGPUCommandBuffer :
252
254
m_commandList.head = nullptr;
253
255
m_commandList.tail = nullptr;
254
256
255
-
// Example 05 crashes here, with assert in `ucrt` maybe vtable gets lost or something?
256
-
// For now commented out because we only have a Vulkan backend and function doesn't do anything.
257
-
//checkForParentPoolReset_impl();
257
+
checkForParentPoolReset_impl();
258
258
259
259
returntrue;
260
260
}
@@ -288,7 +288,7 @@ class NBL_API2 IGPUCommandBuffer :
288
288
returntrue;
289
289
}
290
290
291
-
uint64_t m_resetCheckedStamp = 0;
291
+
uint64_t m_resetCheckedStamp;
292
292
293
293
// This bound descriptor set record doesn't include the descriptor sets whose layout has _any_ one of its bindings
294
294
// created with IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_UPDATE_AFTER_BIND_BIT
0 commit comments