Bug 1048747 - [WebGL2] Query active uniform blocks. r=jgilbert draft
authorDan Glastonbury <dglastonbury@mozilla.com>
Mon, 27 Oct 2014 09:43:34 +1000
changeset 226498 af5c42a9c162833708d18bb014d9068518f48abf
parent 226497 5558df4026930dc5b2b1853a8fe3f9757e8f2265
child 226499 7e6ec35d02cd9e0e4cbc4c3ba665849a95563642
push id53
push userdglastonbury@mozilla.com
push dateWed, 12 Nov 2014 02:04:58 +0000
reviewersjgilbert
bugs1048747
milestone36.0a1
Bug 1048747 - [WebGL2] Query active uniform blocks. r=jgilbert
dom/canvas/WebGLContextGL.cpp
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -1434,46 +1434,51 @@ WebGLContext::GetProgramParameter(WebGLP
 
     if (!ValidateObjectAllowDeleted("getProgramParameter: program", prog))
         return JS::NullValue();
 
     GLuint progname = prog->GLName();
 
     MakeContextCurrent();
 
+    GLint i = 0;
+
+    if (IsWebGL2()) {
+        switch (pname) {
+        case LOCAL_GL_ACTIVE_UNIFORM_BLOCKS:
+        case LOCAL_GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+            gl->fGetProgramiv(progname, pname, &i);
+            return JS::Int32Value(i);
+        }
+    }
+
     switch (pname) {
         case LOCAL_GL_ATTACHED_SHADERS:
         case LOCAL_GL_ACTIVE_UNIFORMS:
         case LOCAL_GL_ACTIVE_ATTRIBUTES:
-        {
-            GLint i = 0;
             gl->fGetProgramiv(progname, pname, &i);
             return JS::Int32Value(i);
-        }
+
         case LOCAL_GL_DELETE_STATUS:
             return JS::BooleanValue(prog->IsDeleteRequested());
+
         case LOCAL_GL_LINK_STATUS:
-        {
             return JS::BooleanValue(prog->LinkStatus());
-        }
+
         case LOCAL_GL_VALIDATE_STATUS:
-        {
-            GLint i = 0;
 #ifdef XP_MACOSX
             // See comment in ValidateProgram below.
             if (gl->WorkAroundDriverBugs())
                 i = 1;
             else
                 gl->fGetProgramiv(progname, pname, &i);
 #else
             gl->fGetProgramiv(progname, pname, &i);
 #endif
             return JS::BooleanValue(bool(i));
-        }
-            break;
 
         default:
             ErrorInvalidEnumInfo("getProgramParameter: parameter", pname);
     }
 
     return JS::NullValue();
 }