Bug 44993

Summary: gl-teximage.html and tex-image-and-sub-image-2d-with-image.html failed on Chromium Mac bots (10.5)
Product: WebKit Reporter: Zhenyao Mo <zmo>
Component: WebGLAssignee: Zhenyao Mo <zmo>
Status: RESOLVED FIXED    
Severity: Normal CC: kbr, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on: 44566    
Bug Blocks:    
Attachments:
Description Flags
patch
zmo: commit-queue-
revised patch: re-enabling failing tests kbr: review+, zmo: commit-queue-

Description Zhenyao Mo 2010-08-31 14:50:01 PDT
The tests run fine on my Mac (10.6), but fail on Chromium bots (10.5).  kbr's educated guess is due to image unpack alignment is ignored in the current code.
Comment 1 Zhenyao Mo 2010-08-31 14:52:33 PDT
Created attachment 66114 [details]
patch
Comment 2 Zhenyao Mo 2010-08-31 15:39:35 PDT
*** Bug 44997 has been marked as a duplicate of this bug. ***
Comment 3 Zhenyao Mo 2010-08-31 16:14:23 PDT
Created attachment 66132 [details]
revised patch: re-enabling failing tests

Enabling the failing tests together with the attempted fix.
Comment 4 Kenneth Russell 2010-08-31 17:29:46 PDT
Comment on attachment 66132 [details]
revised patch: re-enabling failing tests

Looks good; one minor stylistic issue.

> Index: WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
> ===================================================================
> --- WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp	(revision 66549)
> +++ WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp	(working copy)
> @@ -140,7 +140,15 @@ bool GraphicsContext3D::getImageData(Ima
>          return false;
>      const UInt8* rgba = CFDataGetBytePtr(pixelData.get());
>      outputVector.resize(width * height * 4);
> -    bool rt = packPixels(rgba, srcDataFormat, width, height, 0,
> +    unsigned int srcUnpackAlignment = 0;
> +    size_t bytesPerRow = CGImageGetBytesPerRow(cgImage);
> +    unsigned int padding = bytesPerRow - componentsPerPixel * width;
> +    if (padding) {
> +        srcUnpackAlignment = padding + 1;
> +        while (bytesPerRow % srcUnpackAlignment)
> +            srcUnpackAlignment++;
> +    }

This is a little subtle but I can't think of a better way to express it. Use preincrement however (++srcUnpackAligment).

> +    bool rt = packPixels(rgba, srcDataFormat, width, height, srcUnpackAlignment,
>                           format, type, neededAlphaOp, outputVector.data());
>      return rt;
>  }
> Index: LayoutTests/ChangeLog
> ===================================================================
> --- LayoutTests/ChangeLog	(revision 66549)
> +++ LayoutTests/ChangeLog	(working copy)
> @@ -1,3 +1,12 @@
> +2010-08-31  Zhenyao Mo  <zmo@google.com>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        gl-teximage.html and tex-image-and-sub-image-2d-with-image.html failed on Chromium Mac bots (10.5)
> +        https://bugs.webkit.org/show_bug.cgi?id=44993
> +
> +        * platform/chromium/test_expectations.txt: Enabling the failing tests with the fix.
> +
>  2010-08-31  Sam Weinig  <sam@webkit.org>
>  
>          Reviewed by Gavin Barraclough.
> Index: LayoutTests/platform/chromium/test_expectations.txt
> ===================================================================
> --- LayoutTests/platform/chromium/test_expectations.txt	(revision 66549)
> +++ LayoutTests/platform/chromium/test_expectations.txt	(working copy)
> @@ -3165,7 +3165,3 @@ BUGWK44967 MAC : fast/multicol/paginate-
>  // New tests in r66523 and r66516
>  BUGWK44996 WIN : inspector/report-API-errors.html = TEXT
>  BUGWK44996 WIN : inspector/report-protocol-errors.html = TEXT
> -
> -// Failing after r44997
> -BUGWK44997 MAC : fast/canvas/webgl/gl-teximage.html = TEXT
> -BUGWK44997 MAC : fast/canvas/webgl/tex-image-and-sub-image-2d-with-image.html = TEXT
Comment 5 Zhenyao Mo 2010-08-31 17:34:55 PDT
Committed r66559: <http://trac.webkit.org/changeset/66559>