diff --git a/docs/Complete_list_of_command_line_parameters.htm b/docs/Complete_list_of_command_line_parameters.htm
index 7d553df8..3ace310b 100644
--- a/docs/Complete_list_of_command_line_parameters.htm
+++ b/docs/Complete_list_of_command_line_parameters.htm
@@ -115,6 +115,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
-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
-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
-threads N: number of threads to use
-v: Verbose mode
diff --git a/tools/quake3/q3map2/help.cpp b/tools/quake3/q3map2/help.cpp
index 100a5d6b..0c18d16f 100644
--- a/tools/quake3/q3map2/help.cpp
+++ b/tools/quake3/q3map2/help.cpp
@@ -458,6 +458,7 @@ static void HelpCommon()
{"-fs_pakpath ", "Specify a package directory (can be used more than once to look in multiple paths)"},
{"-game ", "Load settings for the given game (default: quake3), -help -game lists available games"},
{"-maxmapdrawsurfs ", "Sets max amount of mapDrawSurfs, used during .map compilation (-bsp, -convert), default = 131072"},
+ {"-maxshaderinfo ", "Sets max amount of shaderInfo, default = 8192"},
{"-subdivisions ", "multiplier for patch subdivisions quality"},
{"-threads ", "number of threads to use"},
{"-v", "Verbose mode"}
diff --git a/tools/quake3/q3map2/main.cpp b/tools/quake3/q3map2/main.cpp
index b6eabcf4..cb9ac3c1 100644
--- a/tools/quake3/q3map2/main.cpp
+++ b/tools/quake3/q3map2/main.cpp
@@ -120,6 +120,13 @@ int main( int argc, char **argv ){
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_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 */
diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h
index c782f8c5..dce4e555 100644
--- a/tools/quake3/q3map2/q3map2.h
+++ b/tools/quake3/q3map2/q3map2.h
@@ -100,8 +100,6 @@
#define DEF_RADIOSITY_BOUNCE 1.0f /* ydnar: default to 100% re-emitted light */
-#define MAX_SHADER_INFO 8192
-
/* epair parsing (note case-sensitivity directive) */
#define CASE_INSENSITIVE_EPAIRS 1
@@ -1718,6 +1716,7 @@ void InjectCommandLine( const char *stage, const std::vec
/* general */
inline shaderInfo_t *shaderInfo;
inline int numShaderInfo;
+inline int max_shader_info = 8192;
inline String64 mapName; /* ydnar: per-map custom shaders for larger lightmaps */
inline CopiedString mapShaderFile;
diff --git a/tools/quake3/q3map2/shaders.cpp b/tools/quake3/q3map2/shaders.cpp
index 792bfb99..557247d8 100644
--- a/tools/quake3/q3map2/shaders.cpp
+++ b/tools/quake3/q3map2/shaders.cpp
@@ -543,13 +543,14 @@ static shaderInfo_t *AllocShaderInfo(){
/* allocate? */
if ( shaderInfo == NULL ) {
- shaderInfo = safe_malloc( sizeof( shaderInfo_t ) * MAX_SHADER_INFO );
+ shaderInfo = safe_malloc( sizeof( shaderInfo_t ) * max_shader_info );
numShaderInfo = 0;
}
/* bounds check */
- if ( numShaderInfo == MAX_SHADER_INFO ) {
- Error( "MAX_SHADER_INFO exceeded. Remove some PK3 files or shader scripts from shaderlist.txt and try again." );
+ if ( numShaderInfo == max_shader_info ) {
+ 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 ];
numShaderInfo++;