Bug 1316530 - Normalized int/uint count as fixed, and should be treated like floats in BlitFramebuffer. - r=ethlin
authorJeff Gilbert (:jgilbert) <jgilbert@mozilla.com>
Mon, 14 Nov 2016 19:23:50 -0800
changeset 440432 510d3ebfd1f62978242899a349348ff774b44844
parent 440431 c7bb0d181c07f106f710dbdd4b498eca8ffa81c5
child 440433 971de933cd5d96b87a320b66e9ff325abfaaed79
push id36216
push userbmo:ato@mozilla.com
push dateThu, 17 Nov 2016 13:57:13 +0000
reviewersethlin
bugs1316530
milestone53.0a1
Bug 1316530 - Normalized int/uint count as fixed, and should be treated like floats in BlitFramebuffer. - r=ethlin 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);