@@ -102,6 +102,25 @@ class IMeshPackerBase : public virtual core::IReferenceCounted
102
102
}
103
103
}
104
104
105
+ void initializeCommonAllocators (
106
+ const core::GeneralpurposeAddressAllocator<uint32_t >& mdiAlctr,
107
+ const core::GeneralpurposeAddressAllocator<uint32_t >& idxAlctr,
108
+ const core::GeneralpurposeAddressAllocator<uint32_t >& vtxAlctr
109
+ )
110
+ {
111
+ uint32_t alctrBuffSz = alctrTraits::get_total_size (mdiAlctr);
112
+ void * resSpcTmp = _NBL_ALIGNED_MALLOC (alctrTraits::reserved_size (alctrBuffSz, mdiAlctr), _NBL_SIMD_ALIGNMENT);
113
+ m_MDIDataAlctr = core::GeneralpurposeAddressAllocator<uint32_t >(alctrBuffSz, mdiAlctr, resSpcTmp);
114
+
115
+ alctrBuffSz = alctrTraits::get_total_size (idxAlctr);
116
+ resSpcTmp = _NBL_ALIGNED_MALLOC (alctrTraits::reserved_size (alctrBuffSz, idxAlctr), _NBL_SIMD_ALIGNMENT);
117
+ m_idxBuffAlctr = core::GeneralpurposeAddressAllocator<uint32_t >(alctrBuffSz, idxAlctr, resSpcTmp);
118
+
119
+ alctrBuffSz = alctrTraits::get_total_size (vtxAlctr);
120
+ resSpcTmp = _NBL_ALIGNED_MALLOC (alctrTraits::reserved_size (alctrBuffSz, vtxAlctr), _NBL_SIMD_ALIGNMENT);
121
+ m_vtxBuffAlctr = core::GeneralpurposeAddressAllocator<uint32_t >(alctrBuffSz, vtxAlctr, resSpcTmp);
122
+ }
123
+
105
124
protected:
106
125
core::GeneralpurposeAddressAllocator<uint32_t > m_vtxBuffAlctr;
107
126
core::GeneralpurposeAddressAllocator<uint32_t > m_idxBuffAlctr;
@@ -221,7 +240,7 @@ class IMeshPacker : public IMeshPackerBase
221
240
// TODO: functions: constructTriangleBatches, convertIdxBufferToTriangles, deinterleaveAndCopyAttribute and deinterleaveAndCopyPerInstanceAttribute
222
241
// will not work with IGPUMeshBuffer as MeshBufferType, move it to new `ICPUMeshPacker`
223
242
224
- TriangleBatches constructTriangleBatches (MeshBufferType* meshBuffer, IdxBufferParams idxBufferParams, core::aabbox3df* aabbs) const
243
+ TriangleBatches constructTriangleBatches (const MeshBufferType* meshBuffer, IdxBufferParams idxBufferParams, core::aabbox3df* aabbs) const
225
244
{
226
245
uint32_t triCnt;
227
246
const bool success = IMeshManipulator::getPolyCount (triCnt,meshBuffer);
0 commit comments