From cfdd35beaf7bf336a096d4ceec13913bc3527049 Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Fri, 23 Feb 2018 18:51:18 -0600 Subject: [PATCH] swr/rast: Add support for generalized late and early z/stencil stats Reviewed-by: Bruce Cherniak --- .../drivers/swr/rasterizer/archrast/archrast.cpp | 45 ++++++++++++++++++++++ .../drivers/swr/rasterizer/archrast/events.proto | 28 ++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index 9186161..0728a85 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -90,6 +90,15 @@ namespace ArchRast //earlyStencil test compute mDSSingleSample.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSingleSample.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + + //earlyZ test single and multi sample + mDSCombined.earlyZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); + mDSCombined.earlyZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + + //earlyStencil test single and multi sample + mDSCombined.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); + mDSCombined.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -102,6 +111,15 @@ namespace ArchRast //earlyStencil test compute mDSSampleRate.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSampleRate.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + + //earlyZ test single and multi sample + mDSCombined.earlyZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); + mDSCombined.earlyZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + + //earlyStencil test single and multi sample + mDSCombined.earlyStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); + mDSCombined.earlyStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -126,6 +144,15 @@ namespace ArchRast //lateStencil test compute mDSSingleSample.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSingleSample.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + + //lateZ test single and multi sample + mDSCombined.lateZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); + mDSCombined.lateZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + + //lateStencil test single and multi sample + mDSCombined.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); + mDSCombined.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -138,6 +165,16 @@ namespace ArchRast //lateStencil test compute mDSSampleRate.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); mDSSampleRate.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + + + //lateZ test single and multi sample + mDSCombined.lateZTestPassCount += _mm_popcnt_u32(event.data.depthPassMask); + mDSCombined.lateZTestFailCount += _mm_popcnt_u32((!event.data.depthPassMask) & event.data.coverageMask); + + //lateStencil test single and multi sample + mDSCombined.lateStencilTestPassCount += _mm_popcnt_u32(event.data.stencilPassMask); + mDSCombined.lateStencilTestFailCount += _mm_popcnt_u32((!event.data.stencilPassMask) & event.data.coverageMask); + mNeedFlush = true; } @@ -223,6 +260,12 @@ namespace ArchRast EventHandlerFile::Handle(EarlyStencilSampleRate(drawId, mDSSampleRate.earlyStencilTestPassCount, mDSSampleRate.earlyStencilTestFailCount)); EventHandlerFile::Handle(LateStencilSampleRate(drawId, mDSSampleRate.lateStencilTestPassCount, mDSSampleRate.lateStencilTestFailCount)); + //combined + EventHandlerFile::Handle(EarlyZ(drawId, mDSCombined.earlyZTestPassCount, mDSCombined.earlyZTestFailCount)); + EventHandlerFile::Handle(LateZ(drawId, mDSCombined.lateZTestPassCount, mDSCombined.lateZTestFailCount)); + EventHandlerFile::Handle(EarlyStencil(drawId, mDSCombined.earlyStencilTestPassCount, mDSCombined.earlyStencilTestFailCount)); + EventHandlerFile::Handle(LateStencil(drawId, mDSCombined.lateStencilTestPassCount, mDSCombined.lateStencilTestFailCount)); + //pixelRate EventHandlerFile::Handle(EarlyZPixelRate(drawId, mDSPixelRate.earlyZTestPassCount, mDSPixelRate.earlyZTestFailCount)); EventHandlerFile::Handle(LateZPixelRate(drawId, mDSPixelRate.lateZTestPassCount, mDSPixelRate.lateZTestFailCount)); @@ -238,6 +281,7 @@ namespace ArchRast //Reset Internal Counters mDSSingleSample = {}; mDSSampleRate = {}; + mDSCombined = {}; mDSPixelRate = {}; mDSNullPS = {}; @@ -287,6 +331,7 @@ namespace ArchRast DepthStencilStats mDSSingleSample = {}; DepthStencilStats mDSSampleRate = {}; DepthStencilStats mDSPixelRate = {}; + DepthStencilStats mDSCombined = {}; DepthStencilStats mDSNullPS = {}; DepthStencilStats mDSOmZ = {}; CStats mClipper = {}; diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index 4a71e0d..ee5d75b 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -175,6 +175,34 @@ event LateStencilSampleRate uint64_t failCount; }; +event EarlyZ +{ + uint32_t drawId; + uint64_t passCount; + uint64_t failCount; +}; + +event LateZ +{ + uint32_t drawId; + uint64_t passCount; + uint64_t failCount; +}; + +event EarlyStencil +{ + uint32_t drawId; + uint64_t passCount; + uint64_t failCount; +}; + +event LateStencil +{ + uint32_t drawId; + uint64_t passCount; + uint64_t failCount; +}; + event EarlyZNullPS { uint32_t drawId; -- 2.7.4