WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
51559
copyTexSubImage2D shouldn't have undefined pixels
https://bugs.webkit.org/show_bug.cgi?id=51559
Summary
copyTexSubImage2D shouldn't have undefined pixels
Zhenyao Mo
Reported
2010-12-23 13:21:48 PST
if the region is beyond the currently bound fbo's bounds, we need to either clean undefined pixels to 0 or make sure they stay unchanged. Undefined leads to potential leaking.
Attachments
Patch
(15.30 KB, patch)
2011-01-06 11:26 PST
,
Zhenyao Mo
no flags
Details
Formatted Diff
Diff
Patch
(17.47 KB, patch)
2011-01-06 14:50 PST
,
Zhenyao Mo
no flags
Details
Formatted Diff
Diff
Patch
(17.70 KB, patch)
2011-01-07 09:36 PST
,
Zhenyao Mo
kbr
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Zhenyao Mo
Comment 1
2011-01-06 09:23:15 PST
After discussing it on public_webgl email list, we are going to set the undefined pixels to 0.
Zhenyao Mo
Comment 2
2011-01-06 11:26:23 PST
Created
attachment 78134
[details]
Patch
Zhenyao Mo
Comment 3
2011-01-06 11:26:59 PST
(In reply to
comment #2
)
> Created an attachment (id=78134) [details] > Patch
Will commit the test changes to khronos once reviewed.
WebKit Review Bot
Comment 4
2011-01-06 11:53:49 PST
Attachment 78134
[details]
did not build on chromium: Build output:
http://queues.webkit.org/results/7374010
Eric Seidel (no email)
Comment 5
2011-01-06 12:11:35 PST
Comment on
attachment 78134
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=78134&action=review
> WebCore/html/canvas/WebGLRenderingContext.cpp:725 > + long clippedX, clippedY, clippedWidth, clippedHeight; > + clip(x, width, getBoundFramebufferWidth(), &clippedX, &clippedWidth); > + clip(y, height, getBoundFramebufferHeight(), &clippedY, &clippedHeight); > + if (clippedX != x || clippedY != y || clippedWidth != width || clippedHeight != height) { > + unsigned long format = tex->getInternalFormat(target, level);
Shouldn't this huge block be a new helper function? It could (should!) even be just static to the file.
WebKit Review Bot
Comment 6
2011-01-06 12:30:25 PST
Attachment 78134
[details]
did not build on chromium: Build output:
http://queues.webkit.org/results/7401013
Kenneth Russell
Comment 7
2011-01-06 14:49:17 PST
(In reply to
comment #5
)
> (From update of
attachment 78134
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=78134&action=review
> > > WebCore/html/canvas/WebGLRenderingContext.cpp:725 > > + long clippedX, clippedY, clippedWidth, clippedHeight; > > + clip(x, width, getBoundFramebufferWidth(), &clippedX, &clippedWidth); > > + clip(y, height, getBoundFramebufferHeight(), &clippedY, &clippedHeight); > > + if (clippedX != x || clippedY != y || clippedWidth != width || clippedHeight != height) { > > + unsigned long format = tex->getInternalFormat(target, level); > > Shouldn't this huge block be a new helper function? It could (should!) even be just static to the file.
I think it's fine in its current form. It isn't duplicated code, and accesses members several times (m_context, getBoundFramebufferWidth/Height) making it inconvenient to write as anything but a method.
Zhenyao Mo
Comment 8
2011-01-06 14:50:53 PST
Created
attachment 78166
[details]
Patch
Zhenyao Mo
Comment 9
2011-01-06 14:53:23 PST
(In reply to
comment #8
)
> Created an attachment (id=78166) [details] > Patch
This patch fixes the build failure on chromium. Also, I refactor the code a little bit, adding a new function clip2D and call it in both copyTexImage2D and copyTexSubImage2D.
Kenneth Russell
Comment 10
2011-01-06 15:02:41 PST
Comment on
attachment 78166
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=78166&action=review
This basically looks good. One issue needing a revision.
> WebCore/html/canvas/WebGLRenderingContext.cpp:752 > + m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, zero.get());
The unpack alignment needs to be set to 1 before this call and restored afterward. See the various WebGLRenderingContext::texSubImage2D variants in this file.
Zhenyao Mo
Comment 11
2011-01-07 09:36:49 PST
Created
attachment 78243
[details]
Patch
Kenneth Russell
Comment 12
2011-01-07 10:05:53 PST
Comment on
attachment 78243
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=78243&action=review
Looks good - one minor issue with the new code which can be fixed upon landing.
> WebCore/html/canvas/WebGLRenderingContext.cpp:752 > + if (zero.get())
This can just be if (zero). These pointer types have an operator which converts to boolean type.
> WebCore/html/canvas/WebGLRenderingContext.cpp:755 > + if (zero.get())
Here too.
Zhenyao Mo
Comment 13
2011-01-07 10:20:22 PST
Committed
r75252
: <
http://trac.webkit.org/changeset/75252
>
Stephen White
Comment 14
2011-01-07 10:37:53 PST
This may have caused a build fail on the canary:
http://build.chromium.org/p/chromium.webkit/builders/Webkit%20Linux/builds/5595/steps/compile/logs/stdio
Zhenyao Mo
Comment 15
2011-01-07 10:43:58 PST
(In reply to
comment #14
)
> This may have caused a build fail on the canary: > >
http://build.chromium.org/p/chromium.webkit/builders/Webkit%20Linux/builds/5595/steps/compile/logs/stdio
I am on it. Just a sec.
Zhenyao Mo
Comment 16
2011-01-07 10:53:53 PST
This should fix it:
r75254
: <
http://trac.webkit.org/changeset/75254
>
Stephen White
Comment 17
2011-01-07 10:55:37 PST
(In reply to
comment #16
)
> This should fix it:
r75254
: <
http://trac.webkit.org/changeset/75254
>
Thanks!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug