Add more spew and try to fix implicit color-buffer-half-float. draft
authorJeff Gilbert <jdashg@gmail.com>
Thu, 17 Dec 2015 16:16:54 -0800
changeset 316107 455e26f5ba6c6ab4a909e335996f9745b6554e7c
parent 316106 d56b16dd46e2198c26eb76c9b567497634e97db7
child 316108 9eb24b1e2cde26f49cdd309ad445a5cc5b8085e7
push id8514
push userjgilbert@mozilla.com
push dateFri, 18 Dec 2015 00:24:33 +0000
milestone45.0a1
Add more spew and try to fix implicit color-buffer-half-float.
dom/canvas/WebGLExtensionTextureHalfFloat.cpp
dom/canvas/WebGLTextureUpload.cpp
gfx/gl/GLContext.cpp
gfx/gl/GLContextFeatures.cpp
--- a/dom/canvas/WebGLExtensionTextureHalfFloat.cpp
+++ b/dom/canvas/WebGLExtensionTextureHalfFloat.cpp
@@ -37,27 +37,27 @@ WebGLExtensionTextureHalfFloat::WebGLExt
     if (!gl->IsSupported(gl::GLFeature::texture_half_float)) {
         MOZ_ASSERT(gl->IsExtensionSupported(gl::GLContext::OES_texture_half_float));
         driverUnpackType = LOCAL_GL_HALF_FLOAT_OES;
     }
 
     ////////////////
 
     pi = {LOCAL_GL_RGBA, LOCAL_GL_HALF_FLOAT_OES};
-    dui = {pi.format, pi.format, pi.type};
+    dui = {pi.format, pi.format, driverUnpackType};
     swizzle = nullptr;
     if (needSizedInternal) {
         dui.internalFormat = LOCAL_GL_RGBA16F;
     }
     fnAdd(webgl::EffectiveFormat::RGBA16F);
 
     //////
 
     pi = {LOCAL_GL_RGB, LOCAL_GL_HALF_FLOAT_OES};
-    dui = {pi.format, pi.format, pi.type};
+    dui = {pi.format, pi.format, driverUnpackType};
     swizzle = nullptr;
     if (needSizedInternal) {
         dui.internalFormat = LOCAL_GL_RGB16F;
     }
     fnAdd(webgl::EffectiveFormat::RGB16F);
 
     //////
 
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -1157,16 +1157,18 @@ WebGLTexture::TexImage(const char* funcN
         mContext->ErrorOutOfMemory("%s: Driver ran out of memory during upload.",
                                    funcName);
         return;
     }
 
     if (glError) {
         mContext->ErrorInvalidOperation("%s: Unexpected error during upload: 0x%04x",
                                         funcName, glError);
+        printf_stderr("%s: dui: %x/%x/%x\n", funcName, driverUnpackInfo->internalFormat,
+                      driverUnpackInfo->unpackFormat, driverUnpackInfo->unpackType);
         MOZ_ASSERT(false, "Unexpected GL error.");
         return;
     }
 
     ////////////////////////////////////
     // Update our specification data.
 
     const ImageInfo newImageInfo(dstUsage, blob->mWidth, blob->mHeight, blob->mDepth,
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -2578,17 +2578,17 @@ GLContext::FlushIfHeavyGLCallsSinceLastF
     }
     MakeCurrent();
     fFlush();
 }
 
 /*static*/ bool
 GLContext::ShouldDumpExts()
 {
-    return gfxEnv::GlDumpExtensions();
+    return true; //gfxEnv::GlDumpExtensions();
 }
 
 bool
 DoesStringMatch(const char* aString, const char *aWantedString)
 {
     if (!aString || !aWantedString)
         return false;
 
--- a/gfx/gl/GLContextFeatures.cpp
+++ b/gfx/gl/GLContextFeatures.cpp
@@ -831,16 +831,25 @@ GLContext::InitFeatures()
 
             if (IsExtensionSupported(featureInfo.mExtensions[j])) {
                 mAvailableFeatures[featureId] = true;
                 break;
             }
         }
     }
 
+    if (ShouldDumpExts()) {
+        for (size_t featureId = 0; featureId < size_t(GLFeature::EnumMax); featureId++) {
+            GLFeature feature = GLFeature(featureId);
+            printf_stderr("[%s] Feature::%s\n",
+                          IsSupported(feature) ? "enabled" : "disabled",
+                          GetFeatureName(feature));
+        }
+    }
+
     if (WorkAroundDriverBugs()) {
 #ifdef XP_MACOSX
         // MacOSX 10.6 reports to support EXT_framebuffer_sRGB and EXT_texture_sRGB but
         // fails to convert from sRGB to linear when reading from an sRGB texture attached
         // to an FBO. (bug 843668)
         if (!nsCocoaFeatures::OnLionOrLater())
             MarkUnsupported(GLFeature::sRGB_framebuffer);
 #endif // XP_MACOSX