GS:MTL: Add barrier counting

This commit is contained in:
TellowKrinkle 2022-09-01 14:49:53 -05:00 committed by tellowkrinkle
parent 7d4ca441d5
commit 66093c3278
1 changed files with 8 additions and 3 deletions

View File

@ -1628,6 +1628,9 @@ void GSDeviceMTL::SendHWDraw(GSHWDrawConfig& config, id<MTLRenderCommandEncoder>
config.nindices / config.indices_per_prim, config.drawlist->size(), message.c_str()]]; config.nindices / config.indices_per_prim, config.drawlist->size(), message.c_str()]];
#endif #endif
g_perfmon.Put(GSPerfMon::DrawCalls, config.drawlist->size());
g_perfmon.Put(GSPerfMon::Barriers, config.drawlist->size());
for (size_t count = 0, p = 0, n = 0; n < config.drawlist->size(); p += count, ++n) for (size_t count = 0, p = 0, n = 0; n < config.drawlist->size(); p += count, ++n)
{ {
count = (*config.drawlist)[n] * config.indices_per_prim; count = (*config.drawlist)[n] * config.indices_per_prim;
@ -1637,13 +1640,15 @@ void GSDeviceMTL::SendHWDraw(GSHWDrawConfig& config, id<MTLRenderCommandEncoder>
indexType:MTLIndexTypeUInt32 indexType:MTLIndexTypeUInt32
indexBuffer:buffer indexBuffer:buffer
indexBufferOffset:off + p * sizeof(*config.indices)]; indexBufferOffset:off + p * sizeof(*config.indices)];
g_perfmon.Put(GSPerfMon::DrawCalls, 1);
} }
[enc popDebugGroup]; [enc popDebugGroup];
} }
else if (config.require_full_barrier) else if (config.require_full_barrier)
{ {
[enc pushDebugGroup:[NSString stringWithFormat:@"Full barrier split draw (%d prims)", config.nindices / config.indices_per_prim]]; const u32 ndraws = config.nindices / config.indices_per_prim;
g_perfmon.Put(GSPerfMon::DrawCalls, ndraws);
g_perfmon.Put(GSPerfMon::Barriers, ndraws);
[enc pushDebugGroup:[NSString stringWithFormat:@"Full barrier split draw (%d prims)", ndraws]];
for (size_t p = 0; p < config.nindices; p += config.indices_per_prim) for (size_t p = 0; p < config.nindices; p += config.indices_per_prim)
{ {
textureBarrier(enc); textureBarrier(enc);
@ -1652,7 +1657,6 @@ void GSDeviceMTL::SendHWDraw(GSHWDrawConfig& config, id<MTLRenderCommandEncoder>
indexType:MTLIndexTypeUInt32 indexType:MTLIndexTypeUInt32
indexBuffer:buffer indexBuffer:buffer
indexBufferOffset:off + p * sizeof(*config.indices)]; indexBufferOffset:off + p * sizeof(*config.indices)];
g_perfmon.Put(GSPerfMon::DrawCalls, 1);
} }
[enc popDebugGroup]; [enc popDebugGroup];
} }
@ -1666,6 +1670,7 @@ void GSDeviceMTL::SendHWDraw(GSHWDrawConfig& config, id<MTLRenderCommandEncoder>
indexBuffer:buffer indexBuffer:buffer
indexBufferOffset:off]; indexBufferOffset:off];
g_perfmon.Put(GSPerfMon::DrawCalls, 1); g_perfmon.Put(GSPerfMon::DrawCalls, 1);
g_perfmon.Put(GSPerfMon::Barriers, 1);
} }
else else
{ {