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 <bruce.cherniak@intel.com>
This commit is contained in:
parent
45df1a6520
commit
f979d0bc2f
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,14 @@
|
|||
#
|
||||
# Provides definitions for events.
|
||||
|
||||
enum AR_DRAW_TYPE
|
||||
{
|
||||
Instanced = 0,
|
||||
IndexedInstanced = 1,
|
||||
InstancedSplit = 2,
|
||||
IndexedInstancedSplit = 3
|
||||
};
|
||||
|
||||
event ThreadStartApiEvent
|
||||
{
|
||||
};
|
||||
|
@ -29,20 +37,12 @@ event ThreadStartWorkerEvent
|
|||
{
|
||||
};
|
||||
|
||||
event DrawInstancedEvent
|
||||
event DrawInfoEvent
|
||||
{
|
||||
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;
|
||||
uint32_t topology;
|
||||
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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue