Measure the available time for "background depth raster". The idea is viable.

This commit is contained in:
Henrik Rydgård committed 2024-12-29 09:45:55 +01:00
1 parent bb2b214d5e
commit c23c3e8d03
4 files changed
+44 -17

No files matched your search

+30 -13
View File
@@ -1042,6 +1042,10 @@ void DrawEngineCommon::DepthRasterTransform(GEPrimitiveType prim, VertexDecoder
depthIndexCount_ += vertexCount;
depthVertexCount_ += numDecoded;
if (depthDraws_.empty()) {
rasterTimeStart_ = time_now_d();
}
depthDraws_.push_back(draw);
// FlushQueuedDepth();
@@ -1081,11 +1085,19 @@ void DrawEngineCommon::DepthRasterPredecoded(GEPrimitiveType prim, const void *i
depthDraws_.push_back(draw);
if (depthDraws_.empty()) {
rasterTimeStart_ = time_now_d();
}
// FlushQueuedDepth();
}
void DrawEngineCommon::FlushQueuedDepth() {
TimeCollector collectStat(&gpuStats.msRasterizeDepth, coreCollectDebugStats);
if (rasterTimeStart_ != 0.0) {
gpuStats.msRasterTimeAvailable += time_now_d() - rasterTimeStart_;
rasterTimeStart_ = 0.0;
}
const bool collectStats = coreCollectDebugStats;
for (const auto &draw : depthDraws_) {
int *tx = depthScreenVerts_;
@@ -1097,19 +1109,24 @@ void DrawEngineCommon::FlushQueuedDepth() {
const float *vertices = depthTransformed_ + 4 * draw.vertexOffset;
const uint16_t *indices = depthIndices_ + draw.indexOffset;
switch (draw.prim) {
case GE_PRIM_RECTANGLES:
outVertCount = DepthRasterClipIndexedRectangles(tx, ty, tz, vertices, indices, draw);
break;
case GE_PRIM_TRIANGLES:
outVertCount = DepthRasterClipIndexedTriangles(tx, ty, tz, vertices, indices, draw);
break;
default:
_dbg_assert_(false);
break;
{
TimeCollector collectStat(&gpuStats.msCullDepth, collectStats);
switch (draw.prim) {
case GE_PRIM_RECTANGLES:
outVertCount = DepthRasterClipIndexedRectangles(tx, ty, tz, vertices, indices, draw);
break;
case GE_PRIM_TRIANGLES:
outVertCount = DepthRasterClipIndexedTriangles(tx, ty, tz, vertices, indices, draw);
break;
default:
_dbg_assert_(false);
break;
}
}
{
TimeCollector collectStat(&gpuStats.msRasterizeDepth, collectStats);
DepthRasterScreenVerts((uint16_t *)Memory::GetPointerWrite(draw.depthAddr), draw.depthStride, tx, ty, tz, outVertCount, draw);
}
// TODO: Could potentially split into tasks here!
DepthRasterScreenVerts((uint16_t *)Memory::GetPointerWrite(draw.depthAddr), draw.depthStride, tx, ty, tz, outVertCount, draw);
}
// Reset queue
+2
View File
@@ -367,4 +367,6 @@ protected:
int depthVertexCount_ = 0;
int depthIndexCount_ = 0;
std::vector<DepthDraw> depthDraws_;
double rasterTimeStart_ = 0.0;
};
+6 -2
View File
@@ -108,8 +108,10 @@ struct GPUStatistics {
numCachedReplacedTextures = 0;
numClutTextures = 0;
msProcessingDisplayLists = 0;
msPrepareDepth = 0.0f;
msRasterizeDepth = 0.0f;
msPrepareDepth = 0.0;
msCullDepth = 0.0;
msRasterizeDepth = 0.0;
msRasterTimeAvailable = 0.0;
numDepthRasterPrims = 0;
numDepthRasterEarlySize = 0;
numDepthRasterNoPixels = 0;
@@ -156,7 +158,9 @@ struct GPUStatistics {
int numClutTextures;
double msProcessingDisplayLists;
double msPrepareDepth;
double msCullDepth;
double msRasterizeDepth;
double msRasterTimeAvailable;
int vertexGPUCycles;
int otherGPUCycles;
int numDepthRasterPrims;
+6 -2
View File
@@ -1763,7 +1763,7 @@ void GPUCommonHW::Execute_BoneMtxData(u32 op, u32 diff) {
gstate_c.Dirty(DIRTY_BONEMATRIX0 << (num / 12));
} else {
gstate_c.deferredVertTypeDirty |= DIRTY_BONEMATRIX0 << (num / 12);
}
}
((u32 *)gstate.boneMatrix)[num] = newVal;
}
num++;
@@ -1801,7 +1801,8 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) {
"replacer: tracks %d references, %d unique textures\n"
"Cpy: depth %d, color %d, reint %d, blend %d, self %d\n"
"GPU cycles: %d (%0.1f per vertex)\n"
"Z-rast: %0.2f/%0.2f ms, %d prim, %d nopix, %d small, %d earlysize, %d zcull, %d box\n%s",
"Z-rast: %0.2f+%0.2f+%0.2f (total %0.2f/%0.2f) ms\n"
"Z-rast: %d prim, %d nopix, %d small, %d earlysize, %d zcull, %d box\n%s",
gpuStats.msProcessingDisplayLists * 1000.0f,
gpuStats.numDrawSyncs,
gpuStats.numListSyncs,
@@ -1839,7 +1840,10 @@ size_t GPUCommonHW::FormatGPUStatsCommon(char *buffer, size_t size) {
gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles,
vertexAverageCycles,
gpuStats.msPrepareDepth * 1000.0,
gpuStats.msCullDepth * 1000.0,
gpuStats.msRasterizeDepth * 1000.0,
(gpuStats.msPrepareDepth + gpuStats.msCullDepth + gpuStats.msRasterizeDepth) * 1000.0,
gpuStats.msRasterTimeAvailable * 1000.0,
gpuStats.numDepthRasterPrims,
gpuStats.numDepthRasterNoPixels,
gpuStats.numDepthRasterTooSmall,