Add measurement of how long DoomLevelMesh::BeginFrame took

This commit is contained in:
Magnus Norddahl 2024-12-10 23:05:57 +01:00
commit dafc612b68

View file

@ -54,6 +54,8 @@ static int InvalidateLightmap()
return count;
}
glcycle_t ProcessLevelMesh;
ADD_STAT(lightmap)
{
FString out;
@ -68,12 +70,18 @@ ADD_STAT(lightmap)
uint32_t atlasPixelCount = levelMesh->AtlasPixelCount();
auto stats = levelMesh->GatherTilePixelStats();
out.Format("Surfaces: %u (awaiting updates: %u)\nSurface pixel area to update: %u\nSurface pixel area: %u\nAtlas pixel area: %u\nAtlas efficiency: %.4f%%",
out.Format(
"Surfaces: %u (awaiting updates: %u)\n"
"Surface pixel area to update: %u\n"
"Surface pixel area: %u\nAtlas pixel area: %u\n"
"Atlas efficiency: %.4f%%\n"
"Level mesh process time: %2.3f ms",
stats.tiles.total, stats.tiles.dirty,
stats.pixels.dirty,
stats.pixels.total,
atlasPixelCount,
float(stats.pixels.total) / float(atlasPixelCount) * 100.0f );
float(stats.pixels.total) / float(atlasPixelCount) * 100.0f,
ProcessLevelMesh.TimeMS());
return out;
}
@ -263,6 +271,8 @@ void DoomLevelMesh::BeginFrame(FLevelLocals& doomMap)
LastFrameStats = CurFrameStats;
CurFrameStats = Stats();
ProcessLevelMesh.ResetAndClock();
// HWWall and HWFlat still looks at r_viewpoint when doing calculations,
// but we aren't rendering a specific viewpoint when this function gets called
int oldextralight = r_viewpoint.extralight;
@ -313,6 +323,8 @@ void DoomLevelMesh::BeginFrame(FLevelLocals& doomMap)
r_viewpoint.extralight = oldextralight;
r_viewpoint.camera = oldcamera;
ProcessLevelMesh.Unclock();
}
void DoomLevelMesh::UploadDynLights(FLevelLocals& doomMap)