struct CStats
{
- uint32_t clippedVerts = 0;
+ uint32_t trivialRejectCount;
+ uint32_t trivialAcceptCount;
+ uint32_t mustClipCount;
};
struct TEStats
}
+ 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)
{
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));
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;
uint32_t drawId;
};
-event ClipVertexCount
-{
- uint64_t vertsPerPrim;
- uint64_t primMask;
-};
-
event TessPrimCount
{
uint64_t primCount;
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;
+};