@@ -591,40 +591,6 @@ class IMeshPackerV2 : public IMeshPacker<MeshBufferType,MDIStructType>, public I
591
591
template <typename MeshBufferIterator>
592
592
bool alloc (ReservedAllocationMeshBuffers* rambOut, const MeshBufferIterator mbBegin, const MeshBufferIterator mbEnd);
593
593
594
- template <typename MeshBufferIterator>
595
- void freeAllocatedAddressesOnAllocFail (ReservedAllocationMeshBuffers* rambOut, const MeshBufferIterator mbBegin, const MeshBufferIterator mbEnd)
596
- {
597
- size_t i = 0ull ;
598
- for (auto it = mbBegin; it != mbEnd; it++)
599
- {
600
- ReservedAllocationMeshBuffers& ramb = *(rambOut + i);
601
-
602
- if (ramb.indexAllocationOffset == INVALID_ADDRESS)
603
- return ;
604
-
605
- m_idxBuffAlctr.free_addr (ramb.indexAllocationOffset , ramb.indexAllocationReservedCnt );
606
-
607
- const auto & mbVtxInputParams = (*it)->getPipeline ()->getVertexInputParams ();
608
- for (uint16_t attrBit = 0x0001 , location = 0 ; location < SVertexInputParams::MAX_ATTR_BUF_BINDING_COUNT; attrBit <<= 1 , location++)
609
- {
610
- if (!(attrBit & mbVtxInputParams.enabledAttribFlags ))
611
- continue ;
612
-
613
- if (ramb.attribAllocParams [location].offset == INVALID_ADDRESS)
614
- return ;
615
-
616
- m_vtxBuffAlctr.free_addr (ramb.attribAllocParams [location].offset , ramb.attribAllocParams [location].size );
617
- }
618
-
619
- if (ramb.mdiAllocationOffset == INVALID_ADDRESS)
620
- return ;
621
-
622
- m_MDIDataAlctr.free_addr (ramb.mdiAllocationOffset , ramb.mdiAllocationReservedCnt );
623
-
624
- i++;
625
- }
626
- }
627
-
628
594
void free (const ReservedAllocationMeshBuffers* rambIn, uint32_t meshBuffersToFreeCnt)
629
595
{
630
596
for (uint32_t i = 0u ; i < meshBuffersToFreeCnt; i++)
@@ -671,6 +637,40 @@ class IMeshPackerV2 : public IMeshPacker<MeshBufferType,MDIStructType>, public I
671
637
);
672
638
};
673
639
640
+ template <typename MeshBufferIterator>
641
+ void freeAllocatedAddressesOnAllocFail (ReservedAllocationMeshBuffers* rambOut, const MeshBufferIterator mbBegin, const MeshBufferIterator mbEnd)
642
+ {
643
+ size_t i = 0ull ;
644
+ for (auto it = mbBegin; it != mbEnd; it++)
645
+ {
646
+ ReservedAllocationMeshBuffers& ramb = *(rambOut + i);
647
+
648
+ if (ramb.indexAllocationOffset == INVALID_ADDRESS)
649
+ return ;
650
+
651
+ m_idxBuffAlctr.free_addr (ramb.indexAllocationOffset , ramb.indexAllocationReservedCnt );
652
+
653
+ const auto & mbVtxInputParams = (*it)->getPipeline ()->getVertexInputParams ();
654
+ for (uint16_t attrBit = 0x0001 , location = 0 ; location < SVertexInputParams::MAX_ATTR_BUF_BINDING_COUNT; attrBit <<= 1 , location++)
655
+ {
656
+ if (!(attrBit & mbVtxInputParams.enabledAttribFlags ))
657
+ continue ;
658
+
659
+ if (ramb.attribAllocParams [location].offset == INVALID_ADDRESS)
660
+ return ;
661
+
662
+ m_vtxBuffAlctr.free_addr (ramb.attribAllocParams [location].offset , ramb.attribAllocParams [location].size );
663
+ }
664
+
665
+ if (ramb.mdiAllocationOffset == INVALID_ADDRESS)
666
+ return ;
667
+
668
+ m_MDIDataAlctr.free_addr (ramb.mdiAllocationOffset , ramb.mdiAllocationReservedCnt );
669
+
670
+ i++;
671
+ }
672
+ }
673
+
674
674
PackerDataStore m_packerDataStore;
675
675
676
676
};
@@ -739,8 +739,6 @@ bool IMeshPackerV2<BufferType,DescriptorSetType,MeshBufferType,MDIStructType>::a
739
739
740
740
if (ramb.attribAllocParams [location].offset == INVALID_ADDRESS)
741
741
return false ;
742
-
743
- // TODO: reset state when allocation fails
744
742
}
745
743
746
744
// allocate MDI structs
0 commit comments