File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -2009,6 +2009,7 @@ static bool ParseStage( shaderStage_t *stage, const char **text )
20092009 filterType_t filterType;
20102010 char buffer[ 1024 ] = " " ;
20112011 bool loadMap = false ;
2012+ bool blendRegimeMatch = true ;
20122013
20132014 while ( true )
20142015 {
@@ -2844,6 +2845,23 @@ static bool ParseStage( shaderStage_t *stage, const char **text )
28442845 continue ;
28452846 }
28462847 }
2848+ // disable the stage if the renderer's blending mode does not match the specified mode
2849+ else if ( !Q_stricmp ( token, " ifBlendRegime" ) )
2850+ {
2851+ token = COM_ParseExt2 ( text, false );
2852+ if ( !Q_stricmp ( token, " naive" ) )
2853+ {
2854+ blendRegimeMatch = !tr.worldLinearizeTexture ;
2855+ }
2856+ else if ( !Q_stricmp ( token, " linear" ) )
2857+ {
2858+ blendRegimeMatch = tr.worldLinearizeTexture ;
2859+ }
2860+ else
2861+ {
2862+ Log::Warn ( " unknown parameter'%s' for ifBlendRegime in shader '%s'" , token, shader.name );
2863+ }
2864+ }
28472865 // alpha <arithmetic expression>
28482866 else if ( !Q_stricmp ( token, " alpha" ) )
28492867 {
@@ -3222,6 +3240,11 @@ static bool ParseStage( shaderStage_t *stage, const char **text )
32223240 }
32233241 }
32243242
3243+ if ( !blendRegimeMatch )
3244+ {
3245+ return true ; // parsing succeeded, but not active
3246+ }
3247+
32253248 // parsing succeeded
32263249 stage->active = true ;
32273250
You can’t perform that action at this time.
0 commit comments