From 04cc9de8f2fbcb11f133c88f02fc11504b3ea6f3 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 15 Apr 2017 10:55:52 +0300 Subject: MeshUpdateQueue: Add a MapBlock cache that minimizes the amount of MapBlock copying done in the main thread Cache size is configurable by the meshgen_block_cache_size (default 20 MB). New profiler stats: - MeshUpdateQueue MapBlock cache hit % - MeshUpdateQueue MapBlock cache size kB Removes one type of stutter that was seen on the client when received MapBlocks were being handled. (the "MeshMakeData::fill" stutter) Kind of related to at least #5239 Originally preceded by these commits, now includes them: - Move the mesh generator thread into src/mesh_generator_thread.{cpp,h} - mesh_generator_thread.cpp: Update code style - MeshUpdateThread: Modify interface to house a different implementation: Actual functionality will be changed by next commits. - MeshMakeData: Add fillBlockData() interface (so that caller can fill in stuff from eg. a MapBlock cache) --- src/mapblock_mesh.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mapblock_mesh.h') diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index 916703f3e..25c699e1c 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -52,6 +52,12 @@ struct MeshMakeData MeshMakeData(Client *client, bool use_shaders, bool use_tangent_vertices = false); + /* + Copy block data manually (to allow optimizations by the caller) + */ + void fillBlockDataBegin(const v3s16 &blockpos); + void fillBlockData(const v3s16 &block_offset, MapNode *data); + /* Copy central data directly from block, and other data from parent of block. -- cgit v1.2.3