return (SWR_CONTEXT*)hContext;
}
+void WakeAllThreads(SWR_CONTEXT *pContext)
+{
+ pContext->FifosNotEmpty.notify_all();
+}
+
//////////////////////////////////////////////////////////////////////////
/// @brief Create SWR Context.
/// @param pCreateInfo - pointer to creation info.
pCreateInfo->contextSaveSize = sizeof(API_STATE);
+ WakeAllThreads(pContext);
+
return (HANDLE)pContext;
}
memcpy(&dst.state, &src.state, sizeof(API_STATE));
}
-void WakeAllThreads(SWR_CONTEXT *pContext)
-{
- pContext->FifosNotEmpty.notify_all();
-}
-
template<bool IsDraw>
void QueueWork(SWR_CONTEXT *pContext)
{
fetchInfo.StartVertex = work.startVertex;
}
-#ifdef KNOB_ENABLE_RDTSC
+#if defined(KNOB_ENABLE_RDTSC) || defined(KNOB_ENABLE_AR)
uint32_t numPrims = GetNumPrims(state.topology, work.numVerts);
#endif
// the worker can safely increment its oldestDraw counter and move on to the next draw.
std::unique_lock<std::mutex> lock(pContext->WaitLock, std::defer_lock);
+ // Suspend thread immediately. SwrCreateContext or QueueWork will wake this up again.
+ lock.lock();
+ pContext->FifosNotEmpty.wait(lock);
+ lock.unlock();
+
auto threadHasWork = [&](uint32_t curDraw) { return curDraw != pContext->dcRing.GetHead(); };
uint32_t curDrawBE = 0;