Skip to content

Commit

Permalink
Fix bug in blue-to-alpha - alpha blending could be on when it shouldn…
Browse files Browse the repository at this point in the history
…'t be.

Fixes #15732. (Split/Second environment mapping problem in the menu).
  • Loading branch information
hrydgard committed Jul 27, 2022
1 parent fc70d21 commit a44bee6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Common/Render/Text/draw_text_android.cpp
Expand Up @@ -77,6 +77,12 @@ std::string TextDrawerAndroid::NormalizeString(std::string str) {
}

void TextDrawerAndroid::MeasureString(const char *str, size_t len, float *w, float *h) {
if (!str) {
*w = 0.0;
*h = 0.0;
return;
}

CacheKey key{ std::string(str, len), fontHash_ };
TextMeasureEntry *entry;
auto iter = sizeCache_.find(key);
Expand Down
6 changes: 5 additions & 1 deletion GPU/Common/GPUStateUtils.cpp
Expand Up @@ -1089,26 +1089,30 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowFramebufferRead,

case REPLACE_BLEND_BLUE_TO_ALPHA:
blueToAlpha = true;
blendState.enabled = gstate.isAlphaBlendEnabled();
// We'll later convert the color blend to blend in the alpha channel.
break;

case REPLACE_BLEND_COPY_FBO:
blendState.enabled = true;
blendState.applyFramebufferRead = true;
blendState.resetFramebufferRead = false;
blendState.replaceAlphaWithStencil = replaceAlphaWithStencil;
break;

case REPLACE_BLEND_PRE_SRC:
case REPLACE_BLEND_PRE_SRC_2X_ALPHA:
blendState.enabled = true;
usePreSrc = true;
break;

case REPLACE_BLEND_STANDARD:
case REPLACE_BLEND_2X_ALPHA:
case REPLACE_BLEND_2X_SRC:
blendState.enabled = true;
break;
}

blendState.enabled = true;
blendState.resetFramebufferRead = true;

const GEBlendMode blendFuncEq = gstate.getBlendEq();
Expand Down
1 change: 1 addition & 0 deletions assets/compat.ini
Expand Up @@ -1102,6 +1102,7 @@ NPEH00029 = true
ULUS10455 = true

[BlueToAlpha]
# Split/Second
ULES01402 = true
ULUS10513 = true
ULJM05812 = true
Expand Down

0 comments on commit a44bee6

Please sign in to comment.