Bug 948406 - Append some zeros to EGL attrib lists to work around a bug in Android/B2G emulator - r=vladv

This commit is contained in:
Benoit Jacob 2013-12-13 15:15:07 -05:00
parent e1ed4ead58
commit 0e72ab2dd3

View File

@ -134,16 +134,26 @@ namespace gl {
static bool
CreateConfig(EGLConfig* aConfig);
// append three zeros at the end of attribs list to work around
// EGL implementation bugs that iterate until they find 0, instead of
// EGL_NONE. See bug 948406.
#define EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS \
LOCAL_EGL_NONE, 0, 0, 0
static EGLint gTerminationAttribs[] = {
EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
};
static EGLint gContextAttribs[] = {
LOCAL_EGL_CONTEXT_CLIENT_VERSION, 2,
LOCAL_EGL_NONE
EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
};
static EGLint gContextAttribsRobustness[] = {
LOCAL_EGL_CONTEXT_CLIENT_VERSION, 2,
//LOCAL_EGL_CONTEXT_ROBUST_ACCESS_EXT, LOCAL_EGL_TRUE,
LOCAL_EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT, LOCAL_EGL_LOSE_CONTEXT_ON_RESET_EXT,
LOCAL_EGL_NONE
EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
};
static int
@ -576,7 +586,9 @@ protected:
pbattrs.AppendElement(bindToTextureFormat);
}
pbattrs.AppendElement(LOCAL_EGL_NONE);
for (size_t i = 0; i < MOZ_ARRAY_LENGTH(gTerminationAttribs); i++) {
pbattrs.AppendElement(gTerminationAttribs[i]);
}
surface = sEGLLibrary.fCreatePbufferSurface(EGL_DISPLAY(), config, &pbattrs[0]);
if (!surface) {
@ -609,7 +621,7 @@ GLContextEGL::ResizeOffscreen(const gfxIntSize& aNewSize)
static const EGLint kEGLConfigAttribsOffscreenPBuffer[] = {
LOCAL_EGL_SURFACE_TYPE, LOCAL_EGL_PBUFFER_BIT,
LOCAL_EGL_RENDERABLE_TYPE, LOCAL_EGL_OPENGL_ES2_BIT,
LOCAL_EGL_NONE
EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
};
static const EGLint kEGLConfigAttribsRGB16[] = {
@ -619,7 +631,7 @@ static const EGLint kEGLConfigAttribsRGB16[] = {
LOCAL_EGL_GREEN_SIZE, 6,
LOCAL_EGL_BLUE_SIZE, 5,
LOCAL_EGL_ALPHA_SIZE, 0,
LOCAL_EGL_NONE
EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
};
static const EGLint kEGLConfigAttribsRGB24[] = {
@ -629,7 +641,7 @@ static const EGLint kEGLConfigAttribsRGB24[] = {
LOCAL_EGL_GREEN_SIZE, 8,
LOCAL_EGL_BLUE_SIZE, 8,
LOCAL_EGL_ALPHA_SIZE, 0,
LOCAL_EGL_NONE
EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
};
static const EGLint kEGLConfigAttribsRGBA32[] = {
@ -642,7 +654,7 @@ static const EGLint kEGLConfigAttribsRGBA32[] = {
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
LOCAL_EGL_FRAMEBUFFER_TARGET_ANDROID, LOCAL_EGL_TRUE,
#endif
LOCAL_EGL_NONE
EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
};
static bool
@ -894,3 +906,4 @@ GLContextProviderEGL::Shutdown()
} /* namespace gl */
} /* namespace mozilla */
#undef EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS