summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_context.cpp
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-08-05 11:17:25 -0600
committerTim Rowley <[email protected]>2016-08-10 11:08:23 -0500
commit6625fd08db0a24fad54d69ca1eb3935304b3a53e (patch)
tree7d9eb12e0fc2a03d326b1384647add15777fcdc3 /src/gallium/drivers/swr/swr_context.cpp
parent047493c1980deddc916294d8cb498d5e0633ad82 (diff)
swr: [rasterizer core] fundamentally change how stats work
Add a per draw stats callback to update driver stats. Signed-off-by: Tim Rowley <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_context.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_context.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
index c8d5cd60d73..53d2b93089b 100644
--- a/src/gallium/drivers/swr/swr_context.cpp
+++ b/src/gallium/drivers/swr/swr_context.cpp
@@ -344,6 +344,36 @@ swr_render_condition(struct pipe_context *pipe,
ctx->render_cond_cond = condition;
}
+static void
+swr_UpdateStats(HANDLE hPrivateContext, const SWR_STATS *pStats)
+{
+ swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
+
+ if (!pDC)
+ return;
+
+ struct swr_context *ctx = (struct swr_context *)pDC->swr_ctx;
+
+ SWR_STATS *pSwrStats = &ctx->stats;
+ pSwrStats->DepthPassCount += pStats->DepthPassCount;
+ pSwrStats->IaVertices += pStats->IaVertices;
+ pSwrStats->IaPrimitives += pStats->IaPrimitives;
+ pSwrStats->VsInvocations += pStats->VsInvocations;
+ pSwrStats->HsInvocations += pStats->HsInvocations;
+ pSwrStats->DsInvocations += pStats->DsInvocations;
+ pSwrStats->GsInvocations += pStats->GsInvocations;
+ pSwrStats->PsInvocations += pStats->PsInvocations;
+ pSwrStats->CsInvocations += pStats->CsInvocations;
+ pSwrStats->CInvocations += pStats->CInvocations;
+ pSwrStats->CPrimitives += pStats->CPrimitives;
+ pSwrStats->GsPrimitives += pStats->GsPrimitives;
+
+ for (unsigned i = 0; i < 4; i++) {
+ pSwrStats->SoPrimStorageNeeded[i] += pStats->SoPrimStorageNeeded[i];
+ pSwrStats->SoNumPrimsWritten[i] += pStats->SoNumPrimsWritten[i];
+ }
+}
+
struct pipe_context *
swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
{
@@ -358,6 +388,7 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
createInfo.pfnLoadTile = swr_LoadHotTile;
createInfo.pfnStoreTile = swr_StoreHotTile;
createInfo.pfnClearTile = swr_StoreHotTileClear;
+ createInfo.pfnUpdateStats = swr_UpdateStats;
ctx->swrContext = SwrCreateContext(&createInfo);
/* Init Load/Store/ClearTiles Tables */