SWR_ASSERT(pCurDrawContext->pArena->IsEmpty() == true);
- pCurDrawContext->dependency = 0;
+ pCurDrawContext->dependent = false;
pCurDrawContext->pContext = pContext;
pCurDrawContext->isCompute = false; // Dispatch has to set this to true.
pDC->FeWork.desc.sync.userData3 = userData3;
// cannot execute until all previous draws have completed
- pDC->dependency = pDC->drawId - 1;
+ pDC->dependent = true;
//enqueue
QueueDraw(pContext);
pDC->FeWork.desc.queryStats.pStats = pStats;
// cannot execute until all previous draws have completed
- pDC->dependency = pDC->drawId - 1;
+ pDC->dependent = true;
//enqueue
QueueDraw(pContext);
struct DRAW_CONTEXT
{
SWR_CONTEXT* pContext;
- uint32_t drawId;
- uint32_t dependency;
union
{
MacroTileMgr* pTileMgr;
DRAW_STATE* pState;
CachingArena* pArena;
+ uint32_t drawId;
+ bool dependent;
bool isCompute; // Is this DC a compute context?
bool cleanupState; // True if this is the last draw using an entry in the state ring.
volatile bool doneFE; // Is FE work done for this draw?
void Init(uint32_t numEntries)
{
SWR_ASSERT(numEntries > 0);
+ SWR_ASSERT(((1ULL << 32) % numEntries) == 0, "%d is not evenly divisible into 2 ^ 32. Wrap errors will occur!", numEntries);
mNumEntries = numEntries;
mpRingBuffer = (T*)AlignedMalloc(sizeof(T)*numEntries, 64);
SWR_ASSERT(mpRingBuffer != nullptr);
INLINE void Enqueue()
{
mRingHead++; // There's only one producer.
+ // Assert to find wrap-around cases, NEVER ENABLE DURING CHECKIN!!
+ // SWR_REL_ASSERT(mRingHead);
}
INLINE void Dequeue()
INLINE bool IsFull()
{
- ///@note We don't handle wrap case due to using 64-bit indices.
- /// It would take 11 million years to wrap at 50,000 DCs per sec.
- /// If we used 32-bit indices then its about 23 hours to wrap.
- uint64_t numEnqueued = GetHead() - GetTail();
+ uint32_t numEnqueued = GetHead() - GetTail();
SWR_ASSERT(numEnqueued <= mNumEntries);
return (numEnqueued == mNumEntries);
INLINE
bool CheckDependency(SWR_CONTEXT *pContext, DRAW_CONTEXT *pDC, uint32_t lastRetiredDraw)
{
- return IDComparesLess(lastRetiredDraw, pDC->dependency);
+ return pDC->dependent && IDComparesLess(lastRetiredDraw, pDC->drawId - 1);
}
// inlined-only version