Closed Bug 681791 Opened 10 years ago Closed 10 years ago
When trying to create a too large canvas, don't throw, instead just use a smaller drawing buffer
We currently file a few WebGL conformance tests, like https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/canvas/drawingbuffer-static-canvas-test.html Because we throw on canvas.width = something_huge when SetDimensions fails. Chrome doesn't throw there. Chrome also won't use a drawingbuffer larger than the max texture size or 4k, whichever is smaller. We need to fail less on resizing-canvases-to-large-sizes by using a smaller drawingbuffer if needed.
This change basically guarantees that GLContext will not be changed if a resize attempt fails.
It didn't occur to me before that the arguably time-saving initialize once approach was incompatible with soft-failing resizing. Updated try: https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=322fe6cae175
Yeah, that didn't work so well. Updated: https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=089d1b13072f
Current patch file.
Attachment #566099 - Flags: review?(bjacob) → feedback?(bjacob)
Ran into a problem on OS X.
Fixed CGL impl.
New try run: https://tbpl.mozilla.org/?tree=Try&rev=5a9f76410202
For some reason my last changes reset. Maybe I reset my patch file somehow. Updated try with CGL fix: https://tbpl.mozilla.org/?tree=Try&rev=ff8c9387530d
Fixed errant tab issues and added further commenting.
Predicates too-verbose debug printf on mDebugMode.
Comment on attachment 567147 [details] [diff] [review] Guarantees that GLContext::ResizeOffscreen is harmless if it fails Review of attachment 567147 [details] [diff] [review]: ----------------------------------------------------------------- This looks all good! Just one remark about something to keep in mind. The ClearSafely() call is mega-super-important for security: we must prevent WebGL scripts from reading back uninitialized video memory from a newly resized canvas. In your AA patches, the FBO becomes two separate FBOs, right. So will we need two ClearSafely() calls there?
Attachment #567147 - Flags: review?(bjacob) → review+
> Just one remark about something to keep in mind. The ClearSafely() call is > mega-super-important for security: we must prevent WebGL scripts from > reading back uninitialized video memory from a newly resized canvas. In your > AA patches, the FBO becomes two separate FBOs, right. So will we need two > ClearSafely() calls there? I will triple-check, but we shouldn't need to. After clearing the draw buffer, the read buffer /may/ be uninitialized, but before any read call is possible, we blit over the cleared draw buffer, clearing the read buffer. Basically, it's only possible to access if you can read it without using GL commands to do so. We could just deliberately blit over the cleared draw buffer, as that should be minimal cost compared to assembling a resized buffer, but it should not be necessary. If it were necessary, there would be other problems with our WebGL restrictions anyways.
Carrying forward r+ from bjacob after PR_TRUE/FALSE conversion.
Re-landed with proper commit message (sorry, should have checked that) http://hg.mozilla.org/integration/mozilla-inbound/rev/716915ed489c
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.