+2012-06-25 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use WebGraphicsContext3D in compositor implementation
+ https://bugs.webkit.org/show_bug.cgi?id=89700
+
+ Reviewed by Adrienne Walker.
+
+ Puts all callback destructors in protected section and removes obsolete memory callback signature.
+
+ * chromium/public/WebGraphicsContext3D.h:
+ (WebGraphicsContextLostCallback):
+ (WebGraphicsErrorMessageCallback):
+ (WebGraphicsSwapBuffersCompleteCallbackCHROMIUM):
+ (WebGraphicsMemoryAllocationChangedCallbackCHROMIUM):
+
2012-06-25 Scott Graham <scottmg@chromium.org>
Plumb Scrollbar button dimensions through WebThemeEngine
class WebGraphicsContextLostCallback {
public:
virtual void onContextLost() = 0;
+
+ protected:
virtual ~WebGraphicsContextLostCallback() { }
};
class WebGraphicsErrorMessageCallback {
public:
virtual void onErrorMessage(const WebString&, WGC3Dint) = 0;
+
+ protected:
virtual ~WebGraphicsErrorMessageCallback() { }
};
class WebGraphicsSwapBuffersCompleteCallbackCHROMIUM {
public:
virtual void onSwapBuffersComplete() = 0;
+
+ protected:
virtual ~WebGraphicsSwapBuffersCompleteCallbackCHROMIUM() { }
};
class WebGraphicsMemoryAllocationChangedCallbackCHROMIUM {
public:
- // FIXME: Remove this once we switch to WebGraphicsMemoryAllocation version.
- virtual void onMemoryAllocationChanged(size_t gpuResourceSizeInBytes) = 0;
- // FIXME: Make this pure virtual once we implement everywhere.
- virtual void onMemoryAllocationChanged(WebGraphicsMemoryAllocation) { }
+ virtual void onMemoryAllocationChanged(WebGraphicsMemoryAllocation) = 0;
protected:
virtual ~WebGraphicsMemoryAllocationChangedCallbackCHROMIUM() { }
+2012-06-25 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use WebGraphicsContext3D in compositor implementation
+ https://bugs.webkit.org/show_bug.cgi?id=89700
+
+ Reviewed by Adrienne Walker.
+
+ This converts the compositor implementation from using WebCore::GraphicsContext3D to using the Platform-provided
+ WebGraphicsContext3D. This removes several unnecessary layers of indirection/wrapping and cuts down the
+ compositor's implementation dependencies. GraphicsContext3D.h is still widely used to provide GL enum values.
+ Most of the changes are purely mechanical - changing type names and the like.
+
+ Ownership is changed a bit. Instead of multiple components holding references to the compositor's context, the
+ context is now owned by the CCGraphicsContext, which is now owned directly by CCLayerTreeHostImpl.
+ CCLayerTreeHostImpl also has ownership of its CCRenderer (LayerRendererChromium in 3D mode) and passes a
+ non-owning pointer down to the CCRenderer.
+
+ Extension checking is a bit different. The compositor does not (and never has) used extensions provided by
+ WebGL's request/ensure mechanism. It simply checks for the existence of extensions it needs in the GL_EXTENSIONS
+ string.
+
+ FrameBufferSkPictureCanvasLayerTextureUpdater had to be patched as well, since it was grabbing a GrContext off
+ of the compositor's GraphicsContext3D. This caused many problems. It was inefficient, since it required a full
+ state flush when switching between ganesh and compositor calls. The gpu memory management was completely broken
+ since the compositor clobbered ganesh's onMemoryAllocationChanged callback. This moves FBSkPCLTU over to using
+ the appropriate SharedGraphicsContext3D, like filters.
+
+ * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
+ (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
+ (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
+ * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
+ (FrameBufferSkPictureCanvasLayerTextureUpdater):
+ * platform/graphics/chromium/GeometryBinding.cpp:
+ (WebCore::GeometryBinding::GeometryBinding):
+ * platform/graphics/chromium/GeometryBinding.h:
+ (WebKit):
+ (GeometryBinding):
+ (WebCore::GeometryBinding::context):
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::LayerRendererChromium::create):
+ (WebCore::LayerRendererChromium::LayerRendererChromium):
+ (WebCore::LayerRendererChromium::initialize):
+ (WebCore::LayerRendererChromium::~LayerRendererChromium):
+ (WebCore::LayerRendererChromium::context):
+ (WebCore::LayerRendererChromium::debugGLCall):
+ (WebCore::LayerRendererChromium::setVisible):
+ (WebCore::LayerRendererChromium::drawStreamVideoQuad):
+ (WebCore::LayerRendererChromium::drawHeadsUpDisplay):
+ (WebCore::LayerRendererChromium::swapBuffers):
+ (WebCore::LayerRendererChromium::onMemoryAllocationChanged):
+ (WebCore):
+ (WebCore::LayerRendererChromium::onMemoryAllocationChangedOnImplThread):
+ (WebCore::LayerRendererChromium::discardFramebuffer):
+ (WebCore::LayerRendererChromium::ensureFramebuffer):
+ (WebCore::LayerRendererChromium::onContextLost):
+ (WebCore::LayerRendererChromium::getFramebufferPixels):
+ (WebCore::LayerRendererChromium::getFramebufferTexture):
+ (WebCore::LayerRendererChromium::bindFramebufferToTexture):
+ (WebCore::LayerRendererChromium::initializeSharedObjects):
+ (WebCore::LayerRendererChromium::tileCheckerboardProgram):
+ (WebCore::LayerRendererChromium::solidColorProgram):
+ (WebCore::LayerRendererChromium::headsUpDisplayProgram):
+ (WebCore::LayerRendererChromium::renderPassProgram):
+ (WebCore::LayerRendererChromium::renderPassProgramAA):
+ (WebCore::LayerRendererChromium::renderPassMaskProgram):
+ (WebCore::LayerRendererChromium::renderPassMaskProgramAA):
+ (WebCore::LayerRendererChromium::tileProgram):
+ (WebCore::LayerRendererChromium::tileProgramOpaque):
+ (WebCore::LayerRendererChromium::tileProgramAA):
+ (WebCore::LayerRendererChromium::tileProgramSwizzle):
+ (WebCore::LayerRendererChromium::tileProgramSwizzleOpaque):
+ (WebCore::LayerRendererChromium::tileProgramSwizzleAA):
+ (WebCore::LayerRendererChromium::textureProgram):
+ (WebCore::LayerRendererChromium::textureProgramFlip):
+ (WebCore::LayerRendererChromium::textureIOSurfaceProgram):
+ (WebCore::LayerRendererChromium::videoYUVProgram):
+ (WebCore::LayerRendererChromium::videoStreamTextureProgram):
+ (WebCore::LayerRendererChromium::cleanupSharedObjects):
+ (WebCore::LayerRendererChromium::isContextLost):
+ * platform/graphics/chromium/LayerRendererChromium.h:
+ (WebKit):
+ (WebCore):
+ (LayerRendererChromium):
+ (WebCore::LayerRendererChromium::isFramebufferDiscarded):
+ * platform/graphics/chromium/LayerTextureSubImage.cpp:
+ (WebCore::LayerTextureSubImage::uploadWithTexSubImage):
+ (WebCore::LayerTextureSubImage::uploadWithMapTexSubImage):
+ * platform/graphics/chromium/ManagedTexture.cpp:
+ (WebCore::ManagedTexture::bindTexture):
+ (WebCore::ManagedTexture::framebufferTexture2D):
+ * platform/graphics/chromium/PlatformColor.h:
+ (WebCore::PlatformColor::bestTextureFormat):
+ * platform/graphics/chromium/ProgramBinding.cpp:
+ (WebCore::contextLost):
+ (WebCore::ProgramBindingBase::init):
+ (WebCore::ProgramBindingBase::cleanup):
+ (WebCore::ProgramBindingBase::loadShader):
+ (WebCore::ProgramBindingBase::createShaderProgram):
+ * platform/graphics/chromium/ProgramBinding.h:
+ (WebKit):
+ (ProgramBindingBase):
+ (WebCore::ProgramBinding::ProgramBinding):
+ (WebCore::ProgramBinding::initialize):
+ * platform/graphics/chromium/ShaderChromium.cpp:
+ (WebCore::VertexShaderPosTex::init):
+ (WebCore::VertexShaderPosTexYUVStretch::init):
+ (WebCore::VertexShaderPos::init):
+ (WebCore::VertexShaderPosTexTransform::init):
+ (WebCore::VertexShaderQuad::init):
+ (WebCore::VertexShaderTile::init):
+ (WebCore::VertexShaderVideoTransform::init):
+ (WebCore::FragmentTexAlphaBinding::init):
+ (WebCore::FragmentTexOpaqueBinding::init):
+ (WebCore::FragmentShaderOESImageExternal::init):
+ (WebCore::FragmentShaderRGBATexAlphaAA::init):
+ (WebCore::FragmentTexClampAlphaAABinding::init):
+ (WebCore::FragmentShaderRGBATexAlphaMask::init):
+ (WebCore::FragmentShaderRGBATexAlphaMaskAA::init):
+ (WebCore::FragmentShaderYUVVideo::init):
+ (WebCore::FragmentShaderColor::init):
+ (WebCore::FragmentShaderCheckerboard::init):
+ * platform/graphics/chromium/ShaderChromium.h:
+ (WebKit):
+ (VertexShaderPosTex):
+ (VertexShaderPosTexYUVStretch):
+ (VertexShaderPos):
+ (WebCore::VertexShaderPosTexIdentity::init):
+ (VertexShaderPosTexTransform):
+ (VertexShaderQuad):
+ (VertexShaderTile):
+ (VertexShaderVideoTransform):
+ (FragmentTexAlphaBinding):
+ (FragmentTexOpaqueBinding):
+ (FragmentShaderOESImageExternal):
+ (FragmentShaderRGBATexAlphaAA):
+ (FragmentTexClampAlphaAABinding):
+ (FragmentShaderRGBATexAlphaMask):
+ (FragmentShaderRGBATexAlphaMaskAA):
+ (FragmentShaderYUVVideo):
+ (FragmentShaderColor):
+ (FragmentShaderCheckerboard):
+ * platform/graphics/chromium/TextureCopier.cpp:
+ (WebCore::AcceleratedTextureCopier::AcceleratedTextureCopier):
+ (WebCore::AcceleratedTextureCopier::~AcceleratedTextureCopier):
+ (WebCore::AcceleratedTextureCopier::copyTexture):
+ * platform/graphics/chromium/TextureCopier.h:
+ (WebKit):
+ (WebCore):
+ (WebCore::AcceleratedTextureCopier::create):
+ (AcceleratedTextureCopier):
+ * platform/graphics/chromium/TextureManager.h:
+ * platform/graphics/chromium/ThrottledTextureUploader.cpp:
+ (WebCore::ThrottledTextureUploader::Query::Query):
+ (WebCore::ThrottledTextureUploader::Query::~Query):
+ (WebCore::ThrottledTextureUploader::Query::begin):
+ (WebCore::ThrottledTextureUploader::Query::end):
+ (WebCore::ThrottledTextureUploader::Query::isPending):
+ (WebCore::ThrottledTextureUploader::Query::wait):
+ (WebCore::ThrottledTextureUploader::ThrottledTextureUploader):
+ * platform/graphics/chromium/ThrottledTextureUploader.h:
+ (WebKit):
+ (WebCore::ThrottledTextureUploader::create):
+ (WebCore::ThrottledTextureUploader::Query::create):
+ (Query):
+ (ThrottledTextureUploader):
+ * platform/graphics/chromium/TrackingTextureAllocator.cpp:
+ (WebCore::TrackingTextureAllocator::TrackingTextureAllocator):
+ (WebCore::TrackingTextureAllocator::createTexture):
+ (WebCore::TrackingTextureAllocator::deleteTexture):
+ (WebCore::TrackingTextureAllocator::deleteAllTextures):
+ * platform/graphics/chromium/TrackingTextureAllocator.h:
+ (WebKit):
+ (WebCore::TrackingTextureAllocator::create):
+ (TrackingTextureAllocator):
+ * platform/graphics/chromium/cc/CCGraphicsContext.h:
+ (CCGraphicsContext):
+ (WebCore::CCGraphicsContext::create2D):
+ (WebCore::CCGraphicsContext::create3D):
+ (WebCore::CCGraphicsContext::context3D):
+ (WebCore::CCGraphicsContext::CCGraphicsContext):
+ * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp:
+ (WebCore::CCHeadsUpDisplay::draw):
+ * platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp:
+ (WebCore::CCIOSurfaceLayerImpl::~CCIOSurfaceLayerImpl):
+ (WebCore::CCIOSurfaceLayerImpl::willDraw):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::createContext):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ (CCLayerTreeHostClient):
+ (WebCore::LayerRendererCapabilities::LayerRendererCapabilities):
+ (LayerRendererCapabilities):
+ (WebCore::CCLayerTreeHost::needsSharedContext):
+ (CCLayerTreeHost):
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+ (WebCore::CCLayerTreeHostImpl::initializeLayerRenderer):
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
+ (CCLayerTreeHostImpl):
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+ (WebCore::CCSingleThreadProxy::initializeContext):
+ (WebCore::CCSingleThreadProxy::recreateContext):
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+ * platform/graphics/chromium/cc/CCTextureUpdater.cpp:
+ (WebCore::CCTextureUpdater::update):
+ * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+ (WebCore::CCThreadProxy::initializeContext):
+ (WebCore::CCThreadProxy::recreateContext):
+ (WebCore::CCThreadProxy::beginFrame):
+ (WebCore::CCThreadProxy::initializeContextOnImplThread):
+ (WebCore::CCThreadProxy::recreateContextOnImplThread):
+ * platform/graphics/chromium/cc/CCThreadProxy.h:
+ (CCThreadProxy):
+ * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
+ (WebCore::CCVideoLayerImpl::FramePlane::allocateData):
+ (WebCore::CCVideoLayerImpl::FramePlane::freeData):
+ (WebCore::CCVideoLayerImpl::copyPlaneData):
+
2012-06-25 Adrienne Walker <enne@google.com>
[chromium] Make CCThreadProxy not draw a frame mid-commit
#include "FrameBufferSkPictureCanvasLayerTextureUpdater.h"
#include "LayerPainterChromium.h"
+#include "SharedGraphicsContext3D.h"
#include "SkCanvas.h"
#include "SkGpuDevice.h"
-#include "cc/CCGraphicsContext.h"
+#include "cc/CCProxy.h"
namespace WebCore {
{
}
-void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
+void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::updateRect(CCGraphicsContext*, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
{
- textureUpdater()->updateTextureRect(context, allocator, texture(), sourceRect, destRect);
+ RefPtr<GraphicsContext3D> sharedContext = CCProxy::hasImplThread() ? SharedGraphicsContext3D::getForImplThread() : SharedGraphicsContext3D::get();
+ if (!sharedContext)
+ return;
+ textureUpdater()->updateTextureRect(sharedContext.release(), allocator, texture(), sourceRect, destRect);
}
PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter)
return LayerTextureUpdater::SampledTexelFormatRGBA;
}
-void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(CCGraphicsContext* context, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
+void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(PassRefPtr<GraphicsContext3D> prpContext, TextureAllocator* allocator, ManagedTexture* texture, const IntRect& sourceRect, const IntRect& destRect)
{
- GraphicsContext3D* context3d = context->context3D();
- if (!context3d) {
- // FIXME: Implement this path for software compositing.
- return;
- }
+ RefPtr<GraphicsContext3D> context(prpContext);
// Make sure ganesh uses the correct GL context.
- context3d->makeContextCurrent();
- // Notify ganesh to sync its internal GL state.
- context3d->grContext()->resetContext();
+ context->makeContextCurrent();
// Create an accelerated canvas to draw on.
- OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context3d, allocator, texture);
+ OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(context.get(), allocator, texture);
// The compositor expects the textures to be upside-down so it can flip
// the final composited image. Ganesh renders the image upright so we
drawPicture(canvas.get());
// Flush ganesh context so that all the rendered stuff appears on the texture.
- context3d->grContext()->flush();
+ context->grContext()->flush();
+
+ // Flush the GL context so rendering results from this context are visible in the compositor's context.
+ context->flush();
}
} // namespace WebCore
virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*) OVERRIDE;
virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE;
- void updateTextureRect(CCGraphicsContext*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
+ void updateTextureRect(PassRefPtr<GraphicsContext3D>, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
private:
explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>);
#include "GeometryBinding.h"
-#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
+#include <public/WebGraphicsContext3D.h>
namespace WebCore {
-GeometryBinding::GeometryBinding(GraphicsContext3D* context)
+GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context)
: m_context(context)
, m_quadVerticesVbo(0)
, m_quadElementsVbo(0)
#if USE(ACCELERATED_COMPOSITING)
-#include "PlatformString.h"
+namespace WebKit {
+class WebGraphicsContext3D;
+}
namespace WebCore {
-class GraphicsContext3D;
-
class GeometryBinding {
public:
- explicit GeometryBinding(GraphicsContext3D*);
+ explicit GeometryBinding(WebKit::WebGraphicsContext3D*);
~GeometryBinding();
bool initialized() const { return m_initialized; }
- GraphicsContext3D* context() const { return m_context; }
+ WebKit::WebGraphicsContext3D* context() const { return m_context; }
unsigned quadVerticesVbo() const { return m_quadVerticesVbo; }
unsigned quadElementsVbo() const { return m_quadElementsVbo; }
static int texCoordAttribLocation() { return 1; }
private:
- GraphicsContext3D* m_context;
+ WebKit::WebGraphicsContext3D* m_context;
unsigned m_quadVerticesVbo;
unsigned m_quadElementsVbo;
bool m_initialized;
#include "FloatQuad.h"
#include "GeometryBinding.h"
#include "GrTexture.h"
-#include "GraphicsContext3D.h"
#include "ManagedTexture.h"
#include "NativeImageSkia.h"
#include "NotImplemented.h"
#include "cc/CCTileDrawQuad.h"
#include "cc/CCVideoLayerImpl.h"
#include "cc/CCYUVVideoDrawQuad.h"
+#include <public/WebGraphicsContext3D.h>
#include <public/WebVideoFrame.h>
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
+#include <wtf/text/StringHash.h>
using namespace std;
+using WebKit::WebGraphicsContext3D;
+using WebKit::WebGraphicsMemoryAllocation;
using WebKit::WebTransformationMatrix;
namespace WebCore {
return screen;
}
-bool contextSupportsAcceleratedPainting(GraphicsContext3D* context)
-{
- WebCore::Extensions3D* extensions = context->getExtensions();
- if (extensions->supports("GL_EXT_texture_format_BGRA8888"))
- extensions->ensureEnabled("GL_EXT_texture_format_BGRA8888");
- else
- return false;
-
- if (extensions->supports("GL_EXT_read_format_bgra"))
- extensions->ensureEnabled("GL_EXT_read_format_bgra");
- else
- return false;
-
- if (!context->grContext())
- return false;
-
- return true;
-}
-
bool needsLionIOSurfaceReadbackWorkaround()
{
#if OS(DARWIN)
} // anonymous namespace
-class LayerRendererSwapBuffersCompleteCallbackAdapter : public Extensions3DChromium::SwapBuffersCompleteCallbackCHROMIUM {
-public:
- static PassOwnPtr<LayerRendererSwapBuffersCompleteCallbackAdapter> create(LayerRendererChromium* layerRenderer)
- {
- return adoptPtr(new LayerRendererSwapBuffersCompleteCallbackAdapter(layerRenderer));
- }
- virtual ~LayerRendererSwapBuffersCompleteCallbackAdapter() { }
-
- virtual void onSwapBuffersComplete()
- {
- m_layerRenderer->onSwapBuffersComplete();
- }
-
-private:
- explicit LayerRendererSwapBuffersCompleteCallbackAdapter(LayerRendererChromium* layerRenderer)
- {
- m_layerRenderer = layerRenderer;
- }
-
- LayerRendererChromium* m_layerRenderer;
-};
-
-class LayerRendererGpuMemoryAllocationChangedCallbackAdapter : public Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM {
-public:
- static PassOwnPtr<LayerRendererGpuMemoryAllocationChangedCallbackAdapter> create(LayerRendererChromium* layerRenderer)
- {
- return adoptPtr(new LayerRendererGpuMemoryAllocationChangedCallbackAdapter(layerRenderer));
- }
- virtual ~LayerRendererGpuMemoryAllocationChangedCallbackAdapter() { }
-
- virtual void onGpuMemoryAllocationChanged(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
- {
- // FIXME: This is called on the main thread in single threaded mode, but we expect it on the impl thread.
- if (m_bindToImplThread) {
- ASSERT(CCProxy::isMainThread());
- DebugScopedSetImplThread impl;
- onGpuMemoryAllocationChangedOnImpl(allocation);
- } else {
- ASSERT(CCProxy::isImplThread());
- onGpuMemoryAllocationChangedOnImpl(allocation);
- }
- }
-
-private:
- explicit LayerRendererGpuMemoryAllocationChangedCallbackAdapter(LayerRendererChromium* layerRenderer)
- : m_layerRenderer(layerRenderer), m_bindToImplThread(!CCProxy::hasImplThread())
- {
- }
-
- void onGpuMemoryAllocationChangedOnImpl(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
- {
- ASSERT(CCProxy::isImplThread());
- m_layerRenderer->setGpuMemoryAllocation(allocation);
- }
-
- LayerRendererChromium* m_layerRenderer;
- bool m_bindToImplThread;
-};
-
-PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, PassRefPtr<GraphicsContext3D> context, TextureUploaderOption textureUploaderSetting)
+PassOwnPtr<LayerRendererChromium> LayerRendererChromium::create(CCRendererClient* client, WebGraphicsContext3D* context, TextureUploaderOption textureUploaderSetting)
{
OwnPtr<LayerRendererChromium> layerRenderer(adoptPtr(new LayerRendererChromium(client, context, textureUploaderSetting)));
if (!layerRenderer->initialize())
}
LayerRendererChromium::LayerRendererChromium(CCRendererClient* client,
- PassRefPtr<GraphicsContext3D> context,
+ WebGraphicsContext3D* context,
TextureUploaderOption textureUploaderSetting)
: CCRenderer(client)
, m_currentRenderPass(0)
, m_visible(true)
, m_textureUploaderSetting(textureUploaderSetting)
{
- ASSERT(m_context.get());
+ ASSERT(m_context);
}
-class ContextLostCallbackAdapter : public GraphicsContext3D::ContextLostCallback {
-public:
- static PassOwnPtr<ContextLostCallbackAdapter> create(CCRendererClient* client)
- {
- return adoptPtr(new ContextLostCallbackAdapter(client));
- }
-
- virtual void onContextLost()
- {
- m_client->didLoseContext();
- }
-
-private:
- explicit ContextLostCallbackAdapter(CCRendererClient* client)
- : m_client(client) { }
-
- CCRendererClient* m_client;
-};
-
bool LayerRendererChromium::initialize()
{
if (!m_context->makeContextCurrent())
return false;
- m_context->setContextLostCallback(ContextLostCallbackAdapter::create(m_client));
+ m_context->setContextLostCallback(this);
- if (settings().acceleratePainting && contextSupportsAcceleratedPainting(m_context.get()))
+ String extensionsString = m_context->getString(GraphicsContext3D::EXTENSIONS);
+ Vector<String> extensionsList;
+ extensionsString.split(' ', extensionsList);
+ HashSet<String> extensions;
+ for (size_t i = 0; i < extensionsList.size(); ++i)
+ extensions.add(extensionsList[i]);
+
+ if (settings().acceleratePainting && extensions.contains("GL_EXT_texture_format_BGRA8888")
+ && extensions.contains("GL_EXT_read_format_bgra"))
m_capabilities.usingAcceleratedPainting = true;
+ else
+ m_capabilities.usingAcceleratedPainting = false;
- WebCore::Extensions3D* extensions = m_context->getExtensions();
- m_capabilities.contextHasCachedFrontBuffer = extensions->supports("GL_CHROMIUM_front_buffer_cached");
- if (m_capabilities.contextHasCachedFrontBuffer)
- extensions->ensureEnabled("GL_CHROMIUM_front_buffer_cached");
- m_capabilities.usingPartialSwap = CCSettings::partialSwapEnabled() && extensions->supports("GL_CHROMIUM_post_sub_buffer");
- if (m_capabilities.usingPartialSwap)
- extensions->ensureEnabled("GL_CHROMIUM_post_sub_buffer");
+ m_capabilities.contextHasCachedFrontBuffer = extensions.contains("GL_CHROMIUM_front_buffer_cached");
+
+ m_capabilities.usingPartialSwap = CCSettings::partialSwapEnabled() && extensions.contains("GL_CHROMIUM_post_sub_buffer");
- m_capabilities.usingMapSub = extensions->supports("GL_CHROMIUM_map_sub");
- if (m_capabilities.usingMapSub)
- extensions->ensureEnabled("GL_CHROMIUM_map_sub");
+ m_capabilities.usingMapSub = extensions.contains("GL_CHROMIUM_map_sub");
// Use the swapBuffers callback only with the threaded proxy.
if (CCProxy::hasImplThread())
- m_capabilities.usingSwapCompleteCallback = extensions->supports("GL_CHROMIUM_swapbuffers_complete_callback");
+ m_capabilities.usingSwapCompleteCallback = extensions.contains("GL_CHROMIUM_swapbuffers_complete_callback");
if (m_capabilities.usingSwapCompleteCallback) {
- extensions->ensureEnabled("GL_CHROMIUM_swapbuffers_complete_callback");
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(extensions);
- extensions3DChromium->setSwapBuffersCompleteCallbackCHROMIUM(LayerRendererSwapBuffersCompleteCallbackAdapter::create(this));
+ m_context->setSwapBuffersCompleteCallbackCHROMIUM(this);
}
- if (extensions->supports("GL_EXT_texture_format_BGRA8888"))
- extensions->ensureEnabled("GL_EXT_texture_format_BGRA8888");
+ m_capabilities.usingSetVisibility = extensions.contains("GL_CHROMIUM_set_visibility");
- m_capabilities.usingSetVisibility = extensions->supports("GL_CHROMIUM_set_visibility");
- if (m_capabilities.usingSetVisibility)
- extensions->ensureEnabled("GL_CHROMIUM_set_visibility");
-
- if (extensions->supports("GL_CHROMIUM_iosurface")) {
- ASSERT(extensions->supports("GL_ARB_texture_rectangle"));
- extensions->ensureEnabled("GL_ARB_texture_rectangle");
- extensions->ensureEnabled("GL_CHROMIUM_iosurface");
+ if (extensions.contains("GL_CHROMIUM_iosurface")) {
+ ASSERT(extensions.contains("GL_ARB_texture_rectangle"));
}
- m_capabilities.usingTextureUsageHint = extensions->supports("GL_ANGLE_texture_usage");
- if (m_capabilities.usingTextureUsageHint)
- extensions->ensureEnabled("GL_ANGLE_texture_usage");
+ m_capabilities.usingTextureUsageHint = extensions.contains("GL_ANGLE_texture_usage");
- m_capabilities.usingTextureStorageExtension = extensions->supports("GL_EXT_texture_storage");
- if (m_capabilities.usingTextureStorageExtension)
- extensions->ensureEnabled("GL_EXT_texture_storage");
+ m_capabilities.usingTextureStorageExtension = extensions.contains("GL_EXT_texture_storage");
- m_capabilities.usingGpuMemoryManager = extensions->supports("GL_CHROMIUM_gpu_memory_manager");
- if (m_capabilities.usingGpuMemoryManager) {
- extensions->ensureEnabled("GL_CHROMIUM_gpu_memory_manager");
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(extensions);
- extensions3DChromium->setGpuMemoryAllocationChangedCallbackCHROMIUM(LayerRendererGpuMemoryAllocationChangedCallbackAdapter::create(this));
- } else {
+ m_capabilities.usingGpuMemoryManager = extensions.contains("GL_CHROMIUM_gpu_memory_manager");
+ if (m_capabilities.usingGpuMemoryManager)
+ m_context->setMemoryAllocationChangedCallbackCHROMIUM(this);
+ else
m_client->setMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()));
- }
- m_capabilities.usingDiscardFramebuffer = extensions->supports("GL_CHROMIUM_discard_framebuffer");
- if (m_capabilities.usingDiscardFramebuffer)
- extensions->ensureEnabled("GL_CHROMIUM_discard_framebuffer");
+ m_capabilities.usingDiscardFramebuffer = extensions.contains("GL_CHROMIUM_discard_framebuffer");
+
+ m_capabilities.usingEglImage = extensions.contains("GL_OES_EGL_image_external");
GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_capabilities.maxTextureSize));
- m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_context.get());
+ m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_context, extensions.contains("GL_EXT_texture_format_BGRA8888"));
if (!initializeSharedObjects())
return false;
LayerRendererChromium::~LayerRendererChromium()
{
ASSERT(CCProxy::isImplThread());
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(m_context->getExtensions());
- extensions3DChromium->setSwapBuffersCompleteCallbackCHROMIUM(nullptr);
- extensions3DChromium->setGpuMemoryAllocationChangedCallbackCHROMIUM(nullptr);
+ m_context->setSwapBuffersCompleteCallbackCHROMIUM(0);
+ m_context->setMemoryAllocationChangedCallbackCHROMIUM(0);
+ m_context->setContextLostCallback(0);
cleanupSharedObjects();
}
-GraphicsContext3D* LayerRendererChromium::context()
+WebGraphicsContext3D* LayerRendererChromium::context()
{
- return m_context.get();
+ return m_context;
}
-void LayerRendererChromium::debugGLCall(GraphicsContext3D* context, const char* command, const char* file, int line)
+void LayerRendererChromium::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line)
{
unsigned long error = context->getError();
if (error != GraphicsContext3D::NO_ERROR)
// TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage front/backbuffers
// crbug.com/116049
if (m_capabilities.usingSetVisibility) {
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(m_context->getExtensions());
- extensions3DChromium->setVisibilityCHROMIUM(visible);
+ m_context->setVisibilityCHROMIUM(visible);
}
}
{
static float glMatrix[16];
- ASSERT(context()->getExtensions()->supports("GL_OES_EGL_image_external") && context()->getExtensions()->isEnabled("GL_OES_EGL_image_external"));
+ ASSERT(m_capabilities.usingEglImage);
const VideoStreamTextureProgram* program = videoStreamTextureProgram();
GLC(context(), context()->useProgram(program->program()));
const HeadsUpDisplayProgram* program = headsUpDisplayProgram();
ASSERT(program && program->initialized());
GLC(m_context, m_context->activeTexture(GraphicsContext3D::TEXTURE0));
- RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(m_context);
- hudTexture->bindTexture(ccContext.get(), m_implTextureAllocator.get());
+ if (!hudTexture->textureId())
+ hudTexture->allocate(m_implTextureAllocator.get());
+ GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, hudTexture->textureId()));
GLC(m_context, m_context->useProgram(program->program()));
GLC(m_context, m_context->uniform1i(program->fragmentShader().samplerLocation(), 0));
-1);
}
-void LayerRendererChromium::setGpuMemoryAllocation(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
-{
- if (m_visible && !allocation.gpuResourceSizeInBytes)
- return;
-
- if (!allocation.suggestHaveBackbuffer && !m_visible)
- discardFramebuffer();
-
- if (!allocation.gpuResourceSizeInBytes) {
- releaseRenderPassTextures();
- m_client->releaseContentsTextures();
- GLC(m_context, m_context->flush());
- } else
- m_client->setMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes);
-}
-
void LayerRendererChromium::finish()
{
TRACE_EVENT("LayerRendererChromium::finish", this, 0);
// If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport)
IntRect clippedSubBuffer = subBuffer;
clippedSubBuffer.intersect(IntRect(IntPoint::zero(), viewportSize()));
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(m_context->getExtensions());
int flippedYPosOfRectBottom = viewportHeight() - clippedSubBuffer.y() - clippedSubBuffer.height();
- extensions3DChromium->postSubBufferCHROMIUM(clippedSubBuffer.x(), flippedYPosOfRectBottom, clippedSubBuffer.width(), clippedSubBuffer.height());
+ m_context->postSubBufferCHROMIUM(clippedSubBuffer.x(), flippedYPosOfRectBottom, clippedSubBuffer.width(), clippedSubBuffer.height());
} else
// Note that currently this has the same effect as swapBuffers; we should
- // consider exposing a different entry point on GraphicsContext3D.
+ // consider exposing a different entry point on WebGraphicsContext3D.
m_context->prepareTexture();
return true;
m_client->onSwapBuffersComplete();
}
+void LayerRendererChromium::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocation)
+{
+ // FIXME: This is called on the main thread in single threaded mode, but we expect it on the impl thread.
+ if (!CCProxy::hasImplThread()) {
+ ASSERT(CCProxy::isMainThread());
+ DebugScopedSetImplThread impl;
+ onMemoryAllocationChangedOnImplThread(allocation);
+ } else {
+ ASSERT(CCProxy::isImplThread());
+ onMemoryAllocationChangedOnImplThread(allocation);
+ }
+}
+
+void LayerRendererChromium::onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation allocation)
+{
+ if (m_visible && !allocation.gpuResourceSizeInBytes)
+ return;
+
+ if (!allocation.suggestHaveBackbuffer && !m_visible)
+ discardFramebuffer();
+
+ if (!allocation.gpuResourceSizeInBytes) {
+ releaseRenderPassTextures();
+ m_client->releaseContentsTextures();
+ GLC(m_context, m_context->flush());
+ } else
+ m_client->setMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes);
+}
+
void LayerRendererChromium::discardFramebuffer()
{
if (m_isFramebufferDiscarded)
if (!m_capabilities.usingDiscardFramebuffer)
return;
- Extensions3D* extensions = m_context->getExtensions();
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(extensions);
// FIXME: Update attachments argument to appropriate values once they are no longer ignored.
- extensions3DChromium->discardFramebufferEXT(GraphicsContext3D::TEXTURE_2D, 0, 0);
+ m_context->discardFramebufferEXT(GraphicsContext3D::TEXTURE_2D, 0, 0);
m_isFramebufferDiscarded = true;
// Damage tracker needs a full reset every time framebuffer is discarded.
if (!m_capabilities.usingDiscardFramebuffer)
return;
- Extensions3D* extensions = m_context->getExtensions();
- Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(extensions);
- extensions3DChromium->ensureFramebufferCHROMIUM();
+ m_context->ensureFramebufferCHROMIUM();
m_isFramebufferDiscarded = false;
}
+void LayerRendererChromium::onContextLost()
+{
+ m_client->didLoseContext();
+}
+
+
void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& rect)
{
ASSERT(rect.maxX() <= viewportWidth() && rect.maxY() <= viewportHeight());
Platform3DObject temporaryTexture = NullPlatform3DObject;
Platform3DObject temporaryFBO = NullPlatform3DObject;
- GraphicsContext3D* context = m_context.get();
if (doWorkaround) {
// On Mac OS X 10.7, calling glReadPixels against an FBO whose color attachment is an
// different OpenGL contexts. It is believed that this is the root cause of top crasher
// http://crbug.com/99393. <rdar://problem/10949687>
- temporaryTexture = context->createTexture();
- GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, temporaryTexture));
- GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
- GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
- GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
- GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
+ temporaryTexture = m_context->createTexture();
+ GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, temporaryTexture));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
// Copy the contents of the current (IOSurface-backed) framebuffer into a temporary texture.
- GLC(context, context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 0, 0, rect.maxX(), rect.maxY(), 0));
- temporaryFBO = context->createFramebuffer();
+ GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 0, 0, rect.maxX(), rect.maxY(), 0));
+ temporaryFBO = m_context->createFramebuffer();
// Attach this texture to an FBO, and perform the readback from that FBO.
- GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, temporaryFBO));
- GLC(context, context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, temporaryTexture, 0));
+ GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, temporaryFBO));
+ GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, temporaryTexture, 0));
- ASSERT(context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE);
+ ASSERT(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE);
}
- GLC(context, context->readPixels(rect.x(), rect.y(), rect.width(), rect.height(),
+ GLC(m_context, m_context->readPixels(rect.x(), rect.y(), rect.width(), rect.height(),
GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels));
if (doWorkaround) {
// Clean up.
- GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
- GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0));
- GLC(context, context->deleteFramebuffer(temporaryFBO));
- GLC(context, context->deleteTexture(temporaryTexture));
+ GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0));
+ GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0));
+ GLC(m_context, m_context->deleteFramebuffer(temporaryFBO));
+ GLC(m_context, m_context->deleteTexture(temporaryTexture));
}
if (!m_visible) {
if (!texture->reserve(deviceRect.size(), GraphicsContext3D::RGB))
return false;
- RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(m_context);
- texture->bindTexture(ccContext.get(), m_implTextureAllocator.get());
+ if (!texture->textureId())
+ texture->allocate(m_implTextureAllocator.get());
+ GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, texture->textureId()));
GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, texture->format(),
deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0));
return true;
{
GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId));
- RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(m_context);
- texture->framebufferTexture2D(ccContext.get(), m_implTextureAllocator.get());
+ if (!texture->textureId())
+ texture->allocate(m_implTextureAllocator.get());
+ GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, texture->textureId(), 0));
#if !defined ( NDEBUG )
if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) {
// We will always need these programs to render, so create the programs eagerly so that the shader compilation can
// start while we do other work. Other programs are created lazily on first access.
- m_sharedGeometry = adoptPtr(new GeometryBinding(m_context.get()));
- m_renderPassProgram = adoptPtr(new RenderPassProgram(m_context.get()));
- m_tileProgram = adoptPtr(new TileProgram(m_context.get()));
- m_tileProgramOpaque = adoptPtr(new TileProgramOpaque(m_context.get()));
+ m_sharedGeometry = adoptPtr(new GeometryBinding(m_context));
+ m_renderPassProgram = adoptPtr(new RenderPassProgram(m_context));
+ m_tileProgram = adoptPtr(new TileProgram(m_context));
+ m_tileProgramOpaque = adoptPtr(new TileProgramOpaque(m_context));
GLC(m_context, m_context->flush());
m_implTextureManager = TextureManager::create(TextureManager::highLimitBytes(viewportSize()),
TextureManager::reclaimLimitBytes(viewportSize()),
m_capabilities.maxTextureSize);
- m_textureCopier = AcceleratedTextureCopier::create(m_context.get());
+ m_textureCopier = AcceleratedTextureCopier::create(m_context);
if (m_textureUploaderSetting == ThrottledUploader)
- m_textureUploader = ThrottledTextureUploader::create(m_context.get());
+ m_textureUploader = ThrottledTextureUploader::create(m_context);
else
m_textureUploader = UnthrottledTextureUploader::create();
- m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context.get());
- m_implTextureAllocator = TrackingTextureAllocator::create(m_context.get());
+ m_contentsTextureAllocator = TrackingTextureAllocator::create(m_context);
+ m_implTextureAllocator = TrackingTextureAllocator::create(m_context);
if (m_capabilities.usingTextureUsageHint)
m_implTextureAllocator->setTextureUsageHint(TrackingTextureAllocator::FramebufferAttachment);
if (m_capabilities.usingTextureStorageExtension) {
const LayerRendererChromium::TileCheckerboardProgram* LayerRendererChromium::tileCheckerboardProgram()
{
if (!m_tileCheckerboardProgram)
- m_tileCheckerboardProgram = adoptPtr(new TileCheckerboardProgram(m_context.get()));
+ m_tileCheckerboardProgram = adoptPtr(new TileCheckerboardProgram(m_context));
if (!m_tileCheckerboardProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::checkerboardProgram::initalize", this, 0);
- m_tileCheckerboardProgram->initialize(m_context.get());
+ m_tileCheckerboardProgram->initialize(m_context);
}
return m_tileCheckerboardProgram.get();
}
const LayerRendererChromium::SolidColorProgram* LayerRendererChromium::solidColorProgram()
{
if (!m_solidColorProgram)
- m_solidColorProgram = adoptPtr(new SolidColorProgram(m_context.get()));
+ m_solidColorProgram = adoptPtr(new SolidColorProgram(m_context));
if (!m_solidColorProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::solidColorProgram::initialize", this, 0);
- m_solidColorProgram->initialize(m_context.get());
+ m_solidColorProgram->initialize(m_context);
}
return m_solidColorProgram.get();
}
const LayerRendererChromium::HeadsUpDisplayProgram* LayerRendererChromium::headsUpDisplayProgram()
{
if (!m_headsUpDisplayProgram)
- m_headsUpDisplayProgram = adoptPtr(new HeadsUpDisplayProgram(m_context.get()));
+ m_headsUpDisplayProgram = adoptPtr(new HeadsUpDisplayProgram(m_context));
if (!m_headsUpDisplayProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::headsUpDisplayProgram::initialize", this, 0);
- m_headsUpDisplayProgram->initialize(m_context.get());
+ m_headsUpDisplayProgram->initialize(m_context);
}
return m_headsUpDisplayProgram.get();
}
ASSERT(m_renderPassProgram);
if (!m_renderPassProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::renderPassProgram::initialize", this, 0);
- m_renderPassProgram->initialize(m_context.get());
+ m_renderPassProgram->initialize(m_context);
}
return m_renderPassProgram.get();
}
const LayerRendererChromium::RenderPassProgramAA* LayerRendererChromium::renderPassProgramAA()
{
if (!m_renderPassProgramAA)
- m_renderPassProgramAA = adoptPtr(new RenderPassProgramAA(m_context.get()));
+ m_renderPassProgramAA = adoptPtr(new RenderPassProgramAA(m_context));
if (!m_renderPassProgramAA->initialized()) {
TRACE_EVENT("LayerRendererChromium::renderPassProgramAA::initialize", this, 0);
- m_renderPassProgramAA->initialize(m_context.get());
+ m_renderPassProgramAA->initialize(m_context);
}
return m_renderPassProgramAA.get();
}
const LayerRendererChromium::RenderPassMaskProgram* LayerRendererChromium::renderPassMaskProgram()
{
if (!m_renderPassMaskProgram)
- m_renderPassMaskProgram = adoptPtr(new RenderPassMaskProgram(m_context.get()));
+ m_renderPassMaskProgram = adoptPtr(new RenderPassMaskProgram(m_context));
if (!m_renderPassMaskProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::renderPassMaskProgram::initialize", this, 0);
- m_renderPassMaskProgram->initialize(m_context.get());
+ m_renderPassMaskProgram->initialize(m_context);
}
return m_renderPassMaskProgram.get();
}
const LayerRendererChromium::RenderPassMaskProgramAA* LayerRendererChromium::renderPassMaskProgramAA()
{
if (!m_renderPassMaskProgramAA)
- m_renderPassMaskProgramAA = adoptPtr(new RenderPassMaskProgramAA(m_context.get()));
+ m_renderPassMaskProgramAA = adoptPtr(new RenderPassMaskProgramAA(m_context));
if (!m_renderPassMaskProgramAA->initialized()) {
TRACE_EVENT("LayerRendererChromium::renderPassMaskProgramAA::initialize", this, 0);
- m_renderPassMaskProgramAA->initialize(m_context.get());
+ m_renderPassMaskProgramAA->initialize(m_context);
}
return m_renderPassMaskProgramAA.get();
}
ASSERT(m_tileProgram);
if (!m_tileProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::tileProgram::initialize", this, 0);
- m_tileProgram->initialize(m_context.get());
+ m_tileProgram->initialize(m_context);
}
return m_tileProgram.get();
}
ASSERT(m_tileProgramOpaque);
if (!m_tileProgramOpaque->initialized()) {
TRACE_EVENT("LayerRendererChromium::tileProgramOpaque::initialize", this, 0);
- m_tileProgramOpaque->initialize(m_context.get());
+ m_tileProgramOpaque->initialize(m_context);
}
return m_tileProgramOpaque.get();
}
const LayerRendererChromium::TileProgramAA* LayerRendererChromium::tileProgramAA()
{
if (!m_tileProgramAA)
- m_tileProgramAA = adoptPtr(new TileProgramAA(m_context.get()));
+ m_tileProgramAA = adoptPtr(new TileProgramAA(m_context));
if (!m_tileProgramAA->initialized()) {
TRACE_EVENT("LayerRendererChromium::tileProgramAA::initialize", this, 0);
- m_tileProgramAA->initialize(m_context.get());
+ m_tileProgramAA->initialize(m_context);
}
return m_tileProgramAA.get();
}
const LayerRendererChromium::TileProgramSwizzle* LayerRendererChromium::tileProgramSwizzle()
{
if (!m_tileProgramSwizzle)
- m_tileProgramSwizzle = adoptPtr(new TileProgramSwizzle(m_context.get()));
+ m_tileProgramSwizzle = adoptPtr(new TileProgramSwizzle(m_context));
if (!m_tileProgramSwizzle->initialized()) {
TRACE_EVENT("LayerRendererChromium::tileProgramSwizzle::initialize", this, 0);
- m_tileProgramSwizzle->initialize(m_context.get());
+ m_tileProgramSwizzle->initialize(m_context);
}
return m_tileProgramSwizzle.get();
}
const LayerRendererChromium::TileProgramSwizzleOpaque* LayerRendererChromium::tileProgramSwizzleOpaque()
{
if (!m_tileProgramSwizzleOpaque)
- m_tileProgramSwizzleOpaque = adoptPtr(new TileProgramSwizzleOpaque(m_context.get()));
+ m_tileProgramSwizzleOpaque = adoptPtr(new TileProgramSwizzleOpaque(m_context));
if (!m_tileProgramSwizzleOpaque->initialized()) {
TRACE_EVENT("LayerRendererChromium::tileProgramSwizzleOpaque::initialize", this, 0);
- m_tileProgramSwizzleOpaque->initialize(m_context.get());
+ m_tileProgramSwizzleOpaque->initialize(m_context);
}
return m_tileProgramSwizzleOpaque.get();
}
const LayerRendererChromium::TileProgramSwizzleAA* LayerRendererChromium::tileProgramSwizzleAA()
{
if (!m_tileProgramSwizzleAA)
- m_tileProgramSwizzleAA = adoptPtr(new TileProgramSwizzleAA(m_context.get()));
+ m_tileProgramSwizzleAA = adoptPtr(new TileProgramSwizzleAA(m_context));
if (!m_tileProgramSwizzleAA->initialized()) {
TRACE_EVENT("LayerRendererChromium::tileProgramSwizzleAA::initialize", this, 0);
- m_tileProgramSwizzleAA->initialize(m_context.get());
+ m_tileProgramSwizzleAA->initialize(m_context);
}
return m_tileProgramSwizzleAA.get();
}
const LayerRendererChromium::TextureProgram* LayerRendererChromium::textureProgram()
{
if (!m_textureProgram)
- m_textureProgram = adoptPtr(new TextureProgram(m_context.get()));
+ m_textureProgram = adoptPtr(new TextureProgram(m_context));
if (!m_textureProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::textureProgram::initialize", this, 0);
- m_textureProgram->initialize(m_context.get());
+ m_textureProgram->initialize(m_context);
}
return m_textureProgram.get();
}
const LayerRendererChromium::TextureProgramFlip* LayerRendererChromium::textureProgramFlip()
{
if (!m_textureProgramFlip)
- m_textureProgramFlip = adoptPtr(new TextureProgramFlip(m_context.get()));
+ m_textureProgramFlip = adoptPtr(new TextureProgramFlip(m_context));
if (!m_textureProgramFlip->initialized()) {
TRACE_EVENT("LayerRendererChromium::textureProgramFlip::initialize", this, 0);
- m_textureProgramFlip->initialize(m_context.get());
+ m_textureProgramFlip->initialize(m_context);
}
return m_textureProgramFlip.get();
}
const LayerRendererChromium::TextureIOSurfaceProgram* LayerRendererChromium::textureIOSurfaceProgram()
{
if (!m_textureIOSurfaceProgram)
- m_textureIOSurfaceProgram = adoptPtr(new TextureIOSurfaceProgram(m_context.get()));
+ m_textureIOSurfaceProgram = adoptPtr(new TextureIOSurfaceProgram(m_context));
if (!m_textureIOSurfaceProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::textureIOSurfaceProgram::initialize", this, 0);
- m_textureIOSurfaceProgram->initialize(m_context.get());
+ m_textureIOSurfaceProgram->initialize(m_context);
}
return m_textureIOSurfaceProgram.get();
}
const LayerRendererChromium::VideoYUVProgram* LayerRendererChromium::videoYUVProgram()
{
if (!m_videoYUVProgram)
- m_videoYUVProgram = adoptPtr(new VideoYUVProgram(m_context.get()));
+ m_videoYUVProgram = adoptPtr(new VideoYUVProgram(m_context));
if (!m_videoYUVProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::videoYUVProgram::initialize", this, 0);
- m_videoYUVProgram->initialize(m_context.get());
+ m_videoYUVProgram->initialize(m_context);
}
return m_videoYUVProgram.get();
}
const LayerRendererChromium::VideoStreamTextureProgram* LayerRendererChromium::videoStreamTextureProgram()
{
if (!m_videoStreamTextureProgram)
- m_videoStreamTextureProgram = adoptPtr(new VideoStreamTextureProgram(m_context.get()));
+ m_videoStreamTextureProgram = adoptPtr(new VideoStreamTextureProgram(m_context));
if (!m_videoStreamTextureProgram->initialized()) {
TRACE_EVENT("LayerRendererChromium::streamTextureProgram::initialize", this, 0);
- m_videoStreamTextureProgram->initialize(m_context.get());
+ m_videoStreamTextureProgram->initialize(m_context);
}
return m_videoStreamTextureProgram.get();
}
m_sharedGeometry.clear();
if (m_tileProgram)
- m_tileProgram->cleanup(m_context.get());
+ m_tileProgram->cleanup(m_context);
if (m_tileProgramOpaque)
- m_tileProgramOpaque->cleanup(m_context.get());
+ m_tileProgramOpaque->cleanup(m_context);
if (m_tileProgramSwizzle)
- m_tileProgramSwizzle->cleanup(m_context.get());
+ m_tileProgramSwizzle->cleanup(m_context);
if (m_tileProgramSwizzleOpaque)
- m_tileProgramSwizzleOpaque->cleanup(m_context.get());
+ m_tileProgramSwizzleOpaque->cleanup(m_context);
if (m_tileProgramAA)
- m_tileProgramAA->cleanup(m_context.get());
+ m_tileProgramAA->cleanup(m_context);
if (m_tileProgramSwizzleAA)
- m_tileProgramSwizzleAA->cleanup(m_context.get());
+ m_tileProgramSwizzleAA->cleanup(m_context);
if (m_tileCheckerboardProgram)
- m_tileCheckerboardProgram->cleanup(m_context.get());
+ m_tileCheckerboardProgram->cleanup(m_context);
if (m_renderPassMaskProgram)
- m_renderPassMaskProgram->cleanup(m_context.get());
+ m_renderPassMaskProgram->cleanup(m_context);
if (m_renderPassProgram)
- m_renderPassProgram->cleanup(m_context.get());
+ m_renderPassProgram->cleanup(m_context);
if (m_renderPassMaskProgramAA)
- m_renderPassMaskProgramAA->cleanup(m_context.get());
+ m_renderPassMaskProgramAA->cleanup(m_context);
if (m_renderPassProgramAA)
- m_renderPassProgramAA->cleanup(m_context.get());
+ m_renderPassProgramAA->cleanup(m_context);
if (m_textureProgram)
- m_textureProgram->cleanup(m_context.get());
+ m_textureProgram->cleanup(m_context);
if (m_textureProgramFlip)
- m_textureProgramFlip->cleanup(m_context.get());
+ m_textureProgramFlip->cleanup(m_context);
if (m_textureIOSurfaceProgram)
- m_textureIOSurfaceProgram->cleanup(m_context.get());
+ m_textureIOSurfaceProgram->cleanup(m_context);
if (m_videoYUVProgram)
- m_videoYUVProgram->cleanup(m_context.get());
+ m_videoYUVProgram->cleanup(m_context);
if (m_videoStreamTextureProgram)
- m_videoStreamTextureProgram->cleanup(m_context.get());
+ m_videoStreamTextureProgram->cleanup(m_context);
if (m_solidColorProgram)
- m_solidColorProgram->cleanup(m_context.get());
+ m_solidColorProgram->cleanup(m_context);
if (m_headsUpDisplayProgram)
- m_headsUpDisplayProgram->cleanup(m_context.get());
+ m_headsUpDisplayProgram->cleanup(m_context);
if (m_offscreenFramebufferId)
GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId));
bool LayerRendererChromium::isContextLost()
{
- return (m_context.get()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR);
+ return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR);
}
} // namespace WebCore
#include "cc/CCRenderer.h"
#include <wtf/PassOwnPtr.h>
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
namespace WebCore {
class CCCheckerboardDrawQuad;
class CCTileDrawQuad;
class CCYUVVideoDrawQuad;
class GeometryBinding;
-class GraphicsContext3D;
-class LayerRendererSwapBuffersCompleteCallbackAdapter;
class ManagedTexture;
class ScopedEnsureFramebufferAllocation;
// Class that handles drawing of composited render layers using GL.
-class LayerRendererChromium : public CCRenderer {
+class LayerRendererChromium : public CCRenderer,
+ public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM,
+ public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM ,
+ public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback {
WTF_MAKE_NONCOPYABLE(LayerRendererChromium);
public:
- static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, PassRefPtr<GraphicsContext3D>, TextureUploaderOption);
+ static PassOwnPtr<LayerRendererChromium> create(CCRendererClient*, WebKit::WebGraphicsContext3D*, TextureUploaderOption);
virtual ~LayerRendererChromium();
virtual const LayerRendererCapabilities& capabilities() const OVERRIDE { return m_capabilities; }
- GraphicsContext3D* context();
+ WebKit::WebGraphicsContext3D* context();
virtual void viewportChanged() OVERRIDE;
// puts backbuffer onscreen
virtual bool swapBuffers(const IntRect& subBuffer) OVERRIDE;
- static void debugGLCall(GraphicsContext3D*, const char* command, const char* file, int line);
+ static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command, const char* file, int line);
const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
float width, float height, float opacity, const FloatQuad&,
int matrixLocation, int alphaLocation, int quadLocation);
void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebKit::WebTransformationMatrix& drawMatrix);
- void setGpuMemoryAllocation(Extensions3DChromium::GpuMemoryAllocationCHROMIUM);
protected:
- void discardFramebuffer();
- void ensureFramebuffer();
- bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
+ LayerRendererChromium(CCRendererClient*, WebKit::WebGraphicsContext3D*, TextureUploaderOption);
- LayerRendererChromium(CCRendererClient*, PassRefPtr<GraphicsContext3D>, TextureUploaderOption);
+ bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
bool initialize();
private:
bool initializeSharedObjects();
void cleanupSharedObjects();
- friend class LayerRendererSwapBuffersCompleteCallbackAdapter;
- void onSwapBuffersComplete();
+ // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM implementation.
+ virtual void onSwapBuffersComplete() OVERRIDE;
+
+ // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM implementation.
+ virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation) OVERRIDE;
+ void onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocation);
+ void discardFramebuffer();
+ void ensureFramebuffer();
+
+ // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation.
+ virtual void onContextLost() OVERRIDE;
LayerRendererCapabilities m_capabilities;
OwnPtr<TrackingTextureAllocator> m_contentsTextureAllocator;
OwnPtr<TrackingTextureAllocator> m_implTextureAllocator;
- RefPtr<GraphicsContext3D> m_context;
+ WebKit::WebGraphicsContext3D* m_context;
const CCRenderPass* m_defaultRenderPass;
pixelSource = &m_subImage[0];
}
- GraphicsContext3D* context3d = context->context3D();
+ WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
return;
GC3Denum format, CCGraphicsContext* context)
{
TRACE_EVENT("LayerTextureSubImage::uploadWithMapTexSubImage", this, 0);
- GraphicsContext3D* context3d = context->context3D();
+ WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
return;
IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y());
// Upload tile data via a mapped transfer buffer
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context3d->getExtensions());
- uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY));
+ uint8_t* pixelDest = static_cast<uint8_t*>(context3d->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY));
if (!pixelDest) {
uploadWithTexSubImage(image, imageRect, sourceRect, destRect, format, context);
&image[4 * (offset.x() + (offset.y() + row) * imageRect.width())],
destRect.width() * componentsPerPixel * bytesPerComponent);
}
- GLC(context3d, extensions->unmapTexSubImage2DCHROMIUM(pixelDest));
+ GLC(context3d, context3d->unmapTexSubImage2DCHROMIUM(pixelDest));
}
} // namespace WebCore
#include "GraphicsContext3D.h"
#include "cc/CCGraphicsContext.h"
+#include <public/WebGraphicsContext3D.h>
+
+using WebKit::WebGraphicsContext3D;
namespace WebCore {
void ManagedTexture::bindTexture(CCGraphicsContext* context, TextureAllocator* allocator)
{
allocate(allocator);
- GraphicsContext3D* context3d = context->context3D();
+ WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
return;
void ManagedTexture::framebufferTexture2D(CCGraphicsContext* context, TextureAllocator* allocator)
{
allocate(allocator);
- GraphicsContext3D* context3d = context->context3D();
+ WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
return;
#include "Extensions3D.h"
#include "GraphicsContext3D.h"
#include "SkTypes.h"
+#include <public/WebGraphicsContext3D.h>
namespace WebCore {
}
// Returns the most efficient texture format for this platform.
- static GC3Denum bestTextureFormat(GraphicsContext3D* context)
+ static GC3Denum bestTextureFormat(WebKit::WebGraphicsContext3D* context, bool supportsBGRA8888)
{
GC3Denum textureFormat = GraphicsContext3D::RGBA;
switch (format()) {
case GraphicsContext3D::SourceFormatRGBA8:
break;
case GraphicsContext3D::SourceFormatBGRA8:
- if (context->getExtensions()->supports("GL_EXT_texture_format_BGRA8888"))
+ if (supportsBGRA8888)
textureFormat = Extensions3D::BGRA_EXT;
break;
default:
#include "ProgramBinding.h"
-#include "Extensions3D.h"
#include "GeometryBinding.h"
-#include "GraphicsContext.h"
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
#include "TraceEvent.h"
+#include <public/WebGraphicsContext3D.h>
+
+using WebKit::WebGraphicsContext3D;
namespace WebCore {
ASSERT(!m_initialized);
}
-static bool contextLost(GraphicsContext3D* context)
+static bool contextLost(WebGraphicsContext3D* context)
{
- return (context->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR);
+ return (context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR);
}
-void ProgramBindingBase::init(GraphicsContext3D* context, const String& vertexShader, const String& fragmentShader)
+void ProgramBindingBase::init(WebGraphicsContext3D* context, const String& vertexShader, const String& fragmentShader)
{
m_program = createShaderProgram(context, vertexShader, fragmentShader);
ASSERT(m_program || contextLost(context));
}
-void ProgramBindingBase::cleanup(GraphicsContext3D* context)
+void ProgramBindingBase::cleanup(WebGraphicsContext3D* context)
{
m_initialized = false;
if (!m_program)
m_program = 0;
}
-unsigned ProgramBindingBase::loadShader(GraphicsContext3D* context, unsigned type, const String& shaderSource)
+unsigned ProgramBindingBase::loadShader(WebGraphicsContext3D* context, unsigned type, const String& shaderSource)
{
unsigned shader = context->createShader(type);
if (!shader)
return 0;
String sourceString(shaderSource);
- GLC(context, context->shaderSource(shader, sourceString));
+ GLC(context, context->shaderSource(shader, sourceString.utf8().data()));
GLC(context, context->compileShader(shader));
#ifndef NDEBUG
int compiled = 0;
return shader;
}
-unsigned ProgramBindingBase::createShaderProgram(GraphicsContext3D* context, const String& vertexShaderSource, const String& fragmentShaderSource)
+unsigned ProgramBindingBase::createShaderProgram(WebGraphicsContext3D* context, const String& vertexShaderSource, const String& fragmentShaderSource)
{
- TRACE_EVENT("ProgramBindingBase::createShaderProgram", this, 0);
+ TRACE_EVENT0("cc", "ProgramBindingBase::createShaderProgram");
unsigned vertexShader = loadShader(context, GraphicsContext3D::VERTEX_SHADER, vertexShaderSource);
if (!vertexShader) {
if (!contextLost(context))
#if USE(ACCELERATED_COMPOSITING)
-#include "PlatformString.h"
+#include <wtf/text/WTFString.h>
-namespace WebCore {
+namespace WebKit {
+class WebGraphicsContext3D;
+}
-class GraphicsContext3D;
+namespace WebCore {
class ProgramBindingBase {
public:
ProgramBindingBase();
~ProgramBindingBase();
- void init(GraphicsContext3D*, const String& vertexShader, const String& fragmentShader);
- void cleanup(GraphicsContext3D*);
+ void init(WebKit::WebGraphicsContext3D*, const String& vertexShader, const String& fragmentShader);
+ void cleanup(WebKit::WebGraphicsContext3D*);
unsigned program() const { ASSERT(m_initialized); return m_program; }
bool initialized() const { return m_initialized; }
protected:
- unsigned loadShader(GraphicsContext3D*, unsigned type, const String& shaderSource);
- unsigned createShaderProgram(GraphicsContext3D*, const String& vertexShaderSource, const String& fragmentShaderSource);
+ unsigned loadShader(WebKit::WebGraphicsContext3D*, unsigned type, const String& shaderSource);
+ unsigned createShaderProgram(WebKit::WebGraphicsContext3D*, const String& vertexShaderSource, const String& fragmentShaderSource);
unsigned m_program;
bool m_initialized;
template<class VertexShader, class FragmentShader>
class ProgramBinding : public ProgramBindingBase {
public:
- explicit ProgramBinding(GraphicsContext3D* context)
+ explicit ProgramBinding(WebKit::WebGraphicsContext3D* context)
{
ProgramBindingBase::init(context, m_vertexShader.getShaderString(), m_fragmentShader.getShaderString());
}
- void initialize(GraphicsContext3D* context)
+ void initialize(WebKit::WebGraphicsContext3D* context)
{
ASSERT(context);
ASSERT(m_program);
#include "ShaderChromium.h"
-#include "GraphicsContext.h"
-#include "GraphicsContext3D.h"
+#include <public/WebGraphicsContext3D.h>
#define SHADER0(Src) #Src
#define SHADER(Src) SHADER0(Src)
+using WebKit::WebGraphicsContext3D;
+
namespace WebCore {
VertexShaderPosTex::VertexShaderPosTex()
{
}
-void VertexShaderPosTex::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPosTex::init(WebGraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
ASSERT(m_matrixLocation != -1);
{
}
-void VertexShaderPosTexYUVStretch::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPosTexYUVStretch::init(WebGraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
m_yWidthScaleFactorLocation = context->getUniformLocation(program, "y_widthScaleFactor");
{
}
-void VertexShaderPos::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPos::init(WebGraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
ASSERT(m_matrixLocation != -1);
{
}
-void VertexShaderPosTexTransform::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderPosTexTransform::init(WebGraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
m_texTransformLocation = context->getUniformLocation(program, "texTransform");
);
}
-void VertexShaderQuad::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderQuad::init(WebGraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
m_pointLocation = context->getUniformLocation(program, "point");
{
}
-void VertexShaderTile::init(GraphicsContext3D* context, unsigned program)
+void VertexShaderTile::init(WebGraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
m_pointLocation = context->getUniformLocation(program, "point");
{
}
-bool VertexShaderVideoTransform::init(GraphicsContext3D* context, unsigned program)
+bool VertexShaderVideoTransform::init(WebGraphicsContext3D* context, unsigned program)
{
m_matrixLocation = context->getUniformLocation(program, "matrix");
m_texMatrixLocation = context->getUniformLocation(program, "texMatrix");
{
}
-void FragmentTexAlphaBinding::init(GraphicsContext3D* context, unsigned program)
+void FragmentTexAlphaBinding::init(WebGraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
m_alphaLocation = context->getUniformLocation(program, "alpha");
{
}
-void FragmentTexOpaqueBinding::init(GraphicsContext3D* context, unsigned program)
+void FragmentTexOpaqueBinding::init(WebGraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
);
}
-bool FragmentShaderOESImageExternal::init(GraphicsContext3D* context, unsigned program)
+bool FragmentShaderOESImageExternal::init(WebGraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
{
}
-void FragmentShaderRGBATexAlphaAA::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderRGBATexAlphaAA::init(WebGraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
m_alphaLocation = context->getUniformLocation(program, "alpha");
{
}
-void FragmentTexClampAlphaAABinding::init(GraphicsContext3D* context, unsigned program)
+void FragmentTexClampAlphaAABinding::init(WebGraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
m_alphaLocation = context->getUniformLocation(program, "alpha");
{
}
-void FragmentShaderRGBATexAlphaMask::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderRGBATexAlphaMask::init(WebGraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
m_maskSamplerLocation = context->getUniformLocation(program, "s_mask");
{
}
-void FragmentShaderRGBATexAlphaMaskAA::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderRGBATexAlphaMaskAA::init(WebGraphicsContext3D* context, unsigned program)
{
m_samplerLocation = context->getUniformLocation(program, "s_texture");
m_maskSamplerLocation = context->getUniformLocation(program, "s_mask");
{
}
-void FragmentShaderYUVVideo::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderYUVVideo::init(WebGraphicsContext3D* context, unsigned program)
{
m_yTextureLocation = context->getUniformLocation(program, "y_texture");
m_uTextureLocation = context->getUniformLocation(program, "u_texture");
{
}
-void FragmentShaderColor::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderColor::init(WebGraphicsContext3D* context, unsigned program)
{
m_colorLocation = context->getUniformLocation(program, "color");
ASSERT(m_colorLocation != -1);
{
}
-void FragmentShaderCheckerboard::init(GraphicsContext3D* context, unsigned program)
+void FragmentShaderCheckerboard::init(WebGraphicsContext3D* context, unsigned program)
{
m_alphaLocation = context->getUniformLocation(program, "alpha");
m_texTransformLocation = context->getUniformLocation(program, "texTransform");
#include "PlatformString.h"
#include "SkColorPriv.h"
-namespace WebCore {
+namespace WebKit {
+class WebGraphicsContext3D;
+}
-class GraphicsContext3D;
+namespace WebCore {
class VertexShaderPosTex {
public:
VertexShaderPosTex();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
public:
VertexShaderPosTexYUVStretch();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
public:
VertexShaderPos();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
class VertexShaderPosTexIdentity {
public:
- void init(GraphicsContext3D*, unsigned program) { }
+ void init(WebKit::WebGraphicsContext3D*, unsigned program) { }
String getShaderString() const;
};
public:
VertexShaderPosTexTransform();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
public:
VertexShaderQuad();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
public:
VertexShaderTile();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
public:
VertexShaderVideoTransform();
- bool init(GraphicsContext3D*, unsigned program);
+ bool init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int matrixLocation() const { return m_matrixLocation; }
public:
FragmentTexAlphaBinding();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int alphaLocation() const { return m_alphaLocation; }
int edgeLocation() const { return -1; }
int fragmentTexTransformLocation() const { return -1; }
public:
FragmentTexOpaqueBinding();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int alphaLocation() const { return -1; }
int edgeLocation() const { return -1; }
int fragmentTexTransformLocation() const { return -1; }
class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding {
public:
String getShaderString() const;
- bool init(GraphicsContext3D*, unsigned program);
+ bool init(WebKit::WebGraphicsContext3D*, unsigned program);
private:
int m_samplerLocation;
};
public:
FragmentShaderRGBATexAlphaAA();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
String getShaderString() const;
int alphaLocation() const { return m_alphaLocation; }
public:
FragmentTexClampAlphaAABinding();
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int alphaLocation() const { return m_alphaLocation; }
int samplerLocation() const { return m_samplerLocation; }
int fragmentTexTransformLocation() const { return m_fragmentTexTransformLocation; }
FragmentShaderRGBATexAlphaMask();
String getShaderString() const;
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int alphaLocation() const { return m_alphaLocation; }
int samplerLocation() const { return m_samplerLocation; }
int maskSamplerLocation() const { return m_maskSamplerLocation; }
FragmentShaderRGBATexAlphaMaskAA();
String getShaderString() const;
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int alphaLocation() const { return m_alphaLocation; }
int samplerLocation() const { return m_samplerLocation; }
int maskSamplerLocation() const { return m_maskSamplerLocation; }
FragmentShaderYUVVideo();
String getShaderString() const;
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int yTextureLocation() const { return m_yTextureLocation; }
int uTextureLocation() const { return m_uTextureLocation; }
FragmentShaderColor();
String getShaderString() const;
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int colorLocation() const { return m_colorLocation; }
private:
FragmentShaderCheckerboard();
String getShaderString() const;
- void init(GraphicsContext3D*, unsigned program);
+ void init(WebKit::WebGraphicsContext3D*, unsigned program);
int alphaLocation() const { return m_alphaLocation; }
int texTransformLocation() const { return m_texTransformLocation; }
int frequencyLocation() const { return m_frequencyLocation; }
#include "config.h"
#include "TextureCopier.h"
-#include "TraceEvent.h"
+#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h" // For the GLC() macro
+#include "TraceEvent.h"
+#include <public/WebGraphicsContext3D.h>
namespace WebCore {
#if USE(ACCELERATED_COMPOSITING)
-AcceleratedTextureCopier::AcceleratedTextureCopier(PassRefPtr<GraphicsContext3D> context)
+AcceleratedTextureCopier::AcceleratedTextureCopier(WebKit::WebGraphicsContext3D* context)
: m_context(context)
{
+ ASSERT(m_context);
GLC(m_context, m_fbo = m_context->createFramebuffer());
GLC(m_context, m_positionBuffer = m_context->createBuffer());
{-1, 1, 0, 1}
};
- GLC(m_context.get(), m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_positionBuffer));
- GLC(m_context.get(), m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, sizeof(kPositions), kPositions, GraphicsContext3D::STATIC_DRAW));
- GLC(m_context.get(), m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0));
+ GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_positionBuffer));
+ GLC(m_context, m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, sizeof(kPositions), kPositions, GraphicsContext3D::STATIC_DRAW));
+ GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0));
- m_blitProgram = adoptPtr(new BlitProgram(m_context.get()));
+ m_blitProgram = adoptPtr(new BlitProgram(m_context));
}
AcceleratedTextureCopier::~AcceleratedTextureCopier()
{
if (m_blitProgram)
- m_blitProgram->cleanup(m_context.get());
+ m_blitProgram->cleanup(m_context);
if (m_positionBuffer)
GLC(m_context, m_context->deleteBuffer(m_positionBuffer));
if (m_fbo)
{
TRACE_EVENT("TextureCopier::copyTexture", this, 0);
- GraphicsContext3D* context = ccContext->context3D();
+ WebKit::WebGraphicsContext3D* context = ccContext->context3D();
if (!context) {
// FIXME: Implement this path for software compositing.
return;
#include "ProgramBinding.h"
#include "ShaderChromium.h"
#include "cc/CCGraphicsContext.h"
-#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
namespace WebCore {
+class IntSize;
class TextureCopier {
public:
class AcceleratedTextureCopier : public TextureCopier {
WTF_MAKE_NONCOPYABLE(AcceleratedTextureCopier);
public:
- static PassOwnPtr<AcceleratedTextureCopier> create(PassRefPtr<GraphicsContext3D> context)
+ static PassOwnPtr<AcceleratedTextureCopier> create(WebKit::WebGraphicsContext3D* context)
{
return adoptPtr(new AcceleratedTextureCopier(context));
}
virtual void copyTexture(CCGraphicsContext*, unsigned sourceTextureId, unsigned destTextureId, const IntSize&);
protected:
- explicit AcceleratedTextureCopier(PassRefPtr<GraphicsContext3D>);
+ explicit AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*);
private:
typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> BlitProgram;
- RefPtr<GraphicsContext3D> m_context;
+ WebKit::WebGraphicsContext3D* m_context;
Platform3DObject m_fbo;
Platform3DObject m_positionBuffer;
OwnPtr<BlitProgram> m_blitProgram;
#include "GraphicsContext3D.h"
#include "IntRect.h"
#include "IntSize.h"
-
#include <wtf/FastAllocBase.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include "ThrottledTextureUploader.h"
#include "Extensions3DChromium.h"
+#include <public/WebGraphicsContext3D.h>
namespace {
namespace WebCore {
-ThrottledTextureUploader::Query::Query(PassRefPtr<GraphicsContext3D> context)
+ThrottledTextureUploader::Query::Query(WebKit::WebGraphicsContext3D* context)
: m_context(context)
, m_queryId(0)
{
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
- m_queryId = extensions->createQueryEXT();
+ m_queryId = m_context->createQueryEXT();
}
ThrottledTextureUploader::Query::~Query()
{
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
- extensions->deleteQueryEXT(m_queryId);
+ m_context->deleteQueryEXT(m_queryId);
}
void ThrottledTextureUploader::Query::begin()
{
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
- extensions->beginQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM, m_queryId);
+ m_context->beginQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM, m_queryId);
}
void ThrottledTextureUploader::Query::end()
{
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
- extensions->endQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM);
+ m_context->endQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM);
}
bool ThrottledTextureUploader::Query::isPending()
{
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
unsigned available = 1;
- extensions->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT, &available);
+ m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT, &available);
return !available;
}
void ThrottledTextureUploader::Query::wait()
{
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
unsigned result;
- extensions->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESULT_EXT, &result);
+ m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESULT_EXT, &result);
}
-ThrottledTextureUploader::ThrottledTextureUploader(PassRefPtr<GraphicsContext3D> context)
+ThrottledTextureUploader::ThrottledTextureUploader(WebKit::WebGraphicsContext3D* context)
: m_context(context)
, m_maxPendingQueries(maxPendingQueries)
{
}
-ThrottledTextureUploader::ThrottledTextureUploader(PassRefPtr<GraphicsContext3D> context, size_t pendingUploadLimit)
+ThrottledTextureUploader::ThrottledTextureUploader(WebKit::WebGraphicsContext3D* context, size_t pendingUploadLimit)
: m_context(context)
, m_maxPendingQueries(pendingUploadLimit)
{
+ ASSERT(m_context);
}
ThrottledTextureUploader::~ThrottledTextureUploader()
#include <wtf/Deque.h>
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
namespace WebCore {
class ThrottledTextureUploader : public TextureUploader {
WTF_MAKE_NONCOPYABLE(ThrottledTextureUploader);
public:
- static PassOwnPtr<ThrottledTextureUploader> create(PassRefPtr<GraphicsContext3D> context)
+ static PassOwnPtr<ThrottledTextureUploader> create(WebKit::WebGraphicsContext3D* context)
{
return adoptPtr(new ThrottledTextureUploader(context));
}
- static PassOwnPtr<ThrottledTextureUploader> create(PassRefPtr<GraphicsContext3D> context, size_t pendingUploadLimit)
+ static PassOwnPtr<ThrottledTextureUploader> create(WebKit::WebGraphicsContext3D* context, size_t pendingUploadLimit)
{
return adoptPtr(new ThrottledTextureUploader(context, pendingUploadLimit));
}
private:
class Query {
public:
- static PassOwnPtr<Query> create(PassRefPtr<GraphicsContext3D> context) { return adoptPtr(new Query(context)); }
+ static PassOwnPtr<Query> create(WebKit::WebGraphicsContext3D* context) { return adoptPtr(new Query(context)); }
virtual ~Query();
void wait();
private:
- explicit Query(PassRefPtr<GraphicsContext3D>);
+ explicit Query(WebKit::WebGraphicsContext3D*);
- RefPtr<GraphicsContext3D> m_context;
+ WebKit::WebGraphicsContext3D* m_context;
unsigned m_queryId;
};
- ThrottledTextureUploader(PassRefPtr<GraphicsContext3D>);
- ThrottledTextureUploader(PassRefPtr<GraphicsContext3D>, size_t pendingUploadLimit);
+ ThrottledTextureUploader(WebKit::WebGraphicsContext3D*);
+ ThrottledTextureUploader(WebKit::WebGraphicsContext3D*, size_t pendingUploadLimit);
void processQueries();
- RefPtr<GraphicsContext3D> m_context;
+ WebKit::WebGraphicsContext3D* m_context;
size_t m_maxPendingQueries;
Deque<OwnPtr<Query> > m_pendingQueries;
Deque<OwnPtr<Query> > m_availableQueries;
#include "TrackingTextureAllocator.h"
#include "Extensions3DChromium.h"
+#include "GraphicsContext3D.h"
#include "IntRect.h"
#include "LayerRendererChromium.h" // For the GLC() macro
namespace WebCore {
-TrackingTextureAllocator::TrackingTextureAllocator(PassRefPtr<GraphicsContext3D> context)
+TrackingTextureAllocator::TrackingTextureAllocator(WebKit::WebGraphicsContext3D* context)
: m_context(context)
, m_currentMemoryUseBytes(0)
, m_textureUsageHint(Any)
, m_useTextureStorageExt(false)
{
+ ASSERT(m_context);
}
TrackingTextureAllocator::~TrackingTextureAllocator()
m_currentMemoryUseBytes += TextureManager::memoryUseBytes(size, format);
unsigned textureId = 0;
- GLC(m_context.get(), textureId = m_context->createTexture());
- GLC(m_context.get(), m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId));
+ GLC(m_context, textureId = m_context->createTexture());
+ GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId));
// Do basic linear filtering on resize.
- GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
- GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
// NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE.
- GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
- GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
if (m_textureUsageHint == FramebufferAttachment)
- GLC(m_context.get(), m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAMEBUFFER_ATTACHMENT_ANGLE));
+ GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAMEBUFFER_ATTACHMENT_ANGLE));
if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) {
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(m_context->getExtensions());
GC3Denum storageFormat = textureToStorageFormat(format);
- extensions->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height());
+ m_context->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height());
} else
- GLC(m_context.get(), m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE));
+ GLC(m_context, m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0));
m_allocatedTextureIds.add(textureId);
return textureId;
}
void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format)
{
m_currentMemoryUseBytes -= TextureManager::memoryUseBytes(size, format);
- GLC(m_context.get(), m_context->deleteTexture(textureId));
+ GLC(m_context, m_context->deleteTexture(textureId));
+ GLC(m_context, m_context->deleteTexture(textureId));
ASSERT(m_allocatedTextureIds.contains(textureId));
m_allocatedTextureIds.remove(textureId);
}
void TrackingTextureAllocator::deleteAllTextures()
{
for (HashSet<unsigned>::const_iterator it = m_allocatedTextureIds.begin(); it != m_allocatedTextureIds.end(); ++it)
- GLC(m_context.get(), m_context->deleteTexture(*it));
+ GLC(m_context, m_context->deleteTexture(*it));
m_currentMemoryUseBytes = 0;
m_allocatedTextureIds.clear();
}
#ifndef TrackingTextureAllocator_h
#define TrackingTextureAllocator_h
-#include "GraphicsContext3D.h"
#include "TextureManager.h"
#include <wtf/HashSet.h>
#include <wtf/PassRefPtr.h>
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
namespace WebCore {
class TrackingTextureAllocator : public TextureAllocator {
WTF_MAKE_NONCOPYABLE(TrackingTextureAllocator);
public:
- static PassOwnPtr<TrackingTextureAllocator> create(PassRefPtr<GraphicsContext3D> context)
+ static PassOwnPtr<TrackingTextureAllocator> create(WebKit::WebGraphicsContext3D* context)
{
return adoptPtr(new TrackingTextureAllocator(context));
}
void setUseTextureStorageExt(bool useStorageExt) { m_useTextureStorageExt = useStorageExt; }
protected:
- explicit TrackingTextureAllocator(PassRefPtr<GraphicsContext3D>);
+ explicit TrackingTextureAllocator(WebKit::WebGraphicsContext3D*);
- RefPtr<GraphicsContext3D> m_context;
+ WebKit::WebGraphicsContext3D* m_context;
size_t m_currentMemoryUseBytes;
TextureUsageHint m_textureUsageHint;
bool m_useTextureStorageExt;
#ifndef CCGraphicsContext_h
#define CCGraphicsContext_h
-#include "GraphicsContext3D.h"
-#include <wtf/PassRefPtr.h>
+#include <public/WebGraphicsContext3D.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
namespace WebCore {
-class GraphicsContext3D;
-class CCGraphicsContext : public RefCounted<CCGraphicsContext> {
+class CCGraphicsContext {
+ WTF_MAKE_NONCOPYABLE(CCGraphicsContext);
public:
- static PassRefPtr<CCGraphicsContext> create2D()
+ static PassOwnPtr<CCGraphicsContext> create2D()
{
- return adoptRef(new CCGraphicsContext());
+ return adoptPtr(new CCGraphicsContext());
}
- static PassRefPtr<CCGraphicsContext> create3D(PassRefPtr<GraphicsContext3D> context3D)
+ static PassOwnPtr<CCGraphicsContext> create3D(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)
{
- return adoptRef(new CCGraphicsContext(context3D));
+ return adoptPtr(new CCGraphicsContext(context3D));
}
- GraphicsContext3D* context3D() { return m_context3D.get(); }
+ WebKit::WebGraphicsContext3D* context3D() { return m_context3D.get(); }
private:
CCGraphicsContext() { }
- explicit CCGraphicsContext(PassRefPtr<GraphicsContext3D> context3D)
+ explicit CCGraphicsContext(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)
: m_context3D(context3D) { }
- RefPtr<GraphicsContext3D> m_context3D;
+ OwnPtr<WebKit::WebGraphicsContext3D> m_context3D;
};
}
#include "cc/CCDebugRectHistory.h"
#include "cc/CCFrameRateCounter.h"
#include "cc/CCLayerTreeHostImpl.h"
+#include <public/WebGraphicsContext3D.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
void CCHeadsUpDisplay::draw(CCLayerTreeHostImpl* layerTreeHostImpl)
{
CCRenderer* layerRenderer = layerTreeHostImpl->layerRenderer();
- GraphicsContext3D* context = layerTreeHostImpl->context()->context3D();
+ WebKit::WebGraphicsContext3D* context = layerTreeHostImpl->context()->context3D();
if (!context) {
// FIXME: Implement this path for software compositing.
return;
m_hudTexture->bindTexture(layerTreeHostImpl->context(), layerRenderer->implTextureAllocator());
bool uploadedViaMap = false;
if (layerRenderer->capabilities().usingMapSub) {
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions());
- uint8_t* pixelDest = static_cast<uint8_t*>(extensions->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY));
+ uint8_t* pixelDest = static_cast<uint8_t*>(context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, 0, 0, hudSize.width(), hudSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY));
if (pixelDest) {
uploadedViaMap = true;
memcpy(pixelDest, locker.pixels(), hudSize.width() * hudSize.height() * 4);
- extensions->unmapTexSubImage2DCHROMIUM(pixelDest);
+ context->unmapTexSubImage2DCHROMIUM(pixelDest);
}
}
#include "cc/CCIOSurfaceLayerImpl.h"
-#include "Extensions3DChromium.h"
+#include "Extensions3D.h"
#include "LayerRendererChromium.h"
#include "TextStream.h"
#include "cc/CCGraphicsContext.h"
#include "cc/CCIOSurfaceDrawQuad.h"
#include "cc/CCLayerTreeHostImpl.h"
#include "cc/CCQuadCuller.h"
+#include <public/WebGraphicsContext3D.h>
namespace WebCore {
CCGraphicsContext* context = layerTreeHostImpl()->context();
// FIXME: Implement this path for software compositing.
- GraphicsContext3D* context3d = context->context3D();
+ WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (context3d)
context3d->deleteTexture(m_ioSurfaceTextureId);
}
CCLayerImpl::willDraw(layerRenderer, context);
if (m_ioSurfaceChanged) {
- GraphicsContext3D* context3d = context->context3D();
+ WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
return;
}
- Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context3d->getExtensions());
- ASSERT(extensions->supports("GL_CHROMIUM_iosurface"));
- ASSERT(extensions->supports("GL_ARB_texture_rectangle"));
// FIXME: Do this in a way that we can track memory usage.
if (!m_ioSurfaceTextureId)
GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
- extensions->texImageIOSurface2DCHROMIUM(Extensions3D::TEXTURE_RECTANGLE_ARB,
- m_ioSurfaceSize.width(),
- m_ioSurfaceSize.height(),
- m_ioSurfaceId,
- 0);
+ context3d->texImageIOSurface2DCHROMIUM(Extensions3D::TEXTURE_RECTANGLE_ARB,
+ m_ioSurfaceSize.width(),
+ m_ioSurfaceSize.height(),
+ m_ioSurfaceId,
+ 0);
// Do not check for error conditions. texImageIOSurface2DCHROMIUM is supposed to hold on to
// the last good IOSurface if the new one is already closed. This is only a possibility
// during live resizing of plugins. However, it seems that this is not sufficient to
m_client->didCommit();
}
-PassRefPtr<CCGraphicsContext> CCLayerTreeHost::createContext()
+PassOwnPtr<CCGraphicsContext> CCLayerTreeHost::createContext()
{
- RefPtr<CCGraphicsContext> context;
if (settings().forceSoftwareCompositing)
return CCGraphicsContext::create2D();
return CCGraphicsContext::create3D(m_client->createContext3D());
virtual void updateAnimations(double frameBeginTime) = 0;
virtual void layout() = 0;
virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
- virtual PassRefPtr<GraphicsContext3D> createContext3D() = 0;
+ virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext3D() = 0;
virtual void didRecreateContext(bool success) = 0;
virtual void willCommit() = 0;
virtual void didCommit() = 0;
, usingTextureStorageExtension(false)
, usingGpuMemoryManager(false)
, usingDiscardFramebuffer(false)
+ , usingEglImage(false)
, maxTextureSize(0) { }
GC3Denum bestTextureFormat;
bool usingTextureStorageExtension;
bool usingGpuMemoryManager;
bool usingDiscardFramebuffer;
+ bool usingEglImage;
int maxTextureSize;
};
static bool needsFilterContext() { return s_needsFilterContext; }
static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterContext = needsFilterContext; }
+ bool needsSharedContext() const { return needsFilterContext() || settings().acceleratePainting; }
// CCLayerTreeHost interface to CCProxy.
void willBeginFrame() { m_client->willBeginFrame(); }
void beginCommitOnImplThread(CCLayerTreeHostImpl*);
void finishCommitOnImplThread(CCLayerTreeHostImpl*);
void commitComplete();
- PassRefPtr<CCGraphicsContext> createContext();
+ PassOwnPtr<CCGraphicsContext> createContext();
virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*);
void didLoseContext();
enum RecreateResult {
setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers);
}
-bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader)
+bool CCLayerTreeHostImpl::initializeLayerRenderer(PassOwnPtr<CCGraphicsContext> context, TextureUploaderOption textureUploader)
{
- GraphicsContext3D* context3d = context->context3D();
+ WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
return false;
void finishAllRendering();
int frameNumber() const { return m_frameNumber; }
- bool initializeLayerRenderer(PassRefPtr<CCGraphicsContext>, TextureUploaderOption);
+ bool initializeLayerRenderer(PassOwnPtr<CCGraphicsContext>, TextureUploaderOption);
bool isContextLost();
CCRenderer* layerRenderer() { return m_layerRenderer.get(); }
const LayerRendererCapabilities& layerRendererCapabilities() const;
void dumpRenderSurfaces(TextStream&, int indent, const CCLayerImpl*) const;
- RefPtr<CCGraphicsContext> m_context;
+ OwnPtr<CCGraphicsContext> m_context;
OwnPtr<CCRenderer> m_layerRenderer;
OwnPtr<CCLayerImpl> m_rootLayerImpl;
CCLayerImpl* m_rootScrollLayerImpl;
bool CCSingleThreadProxy::initializeContext()
{
ASSERT(CCProxy::isMainThread());
- RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
+ OwnPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
if (!context)
return false;
- ASSERT(context->hasOneRef());
- m_contextBeforeInitialization = context;
+ m_contextBeforeInitialization = context.release();
return true;
}
ASSERT(CCProxy::isMainThread());
ASSERT(m_contextLost);
- RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
+ OwnPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
if (!context)
return false;
- ASSERT(context->hasOneRef());
bool initialized;
{
DebugScopedSetImplThread impl;
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
- initialized = m_layerTreeHostImpl->initializeLayerRenderer(context, UnthrottledUploader);
+ initialized = m_layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
if (initialized) {
m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities();
}
// Holds on to the context between initializeContext() and initializeLayerRenderer() calls. Shouldn't
// be used for anything else.
- RefPtr<CCGraphicsContext> m_contextBeforeInitialization;
+ OwnPtr<CCGraphicsContext> m_contextBeforeInitialization;
OwnPtr<CCSingleThreadProxyAnimationTimer> m_animationTimer;
// before letting the main thread proceed as it may make draw calls to the source texture of one of
// our copy operations.
if (m_copyEntries.size()) {
- GraphicsContext3D* context3d = context->context3D();
+ WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (context3d)
context3d->flush();
// FIXME: Implement this path for software compositing.
bool CCThreadProxy::initializeContext()
{
TRACE_EVENT("CCThreadProxy::initializeContext", this, 0);
- RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
+ OwnPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
if (!context)
return false;
- ASSERT(context->hasOneRef());
-
- // Leak the context pointer so we can transfer ownership of it to the other side...
- CCGraphicsContext* contextPtr = context.release().leakRef();
- ASSERT(contextPtr->hasOneRef());
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeContextOnImplThread,
- AllowCrossThreadAccess(contextPtr)));
+ AllowCrossThreadAccess(context.leakPtr())));
return true;
}
ASSERT(isMainThread());
// Try to create the context.
- RefPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
+ OwnPtr<CCGraphicsContext> context = m_layerTreeHost->createContext();
if (!context)
return false;
- if (CCLayerTreeHost::needsFilterContext() && !m_layerTreeHost->settings().forceSoftwareCompositing)
+ if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing)
if (!SharedGraphicsContext3D::createForImplThread())
return false;
- ASSERT(context->hasOneRef());
-
- // Leak the context pointer so we can transfer ownership of it to the other side...
- CCGraphicsContext* contextPtr = context.release().leakRef();
- ASSERT(contextPtr->hasOneRef());
-
// Make a blocking call to recreateContextOnImplThread. The results of that
// call are pushed into the recreateSucceeded and capabilities local
// variables.
LayerRendererCapabilities capabilities;
CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread,
AllowCrossThreadAccess(&completion),
- AllowCrossThreadAccess(contextPtr),
+ AllowCrossThreadAccess(context.leakPtr()),
AllowCrossThreadAccess(&recreateSucceeded),
AllowCrossThreadAccess(&capabilities)));
completion.wait();
return;
}
- if (CCLayerTreeHost::needsFilterContext() && !m_layerTreeHost->settings().forceSoftwareCompositing && !SharedGraphicsContext3D::haveForImplThread())
+ if (m_layerTreeHost->needsSharedContext() && !m_layerTreeHost->settings().forceSoftwareCompositing && !SharedGraphicsContext3D::haveForImplThread())
SharedGraphicsContext3D::createForImplThread();
OwnPtr<BeginFrameAndCommitState> request(m_pendingBeginFrameRequest.release());
{
TRACE_EVENT("CCThreadProxy::initializeContextOnImplThread", this, 0);
ASSERT(isImplThread());
- m_contextBeforeInitializationOnImplThread = adoptRef(context);
+ m_contextBeforeInitializationOnImplThread = adoptPtr(context);
}
void CCThreadProxy::initializeLayerRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities)
TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread");
ASSERT(isImplThread());
m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
- *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptRef(contextPtr), textureUploader);
+ *recreateSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(adoptPtr(contextPtr), textureUploader);
if (*recreateSucceeded) {
*capabilities = m_layerTreeHostImpl->layerRendererCapabilities();
m_schedulerOnImplThread->didRecreateContext();
// Holds on to the context we might use for compositing in between initializeContext()
// and initializeLayerRenderer() calls.
- RefPtr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread;
+ OwnPtr<CCGraphicsContext> m_contextBeforeInitializationOnImplThread;
// Set when the main thread is waiting on a scheduledActionBeginFrame to be issued.
CCCompletionEvent* m_beginFrameCompletionEventOnImplThread;
if (textureId)
return true;
- GraphicsContext3D* context3D = context->context3D();
+ WebKit::WebGraphicsContext3D* context3D = context->context3D();
if (!context3D)
return false;
GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
- GLC(context3D, context3D->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE));
+ GLC(context3D, context3D->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0));
return textureId;
}
if (!textureId)
return;
- GraphicsContext3D* context3D = context->context3D();
+ WebKit::WebGraphicsContext3D* context3D = context->context3D();
if (!context3D)
return;
if (!softwarePlaneCount)
return true;
- GraphicsContext3D* context3d = context->context3D();
+ WebKit::WebGraphicsContext3D* context3d = context->context3D();
if (!context3d) {
// FIXME: Implement this path for software compositing.
return false;
+2012-06-25 James Robinson <jamesr@chromium.org>
+
+ [chromium] Use WebGraphicsContext3D in compositor implementation
+ https://bugs.webkit.org/show_bug.cgi?id=89700
+
+ Reviewed by Adrienne Walker.
+
+ Updates tests for refactor, mostly by removing unnecessary GraphicsContext3D wrapper around mock contexts.
+
+ * WebKit.gypi:
+ * src/WebLayerTreeView.cpp:
+ (WebKit::WebLayerTreeView::context):
+ * src/WebLayerTreeViewImpl.cpp:
+ * tests/CCLayerTreeHostImplTest.cpp:
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommit::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread):
+ * tests/CCSingleThreadProxyTest.cpp:
+ * tests/CCThreadedTest.cpp:
+ (WebKitTests::TestHooks::createContext):
+ * tests/CCThreadedTest.h:
+ (TestHooks):
+ * tests/Canvas2DLayerBridgeTest.cpp:
+ (Canvas2DLayerBridgeTest::fullLifecycleTest):
+ * tests/CompositorFakeGraphicsContext3D.h: Removed.
+ * tests/DrawingBufferChromiumTest.cpp: Removed.
+ * tests/FakeCCLayerTreeHostClient.h:
+ * tests/FakeGraphicsContext3DTest.cpp:
+ (TEST):
+ * tests/GraphicsLayerChromiumTest.cpp:
+ * tests/LayerRendererChromiumTest.cpp:
+ (FakeLayerRendererChromium::FakeLayerRendererChromium):
+ (LayerRendererChromiumTest::LayerRendererChromiumTest):
+ (LayerRendererChromiumTest):
+ (TEST_F):
+ (TEST):
+ * tests/TextureCopierTest.cpp:
+ * tests/ThrottledTextureUploaderTest.cpp:
+ (WebKit::TEST):
+ * tests/TiledLayerChromiumTest.cpp:
+
2012-06-25 Kausalya Madhusudhanan <kmadhusu@chromium.org>
[Chromium] Add a chromium-webkit API to create a serializable file system.
'tests/CCThreadedTest.h',
'tests/CCTimerTest.cpp',
'tests/ClipboardChromiumTest.cpp',
- 'tests/CompositorFakeGraphicsContext3D.h',
'tests/CompositorFakeWebGraphicsContext3D.h',
'tests/DecimalTest.cpp',
'tests/DragImageTest.cpp',
- 'tests/DrawingBufferChromiumTest.cpp',
'tests/EventListenerTest.cpp',
'tests/FakeCCLayerTreeHostClient.h',
'tests/FakeGraphicsContext3DTest.cpp',
WebGraphicsContext3D* WebLayerTreeView::context()
{
- return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context()->context3D());
+ return m_private->layerTreeHost()->context()->context3D();
}
void WebLayerTreeView::loseCompositorContext(int numTimes)
virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { m_client->updateAnimations(monotonicFrameBeginTime); }
virtual void layout() OVERRIDE { m_client->layout(); }
virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); }
- virtual PassRefPtr<WebCore::GraphicsContext3D> createContext3D() OVERRIDE
+ virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE
{
- OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D());
- if (!webContext)
- return 0;
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ );
+ return adoptPtr(m_client->createContext3D());
}
virtual void didRecreateContext(bool success) OVERRIDE { m_client->didRebindGraphicsContext(success); }
virtual void willCommit() OVERRIDE { m_client->willCommit(); }
#include "CCLayerTestCommon.h"
#include "CCTestCommon.h"
#include "FakeWebGraphicsContext3D.h"
-#include "GraphicsContext3DPrivate.h"
#include "LayerRendererChromium.h"
#include "ManagedTexture.h"
#include "cc/CCIOSurfaceLayerImpl.h"
virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { }
- PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassRefPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr)
+ PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOwnPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr)
{
CCSettings::setPartialSwapEnabled(partialSwap);
}
protected:
- PassRefPtr<CCGraphicsContext> createContext()
+ PassOwnPtr<CCGraphicsContext> createContext()
{
- return CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow));
+ return CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3D));
}
DebugScopedSetImplThread m_alwaysImplThread;
// viewport size is never set.
TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw)
{
- ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext();
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
- RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
- m_hostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader);
+ OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new ReshapeTrackerContext));
+ ReshapeTrackerContext* reshapeTracker = static_cast<ReshapeTrackerContext*>(ccContext->context3D());
+ m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader);
CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
root->setAnchorPoint(FloatPoint(0, 0));
// where it should request to swap only the subBuffer that is damaged.
TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
{
- PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext();
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
- RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
+ OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new PartialSwapTrackerContext));
+ PartialSwapTrackerContext* partialSwapTracker = static_cast<PartialSwapTrackerContext*>(ccContext->context3D());
// This test creates its own CCLayerTreeHostImpl, so
// that we can force partial swap enabled.
CCLayerTreeSettings settings;
CCSettings::setPartialSwapEnabled(true);
OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this);
- layerTreeHostImpl->initializeLayerRenderer(ccContext, UnthrottledUploader);
+ layerTreeHostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader);
layerTreeHostImpl->setViewportSize(IntSize(500, 500));
CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
TEST_F(CCLayerTreeHostImplTest, noPartialSwap)
{
- MockContext* mockContext = new MockContext();
- RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext));
+ MockContext* mockContext = static_cast<MockContext*>(context->context3D());
MockContextHarness harness(mockContext);
harness.mustDrawSolidQuad();
harness.mustSetScissor(0, 0, 10, 10);
// Run test case
- OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context, FakeLayerWithQuads::create(1));
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.release(), FakeLayerWithQuads::create(1));
CCLayerTreeHostImpl::FrameData frame;
EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
TEST_F(CCLayerTreeHostImplTest, partialSwap)
{
- MockContext* mockContext = new MockContext();
- RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext));
+ MockContext* mockContext = static_cast<MockContext*>(context->context3D());
MockContextHarness harness(mockContext);
harness.mustDrawSolidQuad();
harness.mustSetScissor(0, 0, 10, 10);
- OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context, FakeLayerWithQuads::create(1));
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.release(), FakeLayerWithQuads::create(1));
CCLayerTreeHostImpl::FrameData frame;
EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
TEST_F(CCLayerTreeHostImplTest, partialSwapNoUpdate)
{
- MockContext* mockContext = new MockContext();
- RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockContext));
+ MockContext* mockContext = static_cast<MockContext*>(context->context3D());
MockContextHarness harness(mockContext);
harness.mustDrawSolidQuad();
harness.mustDrawSolidQuad();
harness.mustSetScissor(0, 0, 10, 10);
- OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context, FakeLayerWithQuads::create(1));
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.release(), FakeLayerWithQuads::create(1));
// Draw once to make sure layer is not new
CCLayerTreeHostImpl::FrameData frame;
{
CCSettings::setPartialSwapEnabled(partialSwap);
- RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
CCLayerTreeSettings settings;
OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, client);
CCLayerTreeSettings settings;
CCSettings::setPartialSwapEnabled(true);
- RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this);
myHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
myHostImpl->setViewportSize(IntSize(10, 10));
TEST_F(CCLayerTreeHostImplTest, finishAllRenderingAfterContextLost)
{
// The context initialization will fail, but we should still be able to call finishAllRendering() without any ill effects.
- m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow)), UnthrottledUploader);
+ m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails)), UnthrottledUploader);
m_hostImpl->finishAllRendering();
}
ADD_FAILURE() << "Trying to bind texture id " << id;
}
- static PassRefPtr<GraphicsContext3D> createGraphicsContext()
- {
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow);
- }
-
private:
HashSet<unsigned> m_allocatedTextureIds;
};
return WebString();
}
-
- static PassRefPtr<GraphicsContext3D> createGraphicsContext()
- {
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface()), GraphicsContext3D::RenderDirectlyToHostWindow);
- }
};
class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D {
return WebString();
}
-
- static PassRefPtr<GraphicsContext3D> createGraphicsContext()
- {
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface()), GraphicsContext3D::RenderDirectlyToHostWindow);
- }
};
TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
rootLayer->addChild(ioSurfaceLayer.release());
// Use a context that supports IOSurfaces
- m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(FakeWebGraphicsContext3DWithIOSurface::createGraphicsContext()), UnthrottledUploader);
+ m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new FakeWebGraphicsContext3DWithIOSurface)), UnthrottledUploader);
m_hostImpl->setRootLayer(rootLayer.release());
// Lose the context, replacing it with a StrictWebGraphicsContext3DWithIOSurface,
// that will warn if any resource from the previous context gets used.
- m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(StrictWebGraphicsContext3DWithIOSurface::createGraphicsContext()), UnthrottledUploader);
+ m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(adoptPtr(new StrictWebGraphicsContext3DWithIOSurface)), UnthrottledUploader);
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
m_hostImpl->didDrawAllLayers(frame);
return WebString();
}
- PassRefPtr<GraphicsContext3D> createGraphicsContext()
- {
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(this), GraphicsContext3D::RenderDirectlyToHostWindow);
- }
-
unsigned numTextures() const { return m_numTextures; }
private:
ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(ioSurfaceLayer.release());
- // Lose the context, replacing it with a TrackingWebGraphicsContext3D, that
- // tracks the number of textures allocated. This pointer is owned by its
- // GraphicsContext3D.
- TrackingWebGraphicsContext3D* trackingWebGraphicsContext = new TrackingWebGraphicsContext3D();
- m_hostImpl->initializeLayerRenderer(CCGraphicsContext::create3D(trackingWebGraphicsContext->createGraphicsContext()), UnthrottledUploader);
+ // Lose the context, replacing it with a TrackingWebGraphicsContext3D (which the CCLayerTreeHostImpl takes ownership of).
+ OwnPtr<CCGraphicsContext> ccContext(CCGraphicsContext::create3D(adoptPtr(new TrackingWebGraphicsContext3D)));
+ TrackingWebGraphicsContext3D* trackingWebGraphicsContext = static_cast<TrackingWebGraphicsContext3D*>(ccContext->context3D());
+ m_hostImpl->initializeLayerRenderer(ccContext.release(), UnthrottledUploader);
m_hostImpl->setRootLayer(rootLayer.release());
TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground)
{
- MockDrawQuadsToFillScreenContext* mockContext = new MockDrawQuadsToFillScreenContext();
- RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new MockDrawQuadsToFillScreenContext));
+ MockDrawQuadsToFillScreenContext* mockContext = static_cast<MockDrawQuadsToFillScreenContext*>(context->context3D());
// Run test case
- OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context, CCLayerImpl::create(1));
+ OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.release(), CCLayerImpl::create(1));
myHostImpl->setBackgroundColor(Color::white);
// Verify one quad is drawn when transparent background set is not set.
static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, CCLayerImpl*& rootPtr, CCLayerImpl*& intermediateLayerPtr, CCLayerImpl*& surfaceLayerPtr, CCLayerImpl*& childPtr, const IntSize& rootSize)
{
- RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new PartialSwapContext()), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(adoptPtr(new PartialSwapContext));
layerTreeHostImpl->initializeLayerRenderer(context.release(), UnthrottledUploader);
layerTreeHostImpl->setViewportSize(rootSize);
virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
switch (impl->sourceFrameNumber()) {
case 0:
virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
// Number of textures used for draw should always be one.
EXPECT_EQ(1, context->numUsedTextures());
virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
switch (impl->sourceFrameNumber()) {
case 0:
virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
{
- CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context()->context3D()));
+ CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(impl->context()->context3D());
// Number of textures used for drawing should two except for frame 4
// where the viewport only contains one layer.
endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000));
}
- virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
+ virtual PassOwnPtr<WebGraphicsContext3D> createContext() OVERRIDE
{
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow);
+ return adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails);
}
virtual void afterTest()
endTestAfterDelay(ceil(CCSingleThreadProxy::animationTimerDelay() * 1000));
}
- virtual PassRefPtr<GraphicsContext3D> createContext() OVERRIDE
+ virtual PassOwnPtr<WebGraphicsContext3D> createContext() OVERRIDE
{
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails), GraphicsContext3D::RenderDirectlyToHostWindow);
+ return adoptPtr(new FakeWebGraphicsContext3DMakeCurrentFails);
}
virtual void afterTest()
{
}
-PassRefPtr<GraphicsContext3D> TestHooks::createContext()
+PassOwnPtr<WebGraphicsContext3D> TestHooks::createContext()
{
- GraphicsContext3D::Attributes attrs;
- WebGraphicsContext3D::Attributes webAttrs;
- webAttrs.alpha = attrs.alpha;
-
- OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs);
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ return CompositorFakeWebGraphicsContext3DWithTextureTracking::create(WebGraphicsContext3D::Attributes());
}
PassOwnPtr<MockLayerTreeHostImpl> MockLayerTreeHostImpl::create(TestHooks* testHooks, const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client)
m_testHooks->applyScrollAndScale(scrollDelta, scale);
}
- virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
+ virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE
{
return m_testHooks->createContext();
}
virtual void notifyAnimationStarted(double time) { }
virtual void notifyAnimationFinished(double time) { }
- virtual PassRefPtr<WebCore::GraphicsContext3D> createContext();
+ virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext();
};
class TimeoutTask;
protected:
void fullLifecycleTest(ThreadMode threadMode, DeferralMode deferralMode)
{
- GraphicsContext3D::Attributes attrs;
-
- RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
- RefPtr<CCGraphicsContext> ccMainContext = CCGraphicsContext::create3D(mainContext);
- RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
- RefPtr<CCGraphicsContext> ccImplContext = CCGraphicsContext::create3D(implContext);
+ RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext), GraphicsContext3D::RenderOffscreen);
+ OwnPtr<CCGraphicsContext> ccImplContext = CCGraphicsContext::create3D(adoptPtr(new MockCanvasContext));
MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
- MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get()));
+ MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(ccImplContext->context3D());
MockWebTextureUpdater updater;
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext), GraphicsContext3D::RenderDirectlyToHostWindow);
OwnPtr<Canvas2DLayerBridge> bridge = Canvas2DLayerBridge::create(mainContext.get(), IntSize(100, 100), Deferred, 1);
RefPtr<LayerChromium> layer = bridge->layer();
bridge.clear();
+++ /dev/null
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CompositorFakeGraphicsContext3D_h
-#define CompositorFakeGraphicsContext3D_h
-
-#include "CompositorFakeWebGraphicsContext3D.h"
-#include "GraphicsContext3D.h"
-#include "GraphicsContext3DPrivate.h"
-
-namespace WebCore {
-
-static PassRefPtr<GraphicsContext3D> createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes attrs)
-{
- WebKit::WebGraphicsContext3D::Attributes webAttrs;
- webAttrs.alpha = attrs.alpha;
-
- OwnPtr<WebKit::WebGraphicsContext3D> webContext = WebKit::CompositorFakeWebGraphicsContext3D::create(webAttrs);
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
-}
-
-}
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "DrawingBuffer.h"
-
-#include "CompositorFakeGraphicsContext3D.h"
-#include "LayerChromium.h"
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-
-using namespace WebCore;
-using namespace WebKit;
-
-namespace {
-
-TEST(DrawingBufferChromiumTest, opaqueFormats)
-{
- RefPtr<DrawingBuffer> buffer;
-
- GraphicsContext3D::Attributes alphaAttrs;
- alphaAttrs.alpha = true;
- GraphicsContext3D::Attributes opaqueAttrs;
- opaqueAttrs.alpha = false;
-
- RefPtr<GraphicsContext3D> alphaContext = createCompositorMockGraphicsContext3D(alphaAttrs);
- EXPECT_TRUE(alphaContext);
- RefPtr<GraphicsContext3D> opaqueContext = createCompositorMockGraphicsContext3D(opaqueAttrs);
- EXPECT_TRUE(opaqueContext);
-
- buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), DrawingBuffer::Preserve, DrawingBuffer::Alpha);
- EXPECT_FALSE(buffer->platformLayer()->opaque());
- buffer = DrawingBuffer::create(alphaContext.get(), IntSize(), DrawingBuffer::Discard, DrawingBuffer::Alpha);
- EXPECT_FALSE(buffer->platformLayer()->opaque());
-
- buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), DrawingBuffer::Preserve, DrawingBuffer::Opaque);
- EXPECT_TRUE(buffer->platformLayer()->opaque());
- buffer = DrawingBuffer::create(opaqueContext.get(), IntSize(), DrawingBuffer::Discard, DrawingBuffer::Opaque);
- EXPECT_TRUE(buffer->platformLayer()->opaque());
-}
-
-} // namespace
#include "config.h"
+#include "CompositorFakeWebGraphicsContext3D.h"
#include "cc/CCLayerTreeHost.h"
-#include "CompositorFakeGraphicsContext3D.h"
namespace WebCore {
virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { }
virtual void layout() OVERRIDE { }
virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { }
- virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
+ virtual PassOwnPtr<WebKit::WebGraphicsContext3D> createContext3D() OVERRIDE
{
- GraphicsContext3D::Attributes attrs;
- return createCompositorMockGraphicsContext3D(attrs);
+ WebKit::WebGraphicsContext3D::Attributes attrs;
+ return WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes());
}
virtual void didRecreateContext(bool success) OVERRIDE { }
virtual void willCommit() OVERRIDE { }
#include "config.h"
-#include "GraphicsContext3D.h"
-
#include "FakeWebGraphicsContext3D.h"
-#include "GraphicsContext3DPrivate.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using namespace WebCore;
using namespace WebKit;
-class FrameCountingContext : public FakeWebGraphicsContext3D {
-public:
- FrameCountingContext() : m_frame(0) { }
-
- // This method would normally do a glSwapBuffers under the hood.
- virtual void prepareTexture() { m_frame++; }
-
- int frameCount() { return m_frame; }
-
-private:
- int m_frame;
-};
-
-TEST(FakeGraphicsContext3DTest, CanOverrideManually)
-{
- GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
- FrameCountingContext& mockContext = *static_cast<FrameCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
-
- for (int i = 0; i < 10; i++) {
- context->clearColor(0, 0, 0, 1);
- context->prepareTexture();
- }
- context->finish();
-
- EXPECT_EQ(10, mockContext.frameCount());
-}
-
-
-class GMockContext : public FakeWebGraphicsContext3D {
-public:
- MOCK_METHOD0(getError, WGC3Denum());
-};
-
-TEST(FakeGraphicsContext3DTest, CanUseGMock)
-{
- GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new GMockContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
- GMockContext& mockContext = *static_cast<GMockContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
-
- EXPECT_CALL(mockContext, getError())
- .WillRepeatedly(testing::Return(314));
-
- // It's OK to call methods GMock doesn't know about.
- context->makeContextCurrent();
-
- // Check that the mocked method is returning as intended.
- for (int i = 0; i < 10; i++)
- EXPECT_EQ((int)context->getError(), 314);
-}
-
class ContextThatCountsMakeCurrents : public FakeWebGraphicsContext3D {
public:
ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { }
};
-TEST(FakeGraphicsContext3DTest, ContextForThisThreadShouldNotMakeCurrent)
-{
- GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), GraphicsContext3D::RenderDirectlyToHostWindow);
- EXPECT_TRUE(context);
- ContextThatCountsMakeCurrents& mockContext = *static_cast<ContextThatCountsMakeCurrents*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
- EXPECT_EQ(0, mockContext.makeCurrentCount());
-}
-
-TEST(FakeGraphicsContext3DTest, ContextForAnotherThreadShouldNotMakeCurrent)
+TEST(FakeGraphicsContext3DTest, ContextCreationShouldNotMakeCurrent)
{
- GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ OwnPtr<ContextThatCountsMakeCurrents> context(adoptPtr(new ContextThatCountsMakeCurrents));
EXPECT_TRUE(context);
- ContextThatCountsMakeCurrents& mockContext = *static_cast<ContextThatCountsMakeCurrents*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
- EXPECT_EQ(0, mockContext.makeCurrentCount());
+ EXPECT_EQ(0, context->makeCurrentCount());
}
#include "GraphicsLayerChromium.h"
#include "CCAnimationTestCommon.h"
-#include "CompositorFakeGraphicsContext3D.h"
+#include "CompositorFakeWebGraphicsContext3D.h"
#include "GraphicsContext3D.h"
#include "GraphicsContext3DPrivate.h"
#include "GraphicsLayer.h"
#include "cc/CCSingleThreadProxy.h"
#include <gtest/gtest.h>
+#include <public/WebGraphicsContext3D.h>
#include <wtf/PassOwnPtr.h>
using namespace WebCore;
virtual void updateAnimations(double frameBeginTime) OVERRIDE { }
virtual void layout() OVERRIDE { }
virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) OVERRIDE { }
- virtual PassRefPtr<GraphicsContext3D> createContext3D() OVERRIDE
+ virtual PassOwnPtr<WebGraphicsContext3D> createContext3D() OVERRIDE
{
- GraphicsContext3D::Attributes attrs;
- return createCompositorMockGraphicsContext3D(attrs);
+ return CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes());
}
virtual void didRecreateContext(bool success) OVERRIDE { }
virtual void willCommit() OVERRIDE { }
#include "CCTestCommon.h"
#include "FakeWebGraphicsContext3D.h"
#include "GraphicsContext3D.h"
-#include "GraphicsContext3DPrivate.h"
#include "WebCompositor.h"
#include "cc/CCDrawQuad.h"
#include "cc/CCSettings.h"
class FakeLayerRendererChromium : public LayerRendererChromium {
public:
- FakeLayerRendererChromium(CCRendererClient* client, PassRefPtr<GraphicsContext3D> context) : LayerRendererChromium(client, context, UnthrottledUploader) { }
+ FakeLayerRendererChromium(CCRendererClient* client, WebGraphicsContext3D* context) : LayerRendererChromium(client, context, UnthrottledUploader) { }
// LayerRendererChromium methods.
LayerRendererChromiumTest()
: m_suggestHaveBackbufferYes(1, true)
, m_suggestHaveBackbufferNo(1, false)
- , m_context(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingMemoryAllocationSettingContext()), GraphicsContext3D::RenderDirectlyToHostWindow))
- , m_mockContext(*static_cast<FrameCountingMemoryAllocationSettingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_context.get())))
- , m_layerRendererChromium(&m_mockClient, m_context.release())
+ , m_context(adoptPtr(new FrameCountingMemoryAllocationSettingContext))
+ , m_layerRendererChromium(&m_mockClient, m_context.get())
{
}
WebGraphicsMemoryAllocation m_suggestHaveBackbufferYes;
WebGraphicsMemoryAllocation m_suggestHaveBackbufferNo;
- RefPtr<GraphicsContext3D> m_context;
- FrameCountingMemoryAllocationSettingContext& m_mockContext;
+ OwnPtr<FrameCountingMemoryAllocationSettingContext> m_context;
FakeCCRendererClient m_mockClient;
FakeLayerRendererChromium m_layerRendererChromium;
CCScopedSettings m_scopedSettings;
// Expected: it does nothing.
TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing)
{
- m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferYes);
+ m_context->setMemoryAllocation(m_suggestHaveBackbufferYes);
EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount());
EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
swapBuffers();
- EXPECT_EQ(1, m_mockContext.frameCount());
+ EXPECT_EQ(1, m_context->frameCount());
}
// Test LayerRendererChromium discardFramebuffer functionality:
TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible)
{
m_layerRendererChromium.setVisible(false);
- m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ m_context->setMemoryAllocation(m_suggestHaveBackbufferNo);
EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
}
TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoDoNothingWhenVisible)
{
m_layerRendererChromium.setVisible(true);
- m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ m_context->setMemoryAllocation(m_suggestHaveBackbufferNo);
EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount());
EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
}
TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing)
{
m_layerRendererChromium.setVisible(false);
- m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ m_context->setMemoryAllocation(m_suggestHaveBackbufferNo);
EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
- m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ m_context->setMemoryAllocation(m_suggestHaveBackbufferNo);
EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
}
TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration)
{
m_layerRendererChromium.setVisible(false);
- m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ m_context->setMemoryAllocation(m_suggestHaveBackbufferNo);
EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
swapBuffers();
- EXPECT_EQ(1, m_mockContext.frameCount());
+ EXPECT_EQ(1, m_context->frameCount());
}
TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisible)
{
m_layerRendererChromium.setVisible(false);
- m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
+ m_context->setMemoryAllocation(m_suggestHaveBackbufferNo);
EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
{
CCScopedSettings scopedSettings;
FakeCCRendererClient mockClient;
- FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ForbidSynchronousCallContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<WebGraphicsContext3D> context(adoptPtr(new ForbidSynchronousCallContext));
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get());
EXPECT_TRUE(layerRendererChromium.initialize());
}
{
CCScopedSettings scopedSettings;
FakeCCRendererClient mockClient;
- FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new LoseContextOnFirstGetContext), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<WebGraphicsContext3D> context(adoptPtr(new LoseContextOnFirstGetContext));
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get());
layerRendererChromium.initialize();
}
TEST(LayerRendererChromiumTest2, initializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation)
{
FakeCCRendererClient mockClient;
- FakeLayerRendererChromium layerRendererChromium(&mockClient, GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions), GraphicsContext3D::RenderDirectlyToHostWindow));
+ OwnPtr<WebGraphicsContext3D> context(adoptPtr(new ContextThatDoesNotSupportMemoryManagmentExtensions));
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get());
layerRendererChromium.initialize();
TEST(LayerRendererChromiumTest2, opaqueBackground)
{
FakeCCRendererClient mockClient;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow);
- FakeLayerRendererChromium layerRendererChromium(&mockClient, context);
+ OwnPtr<ClearCountingContext> context(adoptPtr(new ClearCountingContext));
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get());
mockClient.rootRenderPass()->setHasTransparentBackground(false);
// On DEBUG builds, render passes with opaque background clear to blue to
// easily see regions that were not drawn on the screen.
#if defined(NDEBUG)
- EXPECT_EQ(0, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
+ EXPECT_EQ(0, context->clearCount());
#else
- EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
+ EXPECT_EQ(1, context->clearCount());
#endif
}
TEST(LayerRendererChromiumTest2, transparentBackground)
{
FakeCCRendererClient mockClient;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow);
- FakeLayerRendererChromium layerRendererChromium(&mockClient, context);
+ OwnPtr<ClearCountingContext> context(adoptPtr(new ClearCountingContext));
+ FakeLayerRendererChromium layerRendererChromium(&mockClient, context.get());
mockClient.rootRenderPass()->setHasTransparentBackground(true);
layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect());
layerRendererChromium.finishDrawingFrame();
- EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
+ EXPECT_EQ(1, context->clearCount());
}
TEST(TextureCopierTest, testDrawArraysCopy)
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
- MockContext& mockContext = *static_cast<MockContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
- RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
+ OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(adoptPtr(new MockContext));
+ MockContext& mockContext = *static_cast<MockContext*>(ccContext->context3D());
{
InSequence sequence;
int sourceTextureId = 1;
int destTextureId = 2;
IntSize size(256, 128);
- OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(context));
+ OwnPtr<AcceleratedTextureCopier> copier(AcceleratedTextureCopier::create(ccContext->context3D()));
copier->copyTexture(ccContext.get(), sourceTextureId, destTextureId, size);
}
TEST(ThrottledTextureUploaderTest, IsBusy)
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting()), GraphicsContext3D::RenderDirectlyToHostWindow);
- FakeWebGraphicsContext3DWithQueryTesting& fakeContext = *static_cast<FakeWebGraphicsContext3DWithQueryTesting*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
- OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(context, 2);
+ OwnPtr<FakeWebGraphicsContext3DWithQueryTesting> fakeContext(adoptPtr(new FakeWebGraphicsContext3DWithQueryTesting));
+ OwnPtr<ThrottledTextureUploader> uploader = ThrottledTextureUploader::create(fakeContext.get(), 2);
- fakeContext.setResultAvailable(0);
+ fakeContext->setResultAvailable(0);
EXPECT_FALSE(uploader->isBusy());
uploader->beginUploads();
uploader->endUploads();
uploader->endUploads();
EXPECT_TRUE(uploader->isBusy());
- fakeContext.setResultAvailable(1);
+ fakeContext->setResultAvailable(1);
EXPECT_FALSE(uploader->isBusy());
uploader->beginUploads();
uploader->endUploads();
FakeTextureAllocator fakeAllocator;
FakeTextureCopier fakeCopier;
FakeTextureUploader fakeUploader;
- RefPtr<GraphicsContext3D> context = createCompositorMockGraphicsContext3D(GraphicsContext3D::Attributes());
- RefPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(context);
+ OwnPtr<CCGraphicsContext> ccContext = CCGraphicsContext::create3D(WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes()));
// The tile size is 100x100, so this invalidates and then paints two tiles.
layer->setBounds(IntSize(100, 200));