Bug 1156629 - OpenGL core context deprecated default VAO. r=jgilbert
authorDan Glastonbury <dan.glastonbury@gmail.com>
Thu, 29 Jan 2015 15:29:43 +1000
changeset 240450 3510be31aea47956ced38133f442166cb80f7765
parent 240449 a72145cb5a3d63af16b81dbca8b4f7dd8ca7253d
child 240451 25f042163963b40936853eb34e586a5aa357c7a3
push id28636
push userkwierso@gmail.com
push dateThu, 23 Apr 2015 00:16:12 +0000
treeherdermozilla-central@a5af73b32ac8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1156629
milestone40.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 1156629 - OpenGL core context deprecated default VAO. r=jgilbert Create a VAO and attach it to the default object.
dom/canvas/WebGLContextValidate.cpp
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -1944,16 +1944,31 @@ WebGLContext::InitAndValidateGL()
     for (int32_t index = 0; index < mGLMaxVertexAttribs; ++index) {
         VertexAttrib4f(index, 0, 0, 0, 1);
     }
 
     mDefaultVertexArray = WebGLVertexArray::Create(this);
     mDefaultVertexArray->mAttribs.SetLength(mGLMaxVertexAttribs);
     mBoundVertexArray = mDefaultVertexArray;
 
+    // OpenGL core profiles remove the default VAO object from version
+    // 4.0.0. We create a default VAO for all core profiles,
+    // regardless of version.
+    //
+    // GL Spec 4.0.0:
+    // (https://www.opengl.org/registry/doc/glspec40.core.20100311.pdf)
+    // in Section E.2.2 "Removed Features", pg 397: "[...] The default
+    // vertex array object (the name zero) is also deprecated. [...]"
+
+    if (gl->IsCoreProfile()) {
+        MakeContextCurrent();
+        mDefaultVertexArray->GenVertexArray();
+        mDefaultVertexArray->BindVertexArray();
+    }
+
     if (mLoseContextOnMemoryPressure)
         mContextObserver->RegisterMemoryPressureEvent();
 
     return true;
 }
 
 bool
 WebGLContext::ValidateFramebufferTarget(GLenum target,