Update some macro constants

master
En Yi 2024-12-29 19:22:54 +08:00
parent 23462e6a55
commit 03b847cdb3
2 changed files with 6 additions and 5 deletions

View File

@ -2,13 +2,16 @@
#define _ENGINE_CONF_H
#define MEMORY_ARENA_SIZE_MB 16
#define MAX_N_COMPONENTS 20
#define MAX_ENTITIES 2047
#define MAX_COMP_POOL_SIZE MAX_ENTITIES
#define INVALID_COMP_IDX MAX_COMP_POOL_SIZE
// Take care tuning these params. Web build doesn't work
// if memory used too high
#define MAX_SCENES_TO_RENDER 8
#define MAX_RENDER_LAYERS 4
#define MAX_RENDERMANAGER_DEPTH 4
#define MAX_ENTITIES 2047
#define MAX_TEXTURES 16
#define MAX_SPRITES 127
@ -21,6 +24,4 @@
#define MAX_PARTICLES 32
#define N_TAGS 10
#define N_COMPONENTS 20
#define MAX_COMP_POOL_SIZE MAX_ENTITIES
#endif // _ENGINE_CONF_H

View File

@ -43,7 +43,7 @@ void print_memory_info()
void* new_component_generic(unsigned int comp_type, unsigned int* idx)
{
assert(comp_type < N_COMPONENTS);
assert(comp_type < MAX_N_COMPONENTS);
assert(comp_type < mem_impl.n_components);
if (cc_size(&mem_impl.comp_mempools[comp_type].free_set) == 0) return NULL;
@ -72,7 +72,7 @@ void* get_component_generic(unsigned int comp_type, unsigned int idx)
void free_component_generic(unsigned int comp_type, unsigned int idx)
{
assert(comp_type < N_COMPONENTS);
assert(comp_type < MAX_N_COMPONENTS);
// This just free the component from the memory pool
assert(comp_type < mem_impl.n_components);
if (idx >= mem_impl.comp_mempools->capacity) return;