Bug 1219890. Construct context arguments on the stack. r=jgilbert
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Thu, 26 Nov 2015 17:57:30 -0500
changeset 309410 232826e2ee72cfaf2bb192d44c3ef04d7a57f8a7
parent 309409 cb6196bdba35102ff645918e1139199a4def84c2
child 309411 811dce914c462a9a5e1b42ef2efa877bc9bd1e42
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1219890
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1219890. Construct context arguments on the stack. r=jgilbert We do this so that we can change some of the for es3
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -128,28 +128,16 @@ CreateConfig(EGLConfig* aConfig, nsIWidg
 // 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,
-    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,
-    EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
-};
-
 static int
 next_power_of_two(int v)
 {
     v--;
     v |= v >> 1;
     v |= v >> 2;
     v |= v >> 4;
     v |= v >> 8;
@@ -505,29 +493,41 @@ GLContextEGL::CreateGLContext(const Surf
 {
     if (sEGLLibrary.fBindAPI(LOCAL_EGL_OPENGL_ES_API) == LOCAL_EGL_FALSE) {
         NS_WARNING("Failed to bind API to GLES!");
         return nullptr;
     }
 
     EGLContext eglShareContext = shareContext ? shareContext->mContext
                                               : EGL_NO_CONTEXT;
-    EGLint* attribs = sEGLLibrary.HasRobustness() ? gContextAttribsRobustness
-                                                  : gContextAttribs;
+
+    nsTArray<EGLint> contextAttribs;
+
+    contextAttribs.AppendElement(LOCAL_EGL_CONTEXT_CLIENT_VERSION);
+    contextAttribs.AppendElement(2);
+
+    if (sEGLLibrary.HasRobustness()) {
+//    contextAttribs.AppendElement(LOCAL_EGL_CONTEXT_ROBUST_ACCESS_EXT);
+//    contextAttribs.AppendElement(LOCAL_EGL_TRUE);
+    }
+
+    for (size_t i = 0; i < MOZ_ARRAY_LENGTH(gTerminationAttribs); i++) {
+      contextAttribs.AppendElement(gTerminationAttribs[i]);
+    }
 
     EGLContext context = sEGLLibrary.fCreateContext(EGL_DISPLAY(),
                                                     config,
                                                     eglShareContext,
-                                                    attribs);
+                                                    contextAttribs.Elements());
     if (!context && shareContext) {
         shareContext = nullptr;
         context = sEGLLibrary.fCreateContext(EGL_DISPLAY(),
                                               config,
                                               EGL_NO_CONTEXT,
-                                              attribs);
+                                              contextAttribs.Elements());
     }
     if (!context) {
         NS_WARNING("Failed to create EGLContext!");
         return nullptr;
     }
 
     RefPtr<GLContextEGL> glContext = new GLContextEGL(caps,
                                                         shareContext,