Bug 1521994 - ReadPixels with half-float ext should support FLOAT. r=lsalzman
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 31 Jan 2019 19:18:09 +0000
changeset 456293 700b209169befddde4244057a43716f966443602
parent 456292 65759b936b5d7ca4fb3a93bfdfd69f96b4020865
child 456294 68201fa65ff86b0fff87f64e7457f18ba68c5d5c
push id35478
push usershindli@mozilla.com
push dateFri, 01 Feb 2019 03:55:46 +0000
treeherdermozilla-central@945770882765 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1521994
milestone67.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 1521994 - ReadPixels with half-float ext should support FLOAT. r=lsalzman MozReview-Commit-ID: ZjVnkJLJrl Differential Revision: https://phabricator.services.mozilla.com/D17307
dom/canvas/WebGLContextGL.cpp
dom/canvas/test/webgl-conf/checkout/conformance/reading/read-pixels-test.html
dom/canvas/test/webgl-conf/generated-mochitest.ini
dom/canvas/test/webgl-conf/mochitest-errata.ini
--- a/dom/canvas/WebGLContextGL.cpp
+++ b/dom/canvas/WebGLContextGL.cpp
@@ -1343,36 +1343,34 @@ static webgl::PackingInfo DefaultReadPix
   }
 }
 
 static bool ArePossiblePackEnums(const WebGLContext* webgl,
                                  const webgl::PackingInfo& pi) {
   // OpenGL ES 2.0 $4.3.1 - IMPLEMENTATION_COLOR_READ_{TYPE/FORMAT} is a valid
   // combination for glReadPixels()...
 
-  // So yeah, we are actually checking that these are valid as /unpack/ formats,
-  // instead of /pack/ formats here, but it should cover the INVALID_ENUM cases.
-  if (!webgl->mFormatUsage->AreUnpackEnumsValid(pi.format, pi.type))
-    return false;
-
   // Only valid when pulled from:
   // * GLES 2.0.25 p105:
   //   "table 3.4, excluding formats LUMINANCE and LUMINANCE_ALPHA."
   // * GLES 3.0.4 p193:
   //   "table 3.2, excluding formats DEPTH_COMPONENT and DEPTH_STENCIL."
   switch (pi.format) {
     case LOCAL_GL_LUMINANCE:
     case LOCAL_GL_LUMINANCE_ALPHA:
     case LOCAL_GL_DEPTH_COMPONENT:
     case LOCAL_GL_DEPTH_STENCIL:
       return false;
   }
 
   if (pi.type == LOCAL_GL_UNSIGNED_INT_24_8) return false;
 
+  uint8_t bytes;
+  if (!GetBytesPerPixel(pi, &bytes)) return false;
+
   return true;
 }
 
 webgl::PackingInfo WebGLContext::ValidImplementationColorReadPI(
     const webgl::FormatUsageInfo* usage) const {
   const auto defaultPI = DefaultReadPixelPI(usage);
 
   // ES2_compatibility always returns RGBA/UNSIGNED_BYTE, so branch on actual
--- a/dom/canvas/test/webgl-conf/checkout/conformance/reading/read-pixels-test.html
+++ b/dom/canvas/test/webgl-conf/checkout/conformance/reading/read-pixels-test.html
@@ -164,25 +164,25 @@ function continueTestPart2() {
   }
 
   debug("");
   debug("check invalid format or type");
   for (var ff = 0; ff < invalidFormat.length; ++ff) {
     var format = invalidFormat[ff];
     var buf = new Uint8Array(4);
     gl.readPixels(0, 0, 1, 1, format, gl.UNSIGNED_BYTE, buf);
-    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "Should not be able to read as " + wtu.glEnumToString(gl, format));
+    wtu.glErrorShouldBe(gl, [gl.INVALID_ENUM, gl.INVALID_OPERATION], "Should not be able to read as " + wtu.glEnumToString(gl, format));
   }
 
   for (var tt = 0; tt < invalidTypeInfo.length; ++tt) {
     var info = invalidTypeInfo[tt];
     var type = info.type;
     var dest = info.dest;
     gl.readPixels(0, 0, 1, 1, gl.RGBA, type, dest);
-    wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "Should not be able to read as " + wtu.glEnumToString(gl, type));
+    wtu.glErrorShouldBe(gl, [gl.INVALID_ENUM, gl.INVALID_OPERATION], "Should not be able to read as " + wtu.glEnumToString(gl, type));
   }
 
   var combinations = [
     {
       format: gl.RGBA,
       type: gl.UNSIGNED_BYTE,
       dest: new Uint8Array(4),
     },
--- a/dom/canvas/test/webgl-conf/generated-mochitest.ini
+++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini
@@ -10982,17 +10982,16 @@ fail-if = (os == 'android')
 skip-if = (os == 'win' && os_version == '6.1')
 [generated/test_conformance__extensions__oes-texture-half-float-with-image.html]
 subsuite = webgl1-core
 fail-if = (os == 'android')
 [generated/test_conformance__extensions__oes-texture-half-float-with-video.html]
 subsuite = webgl1-core
 [generated/test_conformance__extensions__oes-texture-half-float.html]
 subsuite = webgl1-core
-fail-if = (os == 'mac') || (os == 'win') || (os == 'android') || (os == 'linux')
 [generated/test_conformance__extensions__oes-vertex-array-object-bufferData.html]
 subsuite = webgl1-core
 [generated/test_conformance__extensions__oes-vertex-array-object.html]
 subsuite = webgl1-core
 [generated/test_conformance__extensions__webgl-compressed-texture-astc.html]
 subsuite = webgl1-core
 [generated/test_conformance__extensions__webgl-compressed-texture-etc.html]
 subsuite = webgl1-core
--- a/dom/canvas/test/webgl-conf/mochitest-errata.ini
+++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini
@@ -17,17 +17,17 @@
 #   https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832%28v=vs.85%29.aspx
 #   * Windows 7: 6.1
 #   * Windows 8: 6.2
 #   * Windows 8.1: 6.3
 #   * Windows 10: 10.0
 
 [DEFAULT]
 # Cross-process WebGL doesn't seem to work under an emulator
-skip-if = toolkit == 'android' && e10s && is_emulator
+skip-if = toolkit == 'android' && e10s && isEmulator
 
 [generated/test_..__always-fail.html]
 fail-if = 1
 
 ####################
 # Tests requesting non-local network connections.
 
 [generated/test_conformance__more__functions__readPixelsBadArgs.html]
@@ -210,18 +210,16 @@ skip-if = (os == 'android') || (os == 'l
 fail-if = (os == 'android')
 # void mozilla::gl::GLContext::fDetachShader(GLuint, GLuint): Generated unexpected GL_INVALID_VALUE error. (0x0501)
 skip-if = (os == 'android' && debug)
 
 [generated/test_conformance__textures__misc__texture-size.html]
 # application crashed [@ mozilla::gl::GLContext::AfterGLCall]
 skip-if = (os == 'android') || (os == 'win')
 
-[generated/test_conformance__extensions__oes-texture-half-float.html]
-fail-if = (os == 'mac') || (os == 'win') || (os == 'android') || (os == 'linux')
 [generated/test_conformance__attribs__gl-vertexattribpointer.html]
 fail-if = (os == 'android')
 [generated/test_conformance__ogles__GL__biuDepthRange__biuDepthRange_001_to_002.html]
 fail-if = (os == 'android')
 [generated/test_conformance__ogles__GL__gl_FragCoord__gl_FragCoord_001_to_003.html]
 fail-if = (os == 'android')
 
 [generated/test_conformance__textures__misc__texture-size-limit.html]