Bug 91976 - [WebGL] Initial size of canvas can be larger than MAX_VIEWPORT_DIMS.
Summary: [WebGL] Initial size of canvas can be larger than MAX_VIEWPORT_DIMS.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nayan Kumar K
URL:
Keywords:
Depends on:
Blocks: 92375
  Show dependency treegraph
 
Reported: 2012-07-23 03:29 PDT by Nayan Kumar K
Modified: 2012-07-26 22:06 PDT (History)
4 users (show)

See Also:


Attachments
Patch (10.08 KB, patch)
2012-07-23 03:45 PDT, Nayan Kumar K
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from gce-cr-linux-06 (299.49 KB, application/zip)
2012-07-23 07:24 PDT, WebKit Review Bot
no flags Details
Patch (9.97 KB, patch)
2012-07-24 07:57 PDT, Nayan Kumar K
no flags Details | Formatted Diff | Diff
Reworked patch (10.64 KB, patch)
2012-07-24 23:28 PDT, Nayan Kumar K
no flags Details | Formatted Diff | Diff
Reworked patch (10.69 KB, patch)
2012-07-25 22:44 PDT, Nayan Kumar K
no flags Details | Formatted Diff | Diff
Reworked patch (10.69 KB, patch)
2012-07-26 22:03 PDT, Nayan Kumar K
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nayan Kumar K 2012-07-23 03:29:04 PDT
Following WebGL conformance test is failing with the current version of WebKit,

https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/canvas/drawingbuffer-test.html

This test got added in r18179 revision of WebGL conformance test suite.

From section 2.2 of the spec the WebGL implementation says initial size of the canvas can be larger than MAX_VIEWPORT_DIMS.
Comment 1 Nayan Kumar K 2012-07-23 03:45:04 PDT
Created attachment 153767 [details]
Patch
Comment 2 WebKit Review Bot 2012-07-23 07:24:46 PDT
Comment on attachment 153767 [details]
Patch

Attachment 153767 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13318921

New failing tests:
platform/chromium/virtual/gpu/fast/canvas/webgl/drawingbuffer-test.html
fast/canvas/webgl/drawingbuffer-test.html
Comment 3 WebKit Review Bot 2012-07-23 07:24:49 PDT
Created attachment 153794 [details]
Archive of layout-test-results from gce-cr-linux-06

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-06  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 4 Nayan Kumar K 2012-07-24 07:57:17 PDT
Created attachment 154061 [details]
Patch
Comment 5 Kenneth Russell 2012-07-24 11:30:27 PDT
Comment on attachment 154061 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=154061&action=review

Thanks for the patch! It looks great except for the same logic being duplicated three times. Please refactor that and submit a new patch, and I'll gladly r+ it.

> Source/WebCore/html/canvas/WebGLRenderingContext.cpp:451
> +    m_drawingBuffer = DrawingBuffer::create(m_context.get(), IntSize(clamp(canvas()->width(), 1, m_maxViewportDims[0]), clamp(canvas()->height(), 1, m_maxViewportDims[1])), preserve, alpha);

Could you please add a private helper method "IntSize clampedCanvasSize()" which returns the canvas' width and height clamped to m_maxViewportDims? Then you can call it here, in initializeNewContext and markContextChanged.
Comment 6 Nayan Kumar K 2012-07-24 23:28:30 PDT
Created attachment 154265 [details]
Reworked patch
Comment 7 Kenneth Russell 2012-07-25 14:52:18 PDT
Comment on attachment 154265 [details]
Reworked patch

View in context: https://bugs.webkit.org/attachment.cgi?id=154265&action=review

Thanks, looks better. r=me. One comment. Mark cq? if you want this committed as is.

> Source/WebCore/html/canvas/WebGLRenderingContext.cpp:523
> +        m_drawingBuffer->reset(clampedCanvasSize());

How about a local variable instead of calling clampedCanvasSize() five times?

> LayoutTests/fast/canvas/webgl/drawingbuffer-test.html:62
> +test(100, maxSize[1]+100)

In the near future, please align the contents of this test with conformance/canvas/drawingbuffer-test.html in the WebGL conformance suite. In general, if we make a code change in WebKit affecting one of the layout tests that's in the conformance suite, we pull the latest version of the conformance test back into WebKit as a layout test.
Comment 8 Nayan Kumar K 2012-07-25 22:44:19 PDT
Created attachment 154544 [details]
Reworked patch
Comment 9 Nayan Kumar K 2012-07-25 22:56:28 PDT
(In reply to comment #7)
> (From update of attachment 154265 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=154265&action=review
> 
> Thanks, looks better. r=me. One comment. Mark cq? if you want this committed as is.
> 
> > Source/WebCore/html/canvas/WebGLRenderingContext.cpp:523
> > +        m_drawingBuffer->reset(clampedCanvasSize());
> 
> How about a local variable instead of calling clampedCanvasSize() five times?

I have reworked and used a local variable here. Reworked patch is set for r?. I'll land the patch once it gets r=.

> 
> > LayoutTests/fast/canvas/webgl/drawingbuffer-test.html:62
> > +test(100, maxSize[1]+100)
> 
> In the near future, please align the contents of this test with conformance/canvas/drawingbuffer-test.html in the WebGL conformance suite. In general, if we make a code change in WebKit affecting one of the layout tests that's in the conformance suite, we pull the latest version of the conformance test back into WebKit as a layout test.

Sure. Soon I'll submit another patch to align this test case with the one in WebGL conformance suite.
Comment 10 Kenneth Russell 2012-07-26 16:11:08 PDT
Comment on attachment 154544 [details]
Reworked patch

Nice, thanks. r=me

I'm setting cq+ since I assume you wanted this committed, but please set the cq? bit in the future. Thanks.
Comment 11 WebKit Review Bot 2012-07-26 17:06:17 PDT
Comment on attachment 154544 [details]
Reworked patch

Clearing flags on attachment: 154544

Committed r123816: <http://trac.webkit.org/changeset/123816>
Comment 12 WebKit Review Bot 2012-07-26 17:06:21 PDT
All reviewed patches have been landed.  Closing bug.
Comment 13 Nayan Kumar K 2012-07-26 22:03:47 PDT
Reopening to attach new patch.
Comment 14 Nayan Kumar K 2012-07-26 22:03:54 PDT
Created attachment 154839 [details]
Reworked patch
Comment 15 Nayan Kumar K 2012-07-26 22:06:58 PDT
By mistake, attached wrong patch to a wrong bug. Hence closing this issue manually.