//////////////////////////////////////////////////////////////////////////
/// @brief Function signature for load hot tiles
-/// @param hPrivateContext - handle to private data
+/// @param hDC - handle to DRAW_CONTEXT
/// @param dstFormat - format of the hot tile
/// @param renderTargetIndex - render target to store, can be color, depth or stencil
/// @param x - destination x coordinate
/// @param y - destination y coordinate
/// @param pDstHotTile - pointer to the hot tile surface
-typedef void(SWR_API* PFN_LOAD_TILE)(HANDLE hPrivateContext,
+typedef void(SWR_API* PFN_LOAD_TILE)(HANDLE hDC,
HANDLE hWorkerPrivateData,
SWR_FORMAT dstFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
//////////////////////////////////////////////////////////////////////////
/// @brief Function signature for store hot tiles
-/// @param hPrivateContext - handle to private data
+/// @param hDC - handle to DRAW_CONTEXT
/// @param srcFormat - format of the hot tile
/// @param renderTargetIndex - render target to store, can be color, depth or stencil
/// @param x - destination x coordinate
/// @param y - destination y coordinate
/// @param pSrcHotTile - pointer to the hot tile surface
-typedef void(SWR_API* PFN_STORE_TILE)(HANDLE hPrivateContext,
+typedef void(SWR_API* PFN_STORE_TILE)(HANDLE hDC,
HANDLE hWorkerPrivateData,
SWR_FORMAT srcFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
int32_t destX = KNOB_MACROTILE_X_DIM * x;
int32_t destY = KNOB_MACROTILE_Y_DIM * y;
- pContext->pfnStoreTile(GetPrivateState(pDC),
+ pContext->pfnStoreTile(pDC,
hWorkerPrivateData,
srcFormat,
attachment,
if (hotTile.state == HOTTILE_DIRTY)
{
- pContext->pfnStoreTile(GetPrivateState(pDC),
+ pContext->pfnStoreTile(pDC,
hWorkerPrivateData,
format,
attachment,
hotTile.pBuffer);
}
- pContext->pfnLoadTile(GetPrivateState(pDC),
+ pContext->pfnLoadTile(pDC,
hWorkerPrivateData,
format,
attachment,
{
RDTSC_BEGIN(pContext->pBucketMgr, BELoadTiles, pDC->drawId);
// invalid hottile before draw requires a load from surface before we can draw to it
- pContext->pfnLoadTile(GetPrivateState(pDC),
+ pContext->pfnLoadTile(pDC,
hWorkerPrivateData,
KNOB_COLOR_HOT_TILE_FORMAT,
(SWR_RENDERTARGET_ATTACHMENT)(SWR_ATTACHMENT_COLOR0 + rtSlot),
{
RDTSC_BEGIN(pContext->pBucketMgr, BELoadTiles, pDC->drawId);
// invalid hottile before draw requires a load from surface before we can draw to it
- pContext->pfnLoadTile(GetPrivateState(pDC),
+ pContext->pfnLoadTile(pDC,
hWorkerPrivateData,
KNOB_DEPTH_HOT_TILE_FORMAT,
SWR_ATTACHMENT_DEPTH,
{
RDTSC_BEGIN(pContext->pBucketMgr, BELoadTiles, pDC->drawId);
// invalid hottile before draw requires a load from surface before we can draw to it
- pContext->pfnLoadTile(GetPrivateState(pDC),
+ pContext->pfnLoadTile(pDC,
hWorkerPrivateData,
KNOB_STENCIL_HOT_TILE_FORMAT,
SWR_ATTACHMENT_STENCIL,
SwrLoadHotTile,
HANDLE hWorkerPrivateData,
const SWR_SURFACE_STATE* pSrcSurface,
+ BucketManager* pBucketManager,
SWR_FORMAT dstFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
uint32_t x,
SwrStoreHotTileToSurface,
HANDLE hWorkerPrivateData,
SWR_SURFACE_STATE* pDstSurface,
+ BucketManager* pBucketManager,
SWR_FORMAT srcFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
uint32_t x,
******************************************************************************/
#include "LoadTile.h"
-
-static void BUCKETS_START(UINT id)
-{
-#ifdef KNOB_ENABLE_RDTSC
- gBucketMgr.StartBucket(id);
-#endif
-}
-
-static void BUCKETS_STOP(UINT id)
-{
-#ifdef KNOB_ENABLE_RDTSC
- gBucketMgr.StopBucket(id);
-#endif
-}
-
// on demand buckets for load tiles
static std::vector<int> sBuckets(NUM_SWR_FORMATS, -1);
static std::mutex sBucketMutex;
void SwrLoadHotTile(
HANDLE hWorkerPrivateData,
const SWR_SURFACE_STATE *pSrcSurface,
+ BucketManager* pBucketMgr,
SWR_FORMAT dstFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
{
const SWR_FORMAT_INFO& info = GetFormatInfo(pSrcSurface->format);
BUCKET_DESC desc{ info.name, "", false, 0xffffffff };
- sBuckets[pSrcSurface->format] = gBucketMgr.RegisterBucket(desc);
+ sBuckets[pSrcSurface->format] = pBucketMgr->RegisterBucket(desc);
}
sBucketMutex.unlock();
}
#endif
- BUCKETS_START(sBuckets[pSrcSurface->format]);
+#ifdef KNOB_ENABLE_RDTSC
+ pBucketMgr->StartBucket(sBuckets[pSrcSurface->format]);
+#endif
pfnLoadTiles(pSrcSurface, pDstHotTile, x, y, renderTargetArrayIndex);
- BUCKETS_STOP(sBuckets[pSrcSurface->format]);
+#ifdef KNOB_ENABLE_RDTSC
+ pBucketMgr->StopBucket(sBuckets[pSrcSurface->format]);
+#endif
}
void SwrLoadHotTile(
HANDLE hWorkerPrivateData,
const SWR_SURFACE_STATE *pSrcSurface,
+ BucketManager* pBucketMgr,
SWR_FORMAT dstFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
- uint8_t *pDstHotTile);
\ No newline at end of file
+ uint8_t *pDstHotTile);
PFN_STORE_TILES sStoreTilesTableDepth[SWR_TILE_MODE_COUNT][NUM_SWR_FORMATS] = {};
PFN_STORE_TILES sStoreTilesTableStencil[SWR_TILE_MODE_COUNT][NUM_SWR_FORMATS] = {};
-static void BUCKETS_START(UINT id)
-{
-#ifdef KNOB_ENABLE_RDTSC
- gBucketMgr.StartBucket(id);
-#endif
-}
-
-static void BUCKETS_STOP(UINT id)
-{
-#ifdef KNOB_ENABLE_RDTSC
- gBucketMgr.StopBucket(id);
-#endif
-}
-
// on demand buckets for store tiles
static std::mutex sBucketMutex;
static std::vector<int32_t> sBuckets(NUM_SWR_FORMATS, -1);
void SwrStoreHotTileToSurface(
HANDLE hWorkerPrivateData,
SWR_SURFACE_STATE *pDstSurface,
+ BucketManager* pBucketMgr,
SWR_FORMAT srcFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
{
const SWR_FORMAT_INFO& info = GetFormatInfo(pDstSurface->format);
BUCKET_DESC desc{info.name, "", false, 0xffffffff};
- sBuckets[pDstSurface->format] = gBucketMgr.RegisterBucket(desc);
+ sBuckets[pDstSurface->format] = pBucketMgr->RegisterBucket(desc);
}
sBucketMutex.unlock();
}
#endif
- BUCKETS_START(sBuckets[pDstSurface->format]);
+#ifdef KNOB_ENABLE_RDTSC
+ pBucketMgr->StartBucket(sBuckets[pDstSurface->format]);
+#endif
pfnStoreTiles(pSrcHotTile, pDstSurface, x, y, renderTargetArrayIndex);
- BUCKETS_STOP(sBuckets[pDstSurface->format]);
+#ifdef KNOB_ENABLE_RDTSC
+ pBucketMgr->StopBucket(sBuckets[pDstSurface->format]);
+#endif
+
}
void SwrStoreHotTileToSurface(
HANDLE hWorkerPrivateData,
SWR_SURFACE_STATE *pDstSurface,
+ BucketManager* pBucketMgr,
SWR_FORMAT srcFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
- uint8_t *pSrcHotTile);
\ No newline at end of file
+ uint8_t *pSrcHotTile);
***************************************************************************/
#pragma once
-
+#include "rasterizer/core/context.h"
INLINE void
-swr_LoadHotTile(HANDLE hPrivateContext,
+swr_LoadHotTile(HANDLE hDC,
HANDLE hWorkerPrivateData,
SWR_FORMAT dstFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
UINT x, UINT y,
uint32_t renderTargetArrayIndex, uint8_t* pDstHotTile)
{
- // Grab source surface state from private context
- swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
- SWR_SURFACE_STATE *pSrcSurface = &pDC->renderTargets[renderTargetIndex];
+ DRAW_CONTEXT *pDC = (DRAW_CONTEXT*)hDC;
+ swr_draw_context *pSDC = (swr_draw_context*)GetPrivateState(pDC);
+ SWR_SURFACE_STATE *pSrcSurface = &pSDC->renderTargets[renderTargetIndex];
- pDC->pTileAPI->pfnSwrLoadHotTile(hWorkerPrivateData, pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
+ pSDC->pTileAPI->pfnSwrLoadHotTile(hWorkerPrivateData, pSrcSurface, pDC->pContext->pBucketMgr, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
}
INLINE void
-swr_StoreHotTile(HANDLE hPrivateContext,
+swr_StoreHotTile(HANDLE hDC,
HANDLE hWorkerPrivateData,
SWR_FORMAT srcFormat,
SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
UINT x, UINT y,
uint32_t renderTargetArrayIndex, uint8_t* pSrcHotTile)
{
- // Grab destination surface state from private context
- swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
- SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
+ DRAW_CONTEXT *pDC = (DRAW_CONTEXT*)hDC;
+ swr_draw_context *pSDC = (swr_draw_context*)GetPrivateState(pDC);
+ SWR_SURFACE_STATE *pDstSurface = &pSDC->renderTargets[renderTargetIndex];
- pDC->pTileAPI->pfnSwrStoreHotTileToSurface(hWorkerPrivateData, pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
+ pSDC->pTileAPI->pfnSwrStoreHotTileToSurface(hWorkerPrivateData, pDstSurface, pDC->pContext->pBucketMgr, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
}
INLINE gfxptr_t