Bug 49206

Summary: Add multisampling support to DrawingBuffer.
Product: WebKit Reporter: Chris Marrin <cmarrin>
Component: WebGLAssignee: Chris Marrin <cmarrin>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, buildbot, dglazkov, eric, jamesr, mihaip, webkit-ews, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on: 47379    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch jamesr: review+

Chris Marrin
Reported 2010-11-08 14:07:53 PST
DrawingBuffer doesn't handle multisampling right now. This is needed to be able to do https://bugs.webkit.org/show_bug.cgi?id=47379.
Attachments
Patch (20.03 KB, patch)
2010-11-08 17:43 PST, Chris Marrin
no flags
Patch (21.10 KB, patch)
2010-11-09 14:57 PST, Chris Marrin
no flags
Patch (22.43 KB, patch)
2010-11-10 10:48 PST, Chris Marrin
no flags
Patch (23.35 KB, patch)
2010-11-10 16:10 PST, Chris Marrin
no flags
Patch (25.41 KB, patch)
2010-11-11 14:26 PST, Chris Marrin
jamesr: review+
Chris Marrin
Comment 1 2010-11-08 17:43:40 PST
Kenneth Russell
Comment 2 2010-11-08 17:48:22 PST
Comment on attachment 73320 [details] Patch Could you please make the Qt and Chromium ports compile by adding these virtuals to their implementations? Qt's is in platform/graphics/qt and Chromium's is in platform/graphics/chromium and WebKit/chromium/src. They can be no-ops with FIXMEs; the Chromium port should explicitly not claim support for them initially.
Early Warning System Bot
Comment 3 2010-11-08 17:53:25 PST
Eric Seidel (no email)
Comment 4 2010-11-08 20:04:01 PST
Build Bot
Comment 5 2010-11-08 20:07:51 PST
Chris Marrin
Comment 6 2010-11-09 14:57:55 PST
Eric Seidel (no email)
Comment 7 2010-11-09 18:51:43 PST
Chris Marrin
Comment 8 2010-11-10 10:48:44 PST
WebKit Review Bot
Comment 9 2010-11-10 14:30:14 PST
Chris Marrin
Comment 10 2010-11-10 16:10:05 PST
James Robinson
Comment 11 2010-11-10 17:20:29 PST
Comment on attachment 73552 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=73552&action=review Looks pretty good to me. Left some comments, but nothing major. To reduce risk, could you set antialias to 'false' in SharedGraphicsContext3D::create() for now? That way we can land this and test it out a bit locally on various platforms/configs before changing the behavior of any DrawingBuffer clients. > WebCore/platform/graphics/gpu/DrawingBuffer.cpp:114 > + // resize multisample FBO This (and the other comments) should be written as sentences (Leading caps, trailing period). > WebCore/platform/graphics/gpu/DrawingBuffer.cpp:119 > + int sampleCount = std::min(8, maxSampleCount); I'm not sure why 8 is special here. Could this be a constant with a more descriptive name? Also, webkit style is to put a 'using namespace std' declaration at the top of the .cpp and just say min() here. > WebCore/platform/graphics/gpu/DrawingBuffer.cpp:207 > + if (multisample()) > + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); > + > + // Initialize renderbuffers to 0. > + unsigned char colorMask[] = {true, true, true, true}, depthMask = true, stencilMask = true; > + unsigned char isScissorEnabled = false; > + unsigned char isDitherEnabled = false; > + unsigned long clearMask = GraphicsContext3D::COLOR_BUFFER_BIT; > + m_context->getBooleanv(GraphicsContext3D::COLOR_WRITEMASK, colorMask); > + m_context->colorMask(true, true, true, true); > + if (attributes.depth) { > + m_context->getBooleanv(GraphicsContext3D::DEPTH_WRITEMASK, &depthMask); > + m_context->depthMask(true); > + clearMask |= GraphicsContext3D::DEPTH_BUFFER_BIT; > + } > + if (attributes.stencil) { > + m_context->getBooleanv(GraphicsContext3D::STENCIL_WRITEMASK, &stencilMask); > + m_context->stencilMask(true); > + clearMask |= GraphicsContext3D::STENCIL_BUFFER_BIT; > + } > + isScissorEnabled = m_context->isEnabled(GraphicsContext3D::SCISSOR_TEST); > + m_context->disable(GraphicsContext3D::SCISSOR_TEST); > + isDitherEnabled = m_context->isEnabled(GraphicsContext3D::DITHER); > + m_context->disable(GraphicsContext3D::DITHER); > + > + m_context->clear(clearMask); > + > + m_context->colorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]); > + if (attributes.depth) > + m_context->depthMask(depthMask); > + if (attributes.stencil) > + m_context->stencilMask(stencilMask); > + if (isScissorEnabled) > + m_context->enable(GraphicsContext3D::SCISSOR_TEST); > + else > + m_context->disable(GraphicsContext3D::SCISSOR_TEST); > + if (isDitherEnabled) > + m_context->enable(GraphicsContext3D::DITHER); > + else > + m_context->disable(GraphicsContext3D::DITHER); > + > + m_context->flush(); I think this would be useful to have this clearing logic as a separate utility function, if just to shorten up the reset() function a bit.
Eric Seidel (no email)
Comment 12 2010-11-10 17:21:12 PST
WebKit Review Bot
Comment 13 2010-11-11 10:42:44 PST
http://trac.webkit.org/changeset/71827 might have broken Leopard Intel Release (Tests) The following tests are not passing: media/video-played-collapse.html media/video-played-ranges-1.html media/video-played-reset.html
James Robinson
Comment 14 2010-11-11 11:14:17 PST
Sadly looks like this did break a bunch of canvas tests in chromium. I'll debug and update the bug when I figure out why.
Mihai Parparita
Comment 15 2010-11-11 12:12:03 PST
For the record, the rollout change was http://trac.webkit.org/changeset/71839
James Robinson
Comment 16 2010-11-11 13:08:17 PST
Ah, as it turns out the DrawingBufferChromium changes weren't quite complete. In particular, the newly added fields on DrawingBuffer weren't initialized in the DrawingBufferChromium.cpp version of the constructor and the DrawingBufferChromium.cpp functions were not using m_colorBuffer when they should have been. I should have caught both of these issues in review - my bad. I'll update this bug with a patch that passes all tests on chromium.
Chris Marrin
Comment 17 2010-11-11 14:26:41 PST
James Robinson
Comment 18 2010-11-11 14:41:24 PST
Comment on attachment 73662 [details] Patch R=me Confirmed that this passes all gpu tests in fast/canvas and canvas/philip on chromium linux.
Chris Marrin
Comment 19 2010-11-11 14:43:34 PST
Note You need to log in before you can comment on or make changes to this bug.