Skip to content

Commit

Permalink
* -maxshaderinfo <N>: Sets max amount of shaderInfo, default = 8192
Browse files Browse the repository at this point in the history
  • Loading branch information
Garux committed Feb 15, 2024
1 parent 20a9afc commit 6749261
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/Complete_list_of_command_line_parameters.htm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ <h2 id="Common-options">Common options<a href="#Common-options" class="wiki-anch
<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>-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>-threads</code> N:</strong> number of threads to use</li>
<li><strong><code>-v</code>:</strong> Verbose mode</li>
Expand Down
1 change: 1 addition & 0 deletions tools/quake3/q3map2/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)"},
{"-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"}
Expand Down
7 changes: 7 additions & 0 deletions tools/quake3/q3map2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions tools/quake3/q3map2/q3map2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions tools/quake3/q3map2/shaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down

0 comments on commit 6749261

Please sign in to comment.