@@ -5835,17 +5835,6 @@ static void GeneratePermanentShaderTable( const float *values, int numValues )
58355835 shaderTableHashTable[ hash ] = newTable;
58365836}
58375837
5838- bool CheckShaderNameLength ( const char * func_err, const char * name, const char * suffix )
5839- {
5840- if ( strlen ( name ) + strlen ( suffix ) >= MAX_QPATH )
5841- {
5842- Log::Warn (" %s Shader name %s%s length longer than MAX_QPATH %d" , func_err, name, suffix, MAX_QPATH );
5843- return false ;
5844- }
5845-
5846- return true ;
5847- }
5848-
58495838static void ValidateStage ( shaderStage_t *pStage )
58505839{
58515840 struct stageCheck_t {
@@ -6095,24 +6084,7 @@ static shader_t *FinishShader()
60956084 shader.noFog = true ;
60966085 shader.fogShader = nullptr ;
60976086
6098- const char * depthShaderSuffix = " $depth" ;
6099-
6100- if ( !CheckShaderNameLength ( " FinishShader" , shader.name , depthShaderSuffix ) )
6101- {
6102- ret->depthShader = nullptr ;
6103-
6104- if ( glConfig.usingMaterialSystem && !tr.worldLoaded ) {
6105- uint8_t maxStages = ret->lastStage - ret->stages ;
6106-
6107- // Add 1 for potential fog stages
6108- maxStages = PAD ( maxStages + 1 , 4 ); // Aligned to 4 components
6109- materialSystem.maxStages = std::max ( maxStages, materialSystem.maxStages );
6110- }
6111-
6112- return ret;
6113- }
6114-
6115- strcat ( shader.name , depthShaderSuffix );
6087+ Q_strcat ( shader.name , sizeof ( shader.name ), " $depth" );
61166088
61176089 if ( stages[0 ].stateBits & GLS_ATEST_BITS ) {
61186090 // alpha test requires a custom depth shader
@@ -6306,6 +6278,7 @@ shader_t *R_FindShader( const char *name, int flags )
63066278 ClearGlobalShader ();
63076279
63086280 Q_strncpyz ( shader.name , strippedName, sizeof ( shader.name ) );
6281+ ASSERT_LT ( strlen ( shader.name ), MAX_QPATH );
63096282 shader.registerFlags = flags;
63106283
63116284 for ( i = 0 ; i < MAX_SHADER_STAGES ; i++ )
@@ -6496,8 +6469,9 @@ qhandle_t RE_RegisterShader( const char *name, int flags )
64966469{
64976470 shader_t *sh;
64986471
6499- if ( ! CheckShaderNameLength ( " RE_RegisterShader " , name, " " ) )
6472+ if ( strlen ( name ) >= MAX_QPATH )
65006473 {
6474+ Log::Warn ( " RE_RegisterShader: name '%s' is too long" , name );
65016475 return 0 ;
65026476 }
65036477
0 commit comments