Bug 943925 - Fix the loading of the glDrawBuffers symbol - r=jgilbert, a=blocking-b2g-1.3
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 10 Jan 2014 22:14:17 -0500
changeset 176305 fdf71716eef04e4161e29d9201ebb597fb68b0b3
parent 176304 56bd156c98ebc137c4ac5c35cb41b71ff8ed0a95
child 176306 b61023119a2139127d2a17bb7c4b8996ea64dbf1
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, blocking-b2g-1
bugs943925
milestone28.0
Bug 943925 - Fix the loading of the glDrawBuffers symbol - r=jgilbert, a=blocking-b2g-1.3
gfx/gl/GLContext.cpp
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -488,17 +488,16 @@ GLContext::InitWithPrefix(const char *pr
             SymLoadStruct symbols_desktop[] = {
                 { (PRFuncPtr*) &mSymbols.fClearDepth, { "ClearDepth", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fDepthRange, { "DepthRange", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fReadBuffer, { "ReadBuffer", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fMapBuffer, { "MapBuffer", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fPointParameterf, { "PointParameterf", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", nullptr } },
-                { (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", nullptr } },
                 { nullptr, { nullptr } },
             };
 
             if (!LoadSymbols(&symbols_desktop[0], trygl, prefix)) {
                 NS_ERROR("Desktop symbols failed to load.");
                 mInitialized = false;
             }
         }
@@ -973,16 +972,30 @@ GLContext::InitWithPrefix(const char *pr
             if (!LoadSymbols(queryObjectsSymbols, trygl, prefix)) {
                 NS_ERROR("GL supports query objects iv getter without supplying its function.");
 
                 MarkUnsupported(GLFeature::get_query_object_iv);
                 mSymbols.fGetQueryObjectiv = nullptr;
             }
         }
 
+        if (IsSupported(GLFeature::draw_buffers)) {
+            SymLoadStruct drawBuffersSymbols[] = {
+                { (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", nullptr } },
+                { nullptr, { nullptr } },
+            };
+
+            if (!LoadSymbols(drawBuffersSymbols, trygl, prefix)) {
+                NS_ERROR("GL supports draw_buffers without supplying its functions.");
+
+                MarkUnsupported(GLFeature::draw_buffers);
+                mSymbols.fDrawBuffers = nullptr;
+            }
+        }
+
         if (IsExtensionSupported(KHR_debug)) {
             SymLoadStruct extSymbols[] = {
                 { (PRFuncPtr*) &mSymbols.fDebugMessageControl,  { "DebugMessageControl",  "DebugMessageControlKHR",  nullptr } },
                 { (PRFuncPtr*) &mSymbols.fDebugMessageInsert,   { "DebugMessageInsert",   "DebugMessageInsertKHR",   nullptr } },
                 { (PRFuncPtr*) &mSymbols.fDebugMessageCallback, { "DebugMessageCallback", "DebugMessageCallbackKHR", nullptr } },
                 { (PRFuncPtr*) &mSymbols.fGetDebugMessageLog,   { "GetDebugMessageLog",   "GetDebugMessageLogKHR",   nullptr } },
                 { (PRFuncPtr*) &mSymbols.fGetPointerv,          { "GetPointerv",          "GetPointervKHR",          nullptr } },
                 { (PRFuncPtr*) &mSymbols.fPushDebugGroup,       { "PushDebugGroup",       "PushDebugGroupKHR",       nullptr } },