diff options
author | George Kyriazis <[email protected]> | 2018-02-12 17:54:30 -0600 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-02-16 10:54:02 -0600 |
commit | f979d0bc2f5646275994f71b737f6828f8d2539c (patch) | |
tree | 2cc3547614157183f93d69d25f787a5b61e2f52a /src | |
parent | 45df1a65200fafc293129a7473a0a6ffef92017c (diff) |
swr/rast: Consolidate archrast Draw events
Consolidate archrst draw events into single draw event with an attribute
that represents the type of draw
- Add handlers for new private proto versions of DrawInstancedEvent,
DrawIndexedInstancedEvent, DrawInstancedSplitEvent, and
DrawIndexedInstancedSplitEvent
- Convert the draw events to generic DrawInfoEvents
- parse_proto_event_fields() replaces 'AR_DRAW_TYPE' as a field type with
'uint32_t'. This draw type is actually an enum, but can be represented
as an unsigned integer.
- is_draw_or_dispatch() recognizes DrawInfoEvent as a draw event
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
4 files changed, 79 insertions, 26 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp index 49e7764bd55..d7a3b292d62 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp +++ b/src/gallium/drivers/swr/rasterizer/archrast/archrast.cpp @@ -173,6 +173,34 @@ namespace ArchRast mClipper.trivialAcceptCount += _mm_popcnt_u32(event.data.validMask & ~event.data.clipMask); } + virtual void Handle(const DrawInstancedEvent& event) + { + DrawInfoEvent e(event.data.drawId, event.data.type, event.data.topology, event.data.numVertices, 0, 0, event.data.startVertex, event.data.numInstances, event.data.startInstance); + + EventHandlerFile::Handle(e); + } + + virtual void Handle(const DrawIndexedInstancedEvent& event) + { + DrawInfoEvent e(event.data.drawId, event.data.type, event.data.topology, 0, event.data.numIndices, event.data.indexOffset, event.data.baseVertex, event.data.numInstances, event.data.startInstance); + + EventHandlerFile::Handle(e); + } + + virtual void Handle(const DrawInstancedSplitEvent& event) + { + DrawInfoEvent e(event.data.drawId, event.data.type, 0, 0, 0, 0, 0, 0, 0); + + EventHandlerFile::Handle(e); + } + + virtual void Handle(const DrawIndexedInstancedSplitEvent& event) + { + DrawInfoEvent e(event.data.drawId, event.data.type, 0, 0, 0, 0, 0, 0, 0); + + EventHandlerFile::Handle(e); + } + // Flush cached events for this draw virtual void FlushDraw(uint32_t drawId) { diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events.proto b/src/gallium/drivers/swr/rasterizer/archrast/events.proto index c96e7a1bd7b..638dfd067c6 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events.proto @@ -21,28 +21,28 @@ # # Provides definitions for events. -event ThreadStartApiEvent +enum AR_DRAW_TYPE { + Instanced = 0, + IndexedInstanced = 1, + InstancedSplit = 2, + IndexedInstancedSplit = 3 }; -event ThreadStartWorkerEvent +event ThreadStartApiEvent { }; -event DrawInstancedEvent +event ThreadStartWorkerEvent { - uint32_t drawId; - uint32_t topology; - uint32_t numVertices; - int32_t startVertex; - uint32_t numInstances; - uint32_t startInstance; }; -event DrawIndexedInstancedEvent +event DrawInfoEvent { uint32_t drawId; + AR_DRAW_TYPE type; uint32_t topology; + uint32_t numVertices; uint32_t numIndices; int32_t indexOffset; int32_t baseVertex; @@ -64,18 +64,6 @@ event FrameEndEvent uint32_t nextDrawId; }; -///@brief API Stat: Split draw event for DrawInstanced. In certain cases, Rasty can split draws up into smaller draws. -event DrawInstancedSplitEvent -{ - uint32_t drawId; -}; - -///@brief API Stat: Split draw event for DrawIndexedInstanced. -event DrawIndexedInstancedSplitEvent -{ - uint32_t drawId; -}; - ///@brief API Stat: Synchonization event. event SwrSyncEvent { diff --git a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto index f6dde331355..71b723d5f61 100644 --- a/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto +++ b/src/gallium/drivers/swr/rasterizer/archrast/events_private.proto @@ -113,3 +113,40 @@ event ClipInfoEvent uint32_t validMask; uint32_t clipMask; }; + +event DrawInstancedEvent +{ + uint32_t drawId; + AR_DRAW_TYPE type; + uint32_t topology; + uint32_t numVertices; + int32_t startVertex; + uint32_t numInstances; + uint32_t startInstance; +}; + +event DrawIndexedInstancedEvent +{ + uint32_t drawId; + AR_DRAW_TYPE type; + uint32_t topology; + uint32_t numIndices; + int32_t indexOffset; + int32_t baseVertex; + uint32_t numInstances; + uint32_t startInstance; +}; + +///@brief API Stat: Split draw event for DrawInstanced. In certain cases, Rasty can split draws up into smaller draws. +event DrawInstancedSplitEvent +{ + uint32_t drawId; + AR_DRAW_TYPE type; +}; + +///@brief API Stat: Split draw event for DrawIndexedInstanced. +event DrawIndexedInstancedSplitEvent +{ + uint32_t drawId; + AR_DRAW_TYPE type; +}; diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 99d3cd5bb01..cb98cbe7eea 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -1169,7 +1169,7 @@ void DrawInstanced( DRAW_CONTEXT* pDC = GetDrawContext(pContext); RDTSC_BEGIN(APIDraw, pDC->drawId); - AR_API_EVENT(DrawInstancedEvent(pDC->drawId, topology, numVertices, startVertex, numInstances, startInstance)); + AR_API_EVENT(DrawInstancedEvent(pDC->drawId, ArchRast::Instanced, topology, numVertices, startVertex, numInstances, startInstance)); uint32_t maxVertsPerDraw = MaxVertsPerDraw(pDC, numVertices, topology); uint32_t primsPerDraw = GetNumPrims(topology, maxVertsPerDraw); @@ -1221,7 +1221,7 @@ void DrawInstanced( //enqueue DC QueueDraw(pContext); - AR_API_EVENT(DrawInstancedSplitEvent(pDC->drawId)); + AR_API_EVENT(DrawInstancedSplitEvent(pDC->drawId, ArchRast::InstancedSplit)); remainingVerts -= numVertsForDraw; draw++; @@ -1297,7 +1297,7 @@ void DrawIndexedInstance( API_STATE* pState = &pDC->pState->state; RDTSC_BEGIN(APIDrawIndexed, pDC->drawId); - AR_API_EVENT(DrawIndexedInstancedEvent(pDC->drawId, topology, numIndices, indexOffset, baseVertex, numInstances, startInstance)); + AR_API_EVENT(DrawIndexedInstancedEvent(pDC->drawId, ArchRast::IndexedInstancedSplit, topology, numIndices, indexOffset, baseVertex, numInstances, startInstance)); uint32_t maxIndicesPerDraw = MaxVertsPerDraw(pDC, numIndices, topology); uint32_t primsPerDraw = GetNumPrims(topology, maxIndicesPerDraw); @@ -1366,7 +1366,7 @@ void DrawIndexedInstance( //enqueue DC QueueDraw(pContext); - AR_API_EVENT(DrawIndexedInstancedSplitEvent(pDC->drawId)); + AR_API_EVENT(DrawIndexedInstancedSplitEvent(pDC->drawId, ArchRast::IndexedInstancedSplit)); pIB += maxIndicesPerDraw * indexSize; remainingIndices -= numIndicesForDraw; |