swr/rast: Add clipper stats.

Clipper event is now:

event ClipperEvent
{
    uint32_t drawId;
    uint32_t trivialRejectCount;
    uint32_t trivialAcceptCount;
    uint32_t mustClipCount;
};

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
George Kyriazis 2018-01-31 13:22:19 -06:00
parent 0420b2be89
commit 2053472723
4 changed files with 33 additions and 19 deletions

View File

@ -50,7 +50,9 @@ namespace ArchRast
struct CStats
{
uint32_t clippedVerts = 0;
uint32_t trivialRejectCount;
uint32_t trivialAcceptCount;
uint32_t mustClipCount;
};
struct TEStats
@ -164,6 +166,13 @@ namespace ArchRast
}
virtual void Handle(const ClipInfoEvent& event)
{
mClipper.mustClipCount += _mm_popcnt_u32(event.data.clipMask);
mClipper.trivialRejectCount += event.data.numInvocations - _mm_popcnt_u32(event.data.validMask);
mClipper.trivialAcceptCount += _mm_popcnt_u32(event.data.validMask & ~event.data.clipMask);
}
// Flush cached events for this draw
virtual void FlushDraw(uint32_t drawId)
{
@ -202,7 +211,7 @@ namespace ArchRast
virtual void Handle(const FrontendDrawEndEvent& event)
{
//Clipper
EventHandlerFile::Handle(VertsClipped(event.data.drawId, mClipper.clippedVerts));
EventHandlerFile::Handle(ClipperEvent(event.data.drawId, mClipper.trivialRejectCount, mClipper.trivialAcceptCount, mClipper.mustClipCount));
//Tesselator
EventHandlerFile::Handle(TessPrims(event.data.drawId, mTS.inputPrims));
@ -225,11 +234,6 @@ namespace ArchRast
mGS.vertsInput += event.data.vertsInput;
}
virtual void Handle(const ClipVertexCount& event)
{
mClipper.clippedVerts += (_mm_popcnt_u32(event.data.primMask) * event.data.vertsPerPrim);
}
virtual void Handle(const TessPrimCount& event)
{
mTS.inputPrims += event.data.primCount;

View File

@ -262,14 +262,16 @@ event GSVertsInput
uint64_t vertsInput;
};
event VertsClipped
{
uint32_t drawId;
uint64_t clipCount;
};
event TessPrims
{
uint32_t drawId;
uint64_t primCount;
};
event ClipperEvent
{
uint32_t drawId;
uint32_t trivialRejectCount;
uint32_t trivialAcceptCount;
uint32_t mustClipCount;
};

View File

@ -90,12 +90,6 @@ event FrontendDrawEndEvent
uint32_t drawId;
};
event ClipVertexCount
{
uint64_t vertsPerPrim;
uint64_t primMask;
};
event TessPrimCount
{
uint64_t primCount;
@ -107,3 +101,15 @@ event GSPrimInfo
uint64_t primGeneratedCount;
uint64_t vertsInput;
};
// validMask is primitives that still need to be clipped. They weren't rejected due to trivial reject or nan.
// clipMask is primitives that need to be clipped. So trivial accepts will be 0 while validMask for that is 1.
// Trivial reject is numInvocations - pop_cnt32(validMask)
// Trivial accept is validMask & ~clipMask
// Must clip count is pop_cnt32(clipMask)
event ClipInfoEvent
{
uint32_t numInvocations;
uint32_t validMask;
uint32_t clipMask;
};

View File

@ -715,6 +715,8 @@ public:
clipMask = primMask & ComputeClipMask();
}
AR_EVENT(ClipInfoEvent(numInvoc, validMask, clipMask));
if (clipMask)
{
RDTSC_BEGIN(FEGuardbandClip, pa.pDC->drawId);