pCurDrawContext->doneFE = false;
pCurDrawContext->FeLock = 0;
pCurDrawContext->threadsDone = 0;
+ pCurDrawContext->retireCallback.pfnCallbackFunc = nullptr;
// Assign unique drawId for this DC
pCurDrawContext->drawId = pContext->dcRing.GetHead();
pDC->FeWork.type = SYNC;
pDC->FeWork.pfnWork = ProcessSync;
- pDC->FeWork.desc.sync.pfnCallbackFunc = pfnFunc;
- pDC->FeWork.desc.sync.userData = userData;
- pDC->FeWork.desc.sync.userData2 = userData2;
- pDC->FeWork.desc.sync.userData3 = userData3;
- // cannot execute until all previous draws have completed
- pDC->dependent = true;
+ // Setup callback function
+ pDC->retireCallback.pfnCallbackFunc = pfnFunc;
+ pDC->retireCallback.userData = userData;
+ pDC->retireCallback.userData2 = userData2;
+ pDC->retireCallback.userData3 = userData3;
//enqueue
QueueDraw(pContext);
void ProcessSyncBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pUserData)
{
- SYNC_DESC *pSync = (SYNC_DESC*)pUserData;
-
uint32_t x, y;
MacroTileMgr::getTileIndices(macroTile, x, y);
SWR_ASSERT(x == 0 && y == 0);
-
- if (pSync->pfnCallbackFunc != nullptr)
- {
- pSync->pfnCallbackFunc(pSync->userData, pSync->userData2, pSync->userData3);
- }
}
void ProcessQueryStatsBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pUserData)
volatile OSALIGNLINE(uint32_t) FeLock;
volatile int64_t threadsDone;
+
+ SYNC_DESC retireCallback; // Call this func when this DC is retired.
};
static_assert((sizeof(DRAW_CONTEXT) & 63) == 0, "Invalid size for DRAW_CONTEXT");
uint32_t workerId,
void *pUserData)
{
- SYNC_DESC *pSync = (SYNC_DESC*)pUserData;
BE_WORK work;
work.type = SYNC;
work.pfnWork = ProcessSyncBE;
- work.desc.sync = *pSync;
MacroTileMgr *pTileMgr = pDC->pTileMgr;
pTileMgr->enqueue(0, 0, &work);
if (result == 0)
{
+ if (pDC->retireCallback.pfnCallbackFunc)
+ {
+ pDC->retireCallback.pfnCallbackFunc(pDC->retireCallback.userData,
+ pDC->retireCallback.userData2,
+ pDC->retireCallback.userData3);
+ }
+
// Cleanup memory allocations
pDC->pArena->Reset(true);
if (!pDC->isCompute)