// Assign unique drawId for this DC
pCurDrawContext->drawId = pContext->dcRing.GetHead();
+
+ pCurDrawContext->cleanupState = true;
}
else
{
pDC->FeWork.desc.draw.startPrimID = draw * primsPerDraw;
pDC->FeWork.desc.draw.startVertexID = draw * maxVertsPerDraw;
+ pDC->cleanupState = (remainingVerts == numVertsForDraw);
+
//enqueue DC
QueueDraw(pContext);
pDC->FeWork.desc.draw.baseVertex = baseVertex;
pDC->FeWork.desc.draw.startPrimID = draw * primsPerDraw;
+ pDC->cleanupState = (remainingIndices == numIndicesForDraw);
+
//enqueue DC
QueueDraw(pContext);
if (result == 0)
{
- _ReadWriteBarrier();
-
// Cleanup memory allocations
pDC->pArena->Reset(true);
pDC->pTileMgr->initialize();
+ if (pDC->cleanupState)
+ {
+ pDC->pState->pArena->Reset(true);
+ }
+
+ _ReadWriteBarrier();
pContext->dcRing.Dequeue(); // Remove from tail
}