OSDN Git Service

GLSurfaceView: Be less picky about EGLConfig alpha sizes
authorAndy Ross <andy.ross@windriver.com>
Tue, 15 Jan 2013 23:05:38 +0000 (15:05 -0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 22 Dec 2015 04:13:50 +0000 (12:13 +0800)
EGLChooseConfig returns a "best match" set of visuals meeting or
exceeding the required r/g/b/a component depths.  But GLSurfaceView
oddly requires that the returned visual be an exact match.  Add to
that that the (rarely used outside of CTS) default request specifies
zero alpha bits and that not all drivers expose a zero-alpha
EGLConfig, and the default configuration will fail needlessly.

It's not incorrect to have alpha bits you didn't request: the only way
to produce divergent behavior is for a fragment shader to write out
explicit alpha values (into the channel it didn't want to begin with!)
with values other than 1.0 and then rely on them being ignored and
treated as 1.0.

For: AXIA-1448
Change-Id: I2f64995d7b9de1ae082aa47822af525390102083
Signed-off-by: Andy Ross <andy.ross@windriver.com>
opengl/java/android/opengl/GLSurfaceView.java

index 3c76115..fde60ea 100644 (file)
@@ -939,7 +939,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
                     int a = findConfigAttrib(egl, display, config,
                             EGL10.EGL_ALPHA_SIZE, 0);
                     if ((r == mRedSize) && (g == mGreenSize)
-                            && (b == mBlueSize) && (a == mAlphaSize)) {
+                            && (b == mBlueSize) && (a >= mAlphaSize)) {
                         return config;
                     }
                 }