@@ -5818,17 +5818,6 @@ static void GeneratePermanentShaderTable( const float *values, int numValues )
58185818 shaderTableHashTable[ hash ] = newTable;
58195819}
58205820
5821- bool CheckShaderNameLength ( const char * func_err, const char * name, const char * suffix )
5822- {
5823- if ( strlen ( name ) + strlen ( suffix ) >= MAX_QPATH )
5824- {
5825- Log::Warn (" %s Shader name %s%s length longer than MAX_QPATH %d" , func_err, name, suffix, MAX_QPATH );
5826- return false ;
5827- }
5828-
5829- return true ;
5830- }
5831-
58325821static void ValidateStage ( shaderStage_t *pStage )
58335822{
58345823 struct stageCheck_t {
@@ -6078,24 +6067,7 @@ static shader_t *FinishShader()
60786067 shader.noFog = true ;
60796068 shader.fogShader = nullptr ;
60806069
6081- const char * depthShaderSuffix = " $depth" ;
6082-
6083- if ( !CheckShaderNameLength ( " FinishShader" , shader.name , depthShaderSuffix ) )
6084- {
6085- ret->depthShader = nullptr ;
6086-
6087- if ( glConfig.usingMaterialSystem && !tr.worldLoaded ) {
6088- uint8_t maxStages = ret->lastStage - ret->stages ;
6089-
6090- // Add 1 for potential fog stages
6091- maxStages = PAD ( maxStages + 1 , 4 ); // Aligned to 4 components
6092- materialSystem.maxStages = std::max ( maxStages, materialSystem.maxStages );
6093- }
6094-
6095- return ret;
6096- }
6097-
6098- strcat ( shader.name , depthShaderSuffix );
6070+ Q_strcat ( shader.name , sizeof ( shader.name ), " $depth" );
60996071
61006072 if ( stages[0 ].stateBits & GLS_ATEST_BITS ) {
61016073 // alpha test requires a custom depth shader
@@ -6284,6 +6256,7 @@ shader_t *R_FindShader( const char *name, int flags )
62846256 ClearGlobalShader ();
62856257
62866258 Q_strncpyz ( shader.name , strippedName, sizeof ( shader.name ) );
6259+ ASSERT_LT ( strlen ( shader.name ), MAX_QPATH );
62876260 shader.registerFlags = flags;
62886261
62896262 for ( i = 0 ; i < MAX_SHADER_STAGES; i++ )
@@ -6474,8 +6447,9 @@ qhandle_t RE_RegisterShader( const char *name, int flags )
64746447{
64756448 shader_t *sh;
64766449
6477- if ( ! CheckShaderNameLength ( " RE_RegisterShader " , name, " " ) )
6450+ if ( strlen ( name ) >= MAX_QPATH )
64786451 {
6452+ Log::Warn ( " RE_RegisterShader: name '%s' is too long" , name );
64796453 return 0 ;
64806454 }
64816455
0 commit comments