@@ -1488,6 +1488,16 @@ static bool LoadMap( shaderStage_t *stage, const char *buffer, stageType_t type,
14881488 {
14891489 case stageType_t::ST_COLORMAP:
14901490 case stageType_t::ST_DIFFUSEMAP:
1491+ {
1492+ bool naiveBlend = stage->stateBits & GLS_NAIVEBLEND;
1493+
1494+ if ( !naiveBlend )
1495+ {
1496+ imageParams.bits |= IF_SRGB;
1497+ stage->convertColorFromSRGB = tr.convertColorFromSRGB ;
1498+ }
1499+ }
1500+ break ;
14911501 case stageType_t::ST_GLOWMAP:
14921502 case stageType_t::ST_REFLECTIONMAP:
14931503 case stageType_t::ST_SKYBOXMAP:
@@ -2074,12 +2084,15 @@ static bool ParseStage( shaderStage_t *stage, const char **text )
20742084 const char *token;
20752085 int colorMaskBits = 0 ;
20762086 int depthMaskBits = GLS_DEPTHMASK_TRUE, blendSrcBits = 0 , blendDstBits = 0 , atestBits = 0 , depthFuncBits = 0 , polyModeBits = 0 ;
2087+ int naiveBlendBits = 0 ;
20772088 bool depthMaskExplicit = false ;
20782089 int imageBits = 0 ;
20792090 filterType_t filterType;
20802091 char buffer[ 1024 ] = " " ;
20812092 bool loadMap = false ;
20822093
2094+ stage->convertColorFromSRGB = convertColorFromSRGB_NOP;
2095+
20832096 memset ( delayedStageTextures, 0 , sizeof ( delayedStageTextures ) );
20842097
20852098 while ( true )
@@ -2648,6 +2661,10 @@ static bool ParseStage( shaderStage_t *stage, const char **text )
26482661 depthMaskBits = 0 ;
26492662 }
26502663 }
2664+ else if ( !Q_stricmp ( token, " naiveBlend" ) )
2665+ {
2666+ naiveBlendBits |= GLS_NAIVEBLEND;
2667+ }
26512668 // stage <type>
26522669 else if ( !Q_stricmp ( token, " stage" ) )
26532670 {
@@ -3336,7 +3353,7 @@ static bool ParseStage( shaderStage_t *stage, const char **text )
33363353 }
33373354
33383355 // compute state bits
3339- stage->stateBits = colorMaskBits | depthMaskBits | blendSrcBits | blendDstBits | atestBits | depthFuncBits | polyModeBits;
3356+ stage->stateBits = colorMaskBits | depthMaskBits | blendSrcBits | blendDstBits | atestBits | depthFuncBits | polyModeBits | naiveBlendBits ;
33403357
33413358 // Do not load heatHaze maps when r_heatHaze is disabled.
33423359 if ( stage->type == stageType_t::ST_HEATHAZEMAP && !r_heatHaze->integer )
0 commit comments