* -maxshaderinfo <N>: Sets max amount of shaderInfo, default = 8192

This commit is contained in:
Garux 2024-02-15 23:35:45 +06:00
parent 20a9afcd1d
commit 6749261e75
5 changed files with 14 additions and 5 deletions

View File

@ -115,6 +115,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
<li><strong><code>-fs_pakpath</code> path:</strong> Specify a package directory (can be used more than once to look in multiple paths)</li> <li><strong><code>-fs_pakpath</code> path:</strong> Specify a package directory (can be used more than once to look in multiple paths)</li>
<li><strong><code>-game</code> gamename:</strong> Load settings for the given game (default: quake3), -help -game lists available games</li> <li><strong><code>-game</code> gamename:</strong> Load settings for the given game (default: quake3), -help -game lists available games</li>
<li><strong><code>-maxmapdrawsurfs</code> N:</strong> Sets max amount of mapDrawSurfs, used during .map compilation (-bsp, -convert), default = 131072</li> <li><strong><code>-maxmapdrawsurfs</code> N:</strong> Sets max amount of mapDrawSurfs, used during .map compilation (-bsp, -convert), default = 131072</li>
<li><strong><code>-maxshaderinfo</code> N:</strong> Sets max amount of shaderInfo, default = 8192</li>
<li><strong><code>-subdivisions</code> F:</strong> multiplier for patch subdivisions quality</li> <li><strong><code>-subdivisions</code> F:</strong> multiplier for patch subdivisions quality</li>
<li><strong><code>-threads</code> N:</strong> number of threads to use</li> <li><strong><code>-threads</code> N:</strong> number of threads to use</li>
<li><strong><code>-v</code>:</strong> Verbose mode</li> <li><strong><code>-v</code>:</strong> Verbose mode</li>

View File

@ -458,6 +458,7 @@ static void HelpCommon()
{"-fs_pakpath <path>", "Specify a package directory (can be used more than once to look in multiple paths)"}, {"-fs_pakpath <path>", "Specify a package directory (can be used more than once to look in multiple paths)"},
{"-game <gamename>", "Load settings for the given game (default: quake3), -help -game lists available games"}, {"-game <gamename>", "Load settings for the given game (default: quake3), -help -game lists available games"},
{"-maxmapdrawsurfs <N>", "Sets max amount of mapDrawSurfs, used during .map compilation (-bsp, -convert), default = 131072"}, {"-maxmapdrawsurfs <N>", "Sets max amount of mapDrawSurfs, used during .map compilation (-bsp, -convert), default = 131072"},
{"-maxshaderinfo <N>", "Sets max amount of shaderInfo, default = 8192"},
{"-subdivisions <F>", "multiplier for patch subdivisions quality"}, {"-subdivisions <F>", "multiplier for patch subdivisions quality"},
{"-threads <N>", "number of threads to use"}, {"-threads <N>", "number of threads to use"},
{"-v", "Verbose mode"} {"-v", "Verbose mode"}

View File

@ -120,6 +120,13 @@ int main( int argc, char **argv ){
Sys_Printf( "max_map_draw_surfs = %d, mapDrawSurfs size = %.2f MBytes \n", Sys_Printf( "max_map_draw_surfs = %d, mapDrawSurfs size = %.2f MBytes \n",
max_map_draw_surfs, sizeof( mapDrawSurface_t ) * max_map_draw_surfs / ( 1024.f * 1024.f ) ); max_map_draw_surfs, sizeof( mapDrawSurface_t ) * max_map_draw_surfs / ( 1024.f * 1024.f ) );
} }
/* max_shader_info */
while ( args.takeArg( "-maxshaderinfo" ) ) {
max_shader_info = abs( atoi( args.takeNext() ) );
Sys_Printf( "max_shader_info = %d, shaderInfo size = %.2f MBytes \n",
max_shader_info, sizeof( shaderInfo_t ) * max_shader_info / ( 1024.f * 1024.f ) );
}
} }
/* init model library */ /* init model library */

View File

@ -100,8 +100,6 @@
#define DEF_RADIOSITY_BOUNCE 1.0f /* ydnar: default to 100% re-emitted light */ #define DEF_RADIOSITY_BOUNCE 1.0f /* ydnar: default to 100% re-emitted light */
#define MAX_SHADER_INFO 8192
/* epair parsing (note case-sensitivity directive) */ /* epair parsing (note case-sensitivity directive) */
#define CASE_INSENSITIVE_EPAIRS 1 #define CASE_INSENSITIVE_EPAIRS 1
@ -1718,6 +1716,7 @@ void InjectCommandLine( const char *stage, const std::vec
/* general */ /* general */
inline shaderInfo_t *shaderInfo; inline shaderInfo_t *shaderInfo;
inline int numShaderInfo; inline int numShaderInfo;
inline int max_shader_info = 8192;
inline String64 mapName; /* ydnar: per-map custom shaders for larger lightmaps */ inline String64 mapName; /* ydnar: per-map custom shaders for larger lightmaps */
inline CopiedString mapShaderFile; inline CopiedString mapShaderFile;

View File

@ -543,13 +543,14 @@ static shaderInfo_t *AllocShaderInfo(){
/* allocate? */ /* allocate? */
if ( shaderInfo == NULL ) { if ( shaderInfo == NULL ) {
shaderInfo = safe_malloc( sizeof( shaderInfo_t ) * MAX_SHADER_INFO ); shaderInfo = safe_malloc( sizeof( shaderInfo_t ) * max_shader_info );
numShaderInfo = 0; numShaderInfo = 0;
} }
/* bounds check */ /* bounds check */
if ( numShaderInfo == MAX_SHADER_INFO ) { if ( numShaderInfo == max_shader_info ) {
Error( "MAX_SHADER_INFO exceeded. Remove some PK3 files or shader scripts from shaderlist.txt and try again." ); Error( "max_shader_info (%d) exceeded. Remove some PK3 files or shader scripts from shaderlist.txt and try again."
" Or consider -maxshaderinfo to increase.", max_shader_info );
} }
si = &shaderInfo[ numShaderInfo ]; si = &shaderInfo[ numShaderInfo ];
numShaderInfo++; numShaderInfo++;