-
Notifications
You must be signed in to change notification settings - Fork 66
Naive blending compatibility #1855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1495,6 +1495,21 @@ static bool LoadMap( shaderStage_t *stage, const char *buffer, stageType_t type, | |
| { | ||
| case stageType_t::ST_COLORMAP: | ||
| case stageType_t::ST_DIFFUSEMAP: | ||
| { | ||
| bool linearColorMap = stage->stateBits & GLS_LINEAR_COLORMAP; | ||
| bool linearColor = stage->stateBits & GLS_LINEAR_COLOR; | ||
|
|
||
| if ( !linearColorMap ) | ||
| { | ||
| imageParams.bits |= IF_SRGB; | ||
| } | ||
|
|
||
| if ( !linearColor ) | ||
| { | ||
| stage->convertColorFromSRGB = tr.convertColorFromSRGB; | ||
| } | ||
| } | ||
| break; | ||
| case stageType_t::ST_GLOWMAP: | ||
| case stageType_t::ST_REFLECTIONMAP: | ||
| case stageType_t::ST_SKYBOXMAP: | ||
|
|
@@ -2088,13 +2103,16 @@ static bool ParseStage( shaderStage_t *stage, const char **text ) | |
| const char *token; | ||
| int colorMaskBits = 0; | ||
| int depthMaskBits = GLS_DEPTHMASK_TRUE, blendSrcBits = 0, blendDstBits = 0, atestBits = 0, depthFuncBits = 0, polyModeBits = 0; | ||
| int linearBits = 0; | ||
| bool depthMaskExplicit = false; | ||
| int imageBits = 0; | ||
| filterType_t filterType; | ||
| char buffer[ 1024 ] = ""; | ||
| bool loadMap = false; | ||
| bool loadAnimMap = false; | ||
|
|
||
| stage->convertColorFromSRGB = convertColorFromSRGB_NOP; | ||
|
|
||
| memset( delayedStageTextures, 0, sizeof( delayedStageTextures ) ); | ||
| memset( delayedAnimationTextures, 0, sizeof( delayedAnimationTextures ) ); | ||
|
|
||
|
|
@@ -2641,6 +2659,14 @@ static bool ParseStage( shaderStage_t *stage, const char **text ) | |
| depthMaskBits = 0; | ||
| } | ||
| } | ||
| else if ( !Q_stricmp( token, "linearColorMap" ) ) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dislike the "linear X" naming. It suggests that the input is in a linear color space and so it should be converted to whatever colorspace is used for further operations. But the point is rather that the resulting color is deliberately made different depending on the blend regime by not converting. So I suggest a name that describes it more as disabling color conversion, like Also for the case of the color uniform, maybe we could make it more obvious what the modifier is used for by making it part of the rgbgen syntax. Something like |
||
| { | ||
| linearBits |= GLS_LINEAR_COLORMAP; | ||
| } | ||
| else if ( !Q_stricmp( token, "linearColor" ) ) | ||
| { | ||
| linearBits |= GLS_LINEAR_COLOR; | ||
| } | ||
| // stage <type> | ||
| else if ( !Q_stricmp( token, "stage" ) ) | ||
| { | ||
|
|
@@ -3329,7 +3355,7 @@ static bool ParseStage( shaderStage_t *stage, const char **text ) | |
| } | ||
|
|
||
| // compute state bits | ||
| stage->stateBits = colorMaskBits | depthMaskBits | blendSrcBits | blendDstBits | atestBits | depthFuncBits | polyModeBits; | ||
| stage->stateBits = colorMaskBits | depthMaskBits | blendSrcBits | blendDstBits | atestBits | depthFuncBits | polyModeBits | linearBits; | ||
|
|
||
| // Do not load heatHaze maps when r_heatHaze is disabled. | ||
| if ( stage->type == stageType_t::ST_HEATHAZEMAP && !r_heatHaze->integer ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't belong here since it doesn't affect the OpenGL state while rendering.