Make LevelMeshUpdater responsible for updating the tiles (playsim tells the mesh updater, the level mesh tells the tiles)

This commit is contained in:
Magnus Norddahl 2025-05-11 20:11:18 +02:00
commit 6cf3cdb871
11 changed files with 45 additions and 117 deletions

View file

@ -142,12 +142,6 @@ LevelMeshTileStats LevelMesh::GatherTilePixelStats()
stats.tiles.dirty++;
stats.pixels.dirty += area;
}
if (tile.AlwaysUpdate)
{
stats.tiles.dirtyDynamic++;
stats.pixels.dirtyDynamic += area;
}
}
stats.tiles.total += Lightmap.Tiles.Size();
return stats;

View file

@ -252,7 +252,7 @@ struct LevelMeshTileStats
{
struct Stats
{
uint32_t total = 0, dirty = 0, dirtyDynamic = 0;
uint32_t total = 0, dirty = 0;
};
Stats tiles, pixels;

View file

@ -26,14 +26,6 @@ struct LightmapTileBinding
}
};
enum TileUpdatePolicy
{
MapChanges,
AlwaysUltraQuality,
Always,
MapChangesUltraQuality
};
struct LightmapTile
{
// Surface location in lightmap texture
@ -68,7 +60,8 @@ struct LightmapTile
// True if the tile needs to be rendered into the lightmap texture before it can be used
bool NeedsUpdate = true;
uint8_t AlwaysUpdate = 0;
// Used to track if tile has already been added to the VisibleTiles list for this scene
int LastSeen = 0;
FVector2 ToUV(const FVector3& vert) const
{

View file

@ -94,22 +94,23 @@ void VkLightmapper::Raytrace(const TArray<LightmapTile*>& tiles)
lightmapRaytraceLast.active = true;
lightmapRaytraceLast.ResetAndClock();
fb->GetCommands()->PushGroup(fb->GetCommands()->GetTransferCommands(), "lightmap.total");
UploadUniforms();
SelectTiles(tiles);
if (selectedTiles.Size() > 0)
while (true)
{
fb->GetCommands()->PushGroup(fb->GetCommands()->GetTransferCommands(), "lightmap.total");
SelectTiles(tiles);
if (selectedTiles.Size() == 0)
break;
UploadUniforms();
Render();
Resolve();
if (lm_blur)
Blur();
CopyResult();
fb->GetCommands()->PopGroup(fb->GetCommands()->GetTransferCommands());
}
fb->GetCommands()->PopGroup(fb->GetCommands()->GetTransferCommands());
lightmapRaytraceLast.Unclock();
}
}