12011-08-16 Jeff Timanus <twiz@chromium.org>
2
3 [Chromium] Rough patch that demonstrates the changes required to unify both WebGL and Canvas2D rendering contexts to use a DrawingBuffer for backing store management.
4
5 WebGL rendering contexts create and render to FBOs managed by a DrawingBuffer instance. All PlatformLayer lifetime management is performed by the DrawingBuffer.
6 Because different layer types are required for Canvas2D and WebGL compositor layers, an agrument is passed to the DrawingBuffer to indicate its usage pattern.
7
8 Because WebGL content is now rendered to a DrawingBuffer, all of the routines that previously read from the back-buffer now must read from the FBO managed by the DrawingBuffer.
9 A temporary solution is proposed: Add an extra argument to readBackFramebuffer to conditionally specify if fb 0 should be bound before the read, or if the read should happen from the currently bound fbo.
10 A parallel Chrome change is required to implement the logic associated with the new argument. See CL: http://codereview.chromium.org/7669002
11
12 This change should only affect the chromium port.
13 https://bugs.webkit.org/show_bug.cgi?id=53201
14
15 Reviewed by NOBODY (OOPS!).
16
17 * html/canvas/CanvasRenderingContext2D.cpp:
18 (WebCore::CanvasRenderingContext2D::resetAcceleration):
19 * html/canvas/WebGLRenderingContext.cpp:
20 (WebCore::WebGLRenderingContext::WebGLRenderingContext):
21 (WebCore::WebGLRenderingContext::initializeNewContext):
22 (WebCore::WebGLRenderingContext::markContextChanged):
23 (WebCore::WebGLRenderingContext::clearIfComposited):
24 (WebCore::WebGLRenderingContext::paintRenderingResultsToCanvas):
25 (WebCore::WebGLRenderingContext::paintRenderingResultsToImageData):
26 (WebCore::WebGLRenderingContext::platformLayer):
27 (WebCore::WebGLRenderingContext::reshape):
28 (WebCore::WebGLRenderingContext::drawingBufferWidth):
29 (WebCore::WebGLRenderingContext::drawingBufferHeight):
30 (WebCore::WebGLRenderingContext::bindFramebuffer):
31 (WebCore::WebGLRenderingContext::copyTexImage2D):
32 (WebCore::WebGLRenderingContext::deleteFramebuffer):
33 (WebCore::WebGLRenderingContext::disable):
34 (WebCore::WebGLRenderingContext::enable):
35 (WebCore::WebGLRenderingContext::readPixels):
36 (WebCore::WebGLRenderingContext::getBoundFramebufferWidth):
37 (WebCore::WebGLRenderingContext::getBoundFramebufferHeight):
38 (WebCore::WebGLRenderingContext::maybeRestoreContext):
39 * html/canvas/WebGLRenderingContext.h:
40 * platform/graphics/GraphicsContext3D.cpp:
41 * platform/graphics/GraphicsContext3D.h:
42 (WebCore::GraphicsContext3D::platformLayer):
43 * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
44 (WebCore::Canvas2DLayerChromium::Canvas2DLayerChromium):
45 (WebCore::Canvas2DLayerChromium::updateCompositorResources):
46 * platform/graphics/chromium/Canvas2DLayerChromium.h:
47 * platform/graphics/chromium/CanvasLayerChromium.cpp:
48 (WebCore::CanvasLayerChromium::CanvasLayerChromium):
49 (WebCore::CanvasLayerChromium::setDrawingBuffer):
50 (WebCore::CanvasLayerChromium::setTextureChanged):
51 (WebCore::CanvasLayerChromium::textureId):
52 (WebCore::CanvasLayerChromium::setLayerRenderer):
53 (WebCore::CanvasLayerChromium::updatePlatformTexture):
54 * platform/graphics/chromium/CanvasLayerChromium.h:
55 (WebCore::CanvasLayerChromium::setTextureUpdated):
56 (WebCore::CanvasLayerChromium::getDrawingBuffer):
57 * platform/graphics/chromium/DrawingBufferChromium.cpp:
58 (WebCore::DrawingBuffer::DrawingBuffer):
59 (WebCore::DrawingBuffer::initialize):
60 (WebCore::DrawingBuffer::publishToPlatformLayer):
61 (WebCore::DrawingBuffer::platformLayer):
62 (WebCore::DrawingBuffer::platformColorBuffer):
63 (WebCore::DrawingBuffer::markContextChanged):
64 * platform/graphics/chromium/WebGLLayerChromium.cpp:
65 (WebCore::WebGLLayerChromium::WebGLLayerChromium):
66 (WebCore::WebGLLayerChromium::~WebGLLayerChromium):
67 (WebCore::WebGLLayerChromium::drawsContent):
68 (WebCore::WebGLLayerChromium::updateCompositorResources):
69 (WebCore::WebGLLayerChromium::context):
70 (WebCore::WebGLLayerChromium::setDrawingBuffer):
71 (WebCore::WebGLLayerChromium::setTextureChanged):
72 (WebCore::WebGLLayerChromium::rateLimitContext):
73 * platform/graphics/chromium/WebGLLayerChromium.h:
74 (WebCore::WebGLLayerChromium::textureId):
75 * platform/graphics/gpu/DrawingBuffer.cpp:
76 (WebCore::DrawingBuffer::create):
77 (WebCore::DrawingBuffer::resetOnNewContext):
78 (WebCore::DrawingBuffer::commit): ANGLE does not support LINEAR when doing a fbo blit. Because no scaling is performed, we can use NEAREST.
79 (WebCore::DrawingBuffer::multisample):
80 (WebCore::DrawingBuffer::paintRenderingResultsToImageData):
81 * platform/graphics/gpu/DrawingBuffer.h:
82 (WebCore::DrawingBuffer::setScissorEnabled):
83