Permalink
Browse files

SDL: Avoid alpha on Mali/ARM devices using GLES.

See #10534.
  • Loading branch information...
unknownbrackets committed Jun 16, 2018
1 parent 84273ff commit 1b417590514ac4e45f2ac3333e842f3d1ab20ba8
Showing with 14 additions and 3 deletions.
  1. +14 −3 SDL/SDLGLGraphicsContext.cpp
@@ -92,6 +92,11 @@ EGLConfig EGL_FindConfig(int *contextVersion) {
return nullptr;
}
// Mali (ARM) seems to have compositing issues with alpha backbuffers.
// EGL_TRANSPARENT_TYPE doesn't help.
const char *vendorName = eglQueryString(g_eglDisplay, EGL_VENDOR);
const bool avoidAlphaGLES = vendorName && !strcmp(vendorName, "ARM");
EGLConfig best = nullptr;
int bestScore = 0;
int bestContextVersion = 0;
@@ -119,17 +124,23 @@ EGLConfig EGL_FindConfig(int *contextVersion) {
bool renderableGLES2 = (renderable & EGL_OPENGL_ES2_BIT) != 0;
bool renderableGL = (renderable & EGL_OPENGL_BIT) != 0;
#ifdef USING_GLES2
int renderableScore = renderableGLES3 ? 100 : (renderableGLES2 ? 80 : 0);
int renderableScoreGLES = renderableGLES3 ? 100 : (renderableGLES2 ? 80 : 0);
int renderableScoreGL = 0;
#else
int renderableScore = renderableGL ? 100 : (renderableGLES3 ? 80 : 0);
int renderableScoreGLES = 0;
int renderableScoreGL = renderableGL ? 100 : (renderableGLES3 ? 80 : 0);
#endif
if (avoidAlphaGLES && renderableScoreGLES > 0) {
alphaScore = 8 - alphaScore;
}
int score = 0;
// Here's a good place to play with the weights to pick a better config.
score += (colorScore + alphaScore) * 10;
score += depthScore * 5 + stencilScore;
score += levelScore + samplesScore + sampleBufferScore + transparentScore;
score += caveatScore + renderableScore;
score += caveatScore + renderableScoreGLES + renderableScoreGL;
if (score > bestScore) {
bestScore = score;

0 comments on commit 1b41759

Please sign in to comment.