diff --git a/neo/idlib/sys/sys_types.h b/neo/idlib/sys/sys_types.h index 871f7210..98fc1bde 100644 --- a/neo/idlib/sys/sys_types.h +++ b/neo/idlib/sys/sys_types.h @@ -154,7 +154,7 @@ const float MAX_ENTITY_COORDINATE = 64000.0f; #endif -// if writing to write-combined memroy, always write indexes as pairs for 32 bit writes +// if writing to write-combined memory, always write indexes as pairs for 32 bit writes ID_INLINE void WriteIndexPair( triIndex_t* dest, const triIndex_t a, const triIndex_t b ) { *( unsigned* )dest = ( unsigned )a | ( ( unsigned )b << 16 ); diff --git a/neo/renderer/VertexCache.h b/neo/renderer/VertexCache.h index 6dcca361..d29a3d3b 100644 --- a/neo/renderer/VertexCache.h +++ b/neo/renderer/VertexCache.h @@ -4,6 +4,7 @@ Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. Copyright (C) 2016-2017 Dustin Land +Copyright (C) 2020 Robert Beckebans This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). @@ -29,24 +30,57 @@ If you have questions concerning this license or the applicable additional terms #ifndef __VERTEXCACHE_H__ #define __VERTEXCACHE_H__ -const int VERTCACHE_INDEX_MEMORY_PER_FRAME = 31 * 1024 * 1024; -const int VERTCACHE_VERTEX_MEMORY_PER_FRAME = 31 * 1024 * 1024; -const int VERTCACHE_JOINT_MEMORY_PER_FRAME = 256 * 1024; +#if 1 -// there are a lot more static indexes than vertexes, because interactions are just new -// index lists that reference existing vertexes -const int STATIC_INDEX_MEMORY = 31 * 1024 * 1024; -const int STATIC_VERTEX_MEMORY = 31 * 1024 * 1024; // make sure it fits in VERTCACHE_OFFSET_MASK! + // RB: increased some static memory limits for custom modder content -// vertCacheHandle_t packs size, offset, and frame number into 64 bits -typedef uint64 vertCacheHandle_t; -const int VERTCACHE_STATIC = 1; // in the static set, not the per-frame set -const int VERTCACHE_SIZE_SHIFT = 1; -const int VERTCACHE_SIZE_MASK = 0x7fffff; // 8 megs -const int VERTCACHE_OFFSET_SHIFT = 24; -const int VERTCACHE_OFFSET_MASK = 0x1ffffff; // 32 megs -const int VERTCACHE_FRAME_SHIFT = 49; -const int VERTCACHE_FRAME_MASK = 0x7fff; // 15 bits = 32k frames to wrap around + const int VERTCACHE_INDEX_MEMORY_PER_FRAME = 31 * 1024 * 1024; + const int VERTCACHE_VERTEX_MEMORY_PER_FRAME = 31 * 1024 * 1024; + const int VERTCACHE_JOINT_MEMORY_PER_FRAME = 256 * 1024; + + // there are a lot more static indexes than vertexes, because interactions are just new + // index lists that reference existing vertexes + const int STATIC_INDEX_MEMORY = 4 * 31 * 1024 * 1024; + const int STATIC_VERTEX_MEMORY = 4 * 31 * 1024 * 1024; // make sure it fits in VERTCACHE_OFFSET_MASK! + + // vertCacheHandle_t packs size, offset, and frame number into 64 bits + typedef uint64 vertCacheHandle_t; + const int VERTCACHE_STATIC = 1; // in the static set, not the per-frame set + + const int VERTCACHE_SIZE_SHIFT = 1; + const int VERTCACHE_SIZE_MASK = 0x7fffff; // 23 bits = 8 megs + + const int VERTCACHE_OFFSET_SHIFT = 24; + const int VERTCACHE_OFFSET_MASK = 0x1ffffff << 2; // 27 bits = 128 megs + + const int VERTCACHE_FRAME_SHIFT = 51; + const int VERTCACHE_FRAME_MASK = 0x1fff; // 13 bits = 8191 frames to wrap around + + +#else + + // RB: original values which are still good for low spec hardware and performance + + const int VERTCACHE_INDEX_MEMORY_PER_FRAME = 31 * 1024 * 1024; + const int VERTCACHE_VERTEX_MEMORY_PER_FRAME = 31 * 1024 * 1024; + const int VERTCACHE_JOINT_MEMORY_PER_FRAME = 256 * 1024; + + // there are a lot more static indexes than vertexes, because interactions are just new + // index lists that reference existing vertexes + const int STATIC_INDEX_MEMORY = 31 * 1024 * 1024; + const int STATIC_VERTEX_MEMORY = 31 * 1024 * 1024; // make sure it fits in VERTCACHE_OFFSET_MASK! + + // vertCacheHandle_t packs size, offset, and frame number into 64 bits + typedef uint64 vertCacheHandle_t; + const int VERTCACHE_STATIC = 1; // in the static set, not the per-frame set + const int VERTCACHE_SIZE_SHIFT = 1; + const int VERTCACHE_SIZE_MASK = 0x7fffff; // 8 megs + const int VERTCACHE_OFFSET_SHIFT = 24; + const int VERTCACHE_OFFSET_MASK = 0x1ffffff; // 32 megs + const int VERTCACHE_FRAME_SHIFT = 49; + const int VERTCACHE_FRAME_MASK = 0x7fff; // 15 bits = 32k frames to wrap around + +#endif const int VERTEX_CACHE_ALIGN = 32; const int INDEX_CACHE_ALIGN = 16;