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 352607 7a0a906b9680cd0717436c74d5ed3d33e68745d0
parent 352606 ffba3e01b09120519e3f4b9011d9e8f9456c4024
child 352608 ef9b2a0ba51b16e65d42728d8aacd265b926bb9f
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethlin, gchang
bugs1316530
milestone52.0a2
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);