Bug 1170855 - Part 4: Pour in the WebGL 2 pnames. r=jgilbert
☠☠ backed out by 862dd46b819f ☠ ☠
authorDan Glastonbury <dglastonbury@mozilla.com>
Fri, 05 Jun 2015 16:42:49 +1000
changeset 248211 4ee1883ffc6506ac415757c496b9b9a04d9e5d32
parent 248210 c666d71f48999437e2c3a71a946fdb3862070b5e
child 248212 835570bc63bf6f0c4a0488746a5cb699d05edb45
push id28893
push userkwierso@gmail.com
push dateFri, 12 Jun 2015 00:02:58 +0000
treeherderautoland@8cf9d3e497f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1170855
milestone41.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 1170855 - Part 4: Pour in the WebGL 2 pnames. r=jgilbert
dom/canvas/WebGL2ContextState.cpp
--- a/dom/canvas/WebGL2ContextState.cpp
+++ b/dom/canvas/WebGL2ContextState.cpp
@@ -7,57 +7,136 @@
 #include "WebGL2Context.h"
 #include "WebGLContextUtils.h"
 
 namespace mozilla {
 
 JS::Value
 WebGL2Context::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
 {
+  // The following cases are handled in WebGLContext::GetParameter():
+  //     case LOCAL_GL_MAX_COLOR_ATTACHMENTS:
+  //     case LOCAL_GL_MAX_DRAW_BUFFERS:
+  //     case LOCAL_GL_DRAW_BUFFERi:
+
   if (IsContextLost())
     return JS::NullValue();
 
   MakeContextCurrent();
 
   switch (pname) {
+    /* GLboolean */
+    case LOCAL_GL_RASTERIZER_DISCARD:
+    case LOCAL_GL_SAMPLE_ALPHA_TO_COVERAGE:
+    case LOCAL_GL_SAMPLE_COVERAGE:
+    case LOCAL_GL_TRANSFORM_FEEDBACK_PAUSED:
+    case LOCAL_GL_TRANSFORM_FEEDBACK_ACTIVE:
+    case LOCAL_GL_UNPACK_SKIP_IMAGES:
+    case LOCAL_GL_UNPACK_SKIP_PIXELS:
+    case LOCAL_GL_UNPACK_SKIP_ROWS: {
+      realGLboolean b = 0;
+      gl->fGetBooleanv(pname, &b);
+      return JS::BooleanValue(bool(b));
+    }
+
+    /* GLenum */
+    case LOCAL_GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
+    case LOCAL_GL_READ_BUFFER:
+      /* fall through */
+
+    /* GLint */
+    case LOCAL_GL_MAX_3D_TEXTURE_SIZE:
+    case LOCAL_GL_MAX_ARRAY_TEXTURE_LAYERS:
+    case LOCAL_GL_MAX_COMBINED_UNIFORM_BLOCKS:
+    case LOCAL_GL_MAX_ELEMENTS_INDICES:
+    case LOCAL_GL_MAX_ELEMENTS_VERTICES:
+    case LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS:
+    case LOCAL_GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
+    case LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+    case LOCAL_GL_MAX_PROGRAM_TEXEL_OFFSET:
     case LOCAL_GL_MAX_SAMPLES:
-    case LOCAL_GL_MAX_UNIFORM_BLOCK_SIZE:
-    case LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS: {
+    case LOCAL_GL_MAX_TEXTURE_LOD_BIAS:
+    case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+    case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+    case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+    case LOCAL_GL_MAX_UNIFORM_BUFFER_BINDINGS:
+    case LOCAL_GL_MAX_VARYING_COMPONENTS:
+    case LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS:
+    case LOCAL_GL_MAX_VERTEX_UNIFORM_BLOCKS:
+    case LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS:
+    case LOCAL_GL_MIN_PROGRAM_TEXEL_OFFSET:
+    case LOCAL_GL_PACK_ROW_LENGTH:
+    case LOCAL_GL_PACK_SKIP_PIXELS:
+    case LOCAL_GL_PACK_SKIP_ROWS:
+    case LOCAL_GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
+    case LOCAL_GL_UNPACK_IMAGE_HEIGHT:
+    case LOCAL_GL_UNPACK_ROW_LENGTH: {
       GLint val;
       gl->fGetIntegerv(pname, &val);
-      return JS::NumberValue(uint32_t(val));
+      return JS::Int32Value(val);
     }
 
-    case LOCAL_GL_TEXTURE_BINDING_3D:
-      return WebGLObjectAsJSValue(cx, mBound3DTextures[mActiveTexture].get(), rv);
+    /* GLint64 */
+    //case LOCAL_GL_MAX_CLIENT_WAIT_TIMEOUT_WEBGL:
+    case LOCAL_GL_MAX_ELEMENT_INDEX:
+    case LOCAL_GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+    case LOCAL_GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+    case LOCAL_GL_MAX_SERVER_WAIT_TIMEOUT:
+    case LOCAL_GL_MAX_UNIFORM_BLOCK_SIZE: {
+      GLint64 val;
+      gl->fGetInteger64v(pname, &val);
+      return JS::DoubleValue(static_cast<double>(val));
+    }
 
-      // DRAW_FRAMEBUFFER_BINDING is the same as FRAMEBUFFER_BINDING.
-    case LOCAL_GL_READ_FRAMEBUFFER_BINDING:
-      return WebGLObjectAsJSValue(cx, mBoundReadFramebuffer.get(), rv);
+    case LOCAL_GL_COPY_READ_BUFFER_BINDING:
+      return WebGLObjectAsJSValue(cx, mBoundCopyReadBuffer.get(), rv);
+
+    case LOCAL_GL_COPY_WRITE_BUFFER_BINDING:
+      return WebGLObjectAsJSValue(cx, mBoundCopyWriteBuffer.get(), rv);
 
     case LOCAL_GL_PIXEL_PACK_BUFFER_BINDING:
       return WebGLObjectAsJSValue(cx, mBoundPixelPackBuffer.get(), rv);
 
     case LOCAL_GL_PIXEL_UNPACK_BUFFER_BINDING:
       return WebGLObjectAsJSValue(cx, mBoundPixelUnpackBuffer.get(), rv);
 
-    case LOCAL_GL_UNIFORM_BUFFER_BINDING:
-      return WebGLObjectAsJSValue(cx, mBoundUniformBuffer.get(), rv);
-
     case LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
       return WebGLObjectAsJSValue(cx, mBoundTransformFeedbackBuffer.get(), rv);
 
-    case LOCAL_GL_COPY_READ_BUFFER_BINDING:
-      return WebGLObjectAsJSValue(cx, mBoundCopyReadBuffer.get(), rv);
+    case LOCAL_GL_UNIFORM_BUFFER_BINDING:
+      return WebGLObjectAsJSValue(cx, mBoundUniformBuffer.get(), rv);
+
+    // DRAW_FRAMEBUFFER_BINDING is the same as FRAMEBUFFER_BINDING.
+    case LOCAL_GL_READ_FRAMEBUFFER_BINDING:
+      return WebGLObjectAsJSValue(cx, mBoundReadFramebuffer.get(), rv);
+
+    case LOCAL_GL_SAMPLER_BINDING:
+      // TODO: Implement bound sampler tracking
+      //return WebGLObjectAsJSValue(cx, mBoundSamplers[mActiveTexture].get(), rv);
+      return JS::NullValue();
 
-    case LOCAL_GL_COPY_WRITE_BUFFER_BINDING:
-      return WebGLObjectAsJSValue(cx, mBoundCopyWriteBuffer.get(), rv);
+    case LOCAL_GL_TEXTURE_BINDING_2D_ARRAY:
+      // TODO: Implement gl.TEXTURE_2D_ARRAY
+      // return WebGLObjectAsJSValue(cx, mBound2DTextureArrays[mActiveTexture].get(), rv);
+      return JS::NullValue();
+
+    case LOCAL_GL_TEXTURE_BINDING_3D:
+      return WebGLObjectAsJSValue(cx, mBound3DTextures[mActiveTexture].get(), rv);
 
-    case LOCAL_GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
-      return JS::Int32Value(mGLMaxTransformFeedbackSeparateAttribs);
+    case LOCAL_GL_TRANSFORM_FEEDBACK_BINDING: {
+      WebGLTransformFeedback* tf =
+        (mBoundTransformFeedback != mDefaultTransformFeedback) ? mBoundTransformFeedback.get() : nullptr;
+      return WebGLObjectAsJSValue(cx, tf, rv);
+    }
+
+    case LOCAL_GL_VERTEX_ARRAY_BINDING: {
+      WebGLVertexArray* vao =
+        (mBoundVertexArray != mDefaultVertexArray) ? mBoundVertexArray.get() : nullptr;
+      return WebGLObjectAsJSValue(cx, vao, rv);
+    }
 
     case LOCAL_GL_VERSION:
       return StringValue(cx, "WebGL 2.0", rv);
 
     case LOCAL_GL_SHADING_LANGUAGE_VERSION:
       return StringValue(cx, "WebGL GLSL ES 3.00", rv);
 
     default: