centralize thread count declarations
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
9719576bda
commit
66eb3a7586
@ -16,6 +16,7 @@ import electrosphere.client.terrain.cache.ChunkData;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.assetmanager.queue.QueuedTexture;
|
import electrosphere.engine.assetmanager.queue.QueuedTexture;
|
||||||
import electrosphere.engine.assetmanager.queue.QueuedTexture.QueuedTextureType;
|
import electrosphere.engine.assetmanager.queue.QueuedTexture.QueuedTextureType;
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.entity.ClientEntityUtils;
|
import electrosphere.entity.ClientEntityUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
@ -153,7 +154,7 @@ public class FoliageModel {
|
|||||||
/**
|
/**
|
||||||
* Used for generating foliage cells
|
* Used for generating foliage cells
|
||||||
*/
|
*/
|
||||||
static final ExecutorService generationService = Executors.newFixedThreadPool(2);
|
static final ExecutorService generationService = Executors.newFixedThreadPool(ThreadCounts.FOLIAGE_MESHGEN_THREADS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a client foliage chunk based on weights and values provided
|
* Creates a client foliage chunk based on weights and values provided
|
||||||
|
|||||||
48
src/main/java/electrosphere/engine/threads/ThreadCounts.java
Normal file
48
src/main/java/electrosphere/engine/threads/ThreadCounts.java
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package electrosphere.engine.threads;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thread counts for various tasks
|
||||||
|
*/
|
||||||
|
public class ThreadCounts {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for foliage meshgen
|
||||||
|
*/
|
||||||
|
public static final int FOLIAGE_MESHGEN_THREADS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for block meshgen
|
||||||
|
*/
|
||||||
|
public static final int BLOCK_MESHGEN_THREADS = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for terrain meshgen
|
||||||
|
*/
|
||||||
|
public static final int TERRAIN_MESHGEN_THREADS = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for solving pathfinding
|
||||||
|
*/
|
||||||
|
public static final int PATHFINDING_THREADS = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for gridded datacell manager chunk loading/unloading
|
||||||
|
*/
|
||||||
|
public static final int GRIDDED_DATACELL_LOADING_THREADS = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for generating physics for the gridded datacell manager
|
||||||
|
*/
|
||||||
|
public static final int GRIDDED_DATACELL_PHYSICS_GEN_THREADS = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for generating block chunks on the server
|
||||||
|
*/
|
||||||
|
public static final int SERVER_BLOCK_GENERATION_THREADS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of threads for generating terrain chunks on the server
|
||||||
|
*/
|
||||||
|
public static final int SERVER_TERRAIN_GENERATION_THREADS = 2;
|
||||||
|
|
||||||
|
}
|
||||||
@ -14,6 +14,7 @@ import electrosphere.collision.PhysicsEntityUtils;
|
|||||||
import electrosphere.collision.PhysicsUtils;
|
import electrosphere.collision.PhysicsUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.assetmanager.queue.QueuedModel;
|
import electrosphere.engine.assetmanager.queue.QueuedModel;
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.entity.ClientEntityUtils;
|
import electrosphere.entity.ClientEntityUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
@ -35,7 +36,7 @@ public class BlockChunkEntity {
|
|||||||
/**
|
/**
|
||||||
* Used for generating block chunks
|
* Used for generating block chunks
|
||||||
*/
|
*/
|
||||||
static final ExecutorService generationService = Executors.newFixedThreadPool(4);
|
static final ExecutorService generationService = Executors.newFixedThreadPool(ThreadCounts.BLOCK_MESHGEN_THREADS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a client block chunk based on weights and values provided
|
* Creates a client block chunk based on weights and values provided
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import electrosphere.client.terrain.manager.ClientTerrainManager;
|
|||||||
import electrosphere.collision.PhysicsEntityUtils;
|
import electrosphere.collision.PhysicsEntityUtils;
|
||||||
import electrosphere.collision.PhysicsUtils;
|
import electrosphere.collision.PhysicsUtils;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.entity.ClientEntityUtils;
|
import electrosphere.entity.ClientEntityUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
@ -38,7 +39,7 @@ public class TerrainChunk {
|
|||||||
/**
|
/**
|
||||||
* Used for generating terrain chunks
|
* Used for generating terrain chunks
|
||||||
*/
|
*/
|
||||||
static final ExecutorService generationService = Executors.newFixedThreadPool(4);
|
static final ExecutorService generationService = Executors.newFixedThreadPool(ThreadCounts.TERRAIN_MESHGEN_THREADS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a client terrain chunk based on weights and values provided
|
* Creates a client terrain chunk based on weights and values provided
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import java.util.concurrent.Executors;
|
|||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.server.datacell.interfaces.VoxelCellManager;
|
import electrosphere.server.datacell.interfaces.VoxelCellManager;
|
||||||
import electrosphere.server.pathfinding.recast.PathingProgressiveData;
|
import electrosphere.server.pathfinding.recast.PathingProgressiveData;
|
||||||
import electrosphere.server.pathfinding.voxel.VoxelPathfinder;
|
import electrosphere.server.pathfinding.voxel.VoxelPathfinder;
|
||||||
@ -31,7 +32,7 @@ public class PathfindingService implements AIService {
|
|||||||
public PathingProgressiveData queuePathfinding(Vector3d start, Vector3d end, VoxelPathfinder pathfinder, VoxelCellManager voxelCellManager){
|
public PathingProgressiveData queuePathfinding(Vector3d start, Vector3d end, VoxelPathfinder pathfinder, VoxelCellManager voxelCellManager){
|
||||||
PathingProgressiveData rVal = new PathingProgressiveData(end);
|
PathingProgressiveData rVal = new PathingProgressiveData(end);
|
||||||
if(executorService == null){
|
if(executorService == null){
|
||||||
executorService = Executors.newFixedThreadPool(2);
|
executorService = Executors.newFixedThreadPool(ThreadCounts.PATHFINDING_THREADS);
|
||||||
}
|
}
|
||||||
executorService.submit(() -> {
|
executorService.submit(() -> {
|
||||||
List<Vector3d> points = pathfinder.findPath(voxelCellManager, start, end, VoxelPathfinder.DEFAULT_MAX_COST);
|
List<Vector3d> points = pathfinder.findPath(voxelCellManager, start, end, VoxelPathfinder.DEFAULT_MAX_COST);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import java.util.concurrent.Future;
|
|||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +20,7 @@ public class GriddedDataCellLoaderService {
|
|||||||
/**
|
/**
|
||||||
* Used for loading/unloading the cells
|
* Used for loading/unloading the cells
|
||||||
*/
|
*/
|
||||||
protected static final ExecutorService ioThreadService = Executors.newFixedThreadPool(4);
|
protected static final ExecutorService ioThreadService = Executors.newFixedThreadPool(ThreadCounts.GRIDDED_DATACELL_LOADING_THREADS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lock for structures in this service
|
* Lock for structures in this service
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import org.joml.Vector3i;
|
|||||||
|
|
||||||
import electrosphere.client.block.BlockChunkData;
|
import electrosphere.client.block.BlockChunkData;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
@ -76,7 +77,7 @@ public class GriddedDataCellManager implements DataCellManager, VoxelCellManager
|
|||||||
/**
|
/**
|
||||||
* Used for generating physics chunks
|
* Used for generating physics chunks
|
||||||
*/
|
*/
|
||||||
static final ExecutorService generationService = Executors.newFixedThreadPool(4);
|
static final ExecutorService generationService = Executors.newFixedThreadPool(ThreadCounts.GRIDDED_DATACELL_PHYSICS_GEN_THREADS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks whether this manager has been flagged to unload cells or not
|
* Tracks whether this manager has been flagged to unload cells or not
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package electrosphere.server.physics.block.manager;
|
|||||||
import electrosphere.client.block.BlockChunkCache;
|
import electrosphere.client.block.BlockChunkCache;
|
||||||
import electrosphere.client.block.BlockChunkData;
|
import electrosphere.client.block.BlockChunkData;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.server.datacell.ServerWorldData;
|
import electrosphere.server.datacell.ServerWorldData;
|
||||||
import electrosphere.server.macro.MacroData;
|
import electrosphere.server.macro.MacroData;
|
||||||
import electrosphere.server.physics.block.diskmap.ServerBlockChunkDiskMap;
|
import electrosphere.server.physics.block.diskmap.ServerBlockChunkDiskMap;
|
||||||
@ -18,11 +19,6 @@ import org.joml.Vector3i;
|
|||||||
* Provides an interface for the server to query information about block chunks
|
* Provides an interface for the server to query information about block chunks
|
||||||
*/
|
*/
|
||||||
public class ServerBlockManager {
|
public class ServerBlockManager {
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of threads for chunk generation
|
|
||||||
*/
|
|
||||||
public static final int GENERATION_THREAD_POOL_SIZE = 2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent world data
|
* The parent world data
|
||||||
@ -50,7 +46,7 @@ public class ServerBlockManager {
|
|||||||
* The threadpool for chunk generation
|
* The threadpool for chunk generation
|
||||||
*/
|
*/
|
||||||
@Exclude
|
@Exclude
|
||||||
static final ExecutorService chunkExecutorService = Executors.newFixedThreadPool(GENERATION_THREAD_POOL_SIZE);
|
static final ExecutorService chunkExecutorService = Executors.newFixedThreadPool(ThreadCounts.SERVER_BLOCK_GENERATION_THREADS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package electrosphere.server.physics.terrain.manager;
|
|||||||
|
|
||||||
import electrosphere.client.terrain.cache.ChunkData;
|
import electrosphere.client.terrain.cache.ChunkData;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.threads.ThreadCounts;
|
||||||
import electrosphere.entity.scene.RealmDescriptor;
|
import electrosphere.entity.scene.RealmDescriptor;
|
||||||
import electrosphere.server.datacell.ServerWorldData;
|
import electrosphere.server.datacell.ServerWorldData;
|
||||||
import electrosphere.server.physics.terrain.diskmap.ChunkDiskMap;
|
import electrosphere.server.physics.terrain.diskmap.ChunkDiskMap;
|
||||||
@ -28,12 +29,7 @@ import org.joml.Vector3i;
|
|||||||
* Provides an interface for the server to query information about terrain
|
* Provides an interface for the server to query information about terrain
|
||||||
*/
|
*/
|
||||||
public class ServerTerrainManager {
|
public class ServerTerrainManager {
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of threads for chunk generation
|
|
||||||
*/
|
|
||||||
public static final int GENERATION_THREAD_POOL_SIZE = 2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full world discrete size
|
* Full world discrete size
|
||||||
*/
|
*/
|
||||||
@ -82,7 +78,7 @@ public class ServerTerrainManager {
|
|||||||
* The threadpool for chunk generation
|
* The threadpool for chunk generation
|
||||||
*/
|
*/
|
||||||
@Exclude
|
@Exclude
|
||||||
static final ExecutorService chunkExecutorService = Executors.newFixedThreadPool(GENERATION_THREAD_POOL_SIZE);
|
static final ExecutorService chunkExecutorService = Executors.newFixedThreadPool(ThreadCounts.SERVER_TERRAIN_GENERATION_THREADS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user