swr: [rasterizer core] SwrStoreTiles api change

SwrStoreTiles now takes a mask of surfaces to store.  Reduces
overhead when storing multiple render targets.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
This commit is contained in:
Tim Rowley
2016-10-06 13:22:35 -05:00
parent 5d5179a6c2
commit a907b7a5f7
7 changed files with 27 additions and 19 deletions
@@ -1445,7 +1445,7 @@ void SwrDispatch(
// described by pState
void SWR_API SwrStoreTiles(
HANDLE hContext,
SWR_RENDERTARGET_ATTACHMENT attachment,
uint32_t attachmentMask,
SWR_TILE_STATE postStoreTileState,
const SWR_RECT& storeRect)
{
@@ -1461,7 +1461,7 @@ void SWR_API SwrStoreTiles(
pDC->FeWork.type = STORETILES;
pDC->FeWork.pfnWork = ProcessStoreTiles;
pDC->FeWork.desc.storeTiles.attachment = attachment;
pDC->FeWork.desc.storeTiles.attachmentMask = attachmentMask;
pDC->FeWork.desc.storeTiles.postStoreTileState = postStoreTileState;
pDC->FeWork.desc.storeTiles.rect = storeRect;
pDC->FeWork.desc.storeTiles.rect &= g_MaxScissorRect;
@@ -543,7 +543,7 @@ enum SWR_TILE_STATE
/// @todo Add a good description for what attachments are and when and why you would use the different SWR_TILE_STATEs.
void SWR_API SwrStoreTiles(
HANDLE hContext,
SWR_RENDERTARGET_ATTACHMENT attachment,
uint32_t attachmentMask,
SWR_TILE_STATE postStoreTileState,
const SWR_RECT& storeRect);
@@ -280,19 +280,15 @@ void ProcessClearBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, vo
}
}
void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData)
void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, STORE_TILES_DESC* pDesc,
SWR_RENDERTARGET_ATTACHMENT attachment)
{
STORE_TILES_DESC *pDesc = (STORE_TILES_DESC*)pData;
SWR_CONTEXT *pContext = pDC->pContext;
AR_BEGIN(BEStoreTiles, pDC->drawId);
#if defined(KNOB_ENABLE_RDTSC) || defined(KNOB_ENABLE_AR)
uint32_t numTiles = 0;
#endif
SWR_FORMAT srcFormat;
switch (pDesc->attachment)
switch (attachment)
{
case SWR_ATTACHMENT_COLOR0:
case SWR_ATTACHMENT_COLOR1:
@@ -304,14 +300,14 @@ void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile
case SWR_ATTACHMENT_COLOR7: srcFormat = KNOB_COLOR_HOT_TILE_FORMAT; break;
case SWR_ATTACHMENT_DEPTH: srcFormat = KNOB_DEPTH_HOT_TILE_FORMAT; break;
case SWR_ATTACHMENT_STENCIL: srcFormat = KNOB_STENCIL_HOT_TILE_FORMAT; break;
default: SWR_ASSERT(false, "Unknown attachment: %d", pDesc->attachment); srcFormat = KNOB_COLOR_HOT_TILE_FORMAT; break;
default: SWR_ASSERT(false, "Unknown attachment: %d", attachment); srcFormat = KNOB_COLOR_HOT_TILE_FORMAT; break;
}
uint32_t x, y;
MacroTileMgr::getTileIndices(macroTile, x, y);
// Only need to store the hottile if it's been rendered to...
HOTTILE *pHotTile = pContext->pHotTileMgr->GetHotTile(pContext, pDC, macroTile, pDesc->attachment, false);
HOTTILE *pHotTile = pContext->pHotTileMgr->GetHotTile(pContext, pDC, macroTile, attachment, false);
if (pHotTile)
{
// clear if clear is pending (i.e., not rendered to), then mark as dirty for store.
@@ -320,7 +316,7 @@ void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile
PFN_CLEAR_TILES pfnClearTiles = sClearTilesTable[srcFormat];
SWR_ASSERT(pfnClearTiles != nullptr);
pfnClearTiles(pDC, pDesc->attachment, macroTile, pHotTile->clearData, pDesc->rect);
pfnClearTiles(pDC, attachment, macroTile, pHotTile->clearData, pDesc->rect);
}
if (pHotTile->state == HOTTILE_DIRTY || pDesc->postStoreTileState == (SWR_TILE_STATE)HOTTILE_DIRTY)
@@ -329,7 +325,7 @@ void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile
int32_t destY = KNOB_MACROTILE_Y_DIM * y;
pContext->pfnStoreTile(GetPrivateState(pDC), srcFormat,
pDesc->attachment, destX, destY, pHotTile->renderTargetArrayIndex, pHotTile->pBuffer);
attachment, destX, destY, pHotTile->renderTargetArrayIndex, pHotTile->pBuffer);
}
@@ -338,9 +334,21 @@ void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile
pHotTile->state = (HOTTILE_STATE)pDesc->postStoreTileState;
}
}
AR_END(BEStoreTiles, numTiles);
AR_END(BEStoreTiles, 1);
}
void ProcessStoreTilesBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData)
{
STORE_TILES_DESC *pDesc = (STORE_TILES_DESC*)pData;
unsigned long rt = 0;
uint32_t mask = pDesc->attachmentMask;
while (_BitScanForward(&rt, mask))
{
mask &= ~(1 << rt);
ProcessStoreTileBE(pDC, workerId, macroTile, pDesc, (SWR_RENDERTARGET_ATTACHMENT)rt);
}
}
void ProcessDiscardInvalidateTilesBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData)
{
@@ -36,7 +36,7 @@
void ProcessComputeBE(DRAW_CONTEXT* pDC, uint32_t workerId, uint32_t threadGroupId, void*& pSpillFillBuffer);
void ProcessSyncBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pUserData);
void ProcessClearBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pUserData);
void ProcessStoreTileBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData);
void ProcessStoreTilesBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData);
void ProcessDiscardInvalidateTilesBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pData);
void ProcessShutdownBE(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t macroTile, void *pUserData);
void BackendNullPS(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint32_t y, SWR_TRIANGLE_DESC &work, RenderOutputBuffers &renderBuffers);
@@ -137,7 +137,7 @@ struct SYNC_DESC
struct STORE_TILES_DESC
{
SWR_RENDERTARGET_ATTACHMENT attachment;
uint32_t attachmentMask;
SWR_TILE_STATE postStoreTileState;
SWR_RECT rect;
};
@@ -174,7 +174,7 @@ void ProcessStoreTiles(
// store tiles
BE_WORK work;
work.type = STORETILES;
work.pfnWork = ProcessStoreTileBE;
work.pfnWork = ProcessStoreTilesBE;
work.desc.storeTiles = *pDesc;
for (uint32_t y = macroTileYMin; y <= macroTileYMax; ++y)
+1 -1
View File
@@ -262,7 +262,7 @@ swr_store_render_target(struct pipe_context *pipe,
SWR_RECT full_rect =
{0, 0, (int32_t)renderTarget->width, (int32_t)renderTarget->height};
SwrStoreTiles(ctx->swrContext,
(enum SWR_RENDERTARGET_ATTACHMENT)attachment,
1 << attachment,
post_tile_state,
full_rect);
}