diff options
author | George Kyriazis <[email protected]> | 2018-03-06 19:32:53 -0600 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-04-18 10:51:38 -0500 |
commit | 0f6fef96329314262cf03fe91734b0ce9cce3fa0 (patch) | |
tree | 096bc67b47e57c0e873467ef08f19589ebd5b5c6 /src/gallium/drivers/swr/rasterizer/archrast | |
parent | b488028854945482a41d701dff66117e85d00851 (diff) |
swr/rast: Add some archrast stats
Add stats for degenerate and backfacing primitive counts
Wire archrast stats for alpha blend and alpha test.
pass value to jitter, upon return have archrast event increment a value
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/archrast')
3 files changed, 68 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index 1f87dbabcd0..12dfc0e3372 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -73,6 +73,18 @@ namespace ArchRast uint32_t rasterTiles = 0; }; + struct CullStats + { + uint32_t degeneratePrimCount = 0; + uint32_t backfacePrimCount = 0; + }; + + struct AlphaStats + { + uint32_t alphaTestCount = 0; + uint32_t alphaBlendCount = 0; + }; + ////////////////////////////////////////////////////////////////////////// /// @brief Event handler that handles API thread events. This is shared /// between the API and its caller (e.g. driver shim) but typically @@ -280,7 +292,12 @@ namespace ArchRast // Rasterized Subspans EventHandlerFile::Handle(RasterTiles(drawId, rastStats.rasterTiles)); - //Reset Internal Counters + // Alpha Subspans + EventHandlerFile::Handle(AlphaEvent(drawId, mAlphaStats.alphaTestCount, mAlphaStats.alphaBlendCount)); + + // Primitive Culling + EventHandlerFile::Handle(CullEvent(drawId, mCullStats.backfacePrimCount, mCullStats.degeneratePrimCount)); + mDSSingleSample = {}; mDSSampleRate = {}; mDSCombined = {}; @@ -288,6 +305,8 @@ namespace ArchRast mDSNullPS = {}; rastStats = {}; + mCullStats = {}; + mAlphaStats = {}; mNeedFlush = false; } @@ -327,6 +346,18 @@ namespace ArchRast rastStats.rasterTiles += event.data.rasterTiles; } + virtual void Handle(const CullInfoEvent& event) + { + mCullStats.degeneratePrimCount += _mm_popcnt_u32(event.data.validMask ^ (event.data.validMask & ~event.data.degeneratePrimMask)); + mCullStats.backfacePrimCount += _mm_popcnt_u32(event.data.validMask ^ (event.data.validMask & ~event.data.backfacePrimMask)); + } + + virtual void Handle(const AlphaInfoEvent& event) + { + mAlphaStats.alphaTestCount += event.data.alphaTestEnable; + mAlphaStats.alphaBlendCount += event.data.alphaBlendEnable; + } + protected: bool mNeedFlush; // Per draw stats @@ -340,6 +371,8 @@ namespace ArchRast TEStats mTS = {}; GSStats mGS = {}; RastStats rastStats = {}; + CullStats mCullStats = {}; + AlphaStats mAlphaStats = {}; }; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index 7d9a68d502e..deb0373bf5a 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -180,6 +180,7 @@ event LateStencilSampleRate uint64_t failCount; }; +// Total Early-Z counts, SingleSample and SampleRate event EarlyZ { uint32_t drawId; @@ -187,6 +188,7 @@ event EarlyZ uint64_t failCount; }; +// Total LateZ counts, SingleSample and SampleRate event LateZ { uint32_t drawId; @@ -194,6 +196,7 @@ event LateZ uint64_t failCount; }; +// Total EarlyStencil counts, SingleSample and SampleRate event EarlyStencil { uint32_t drawId; @@ -201,6 +204,7 @@ event EarlyStencil uint64_t failCount; }; +// Total LateStencil counts, SingleSample and SampleRate event LateStencil { uint32_t drawId; @@ -302,3 +306,18 @@ event ClipperEvent uint32_t trivialAcceptCount; uint32_t mustClipCount; }; + +event CullEvent +{ + uint32_t drawId; + uint64_t backfacePrimCount; + uint64_t degeneratePrimCount; +}; + +event AlphaEvent +{ + uint32_t drawId; + uint32_t alphaTestCount; + uint32_t alphaBlendCount; +}; + diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto index f0a93107e5e..37593befbca 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto @@ -120,6 +120,21 @@ event ClipInfoEvent uint32_t clipMask; }; +event CullInfoEvent +{ + uint32_t drawId; + uint64_t degeneratePrimMask; + uint64_t backfacePrimMask; + uint32_t validMask; +}; + +event AlphaInfoEvent +{ + uint32_t drawId; + uint32_t alphaTestEnable; + uint32_t alphaBlendEnable; +}; + event DrawInstancedEvent { uint32_t drawId; |