Bug 1316530 - Normalized int/uint count as fixed, and should be treated like floats in BlitFramebuffer. r=ethlin, a=gchang
authorJeff Gilbert (:jgilbert) <jgilbert@mozilla.com>
Mon, 14 Nov 2016 19:23:50 -0800
changeset 358936 d2a50c565d374e36a219984c44081a528d4e26bd
parent 358935 01b98cd6930cf8a5b6381ba4e0edc6c0f5d149de
child 358937 ea95da0bb7ab5f8f9f9be6ce1920f56aa9dd3bf9
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethlin, gchang
bugs1316530
milestone51.0
Bug 1316530 - Normalized int/uint count as fixed, and should be treated like floats in BlitFramebuffer. r=ethlin, a=gchang MozReview-Commit-ID: FBV0qTDk4pS
dom/canvas/WebGLFramebuffer.cpp
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -1604,20 +1604,32 @@ WebGLFramebuffer::BlitFramebuffer(WebGLC
 
     bool dstSampleBuffers;
     const webgl::FormatInfo* dstDepthFormat;
     const webgl::FormatInfo* dstStencilFormat;
     bool dstHasColor = false;
     bool colorFormatsMatch = true;
     bool colorTypesMatch = true;
 
+    const auto fnNarrowComponentType = [&](const webgl::FormatInfo* format) {
+        switch (format->componentType) {
+        case webgl::ComponentType::NormInt:
+        case webgl::ComponentType::NormUInt:
+            return webgl::ComponentType::Float;
+
+        default:
+            return format->componentType;
+        }
+    };
+
     const auto fnCheckColorFormat = [&](const webgl::FormatInfo* dstFormat) {
         dstHasColor = true;
         colorFormatsMatch &= (dstFormat == srcColorFormat);
-        colorTypesMatch &= (dstFormat->componentType == srcColorFormat->componentType);
+        colorTypesMatch &= ( fnNarrowComponentType(dstFormat) ==
+                             fnNarrowComponentType(srcColorFormat) );
     };
 
     if (dstFB) {
         dstSampleBuffers = dstFB->mResolvedCompleteData->hasSampleBuffers;
 
         dstDepthFormat = fnGetFormat(dstFB->mResolvedCompleteData->depthBuffer);
         dstStencilFormat = fnGetFormat(dstFB->mResolvedCompleteData->stencilBuffer);