swr: [rasterizer core] various code style changes

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
Tim Rowley 2016-11-02 16:29:29 -05:00
parent 584b65ad44
commit 5912552947
6 changed files with 26 additions and 5 deletions

View file

@ -155,6 +155,7 @@ HANDLE SwrCreateContext(
pContext->pfnUpdateSoWriteOffset = pCreateInfo->pfnUpdateSoWriteOffset;
pContext->pfnUpdateStats = pCreateInfo->pfnUpdateStats;
pContext->pfnUpdateStatsFE = pCreateInfo->pfnUpdateStatsFE;
// pass pointer to bucket manager back to caller
#ifdef KNOB_ENABLE_RDTSC
@ -333,6 +334,7 @@ DRAW_CONTEXT* GetDrawContext(SWR_CONTEXT *pContext, bool isSplitDraw = false)
pCurDrawContext->drawId = pContext->dcRing.GetHead();
pCurDrawContext->cleanupState = true;
}
else
{
@ -822,6 +824,7 @@ extern PFN_BACKEND_FUNC gBackendPixelRateTable[SWR_MULTISAMPLE_TYPE_COUNT][SWR_M
extern PFN_BACKEND_FUNC gBackendSampleRateTable[SWR_MULTISAMPLE_TYPE_COUNT][SWR_INPUT_COVERAGE_COUNT][2][2];
void SetupPipeline(DRAW_CONTEXT *pDC)
{
SWR_CONTEXT* pContext = pDC->pContext;
DRAW_STATE* pState = pDC->pState;
const SWR_RASTSTATE &rastState = pState->state.rastState;
const SWR_PS_STATE &psState = pState->state.psState;
@ -891,6 +894,7 @@ void SetupPipeline(DRAW_CONTEXT *pDC)
break;
};
// disable clipper if viewport transform is disabled
if (pState->state.frontendState.vpTransformDisable)
{
@ -912,6 +916,7 @@ void SetupPipeline(DRAW_CONTEXT *pDC)
pState->pfnProcessPrims = nullptr;
}
// set up the frontend attribute count
pState->state.feNumAttributes = 0;
const SWR_BACKEND_STATE& backendState = pState->state.backendState;
@ -1010,6 +1015,8 @@ void InitDraw(
SetupMacroTileScissors(pDC);
SetupPipeline(pDC);
}
}
//////////////////////////////////////////////////////////////////////////
@ -1137,6 +1144,7 @@ void DrawInstanced(
pState->rastState.cullMode = SWR_CULLMODE_NONE;
}
int draw = 0;
while (remainingVerts)
{
@ -1175,6 +1183,7 @@ void DrawInstanced(
pDC = GetDrawContext(pContext);
pDC->pState->state.rastState.cullMode = oldCullMode;
AR_API_END(APIDraw, numVertices * numInstances);
}
@ -1276,6 +1285,7 @@ void DrawIndexedInstance(
pState->rastState.cullMode = SWR_CULLMODE_NONE;
}
while (remainingIndices)
{
uint32_t numIndicesForDraw = (remainingIndices < maxIndicesPerDraw) ?
@ -1283,6 +1293,7 @@ void DrawIndexedInstance(
// When breaking up draw, we need to obtain new draw context for each iteration.
bool isSplitDraw = (draw > 0) ? true : false;
pDC = GetDrawContext(pContext, isSplitDraw);
InitDraw(pDC, isSplitDraw);
@ -1314,9 +1325,10 @@ void DrawIndexedInstance(
draw++;
}
// restore culling state
// Restore culling state
pDC = GetDrawContext(pContext);
pDC->pState->state.rastState.cullMode = oldCullMode;
AR_API_END(APIDrawIndexed, numIndices * numInstances);
}
@ -1626,3 +1638,4 @@ void SWR_API SwrEndFrame(
pContext->frameCount++;
}

View file

@ -206,6 +206,7 @@ struct SWR_CREATECONTEXT_INFO
PFN_UPDATE_STATS pfnUpdateStats;
PFN_UPDATE_STATS_FE pfnUpdateStatsFE;
// Pointer to rdtsc buckets mgr returned to the caller.
// Only populated when KNOB_ENABLE_RDTSC is set
BucketManager* pBucketMgr;
@ -648,4 +649,5 @@ void SWR_API SwrEnableStatsBE(
void SWR_API SwrEndFrame(
HANDLE hContext);
#endif//__SWR_API_H__
#endif

View file

@ -761,6 +761,8 @@ void BinTriangles(
_simd_store_si((simdscalari*)aRTAI, _simd_setzero_si());
}
endBinTriangles:
// scan remaining valid triangles and bin each separately
while (_BitScanForward(&triIndex, triMask))
{
@ -839,7 +841,6 @@ void BinTriangles(
triMask &= ~(1 << triIndex);
}
endBinTriangles:
AR_END(FEBinTriangles, 1);
}
@ -860,6 +861,7 @@ PFN_PROCESS_PRIMS GetBinTrianglesFunc(bool IsConservative)
return TemplateArgUnroller<FEBinTrianglesChooser>::GetFunc(IsConservative);
}
//////////////////////////////////////////////////////////////////////////
/// @brief Bin SIMD points to the backend. Only supports point size of 1
/// @param pDC - pointer to draw context.

View file

@ -502,8 +502,7 @@ public:
void ExecuteStage(PA_STATE& pa, simdvector prim[], uint32_t primMask, simdscalari primId, simdscalari viewportIdx)
{
SWR_ASSERT(pa.pDC != nullptr);
SWR_CONTEXT *pContext = pa.pDC->pContext;
SWR_CONTEXT* pContext = pa.pDC->pContext;
// set up binner based on PA state
PFN_PROCESS_PRIMS pfnBinner;
@ -524,6 +523,7 @@ public:
break;
};
// update clipper invocations pipeline stat
uint32_t numInvoc = _mm_popcnt_u32(primMask);
UPDATE_STAT_FE(CInvocations, numInvoc);

View file

@ -415,6 +415,8 @@ struct DRAW_CONTEXT
volatile int32_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");
@ -496,6 +498,7 @@ struct SWR_CONTEXT
PFN_UPDATE_STATS pfnUpdateStats;
PFN_UPDATE_STATS_FE pfnUpdateStatsFE;
// Global Stats
SWR_STATS* pStats;

View file

@ -1388,6 +1388,7 @@ void ProcessDraw(
pa.Reset();
}
AR_END(FEProcessDraw, numPrims * work.numInstances);
}