diff options
71 files changed, 384 insertions, 577 deletions
diff --git a/cc/bitmap_canvas_layer_texture_updater.cc b/cc/bitmap_canvas_layer_texture_updater.cc index 3976995..d469d3b 100644 --- a/cc/bitmap_canvas_layer_texture_updater.cc +++ b/cc/bitmap_canvas_layer_texture_updater.cc @@ -49,7 +49,7 @@ scoped_ptr<LayerTextureUpdater::Texture> BitmapCanvasLayerTextureUpdater::create return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); } -LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampledTexelFormat(GC3Denum textureFormat) +LayerTextureUpdater::SampledTexelFormat BitmapCanvasLayerTextureUpdater::sampledTexelFormat(GLenum textureFormat) { // The component order may be bgra if we uploaded bgra pixels to rgba textures. return PlatformColor::sameComponentOrder(textureFormat) ? diff --git a/cc/bitmap_canvas_layer_texture_updater.h b/cc/bitmap_canvas_layer_texture_updater.h index 9b40b5a..a484f7f 100644 --- a/cc/bitmap_canvas_layer_texture_updater.h +++ b/cc/bitmap_canvas_layer_texture_updater.h @@ -35,7 +35,7 @@ public: static scoped_refptr<BitmapCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; - virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; + virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE; virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE; void updateTexture(CCTextureUpdateQueue&, CCPrioritizedTexture*, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate); diff --git a/cc/bitmap_skpicture_canvas_layer_texture_updater.cc b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc index cb06ea8..3887746 100644 --- a/cc/bitmap_skpicture_canvas_layer_texture_updater.cc +++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc @@ -60,7 +60,7 @@ scoped_ptr<LayerTextureUpdater::Texture> BitmapSkPictureCanvasLayerTextureUpdate return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); } -LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GC3Denum textureFormat) +LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GLenum textureFormat) { // The component order may be bgra if we uploaded bgra pixels to rgba textures. return PlatformColor::sameComponentOrder(textureFormat) ? diff --git a/cc/bitmap_skpicture_canvas_layer_texture_updater.h b/cc/bitmap_skpicture_canvas_layer_texture_updater.h index 260557d..f499129 100644 --- a/cc/bitmap_skpicture_canvas_layer_texture_updater.h +++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.h @@ -30,7 +30,7 @@ public: static scoped_refptr<BitmapSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; - virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; + virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE; void paintContentsRect(SkCanvas*, const IntRect& sourceRect, CCRenderingStats&); private: @@ -339,15 +339,11 @@ ], 'sources': [ '<@(cc_source_files)', - 'stubs/Extensions3D.h', - 'stubs/Extensions3DChromium.h', 'stubs/FloatPoint.h', 'stubs/FloatPoint3D.h', 'stubs/FloatQuad.h', 'stubs/FloatRect.h', 'stubs/FloatSize.h', - 'stubs/GraphicsContext3D.h', - 'stubs/GraphicsTypes3D.h', 'stubs/IntPoint.h', 'stubs/IntRect.h', 'stubs/IntSize.h', @@ -358,15 +354,11 @@ 'stubs/UnitBezier.h', 'stubs/config.h', - 'stubs/extensions_3d_chromium.h', - 'stubs/extensions_3d.h', 'stubs/float_point_3d.h', 'stubs/float_point.h', 'stubs/float_quad.h', 'stubs/float_rect.h', 'stubs/float_size.h', - 'stubs/graphics_context_3d.h', - 'stubs/graphics_types_3d.h', 'stubs/int_point.h', 'stubs/int_rect.h', 'stubs/int_size.h', diff --git a/cc/content_layer.cc b/cc/content_layer.cc index 32ff381..6de4dff 100644 --- a/cc/content_layer.cc +++ b/cc/content_layer.cc @@ -96,7 +96,7 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(painter.Pass()); m_textureUpdater->setOpaque(contentsOpaque()); - GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; + GLenum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc index 68deadb..444c15f 100644 --- a/cc/direct_renderer.cc +++ b/cc/direct_renderer.cc @@ -130,7 +130,7 @@ void CCDirectRenderer::decideRenderPassAllocationsForFrame(const CCRenderPassLis const CCRenderPass* renderPassInFrame = it->second; const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); - GC3Denum requiredFormat = renderPassTextureFormat(renderPassInFrame); + GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame); CachedTexture* texture = passIterator->second; DCHECK(texture); @@ -229,9 +229,9 @@ IntSize CCDirectRenderer::renderPassTextureSize(const CCRenderPass* pass) } // static -GC3Denum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) +GLenum CCDirectRenderer::renderPassTextureFormat(const CCRenderPass*) { - return GraphicsContext3D::RGBA; + return GL_RGBA; } } diff --git a/cc/direct_renderer.h b/cc/direct_renderer.h index 73e6dc6..edf4001 100644 --- a/cc/direct_renderer.h +++ b/cc/direct_renderer.h @@ -77,7 +77,7 @@ protected: bool haveCachedResources(CCRenderPass::Id) const; static IntSize renderPassTextureSize(const CCRenderPass*); - static GC3Denum renderPassTextureFormat(const CCRenderPass*); + static GLenum renderPassTextureFormat(const CCRenderPass*); void drawRenderPass(DrawingFrame&, const CCRenderPass*); bool useRenderPass(DrawingFrame&, const CCRenderPass*); diff --git a/cc/draw_quad_unittest.cc b/cc/draw_quad_unittest.cc index aefe039..e9f1722 100644 --- a/cc/draw_quad_unittest.cc +++ b/cc/draw_quad_unittest.cc @@ -256,7 +256,7 @@ TEST(CCDrawQuadTest, copyTileDrawQuad) unsigned resourceId = 104; IntPoint textureOffset(-31, 47); IntSize textureSize(85, 32); - GC3Dint textureFilter = 82; + GLint textureFilter = 82; bool swizzleContents = true; bool leftEdgeAA = true; bool topEdgeAA = true; diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc index 284fa5e..2ad718c 100644 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc +++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc @@ -44,7 +44,7 @@ scoped_ptr<LayerTextureUpdater::Texture> FrameBufferSkPictureCanvasLayerTextureU return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); } -LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GC3Denum textureFormat) +LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GLenum textureFormat) { // Here we directly render to the texture, so the component order is always correct. return LayerTextureUpdater::SampledTexelFormatRGBA; diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h index 25981a5..0531637 100644 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h +++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h @@ -31,7 +31,7 @@ public: static scoped_refptr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); virtual scoped_ptr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; - virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; + virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE; private: explicit FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); diff --git a/cc/geometry_binding.cc b/cc/geometry_binding.cc index f1ab929..0f5fb6b 100644 --- a/cc/geometry_binding.cc +++ b/cc/geometry_binding.cc @@ -6,8 +6,8 @@ #include "cc/geometry_binding.h" +#include "third_party/khronos/GLES2/gl2.h" #include "CCRendererGL.h" // For the GLC() macro. -#include "GraphicsContext3D.h" #include <public/WebGraphicsContext3D.h> namespace cc { @@ -28,10 +28,10 @@ GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context, const Fl GLC(m_context, m_quadVerticesVbo = m_context->createBuffer()); GLC(m_context, m_quadElementsVbo = m_context->createBuffer()); - GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_quadVerticesVbo)); - GLC(m_context, m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, sizeof(vertices), vertices, GraphicsContext3D::STATIC_DRAW)); - GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, m_quadElementsVbo)); - GLC(m_context, m_context->bufferData(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GraphicsContext3D::STATIC_DRAW)); + GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, m_quadVerticesVbo)); + GLC(m_context, m_context->bufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW)); + GLC(m_context, m_context->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_quadElementsVbo)); + GLC(m_context, m_context->bufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW)); m_initialized = true; } @@ -44,12 +44,12 @@ GeometryBinding::~GeometryBinding() void GeometryBinding::prepareForDraw() { - GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, quadVerticesVbo())); - GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, quadElementsVbo())); + GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, quadVerticesVbo())); + GLC(m_context, m_context->bindBuffer(GL_ELEMENT_ARRAY_BUFFER, quadElementsVbo())); unsigned offset = 0; - GLC(m_context, m_context->vertexAttribPointer(positionAttribLocation(), 3, GraphicsContext3D::FLOAT, false, 5 * sizeof(float), offset)); + GLC(m_context, m_context->vertexAttribPointer(positionAttribLocation(), 3, GL_FLOAT, false, 5 * sizeof(float), offset)); offset += 3 * sizeof(float); - GLC(m_context, m_context->vertexAttribPointer(texCoordAttribLocation(), 2, GraphicsContext3D::FLOAT, false, 5 * sizeof(float), offset)); + GLC(m_context, m_context->vertexAttribPointer(texCoordAttribLocation(), 2, GL_FLOAT, false, 5 * sizeof(float), offset)); GLC(m_context, m_context->enableVertexAttribArray(positionAttribLocation())); GLC(m_context, m_context->enableVertexAttribArray(texCoordAttribLocation())); } diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc index d4dbce5..6f60483 100644 --- a/cc/gl_renderer.cc +++ b/cc/gl_renderer.cc @@ -6,6 +6,8 @@ #include "CCRendererGL.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include "CCDamageTracker.h" #include "CCLayerQuad.h" #include "CCMathUtil.h" @@ -16,7 +18,6 @@ #include "CCSettings.h" #include "CCSingleThreadProxy.h" #include "CCVideoLayerImpl.h" -#include "Extensions3D.h" #include "FloatQuad.h" #include "GrTexture.h" #include "NotImplemented.h" @@ -89,7 +90,7 @@ bool CCRendererGL::initialize() m_context->setContextLostCallback(this); m_context->pushGroupMarkerEXT("CompositorContext"); - std::string extensionsString = UTF16ToASCII(m_context->getString(GraphicsContext3D::EXTENSIONS)); + std::string extensionsString = UTF16ToASCII(m_context->getString(GL_EXTENSIONS)); std::vector<std::string> extensionsList; base::SplitString(extensionsString, ' ', &extensionsList); std::set<string> extensions(extensionsList.begin(), extensionsList.end()); @@ -124,7 +125,7 @@ bool CCRendererGL::initialize() m_capabilities.usingEglImage = extensions.count("GL_OES_EGL_image_external"); - GLC(m_context, m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_capabilities.maxTextureSize)); + GLC(m_context, m_context->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_capabilities.maxTextureSize)); m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_context, extensions.count("GL_EXT_texture_format_BGRA8888")); m_isUsingBindUniform = extensions.count("GL_CHROMIUM_bind_uniform_location"); @@ -159,7 +160,7 @@ WebGraphicsContext3D* CCRendererGL::context() void CCRendererGL::debugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) { unsigned long error = context->getError(); - if (error != GraphicsContext3D::NO_ERROR) + if (error != GL_NO_ERROR) LOG(ERROR) << "GL command failed: File: " << file << "\n\tLine " << line << "\n\tcommand: " << command << ", error " << static_cast<int>(error) << "\n"; } @@ -198,7 +199,7 @@ void CCRendererGL::clearFramebuffer(DrawingFrame& frame) #ifdef NDEBUG if (frame.currentRenderPass->hasTransparentBackground()) #endif - m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); + m_context->clear(GL_COLOR_BUFFER_BIT); } void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) @@ -222,25 +223,25 @@ void CCRendererGL::beginDrawingFrame(DrawingFrame& frame) // Bind the common vertex attributes used for drawing all the layers. m_sharedGeometry->prepareForDraw(); - GLC(m_context, m_context->disable(GraphicsContext3D::DEPTH_TEST)); - GLC(m_context, m_context->disable(GraphicsContext3D::CULL_FACE)); + GLC(m_context, m_context->disable(GL_DEPTH_TEST)); + GLC(m_context, m_context->disable(GL_CULL_FACE)); GLC(m_context, m_context->colorMask(true, true, true, true)); - GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); - GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); + GLC(m_context, m_context->enable(GL_BLEND)); + GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); } void CCRendererGL::doNoOp() { - GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); + GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); GLC(m_context, m_context->flush()); } void CCRendererGL::drawQuad(DrawingFrame& frame, const CCDrawQuad* quad) { if (quad->needsBlending()) - GLC(m_context, m_context->enable(GraphicsContext3D::BLEND)); + GLC(m_context, m_context->enable(GL_BLEND)); else - GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); + GLC(m_context, m_context->disable(GL_BLEND)); switch (quad->material()) { case CCDrawQuad::Invalid: @@ -324,7 +325,7 @@ void CCRendererGL::drawDebugBorderQuad(const DrawingFrame& frame, const CCDebugB GLC(context(), context()->lineWidth(quad->width())); // The indices for the line are stored in the same array as the triangle indices. - GLC(context(), context()->drawElements(GraphicsContext3D::LINE_LOOP, 4, GraphicsContext3D::UNSIGNED_SHORT, 6 * sizeof(unsigned short))); + GLC(context(), context()->drawElements(GL_LINE_LOOP, 4, GL_UNSIGNED_SHORT, 6 * sizeof(unsigned short))); } static inline SkBitmap applyFilters(CCRendererGL* renderer, const WebKit::WebFilterOperations& filters, CCScopedTexture* sourceTexture) @@ -394,7 +395,7 @@ scoped_ptr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); scoped_ptr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resourceProvider); - if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer)) + if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size(), GL_RGBA, CCResourceProvider::TextureUsageFramebuffer)) return scoped_ptr<CCScopedTexture>(); const CCRenderPass* targetRenderPass = frame.currentRenderPass; @@ -479,8 +480,8 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra // FIXME: use the backgroundTexture and blend the background in with this draw instead of having a separate copy of the background texture. - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - context()->bindTexture(GraphicsContext3D::TEXTURE_2D, contentsTextureId); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); + context()->bindTexture(GL_TEXTURE_2D, contentsTextureId); int shaderQuadLocation = -1; int shaderEdgeLocation = -1; @@ -532,12 +533,12 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra if (shaderMaskSamplerLocation != -1) { DCHECK(shaderMaskTexCoordScaleLocation != 1); DCHECK(shaderMaskTexCoordOffsetLocation != 1); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); + GLC(context(), context()->activeTexture(GL_TEXTURE1)); GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, quad->maskTexCoordScaleX(), quad->maskTexCoordScaleY())); GLC(context(), context()->uniform2f(shaderMaskTexCoordOffsetLocation, quad->maskTexCoordOffsetX(), quad->maskTexCoordOffsetY())); - context()->bindTexture(GraphicsContext3D::TEXTURE_2D, maskTextureId); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + context()->bindTexture(GL_TEXTURE_2D, maskTextureId); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); } if (shaderEdgeLocation != -1) { @@ -663,11 +664,11 @@ void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* GLC(context(), context()->useProgram(uniforms.program)); GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId()); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId())); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, quad->textureFilter())); - GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, quad->textureFilter())); + GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textureId())); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, quad->textureFilter())); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, quad->textureFilter())); bool useAA = !clipped && quad->isAntialiased(); if (useAA) { @@ -774,12 +775,12 @@ void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoD CCResourceProvider::ScopedReadLockGL yPlaneLock(m_resourceProvider, yPlane.resourceId); CCResourceProvider::ScopedReadLockGL uPlaneLock(m_resourceProvider, uPlane.resourceId); CCResourceProvider::ScopedReadLockGL vPlaneLock(m_resourceProvider, vPlane.resourceId); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE1)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, yPlaneLock.textureId())); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE2)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, uPlaneLock.textureId())); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE3)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, vPlaneLock.textureId())); + GLC(context(), context()->activeTexture(GL_TEXTURE1)); + GLC(context(), context()->bindTexture(GL_TEXTURE_2D, yPlaneLock.textureId())); + GLC(context(), context()->activeTexture(GL_TEXTURE2)); + GLC(context(), context()->bindTexture(GL_TEXTURE_2D, uPlaneLock.textureId())); + GLC(context(), context()->activeTexture(GL_TEXTURE3)); + GLC(context(), context()->bindTexture(GL_TEXTURE_2D, vPlaneLock.textureId())); GLC(context(), context()->useProgram(program->program())); @@ -819,7 +820,7 @@ void CCRendererGL::drawYUVVideoQuad(const DrawingFrame& frame, const CCYUVVideoD drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation()); // Reset active texture back to texture 0. - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); } void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStreamVideoDrawQuad* quad) @@ -834,8 +835,8 @@ void CCRendererGL::drawStreamVideoQuad(const DrawingFrame& frame, const CCStream toGLMatrix(&glMatrix[0], quad->matrix()); GLC(context(), context()->uniformMatrix4fv(program->vertexShader().texMatrixLocation(), 1, false, glMatrix)); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context(), context()->bindTexture(Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES, quad->textureId())); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); + GLC(context(), context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, quad->textureId())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -881,16 +882,16 @@ void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDra const FloatRect& uvRect = quad->uvRect(); GLC(context(), context()->uniform4f(binding.texTransformLocation, uvRect.x(), uvRect.y(), uvRect.width(), uvRect.height())); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); CCResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad->resourceId()); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quadResourceLock.textureId())); + GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textureId())); // FIXME: setting the texture parameters every time is redundant. Move this code somewhere // where it will only happen once per texture. - 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)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); if (!quad->premultipliedAlpha()) { // As it turns out, the premultiplied alpha blending function (ONE, ONE_MINUS_SRC_ALPHA) @@ -901,14 +902,14 @@ void CCRendererGL::drawTextureQuad(const DrawingFrame& frame, const CCTextureDra // https://bugs.webkit.org/show_bug.cgi?id=82412), so in this situation, use a separate // blend function for the alpha channel to avoid modifying it. Don't use colorMask for this // as it has performance implications on some platforms. - GLC(context(), context()->blendFuncSeparate(GraphicsContext3D::SRC_ALPHA, GraphicsContext3D::ONE_MINUS_SRC_ALPHA, GraphicsContext3D::ZERO, GraphicsContext3D::ONE)); + GLC(context(), context()->blendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE)); } setShaderOpacity(quad->opacity(), binding.alphaLocation); drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.matrixLocation); if (!quad->premultipliedAlpha()) - GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); + GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); } void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfaceDrawQuad* quad) @@ -924,13 +925,13 @@ void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfac else GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0, quad->ioSurfaceSize().width(), quad->ioSurfaceSize().height())); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, quad->ioSurfaceTextureId())); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); + GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, quad->ioSurfaceTextureId())); setShaderOpacity(quad->opacity(), binding.alphaLocation); drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.matrixLocation); - GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); + GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); } void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) @@ -938,8 +939,8 @@ void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) m_currentFramebufferLock.reset(); m_swapBufferRect.unite(enclosingIntRect(frame.rootDamageRect)); - GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); - GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); + GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); + GLC(m_context, m_context->disable(GL_BLEND)); } bool CCRendererGL::flippedFramebuffer() const @@ -998,19 +999,19 @@ void CCRendererGL::drawQuadGeometry(const DrawingFrame& frame, const WebKit::Web toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatrix[0])); - GLC(m_context, m_context->drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0)); + GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); } void CCRendererGL::copyTextureToFramebuffer(const DrawingFrame& frame, int textureId, const IntRect& rect, const WebTransformationMatrix& drawMatrix) { const RenderPassProgram* program = renderPassProgram(); - GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - 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)); + GLC(context(), context()->activeTexture(GL_TEXTURE0)); + GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); + GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); GLC(context(), context()->useProgram(program->program())); GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); @@ -1097,7 +1098,7 @@ void CCRendererGL::discardFramebuffer() return; // FIXME: Update attachments argument to appropriate values once they are no longer ignored. - m_context->discardFramebufferEXT(GraphicsContext3D::TEXTURE_2D, 0, 0); + m_context->discardFramebufferEXT(GL_TEXTURE_2D, 0, 0); m_isFramebufferDiscarded = true; // Damage tracker needs a full reset every time framebuffer is discarded. @@ -1134,8 +1135,8 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) bool doWorkaround = needsIOSurfaceReadbackWorkaround(); - Platform3DObject temporaryTexture = 0; - Platform3DObject temporaryFBO = 0; + GLuint temporaryTexture = 0; + GLuint temporaryFBO = 0; if (doWorkaround) { // On Mac OS X, calling glReadPixels against an FBO whose color attachment is an @@ -1144,24 +1145,24 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) // http://crbug.com/99393. <rdar://problem/10949687> 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)); + GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, temporaryTexture)); + GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); + GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); + GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); // Copy the contents of the current (IOSurface-backed) framebuffer into a temporary texture. - GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 0, 0, viewportSize().width(), viewportSize().height(), 0)); + GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, viewportSize().width(), viewportSize().height(), 0)); temporaryFBO = m_context->createFramebuffer(); // Attach this texture to an FBO, and perform the readback from that FBO. - 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)); + GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, temporaryFBO)); + GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, temporaryTexture, 0)); - DCHECK(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); + DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); } scoped_array<uint8_t> srcPixels(new uint8_t[rect.width() * rect.height() * 4]); GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rect.maxY(), rect.width(), rect.height(), - GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, srcPixels.get())); + GL_RGBA, GL_UNSIGNED_BYTE, srcPixels.get())); uint8_t* destPixels = static_cast<uint8_t*>(pixels); size_t rowBytes = rect.width() * 4; @@ -1181,8 +1182,8 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) if (doWorkaround) { // Clean up. - GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); + GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); + GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0)); GLC(m_context, m_context->deleteFramebuffer(temporaryFBO)); GLC(m_context, m_context->deleteTexture(temporaryTexture)); } @@ -1192,14 +1193,14 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) { - DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); + DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GL_RGB)); - if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GraphicsContext3D::RGB, CCResourceProvider::TextureUsageAny)) + if (!texture->id() && !texture->allocate(CCRenderer::ImplPool, deviceRect.size(), GL_RGB, CCResourceProvider::TextureUsageAny)) return false; CCResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId())); - GLC(m_context, m_context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, texture->format(), + GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, lock.textureId())); + GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, texture->format(), deviceRect.x(), deviceRect.y(), deviceRect.width(), deviceRect.height(), 0)); return true; } @@ -1216,19 +1217,19 @@ bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) { m_currentFramebufferLock.reset(); - GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); + GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); } bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedTexture* texture, const IntRect& framebufferRect) { DCHECK(texture->id()); - GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId)); + GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebufferId)); m_currentFramebufferLock = make_scoped_ptr(new CCResourceProvider::ScopedWriteLockGL(m_resourceProvider, texture->id())); unsigned textureId = m_currentFramebufferLock->textureId(); - GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId, 0)); + GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0)); - DCHECK(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); + DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); initializeMatrices(frame, framebufferRect, false); setDrawViewportSize(framebufferRect.size()); @@ -1238,13 +1239,13 @@ bool CCRendererGL::bindFramebufferToTexture(DrawingFrame& frame, const CCScopedT void CCRendererGL::enableScissorTestRect(const IntRect& scissorRect) { - GLC(m_context, m_context->enable(GraphicsContext3D::SCISSOR_TEST)); + GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorRect.width(), scissorRect.height())); } void CCRendererGL::disableScissorTest() { - GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST)); + GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); } void CCRendererGL::setDrawViewportSize(const IntSize& viewportSize) @@ -1514,7 +1515,7 @@ void CCRendererGL::cleanupSharedObjects() bool CCRendererGL::isContextLost() { - return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); + return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); } } // namespace cc diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h index 617c9a8..57e554b 100644 --- a/cc/gl_renderer.h +++ b/cc/gl_renderer.h @@ -18,7 +18,6 @@ #include "CCTextureDrawQuad.h" #include "CCTileDrawQuad.h" #include "CCYUVVideoDrawQuad.h" -#include "Extensions3DChromium.h" namespace WebKit { class WebGraphicsContext3D; diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index b8c47c7..f1f03d9 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -10,13 +10,13 @@ #include "CCResourceProvider.h" #include "CCSettings.h" #include "CCSingleThreadProxy.h" -#include "GraphicsContext3D.h" #include "cc/test/fake_web_compositor_output_surface.h" #include "cc/test/fake_web_graphics_context_3d.h" #include "cc/test/test_common.h" #include "cc/test/web_compositor_initializer.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/khronos/GLES2/gl2.h" #include <public/WebTransformationMatrix.h> using namespace cc; @@ -34,7 +34,7 @@ public: virtual void setMemoryAllocationChangedCallbackCHROMIUM(WebGraphicsMemoryAllocationChangedCallbackCHROMIUM* callback) { m_memoryAllocationChangedCallback = callback; } virtual WebString getString(WebKit::WGC3Denum name) { - if (name == GraphicsContext3D::EXTENSIONS) + if (name == GL_EXTENSIONS) return WebString("GL_CHROMIUM_set_visibility GL_CHROMIUM_gpu_memory_manager GL_CHROMIUM_discard_framebuffer"); return WebString(); } @@ -241,7 +241,7 @@ public: virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) { ADD_FAILURE(); } virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) { - if (pname == GraphicsContext3D::MAX_TEXTURE_SIZE) + if (pname == GL_MAX_TEXTURE_SIZE) *value = 1024; // MAX_TEXTURE_SIZE is cached client side, so it's OK to query. else ADD_FAILURE(); @@ -270,7 +270,7 @@ public: { // We allow querying the extension string. // FIXME: It'd be better to check that we only do this before starting any other expensive work (like starting a compilation) - if (name != GraphicsContext3D::EXTENSIONS) + if (name != GL_EXTENSIONS) ADD_FAILURE(); return WebString(); } diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc index c6a46b8..1904baf 100644 --- a/cc/heads_up_display_layer_impl.cc +++ b/cc/heads_up_display_layer_impl.cc @@ -6,20 +6,21 @@ #include "CCHeadsUpDisplayLayerImpl.h" -#include "base/stringprintf.h" -#include "ui/gfx/point.h" #include "CCDebugRectHistory.h" #include "CCFontAtlas.h" #include "CCFrameRateCounter.h" #include "CCLayerTreeHostImpl.h" #include "CCQuadSink.h" #include "CCTextureDrawQuad.h" -#include "Extensions3DChromium.h" -#include "GraphicsContext3D.h" +#include "base/stringprintf.h" #include "skia/ext/platform_canvas.h" +#include "skia/ext/platform_canvas.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/effects/SkColorMatrixFilter.h" +#include "ui/gfx/point.h" namespace cc { @@ -67,7 +68,7 @@ void CCHeadsUpDisplayLayerImpl::willDraw(CCResourceProvider* resourceProvider) m_hudTexture->free(); if (!m_hudTexture->id()) - m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GL_RGBA, CCResourceProvider::TextureUsageAny); } void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData) diff --git a/cc/image_layer.cc b/cc/image_layer.cc index 04694a6..3b9d209 100644 --- a/cc/image_layer.cc +++ b/cc/image_layer.cc @@ -46,7 +46,7 @@ public: return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); } - virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE + virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) OVERRIDE { return PlatformColor::sameComponentOrder(textureFormat) ? LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA; @@ -138,7 +138,7 @@ void ImageLayerChromium::createTextureUpdaterIfNeeded() return; m_textureUpdater = ImageLayerTextureUpdater::create(); - GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; + GLenum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; setTextureFormat(textureFormat); setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } diff --git a/cc/io_surface_layer_impl.cc b/cc/io_surface_layer_impl.cc index 9d9ee72..35454df 100644 --- a/cc/io_surface_layer_impl.cc +++ b/cc/io_surface_layer_impl.cc @@ -7,12 +7,13 @@ #include "CCIOSurfaceLayerImpl.h" #include "base/stringprintf.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include "CCGraphicsContext.h" #include "CCIOSurfaceDrawQuad.h" #include "CCLayerTreeHostImpl.h" #include "CCQuadSink.h" #include "CCRendererGL.h" // For the GLC() macro. -#include "Extensions3D.h" #include <public/WebGraphicsContext3D.h> namespace cc { @@ -52,13 +53,13 @@ void CCIOSurfaceLayerImpl::willDraw(CCResourceProvider* resourceProvider) if (!m_ioSurfaceTextureId) m_ioSurfaceTextureId = context3d->createTexture(); - GLC(context3d, context3d->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context3d, context3d->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, m_ioSurfaceTextureId)); - GLC(context3d, context3d->texParameteri(Extensions3D::TEXTURE_RECTANGLE_ARB, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - 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)); - context3d->texImageIOSurface2DCHROMIUM(Extensions3D::TEXTURE_RECTANGLE_ARB, + GLC(context3d, context3d->activeTexture(GL_TEXTURE0)); + GLC(context3d, context3d->bindTexture(GL_TEXTURE_RECTANGLE_ARB, m_ioSurfaceTextureId)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); + context3d->texImageIOSurface2DCHROMIUM(GL_TEXTURE_RECTANGLE_ARB, m_ioSurfaceSize.width(), m_ioSurfaceSize.height(), m_ioSurfaceId, diff --git a/cc/layer_texture_sub_image.cc b/cc/layer_texture_sub_image.cc index 2261bf9..7de7159 100644 --- a/cc/layer_texture_sub_image.cc +++ b/cc/layer_texture_sub_image.cc @@ -7,9 +7,9 @@ #include "cc/layer_texture_sub_image.h" #include "CCRendererGL.h" // For the GLC() macro. -#include "GraphicsContext3D.h" -#include "Extensions3DChromium.h" #include "base/debug/trace_event.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include <public/WebGraphicsContext3D.h> using WebKit::WebGraphicsContext3D; @@ -28,7 +28,7 @@ LayerTextureSubImage::~LayerTextureSubImage() void LayerTextureSubImage::upload(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset, - GC3Denum format, WebGraphicsContext3D* context) + GLenum format, WebGraphicsContext3D* context) { if (m_useMapTexSubImage) uploadWithMapTexSubImage(image, imageRect, sourceRect, destOffset, format, context); @@ -38,7 +38,7 @@ void LayerTextureSubImage::upload(const uint8_t* image, const IntRect& imageRect void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset, - GC3Denum format, WebGraphicsContext3D* context) + GLenum format, WebGraphicsContext3D* context) { TRACE_EVENT0("cc", "LayerTextureSubImage::uploadWithTexSubImage"); @@ -64,19 +64,19 @@ void LayerTextureSubImage::uploadWithTexSubImage(const uint8_t* image, const Int pixelSource = &m_subImage[0]; } - GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destOffset.width(), destOffset.height(), sourceRect.width(), sourceRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); + GLC(context, context->texSubImage2D(GL_TEXTURE_2D, 0, destOffset.width(), destOffset.height(), sourceRect.width(), sourceRect.height(), format, GL_UNSIGNED_BYTE, pixelSource)); } void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset, - GC3Denum format, WebGraphicsContext3D* context) + GLenum format, WebGraphicsContext3D* context) { TRACE_EVENT0("cc", "LayerTextureSubImage::uploadWithMapTexSubImage"); // Offset from image-rect to source-rect. IntPoint offset(sourceRect.x() - imageRect.x(), sourceRect.y() - imageRect.y()); // Upload tile data via a mapped transfer buffer - uint8_t* pixelDest = static_cast<uint8_t*>(context->mapTexSubImage2DCHROMIUM(GraphicsContext3D::TEXTURE_2D, 0, destOffset.width(), destOffset.height(), sourceRect.width(), sourceRect.height(), format, GraphicsContext3D::UNSIGNED_BYTE, Extensions3DChromium::WRITE_ONLY)); + uint8_t* pixelDest = static_cast<uint8_t*>(context->mapTexSubImage2DCHROMIUM(GL_TEXTURE_2D, 0, destOffset.width(), destOffset.height(), sourceRect.width(), sourceRect.height(), format, GL_UNSIGNED_BYTE, GL_WRITE_ONLY)); if (!pixelDest) { uploadWithTexSubImage(image, imageRect, sourceRect, destOffset, format, context); @@ -85,11 +85,11 @@ void LayerTextureSubImage::uploadWithMapTexSubImage(const uint8_t* image, const unsigned int componentsPerPixel = 0; switch (format) { - case GraphicsContext3D::RGBA: - case Extensions3D::BGRA_EXT: + case GL_RGBA: + case GL_BGRA_EXT: componentsPerPixel = 4; break; - case GraphicsContext3D::LUMINANCE: + case GL_LUMINANCE: componentsPerPixel = 1; break; default: diff --git a/cc/layer_texture_sub_image.h b/cc/layer_texture_sub_image.h index 6d84427..35bb6f4 100644 --- a/cc/layer_texture_sub_image.h +++ b/cc/layer_texture_sub_image.h @@ -6,7 +6,7 @@ #define LayerTextureSubImage_h #include "base/memory/scoped_ptr.h" -#include "GraphicsTypes3D.h" +#include "third_party/khronos/GLES2/gl2.h" #include "IntRect.h" #include "IntSize.h" @@ -23,15 +23,15 @@ public: void upload(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset, - GC3Denum format, WebKit::WebGraphicsContext3D*); + GLenum format, WebKit::WebGraphicsContext3D*); private: void uploadWithTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset, - GC3Denum format, WebKit::WebGraphicsContext3D*); + GLenum format, WebKit::WebGraphicsContext3D*); void uploadWithMapTexSubImage(const uint8_t* image, const IntRect& imageRect, const IntRect& sourceRect, const IntSize& destOffset, - GC3Denum format, WebKit::WebGraphicsContext3D*); + GLenum format, WebKit::WebGraphicsContext3D*); bool m_useMapTexSubImage; size_t m_subImageSize; diff --git a/cc/layer_texture_updater.h b/cc/layer_texture_updater.h index 0431d93..838e342 100644 --- a/cc/layer_texture_updater.h +++ b/cc/layer_texture_updater.h @@ -6,9 +6,9 @@ #ifndef LayerTextureUpdater_h #define LayerTextureUpdater_h -#include "base/memory/ref_counted.h" #include "CCPrioritizedTexture.h" -#include "GraphicsTypes3D.h" +#include "base/memory/ref_counted.h" +#include "third_party/khronos/GLES2/gl2.h" namespace cc { @@ -49,7 +49,7 @@ public: // This format should not be confused by texture internal format. // This format specifies the component order in the sampled texel. // If the format is TexelFormatBGRA, vec4.x is blue and vec4.z is red. - virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) = 0; + virtual SampledTexelFormat sampledTexelFormat(GLenum textureFormat) = 0; // The |resultingOpaqueRect| gives back a region of the layer that was painted opaque. If the layer is marked opaque in the updater, // then this region should be ignored in preference for the entire layer's area. virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) { } diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc index a571506..f7cdfbe 100644 --- a/cc/layer_tree_host.cc +++ b/cc/layer_tree_host.cc @@ -164,7 +164,7 @@ void CCLayerTreeHost::initializeRenderer() m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, CCRenderer::ContentPool); - m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA); + m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GL_RGBA); m_rendererInitialized = true; @@ -621,7 +621,7 @@ size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& update LayerChromium* renderSurfaceLayer = updateList[i].get(); RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); - size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA); + size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GL_RGBA); contentsTextureBytes += bytes; if (renderSurfaceLayer->backgroundFilters().isEmpty()) @@ -630,7 +630,7 @@ size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& update if (bytes > maxBackgroundTextureBytes) maxBackgroundTextureBytes = bytes; if (!readbackBytes) - readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GraphicsContext3D::RGBA); + readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GL_RGBA); } return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; } diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h index 6d8c9979..1c89e26 100644 --- a/cc/layer_tree_host.h +++ b/cc/layer_tree_host.h @@ -75,7 +75,7 @@ struct RendererCapabilities { RendererCapabilities(); ~RendererCapabilities(); - GC3Denum bestTextureFormat; + GLenum bestTextureFormat; bool contextHasCachedFrontBuffer; bool usingPartialSwap; bool usingAcceleratedPainting; diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 26d806f..b3ee684 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -965,7 +965,7 @@ private: setTilingData(*tilingData.get()); setSkipsDraw(skipsDraw); if (!tileMissing) { - CCResourceProvider::ResourceId resource = resourceProvider->createResource(CCRenderer::ContentPool, IntSize(), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + CCResourceProvider::ResourceId resource = resourceProvider->createResource(CCRenderer::ContentPool, IntSize(), GL_RGBA, CCResourceProvider::TextureUsageAny); pushTileProperties(0, 0, resource, IntRect()); } if (animating) @@ -1510,13 +1510,13 @@ public: virtual void enable(WGC3Denum cap) { - if (cap == GraphicsContext3D::BLEND) + if (cap == GL_BLEND) m_blend = true; } virtual void disable(WGC3Denum cap) { - if (cap == GraphicsContext3D::BLEND) + if (cap == GL_BLEND) m_blend = false; } @@ -1569,7 +1569,7 @@ private: , m_quadsAppended(false) , m_quadRect(5, 5, 5, 5) , m_quadVisibleRect(5, 5, 5, 5) - , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool, IntSize(1, 1), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny)) + , m_resourceId(resourceProvider->createResource(CCRenderer::ContentPool, IntSize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny)) { setAnchorPoint(FloatPoint(0, 0)); setBounds(IntSize(10, 10)); @@ -1918,7 +1918,7 @@ public: virtual WebString getString(WGC3Denum name) { - if (name == GraphicsContext3D::EXTENSIONS) + if (name == GL_EXTENSIONS) return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibility"); return WebString(); @@ -2095,7 +2095,7 @@ public: .WillRepeatedly(Return(WebString())); // Support for partial swap, if needed - EXPECT_CALL(*m_context, getString(GraphicsContext3D::EXTENSIONS)) + EXPECT_CALL(*m_context, getString(GL_EXTENSIONS)) .WillRepeatedly(Return(WebString("GL_CHROMIUM_post_sub_buffer"))); EXPECT_CALL(*m_context, getRequestableExtensionsCHROMIUM()) @@ -2112,7 +2112,7 @@ public: void mustDrawSolidQuad() { - EXPECT_CALL(*m_context, drawElements(GraphicsContext3D::TRIANGLES, 6, GraphicsContext3D::UNSIGNED_SHORT, 0)) + EXPECT_CALL(*m_context, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)) .WillOnce(Return()) .RetiresOnSaturation(); @@ -2125,7 +2125,7 @@ public: void mustSetScissor(int x, int y, int width, int height) { - EXPECT_CALL(*m_context, enable(GraphicsContext3D::SCISSOR_TEST)) + EXPECT_CALL(*m_context, enable(GL_SCISSOR_TEST)) .WillRepeatedly(Return()); EXPECT_CALL(*m_context, scissor(x, y, width, height)) @@ -2135,10 +2135,10 @@ public: void mustSetNoScissor() { - EXPECT_CALL(*m_context, disable(GraphicsContext3D::SCISSOR_TEST)) + EXPECT_CALL(*m_context, disable(GL_SCISSOR_TEST)) .WillRepeatedly(Return()); - EXPECT_CALL(*m_context, enable(GraphicsContext3D::SCISSOR_TEST)) + EXPECT_CALL(*m_context, enable(GL_SCISSOR_TEST)) .Times(0); EXPECT_CALL(*m_context, scissor(_, _, _, _)) @@ -2203,7 +2203,7 @@ class PartialSwapContext : public FakeWebGraphicsContext3D { public: WebString getString(WGC3Denum name) { - if (name == GraphicsContext3D::EXTENSIONS) + if (name == GL_EXTENSIONS) return WebString("GL_CHROMIUM_post_sub_buffer"); return WebString(); } @@ -2216,7 +2216,7 @@ public: // Unlimited texture size. virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) { - if (pname == cc::GraphicsContext3D::MAX_TEXTURE_SIZE) + if (pname == GL_MAX_TEXTURE_SIZE) *value = 8192; } }; @@ -2544,7 +2544,7 @@ public: virtual int stride(unsigned plane) const { return 4; } virtual const void* data(unsigned plane) const { return m_data; } virtual unsigned textureId() const { return m_textureId; } - virtual unsigned textureTarget() const { return m_textureId ? GraphicsContext3D::TEXTURE_2D : 0; } + virtual unsigned textureTarget() const { return m_textureId ? GL_TEXTURE_2D : 0; } void setTextureId(unsigned id) { m_textureId = id; } @@ -2578,7 +2578,7 @@ class StrictWebGraphicsContext3DWithIOSurface : public StrictWebGraphicsContext3 public: virtual WebString getString(WGC3Denum name) OVERRIDE { - if (name == cc::GraphicsContext3D::EXTENSIONS) + if (name == GL_EXTENSIONS) return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); return WebString(); @@ -2589,7 +2589,7 @@ class FakeWebGraphicsContext3DWithIOSurface : public FakeWebGraphicsContext3D { public: virtual WebString getString(WGC3Denum name) OVERRIDE { - if (name == cc::GraphicsContext3D::EXTENSIONS) + if (name == GL_EXTENSIONS) return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); return WebString(); @@ -2619,7 +2619,7 @@ public: DCHECK(provider); int pool = 0; IntSize size(10, 10); - GC3Denum format = GraphicsContext3D::RGBA; + GLenum format = GL_RGBA; CCResourceProvider::TextureUsageHint hint = CCResourceProvider::TextureUsageAny; setScrollbarGeometry(CCScrollbarGeometryFixedThumb::create(FakeWebScrollbarThemeGeometryNonEmpty::create())); @@ -2637,7 +2637,7 @@ protected: static inline scoped_ptr<CCRenderPass> createRenderPassWithResource(CCResourceProvider* provider) { - CCResourceProvider::ResourceId resourceId = provider->createResource(0, IntSize(1, 1), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + CCResourceProvider::ResourceId resourceId = provider->createResource(0, IntSize(1, 1), GL_RGBA, CCResourceProvider::TextureUsageAny); scoped_ptr<CCRenderPass> pass = CCRenderPass::create(CCRenderPass::Id(1, 1), IntRect(0, 0, 1, 1), WebTransformationMatrix()); scoped_ptr<CCSharedQuadState> sharedState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false); @@ -2823,7 +2823,7 @@ public: virtual WebString getString(WGC3Denum name) OVERRIDE { - if (name == cc::GraphicsContext3D::EXTENSIONS) + if (name == GL_EXTENSIONS) return WebString("GL_CHROMIUM_iosurface GL_ARB_texture_rectangle"); return WebString(); diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index a91304e..4c55d65 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -13,7 +13,6 @@ #include "CCTextureUpdateQueue.h" #include "CCThreadedTest.h" #include "CCTimingFunction.h" -#include "Extensions3DChromium.h" #include "base/synchronization/lock.h" #include "cc/content_layer.h" #include "cc/content_layer_client.h" @@ -21,6 +20,8 @@ #include "cc/test/geometry_test_utils.h" #include "cc/test/occlusion_tracker_test_common.h" #include "testing/gmock/include/gmock/gmock.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include <public/Platform.h> #include <public/WebLayerScrollClient.h> #include <public/WebSize.h> @@ -2419,7 +2420,7 @@ private: if (m_texture.get()) return; m_texture = CCPrioritizedTexture::create(layerTreeHost()->contentsTextureManager()); - m_texture->setDimensions(IntSize(10, 10), cc::GraphicsContext3D::RGBA); + m_texture->setDimensions(IntSize(10, 10), GL_RGBA); m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); } @@ -2725,8 +2726,8 @@ public: virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) { m_contextLostCallback = callback; } virtual bool isContextLost() { return m_isContextLost; } - virtual void beginQueryEXT(GC3Denum, WebGLId) { } - virtual void endQueryEXT(GC3Denum) + virtual void beginQueryEXT(WGC3Denum, WebGLId) { } + virtual void endQueryEXT(WGC3Denum) { // Lose context. if (!m_isContextLost) { @@ -2734,10 +2735,10 @@ public: m_isContextLost = true; } } - virtual void getQueryObjectuivEXT(WebGLId, GC3Denum pname, GC3Duint* params) + virtual void getQueryObjectuivEXT(WebGLId, WGC3Denum pname, WGC3Duint* params) { // Context is lost. We need to behave as if result is available. - if (pname == Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT) + if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) *params = 1; } diff --git a/cc/platform_color.h b/cc/platform_color.h index a3f3f35..54a305c 100644 --- a/cc/platform_color.h +++ b/cc/platform_color.h @@ -5,8 +5,8 @@ #ifndef PlatformColor_h #define PlatformColor_h -#include "Extensions3D.h" -#include "GraphicsContext3D.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/skia/include/core/SkTypes.h" #include <public/WebGraphicsContext3D.h> @@ -14,21 +14,23 @@ namespace cc { class PlatformColor { public: - static GraphicsContext3D::SourceDataFormat format() + enum SourceDataFormat { SourceFormatRGBA8, SourceFormatBGRA8 }; + + static SourceDataFormat format() { - return SK_B32_SHIFT ? GraphicsContext3D::SourceFormatRGBA8 : GraphicsContext3D::SourceFormatBGRA8; + return SK_B32_SHIFT ? SourceFormatRGBA8 : SourceFormatBGRA8; } // Returns the most efficient texture format for this platform. - static GC3Denum bestTextureFormat(WebKit::WebGraphicsContext3D* context, bool supportsBGRA8888) + static GLenum bestTextureFormat(WebKit::WebGraphicsContext3D* context, bool supportsBGRA8888) { - GC3Denum textureFormat = GraphicsContext3D::RGBA; + GLenum textureFormat = GL_RGBA; switch (format()) { - case GraphicsContext3D::SourceFormatRGBA8: + case SourceFormatRGBA8: break; - case GraphicsContext3D::SourceFormatBGRA8: + case SourceFormatBGRA8: if (supportsBGRA8888) - textureFormat = Extensions3D::BGRA_EXT; + textureFormat = GL_BGRA_EXT; break; default: NOTREACHED(); @@ -39,13 +41,13 @@ public: // Return true if the given texture format has the same component order // as the color on this platform. - static bool sameComponentOrder(GC3Denum textureFormat) + static bool sameComponentOrder(GLenum textureFormat) { switch (format()) { - case GraphicsContext3D::SourceFormatRGBA8: - return textureFormat == GraphicsContext3D::RGBA; - case GraphicsContext3D::SourceFormatBGRA8: - return textureFormat == Extensions3D::BGRA_EXT; + case SourceFormatRGBA8: + return textureFormat == GL_RGBA; + case SourceFormatBGRA8: + return textureFormat == GL_BGRA_EXT; default: NOTREACHED(); return false; diff --git a/cc/prioritized_texture.cc b/cc/prioritized_texture.cc index ed9ca06..bfda4de 100644 --- a/cc/prioritized_texture.cc +++ b/cc/prioritized_texture.cc @@ -15,7 +15,7 @@ using namespace std; namespace cc { -CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format) +CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, IntSize size, GLenum format) : m_size(size) , m_format(format) , m_bytes(0) @@ -49,7 +49,7 @@ void CCPrioritizedTexture::setTextureManager(CCPrioritizedTextureManager* manage manager->registerTexture(this); } -void CCPrioritizedTexture::setDimensions(IntSize size, GC3Denum format) +void CCPrioritizedTexture::setDimensions(IntSize size, GLenum format) { if (m_format != format || m_size != size) { m_isAbovePriorityCutoff = false; @@ -120,12 +120,12 @@ void CCPrioritizedTexture::unlink() void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) { - setDimensions(IntSize(), GraphicsContext3D::RGBA); + setDimensions(IntSize(), GL_RGBA); setIsSelfManaged(true); m_bytes = bytes; } -CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resourceProvider, IntSize size, GC3Denum format) +CCPrioritizedTexture::Backing::Backing(unsigned id, CCResourceProvider* resourceProvider, IntSize size, GLenum format) : CCTexture(id, size, format) , m_owner(0) , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) diff --git a/cc/prioritized_texture.h b/cc/prioritized_texture.h index f0226cc..fe06b17 100644 --- a/cc/prioritized_texture.h +++ b/cc/prioritized_texture.h @@ -5,15 +5,15 @@ #ifndef CCPrioritizedTexture_h #define CCPrioritizedTexture_h -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "base/logging.h" #include "CCPriorityCalculator.h" #include "CCResourceProvider.h" #include "CCTexture.h" -#include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" +#include "base/basictypes.h" +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "third_party/khronos/GLES2/gl2.h" namespace cc { @@ -21,7 +21,7 @@ class CCPrioritizedTextureManager; class CCPrioritizedTexture { public: - static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format) + static scoped_ptr<CCPrioritizedTexture> create(CCPrioritizedTextureManager* manager, IntSize size, GLenum format) { return make_scoped_ptr(new CCPrioritizedTexture(manager, size, format)); } @@ -35,8 +35,8 @@ public: // Setting these to the same value is a no-op. void setTextureManager(CCPrioritizedTextureManager*); CCPrioritizedTextureManager* textureManager() { return m_manager; } - void setDimensions(IntSize, GC3Denum format); - GC3Denum format() const { return m_format; } + void setDimensions(IntSize, GLenum format); + GLenum format() const { return m_format; } IntSize size() const { return m_size; } size_t bytes() const { return m_bytes; } @@ -88,7 +88,7 @@ private: class Backing : public CCTexture { public: - Backing(unsigned id, CCResourceProvider*, IntSize, GC3Denum format); + Backing(unsigned id, CCResourceProvider*, IntSize, GLenum format); ~Backing(); void updatePriority(); void updateInDrawingImplTree(); @@ -119,7 +119,7 @@ private: DISALLOW_COPY_AND_ASSIGN(Backing); }; - CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format); + CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GLenum format); bool isAbovePriorityCutoff() { return m_isAbovePriorityCutoff; } void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; } @@ -130,7 +130,7 @@ private: void unlink(); IntSize m_size; - GC3Denum m_format; + GLenum m_format; size_t m_bytes; int m_priority; diff --git a/cc/prioritized_texture_manager.cc b/cc/prioritized_texture_manager.cc index b361d3d..d766380 100644 --- a/cc/prioritized_texture_manager.cc +++ b/cc/prioritized_texture_manager.cc @@ -347,7 +347,7 @@ void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* tex texture->unlink(); } -CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, CCResourceProvider* resourceProvider) +CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GLenum format, CCResourceProvider* resourceProvider) { DCHECK(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); DCHECK(resourceProvider); diff --git a/cc/prioritized_texture_manager.h b/cc/prioritized_texture_manager.h index 1ccf538..7f7b17a 100644 --- a/cc/prioritized_texture_manager.h +++ b/cc/prioritized_texture_manager.h @@ -8,10 +8,10 @@ #include "base/basictypes.h" #include "base/hash_tables.h" #include "base/memory/scoped_ptr.h" +#include "third_party/khronos/GLES2/gl2.h" #include "CCPrioritizedTexture.h" #include "CCPriorityCalculator.h" #include "CCTexture.h" -#include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" #include <wtf/Vector.h> @@ -38,7 +38,7 @@ public: { return make_scoped_ptr(new CCPrioritizedTextureManager(maxMemoryLimitBytes, maxTextureSize, pool)); } - scoped_ptr<CCPrioritizedTexture> createTexture(IntSize size, GC3Denum format) + scoped_ptr<CCPrioritizedTexture> createTexture(IntSize size, GLenum format) { return make_scoped_ptr(new CCPrioritizedTexture(this, size, format)); } @@ -136,7 +136,7 @@ private: CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool); bool evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*); - CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*); + CCPrioritizedTexture::Backing* createBacking(IntSize, GLenum format, CCResourceProvider*); void evictFirstBackingResource(CCResourceProvider*); void deleteUnlinkedEvictedBackings(); void sortBackings(); diff --git a/cc/prioritized_texture_unittest.cc b/cc/prioritized_texture_unittest.cc index 6b4b136..43b8c09 100644 --- a/cc/prioritized_texture_unittest.cc +++ b/cc/prioritized_texture_unittest.cc @@ -23,7 +23,7 @@ class CCPrioritizedTextureTest : public testing::Test { public: CCPrioritizedTextureTest() : m_textureSize(256, 256) - , m_textureFormat(GraphicsContext3D::RGBA) + , m_textureFormat(GL_RGBA) , m_compositorInitializer(0) , m_context(WebKit::createFakeCCGraphicsContext()) { @@ -92,7 +92,7 @@ public: protected: const IntSize m_textureSize; - const GC3Denum m_textureFormat; + const GLenum m_textureFormat; WebCompositorInitializer m_compositorInitializer; scoped_ptr<CCGraphicsContext> m_context; scoped_ptr<CCResourceProvider> m_resourceProvider; diff --git a/cc/priority_calculator.h b/cc/priority_calculator.h index 45f2e64..2d0f5ba 100644 --- a/cc/priority_calculator.h +++ b/cc/priority_calculator.h @@ -5,7 +5,6 @@ #ifndef CCPriorityCalculator_h #define CCPriorityCalculator_h -#include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" diff --git a/cc/program_binding.cc b/cc/program_binding.cc index 26ba502..cf4e6fd 100644 --- a/cc/program_binding.cc +++ b/cc/program_binding.cc @@ -7,9 +7,9 @@ #include "cc/program_binding.h" #include "CCRendererGL.h" // For the GLC() macro. -#include "GraphicsContext3D.h" #include "base/debug/trace_event.h" #include "cc/geometry_binding.h" +#include "third_party/khronos/GLES2/gl2.h" #include <public/WebGraphicsContext3D.h> using WebKit::WebGraphicsContext3D; @@ -35,21 +35,21 @@ ProgramBindingBase::~ProgramBindingBase() static bool contextLost(WebGraphicsContext3D* context) { - return (context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); + return (context->getGraphicsResetStatusARB() != GL_NO_ERROR); } void ProgramBindingBase::init(WebGraphicsContext3D* context, const std::string& vertexShader, const std::string& fragmentShader) { TRACE_EVENT0("cc", "ProgramBindingBase::init"); - m_vertexShaderId = loadShader(context, GraphicsContext3D::VERTEX_SHADER, vertexShader); + m_vertexShaderId = loadShader(context, GL_VERTEX_SHADER, vertexShader); if (!m_vertexShaderId) { if (!contextLost(context)) LOG(ERROR) << "Failed to create vertex shader"; return; } - m_fragmentShaderId = loadShader(context, GraphicsContext3D::FRAGMENT_SHADER, fragmentShader); + m_fragmentShaderId = loadShader(context, GL_FRAGMENT_SHADER, fragmentShader); if (!m_fragmentShaderId) { GLC(context, context->deleteShader(m_vertexShaderId)); m_vertexShaderId = 0; @@ -68,7 +68,7 @@ void ProgramBindingBase::link(WebGraphicsContext3D* context) cleanupShaders(context); #ifndef NDEBUG int linked = 0; - GLC(context, context->getProgramiv(m_program, GraphicsContext3D::LINK_STATUS, &linked)); + GLC(context, context->getProgramiv(m_program, GL_LINK_STATUS, &linked)); if (!linked) { if (!contextLost(context)) LOG(ERROR) << "Failed to link shader program"; @@ -99,7 +99,7 @@ unsigned ProgramBindingBase::loadShader(WebGraphicsContext3D* context, unsigned GLC(context, context->compileShader(shader)); #ifndef NDEBUG int compiled = 0; - GLC(context, context->getShaderiv(shader, GraphicsContext3D::COMPILE_STATUS, &compiled)); + GLC(context, context->getShaderiv(shader, GL_COMPILE_STATUS, &compiled)); if (!compiled) { GLC(context, context->deleteShader(shader)); return 0; diff --git a/cc/resource_provider.cc b/cc/resource_provider.cc index c6e7882..1d1093f 100644 --- a/cc/resource_provider.cc +++ b/cc/resource_provider.cc @@ -10,7 +10,6 @@ #include "CCProxy.h" #include "CCRendererGL.h" // For the GLC() macro. -#include "Extensions3DChromium.h" #include "IntRect.h" #include "base/debug/alias.h" #include "base/hash_tables.h" @@ -20,20 +19,22 @@ #include "cc/layer_texture_sub_image.h" #include "cc/throttled_texture_uploader.h" #include "cc/unthrottled_texture_uploader.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include <public/WebGraphicsContext3D.h> using WebKit::WebGraphicsContext3D; namespace cc { -static GC3Denum textureToStorageFormat(GC3Denum textureFormat) +static GLenum textureToStorageFormat(GLenum textureFormat) { - GC3Denum storageFormat = Extensions3D::RGBA8_OES; + GLenum storageFormat = GL_RGBA8_OES; switch (textureFormat) { - case GraphicsContext3D::RGBA: + case GL_RGBA: break; - case Extensions3D::BGRA_EXT: - storageFormat = Extensions3DChromium::BGRA8_EXT; + case GL_BGRA_EXT: + storageFormat = GL_BGRA8_EXT; break; default: NOTREACHED(); @@ -43,9 +44,9 @@ static GC3Denum textureToStorageFormat(GC3Denum textureFormat) return storageFormat; } -static bool isTextureFormatSupportedForStorage(GC3Denum format) +static bool isTextureFormatSupportedForStorage(GLenum format) { - return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EXT); + return (format == GL_RGBA || format == GL_BGRA_EXT); } CCResourceProvider::TransferableResourceList::TransferableResourceList() @@ -71,7 +72,7 @@ CCResourceProvider::Resource::Resource() { } -CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum format) +CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSize& size, GLenum format) : glId(textureId) , pixels(0) , pool(pool) @@ -86,7 +87,7 @@ CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSi { } -CCResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format) +CCResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format) : glId(0) , pixels(pixels) , pool(pool) @@ -141,13 +142,13 @@ bool CCResourceProvider::inUseByConsumer(ResourceId id) return !!resource->lockForReadCount || resource->exported; } -CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, const IntSize& size, GC3Denum format, TextureUsageHint hint) +CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, const IntSize& size, GLenum format, TextureUsageHint hint) { switch (m_defaultResourceType) { case GLTexture: return createGLTexture(pool, size, format, hint); case Bitmap: - DCHECK(format == GraphicsContext3D::RGBA); + DCHECK(format == GL_RGBA); return createBitmap(pool, size); } @@ -155,26 +156,26 @@ CCResourceProvider::ResourceId CCResourceProvider::createResource(int pool, cons return 0; } -CCResourceProvider::ResourceId CCResourceProvider::createGLTexture(int pool, const IntSize& size, GC3Denum format, TextureUsageHint hint) +CCResourceProvider::ResourceId CCResourceProvider::createGLTexture(int pool, const IntSize& size, GLenum format, TextureUsageHint hint) { DCHECK(CCProxy::isImplThread()); unsigned textureId = 0; WebGraphicsContext3D* context3d = m_context->context3D(); DCHECK(context3d); GLC(context3d, textureId = context3d->createTexture()); - GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - 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->bindTexture(GL_TEXTURE_2D, textureId)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); if (m_useTextureUsageHint && hint == TextureUsageFramebuffer) - GLC(context3d, context3d->texParameteri(GraphicsContext3D::TEXTURE_2D, Extensions3DChromium::GL_TEXTURE_USAGE_ANGLE, Extensions3DChromium::GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); + GLC(context3d, context3d->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_FRAMEBUFFER_ATTACHMENT_ANGLE)); if (m_useTextureStorageExt && isTextureFormatSupportedForStorage(format)) { - GC3Denum storageFormat = textureToStorageFormat(format); - GLC(context3d, context3d->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height())); + GLenum storageFormat = textureToStorageFormat(format); + GLC(context3d, context3d->texStorage2DEXT(GL_TEXTURE_2D, 1, storageFormat, size.width(), size.height())); } else - GLC(context3d, context3d->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE, 0)); + GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GL_UNSIGNED_BYTE, 0)); ResourceId id = m_nextId++; Resource resource(textureId, pool, size, format); m_resources[id] = resource; @@ -188,7 +189,7 @@ CCResourceProvider::ResourceId CCResourceProvider::createBitmap(int pool, const uint8_t* pixels = new uint8_t[size.width() * size.height() * 4]; ResourceId id = m_nextId++; - Resource resource(pixels, pool, size, GraphicsContext3D::RGBA); + Resource resource(pixels, pool, size, GL_RGBA); m_resources[id] = resource; return id; } @@ -270,7 +271,7 @@ void CCResourceProvider::upload(ResourceId id, const uint8_t* image, const IntRe WebGraphicsContext3D* context3d = m_context->context3D(); DCHECK(context3d); DCHECK(m_texSubImage.get()); - context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, resource->glId); + context3d->bindTexture(GL_TEXTURE_2D, resource->glId); m_texSubImage->upload(image, imageRect, sourceRect, destOffset, resource->format, context3d); } @@ -387,7 +388,7 @@ CCResourceProvider::ScopedWriteLockGL::~ScopedWriteLockGL() void CCResourceProvider::populateSkBitmapWithResource(SkBitmap* skBitmap, const Resource* resource) { DCHECK(resource->pixels); - DCHECK(resource->format == GraphicsContext3D::RGBA); + DCHECK(resource->format == GL_RGBA); skBitmap->setConfig(SkBitmap::kARGB_8888_Config, resource->size.width(), resource->size.height()); skBitmap->setPixels(resource->pixels); } @@ -441,7 +442,7 @@ bool CCResourceProvider::initialize() if (!context3d->makeContextCurrent()) return false; - std::string extensionsString = UTF16ToASCII(context3d->getString(GraphicsContext3D::EXTENSIONS)); + std::string extensionsString = UTF16ToASCII(context3d->getString(GL_EXTENSIONS)); std::vector<std::string> extensions; base::SplitString(extensionsString, ' ', &extensions); bool useMapSub = false; @@ -463,7 +464,7 @@ bool CCResourceProvider::initialize() m_textureCopier = AcceleratedTextureCopier::create(context3d, useBindUniform); m_textureUploader = ThrottledTextureUploader::create(context3d); - GLC(context3d, context3d->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSize)); + GLC(context3d, context3d->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize)); return true; } @@ -565,8 +566,8 @@ void CCResourceProvider::receiveFromChild(int child, const TransferableResourceL for (TransferableResourceArray::const_iterator it = resources.resources.begin(); it != resources.resources.end(); ++it) { unsigned textureId; GLC(context3d, textureId = context3d->createTexture()); - GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId)); - GLC(context3d, context3d->consumeTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, it->mailbox.name)); + GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, textureId)); + GLC(context3d, context3d->consumeTextureCHROMIUM(GL_TEXTURE_2D, it->mailbox.name)); ResourceId id = m_nextId++; Resource resource(textureId, childInfo.pool, it->size, it->format); m_resources[id] = resource; @@ -592,8 +593,8 @@ void CCResourceProvider::receiveFromParent(const TransferableResourceList& resou Resource* resource = &mapIterator->second; DCHECK(resource->exported); resource->exported = false; - GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, resource->glId)); - GLC(context3d, context3d->consumeTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, it->mailbox.name)); + GLC(context3d, context3d->bindTexture(GL_TEXTURE_2D, resource->glId)); + GLC(context3d, context3d->consumeTextureCHROMIUM(GL_TEXTURE_2D, it->mailbox.name)); m_mailboxes.push_back(it->mailbox); if (resource->markedForDeletion) deleteResourceInternal(mapIterator); @@ -620,8 +621,8 @@ bool CCResourceProvider::transferResource(WebGraphicsContext3D* context, Resourc } else GLC(context, context->genMailboxCHROMIUM(resource->mailbox.name)); - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, source->glId)); - GLC(context, context->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, resource->mailbox.name)); + GLC(context, context->bindTexture(GL_TEXTURE_2D, source->glId)); + GLC(context, context->produceTextureCHROMIUM(GL_TEXTURE_2D, resource->mailbox.name)); return true; } diff --git a/cc/resource_provider.h b/cc/resource_provider.h index 3c2ba50..dfebcc3 100644 --- a/cc/resource_provider.h +++ b/cc/resource_provider.h @@ -5,13 +5,13 @@ #ifndef CCResourceProvider_h #define CCResourceProvider_h +#include "IntSize.h" #include "base/basictypes.h" #include "base/hash_tables.h" #include "base/memory/scoped_ptr.h" -#include "CCGraphicsContext.h" +#include "cc/graphics_context.h" #include "cc/texture_copier.h" -#include "GraphicsContext3D.h" -#include "IntSize.h" +#include "third_party/khronos/GLES2/gl2.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" #include <deque> @@ -41,11 +41,11 @@ public: Bitmap, }; struct Mailbox { - GC3Dbyte name[64]; + GLbyte name[64]; }; struct TransferableResource { unsigned id; - GC3Denum format; + GLenum format; IntSize size; Mailbox mailbox; }; @@ -79,10 +79,10 @@ public: ResourceType resourceType(ResourceId); // Creates a resource of the default resource type. - ResourceId createResource(int pool, const IntSize&, GC3Denum format, TextureUsageHint); + ResourceId createResource(int pool, const IntSize&, GLenum format, TextureUsageHint); // You can also explicitly create a specific resource type. - ResourceId createGLTexture(int pool, const IntSize&, GC3Denum format, TextureUsageHint); + ResourceId createGLTexture(int pool, const IntSize&, GLenum format, TextureUsageHint); ResourceId createBitmap(int pool, const IntSize&); // Wraps an external texture into a GL resource. ResourceId createResourceFromExternalTexture(unsigned textureId); @@ -210,8 +210,8 @@ public: private: struct Resource { Resource(); - Resource(unsigned textureId, int pool, const IntSize& size, GC3Denum format); - Resource(uint8_t* pixels, int pool, const IntSize& size, GC3Denum format); + Resource(unsigned textureId, int pool, const IntSize& size, GLenum format); + Resource(uint8_t* pixels, int pool, const IntSize& size, GLenum format); unsigned glId; uint8_t* pixels; @@ -222,7 +222,7 @@ private: bool exported; bool markedForDeletion; IntSize size; - GC3Denum format; + GLenum format; ResourceType type; }; typedef base::hash_map<ResourceId, Resource> ResourceMap; diff --git a/cc/resource_provider_unittest.cc b/cc/resource_provider_unittest.cc index 5d387f7..7c6dc37 100644 --- a/cc/resource_provider_unittest.cc +++ b/cc/resource_provider_unittest.cc @@ -8,13 +8,14 @@ #include "CCGraphicsContext.h" #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread -#include "Extensions3DChromium.h" #include "base/logging.h" #include "cc/scoped_ptr_deque.h" #include "cc/scoped_ptr_hash_map.h" #include "cc/test/compositor_fake_web_graphics_context_3d.h" #include "cc/test/fake_web_compositor_output_surface.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include <public/WebGraphicsContext3D.h> using namespace cc; @@ -116,7 +117,7 @@ public: virtual void bindTexture(WGC3Denum target, WebGLId texture) { - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT_EQ(target, GL_TEXTURE_2D); ASSERT_TRUE(!texture || m_textures.find(texture) != m_textures.end()); m_currentTexture = texture; } @@ -141,14 +142,14 @@ public: WGC3Dint width, WGC3Dint height) { ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT_EQ(target, GL_TEXTURE_2D); ASSERT_EQ(levels, 1); - WGC3Denum format = GraphicsContext3D::RGBA; + WGC3Denum format = GL_RGBA; switch (internalformat) { - case Extensions3D::RGBA8_OES: + case GL_RGBA8_OES: break; - case Extensions3DChromium::BGRA8_EXT: - format = Extensions3D::BGRA_EXT; + case GL_BGRA8_EXT: + format = GL_BGRA_EXT; break; default: NOTREACHED(); @@ -159,11 +160,11 @@ public: virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) { ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT_EQ(target, GL_TEXTURE_2D); ASSERT_FALSE(level); ASSERT_EQ(internalformat, format); ASSERT_FALSE(border); - ASSERT_EQ(type, GraphicsContext3D::UNSIGNED_BYTE); + ASSERT_EQ(type, GL_UNSIGNED_BYTE); allocateTexture(IntSize(width, height), format); if (pixels) setPixels(0, 0, width, height, pixels); @@ -172,11 +173,11 @@ public: virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) { ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT_EQ(target, GL_TEXTURE_2D); ASSERT_FALSE(level); ASSERT_TRUE(m_textures.get(m_currentTexture)); ASSERT_EQ(m_textures.get(m_currentTexture)->format, format); - ASSERT_EQ(type, GraphicsContext3D::UNSIGNED_BYTE); + ASSERT_EQ(type, GL_UNSIGNED_BYTE); ASSERT_TRUE(pixels); setPixels(xoffset, yoffset, width, height, pixels); } @@ -185,7 +186,7 @@ public: virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT_EQ(target, GL_TEXTURE_2D); // Delay moving the texture into the mailbox until the next // insertSyncPoint, so that it is not visible to other contexts that @@ -200,7 +201,7 @@ public: virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { ASSERT_TRUE(m_currentTexture); - ASSERT_EQ(target, GraphicsContext3D::TEXTURE_2D); + ASSERT_EQ(target, GL_TEXTURE_2D); m_textures.set(m_currentTexture, m_sharedData->consumeTexture(mailbox, m_lastWaitedSyncPoint)); } @@ -283,7 +284,7 @@ public: if (GetParam() == CCResourceProvider::GLTexture) { CCResourceProvider::ScopedReadLockGL lockGL(m_resourceProvider.get(), id); ASSERT_NE(0U, lockGL.textureId()); - context()->bindTexture(GraphicsContext3D::TEXTURE_2D, lockGL.textureId()); + context()->bindTexture(GL_TEXTURE_2D, lockGL.textureId()); context()->getPixels(size, format, pixels); } else if (GetParam() == CCResourceProvider::Bitmap) { CCResourceProvider::ScopedReadLockSoftware lockSoftware(m_resourceProvider.get(), id); @@ -308,7 +309,7 @@ protected: TEST_P(CCResourceProviderTest, Basic) { IntSize size(1, 1); - WGC3Denum format = GraphicsContext3D::RGBA; + WGC3Denum format = GL_RGBA; int pool = 1; size_t pixelSize = textureSize(size, format); ASSERT_EQ(4U, pixelSize); @@ -331,7 +332,7 @@ TEST_P(CCResourceProviderTest, Basic) TEST_P(CCResourceProviderTest, DeleteOwnedResources) { IntSize size(1, 1); - WGC3Denum format = GraphicsContext3D::RGBA; + WGC3Denum format = GL_RGBA; int pool = 1; const int count = 3; @@ -349,7 +350,7 @@ TEST_P(CCResourceProviderTest, DeleteOwnedResources) TEST_P(CCResourceProviderTest, Upload) { IntSize size(2, 2); - WGC3Denum format = GraphicsContext3D::RGBA; + WGC3Denum format = GL_RGBA; int pool = 1; size_t pixelSize = textureSize(size, format); ASSERT_EQ(16U, pixelSize); @@ -420,7 +421,7 @@ TEST_P(CCResourceProviderTest, TransferResources) scoped_ptr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); IntSize size(1, 1); - WGC3Denum format = GraphicsContext3D::RGBA; + WGC3Denum format = GL_RGBA; int pool = 1; size_t pixelSize = textureSize(size, format); ASSERT_EQ(4U, pixelSize); @@ -496,14 +497,14 @@ TEST_P(CCResourceProviderTest, TransferResources) { CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id1); ASSERT_NE(0U, lock.textureId()); - childContext3D->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()); + childContext3D->bindTexture(GL_TEXTURE_2D, lock.textureId()); childContext3D->getPixels(size, format, result); EXPECT_EQ(0, memcmp(data1, result, pixelSize)); } { CCResourceProvider::ScopedReadLockGL lock(childResourceProvider.get(), id2); ASSERT_NE(0U, lock.textureId()); - childContext3D->bindTexture(GraphicsContext3D::TEXTURE_2D, lock.textureId()); + childContext3D->bindTexture(GL_TEXTURE_2D, lock.textureId()); childContext3D->getPixels(size, format, result); EXPECT_EQ(0, memcmp(data2, result, pixelSize)); } @@ -537,7 +538,7 @@ TEST_P(CCResourceProviderTest, DeleteTransferredResources) scoped_ptr<CCResourceProvider> childResourceProvider(CCResourceProvider::create(childContext.get())); IntSize size(1, 1); - WGC3Denum format = GraphicsContext3D::RGBA; + WGC3Denum format = GL_RGBA; int pool = 1; size_t pixelSize = textureSize(size, format); ASSERT_EQ(4U, pixelSize); diff --git a/cc/scoped_texture.cc b/cc/scoped_texture.cc index ff54056..383c6e7 100644 --- a/cc/scoped_texture.cc +++ b/cc/scoped_texture.cc @@ -19,7 +19,7 @@ CCScopedTexture::~CCScopedTexture() free(); } -bool CCScopedTexture::allocate(int pool, const IntSize& size, GC3Denum format, CCResourceProvider::TextureUsageHint hint) +bool CCScopedTexture::allocate(int pool, const IntSize& size, GLenum format, CCResourceProvider::TextureUsageHint hint) { DCHECK(!id()); DCHECK(!size.isEmpty()); diff --git a/cc/scoped_texture.h b/cc/scoped_texture.h index 5674c9d..29f46ee 100644 --- a/cc/scoped_texture.h +++ b/cc/scoped_texture.h @@ -26,7 +26,7 @@ public: using CCTexture::format; using CCTexture::bytes; - bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider::TextureUsageHint); + bool allocate(int pool, const IntSize&, GLenum format, CCResourceProvider::TextureUsageHint); void free(); void leak(); diff --git a/cc/scoped_texture_unittest.cc b/cc/scoped_texture_unittest.cc index 44260ac..630afe1 100644 --- a/cc/scoped_texture_unittest.cc +++ b/cc/scoped_texture_unittest.cc @@ -8,10 +8,10 @@ #include "CCRenderer.h" #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread -#include "GraphicsContext3D.h" #include "cc/test/fake_graphics_context.h" #include "cc/test/tiled_layer_test_common.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/khronos/GLES2/gl2.h" using namespace cc; using namespace WebKit; @@ -40,14 +40,14 @@ TEST(CCScopedTextureTest, CreateScopedTexture) DebugScopedSetImplThread implThread; scoped_ptr<CCResourceProvider> resourceProvider(CCResourceProvider::create(context.get())); scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); // The texture has an allocated byte-size now. size_t expectedBytes = 30 * 30 * 4; EXPECT_EQ(expectedBytes, texture->bytes()); EXPECT_LT(0u, texture->id()); - EXPECT_EQ(GraphicsContext3D::RGBA, texture->format()); + EXPECT_EQ(GL_RGBA, texture->format()); EXPECT_EQ(IntSize(30, 30), texture->size()); } @@ -61,7 +61,7 @@ TEST(CCScopedTextureTest, ScopedTextureIsDeleted) scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); } @@ -71,7 +71,7 @@ TEST(CCScopedTextureTest, ScopedTextureIsDeleted) { scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); texture->free(); @@ -89,7 +89,7 @@ TEST(CCScopedTextureTest, LeakScopedTexture) scoped_ptr<CCScopedTexture> texture = CCScopedTexture::create(resourceProvider.get()); EXPECT_EQ(0u, resourceProvider->numResources()); - texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + texture->allocate(CCRenderer::ImplPool, IntSize(30, 30), GL_RGBA, CCResourceProvider::TextureUsageAny); EXPECT_LT(0u, texture->id()); EXPECT_EQ(1u, resourceProvider->numResources()); diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc index 7788745..cb9325c 100644 --- a/cc/scrollbar_layer.cc +++ b/cc/scrollbar_layer.cc @@ -33,7 +33,7 @@ ScrollbarLayerChromium::ScrollbarLayerChromium(scoped_ptr<WebKit::WebScrollbar> , m_painter(painter) , m_geometry(geometry.Pass()) , m_scrollLayerId(scrollLayerId) - , m_textureFormat(GraphicsContext3D::INVALID_ENUM) + , m_textureFormat(GL_INVALID_ENUM) { } diff --git a/cc/scrollbar_layer.h b/cc/scrollbar_layer.h index c3dd96e..9ddb9d8 100644 --- a/cc/scrollbar_layer.h +++ b/cc/scrollbar_layer.h @@ -50,7 +50,7 @@ private: scoped_ptr<WebKit::WebScrollbarThemeGeometry> m_geometry; int m_scrollLayerId; - GC3Denum m_textureFormat; + GLenum m_textureFormat; scoped_refptr<CachingBitmapCanvasLayerTextureUpdater> m_backTrackUpdater; scoped_refptr<CachingBitmapCanvasLayerTextureUpdater> m_foreTrackUpdater; diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc index b441f8d..bba7e93 100644 --- a/cc/software_renderer.cc +++ b/cc/software_renderer.cc @@ -78,7 +78,7 @@ CCRendererSoftware::CCRendererSoftware(CCRendererClient* client, CCResourceProvi m_resourceProvider->setDefaultResourceType(CCResourceProvider::Bitmap); m_capabilities.maxTextureSize = INT_MAX; - m_capabilities.bestTextureFormat = GraphicsContext3D::RGBA; + m_capabilities.bestTextureFormat = GL_RGBA; m_capabilities.contextHasCachedFrontBuffer = true; m_capabilities.usingSetVisibility = true; diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc index d77ad7f..5160963 100644 --- a/cc/software_renderer_unittest.cc +++ b/cc/software_renderer_unittest.cc @@ -112,8 +112,8 @@ TEST_F(CCRendererSoftwareTest, tileQuad) setViewportSize(outerSize); initializeRenderer(); - CCResourceProvider::ResourceId resourceYellow = resourceProvider()->createResource(1, outerSize, GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); - CCResourceProvider::ResourceId resourceCyan = resourceProvider()->createResource(1, innerSize, GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageAny); + CCResourceProvider::ResourceId resourceYellow = resourceProvider()->createResource(1, outerSize, GL_RGBA, CCResourceProvider::TextureUsageAny); + CCResourceProvider::ResourceId resourceCyan = resourceProvider()->createResource(1, innerSize, GL_RGBA, CCResourceProvider::TextureUsageAny); SkColor yellow = SK_ColorYELLOW; SkColor cyan = SK_ColorCYAN; diff --git a/cc/stubs/Extensions3D.h b/cc/stubs/Extensions3D.h deleted file mode 100644 index 77f010e..0000000 --- a/cc/stubs/Extensions3D.h +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Temporary forwarding header -#include "cc/stubs/extensions_3d.h" diff --git a/cc/stubs/Extensions3DChromium.h b/cc/stubs/Extensions3DChromium.h deleted file mode 100644 index f3c6fa9..0000000 --- a/cc/stubs/Extensions3DChromium.h +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Temporary forwarding header -#include "cc/stubs/extensions_3d_chromium.h" diff --git a/cc/stubs/GraphicsContext3D.h b/cc/stubs/GraphicsContext3D.h deleted file mode 100644 index 3460a30..0000000 --- a/cc/stubs/GraphicsContext3D.h +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Temporary forwarding header -#include "cc/stubs/graphics_context_3d.h" diff --git a/cc/stubs/GraphicsTypes3D.h b/cc/stubs/GraphicsTypes3D.h deleted file mode 100644 index 8d08bb3..0000000 --- a/cc/stubs/GraphicsTypes3D.h +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Temporary forwarding header -#include "cc/stubs/graphics_types_3d.h" diff --git a/cc/stubs/extensions_3d.h b/cc/stubs/extensions_3d.h deleted file mode 100644 index bbeb9e6..0000000 --- a/cc/stubs/extensions_3d.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_STUBS_EXTENSIONS3D_H_ -#define CC_STUBS_EXTENSIONS3D_H_ - -#include "third_party/khronos/GLES2/gl2.h" -#include "third_party/khronos/GLES2/gl2ext.h" - -namespace cc { - -class Extensions3D { -public: - enum { - TEXTURE_RECTANGLE_ARB = GL_TEXTURE_RECTANGLE_ARB, - BGRA_EXT = GL_BGRA_EXT, - RGBA8_OES = GL_RGBA8_OES, - }; -}; - -} - - -#endif // CC_STUBS_EXTENSIONS3D_H_ diff --git a/cc/stubs/extensions_3d_chromium.h b/cc/stubs/extensions_3d_chromium.h deleted file mode 100644 index f5d36d2..0000000 --- a/cc/stubs/extensions_3d_chromium.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_STUBS_EXTENSIONS3DCHROMIUM_H_ -#define CC_STUBS_EXTENSIONS3DCHROMIUM_H_ - -#include "Extensions3D.h" - -// These enum names collides with gl2ext.h, so we just redefine them. -#ifdef GL_TEXTURE_EXTERNAL_OES -#undef GL_TEXTURE_EXTERNAL_OES -#endif -#ifdef GL_TEXTURE_USAGE_ANGLE -#undef GL_TEXTURE_USAGE_ANGLE -#endif -#ifdef GL_FRAMEBUFFER_ATTACHMENT_ANGLE -#undef GL_FRAMEBUFFER_ATTACHMENT_ANGLE -#endif - -namespace cc { - -class Extensions3DChromium { -public: - enum { - // GL_OES_EGL_image_external - GL_TEXTURE_EXTERNAL_OES = 0x8D65, - - // GL_CHROMIUM_map_sub (enums inherited from GL_ARB_vertex_buffer_object) - READ_ONLY = 0x88B8, - WRITE_ONLY = 0x88B9, - - // GL_ANGLE_texture_usage - GL_TEXTURE_USAGE_ANGLE = 0x93A2, - GL_FRAMEBUFFER_ATTACHMENT_ANGLE = 0x93A3, - - // GL_EXT_texture_storage - BGRA8_EXT = 0x93A1, - - // GL_EXT_occlusion_query_boolean - ANY_SAMPLES_PASSED_EXT = 0x8C2F, - ANY_SAMPLES_PASSED_CONSERVATIVE_EXT = 0x8D6A, - CURRENT_QUERY_EXT = 0x8865, - QUERY_RESULT_EXT = 0x8866, - QUERY_RESULT_AVAILABLE_EXT = 0x8867, - - // GL_CHROMIUM_command_buffer_query - COMMANDS_ISSUED_CHROMIUM = 0x84F2 - }; -}; - -} - -#endif // CC_STUBS_EXTENSIONS3DCHROMIUM_H_ diff --git a/cc/stubs/graphics_context_3d.h b/cc/stubs/graphics_context_3d.h deleted file mode 100644 index e7f7a60..0000000 --- a/cc/stubs/graphics_context_3d.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_STUBS_GRAPHICSCONTEXT3D_H_ -#define CC_STUBS_GRAPHICSCONTEXT3D_H_ - -#include "GraphicsTypes3D.h" -#include "IntSize.h" -#include "third_party/khronos/GLES2/gl2.h" - -#ifdef NO_ERROR -#undef NO_ERROR -#endif - -namespace cc { - -class GraphicsContext3D { -public: - enum SourceDataFormat { SourceFormatRGBA8, SourceFormatBGRA8 }; - static bool computeFormatAndTypeParameters(unsigned, unsigned, unsigned* componentsPerPixel, unsigned* bytesPerComponent); - - enum { - ARRAY_BUFFER = GL_ARRAY_BUFFER, - BLEND = GL_BLEND, - CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, - COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0, - COLOR_BUFFER_BIT = GL_COLOR_BUFFER_BIT, - COMPILE_STATUS = GL_COMPILE_STATUS, - CULL_FACE = GL_CULL_FACE, - DEPTH_TEST = GL_DEPTH_TEST, - ELEMENT_ARRAY_BUFFER = GL_ELEMENT_ARRAY_BUFFER, - EXTENSIONS = GL_EXTENSIONS, - FLOAT = GL_FLOAT, - FRAGMENT_SHADER = GL_FRAGMENT_SHADER, - FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE, - FRAMEBUFFER = GL_FRAMEBUFFER, - INVALID_ENUM = GL_INVALID_ENUM, - INVALID_VALUE = GL_INVALID_VALUE, - LINEAR = GL_LINEAR, - LINE_LOOP = GL_LINE_LOOP , - LINK_STATUS = GL_LINK_STATUS, - LUMINANCE = GL_LUMINANCE, - MAX_TEXTURE_SIZE = GL_MAX_TEXTURE_SIZE, - NEAREST = GL_NEAREST, - NO_ERROR = GL_NO_ERROR, - ONE = GL_ONE, - ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA, - RGBA = GL_RGBA, - RGB = GL_RGB, - SCISSOR_TEST = GL_SCISSOR_TEST, - SRC_ALPHA = GL_SRC_ALPHA, - STATIC_DRAW = GL_STATIC_DRAW, - TEXTURE0 = GL_TEXTURE0, - TEXTURE1 = GL_TEXTURE1, - TEXTURE_2D = GL_TEXTURE_2D, - TEXTURE2 = GL_TEXTURE2, - TEXTURE3 = GL_TEXTURE3, - TEXTURE_MAG_FILTER = GL_TEXTURE_MAG_FILTER, - TEXTURE_MIN_FILTER = GL_TEXTURE_MIN_FILTER, - TEXTURE_WRAP_S = GL_TEXTURE_WRAP_S, - TEXTURE_WRAP_T = GL_TEXTURE_WRAP_T, - TRIANGLES = GL_TRIANGLES, - TRIANGLE_FAN = GL_TRIANGLE_FAN, - UNSIGNED_BYTE = GL_UNSIGNED_BYTE, - UNSIGNED_SHORT = GL_UNSIGNED_SHORT, - VERTEX_SHADER = GL_VERTEX_SHADER, - ZERO = GL_ZERO, - }; -}; - -} - -#endif // CC_STUBS_GRAPHICSCONTEXT3D_H_ diff --git a/cc/stubs/graphics_types_3d.h b/cc/stubs/graphics_types_3d.h deleted file mode 100644 index a01414e..0000000 --- a/cc/stubs/graphics_types_3d.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_STUBS_GRAPHICSTYPES3D_H_ -#define CC_STUBS_GRAPHICSTYPES3D_H_ - -#define NullPlatform3DObject 0 - -typedef unsigned char GC3Dboolean; -typedef unsigned GC3Denum; -typedef unsigned GC3Duint; -typedef unsigned Platform3DObject; -typedef int GC3Dint; -typedef signed char GC3Dbyte; - -#endif // CC_STUBS_GRAPHICSTYPES3D_H_ - diff --git a/cc/test/fake_web_graphics_context_3d.h b/cc/test/fake_web_graphics_context_3d.h index 4e753f7..7d4b62c 100644 --- a/cc/test/fake_web_graphics_context_3d.h +++ b/cc/test/fake_web_graphics_context_3d.h @@ -5,7 +5,7 @@ #ifndef FakeWebGraphicsContext3D_h #define FakeWebGraphicsContext3D_h -#include "GraphicsContext3D.h" +#include "third_party/khronos/GLES2/gl2.h" #include <public/WebGraphicsContext3D.h> namespace WebKit { @@ -76,7 +76,7 @@ public: virtual WGC3Denum checkFramebufferStatus(WGC3Denum target) { - return cc::GraphicsContext3D::FRAMEBUFFER_COMPLETE; + return GL_FRAMEBUFFER_COMPLETE; } virtual void clear(WGC3Dbitfield mask) { } @@ -122,13 +122,13 @@ public: virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) { - if (pname == cc::GraphicsContext3D::MAX_TEXTURE_SIZE) + if (pname == GL_MAX_TEXTURE_SIZE) *value = 1024; } virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) { - if (pname == cc::GraphicsContext3D::LINK_STATUS) + if (pname == GL_LINK_STATUS) *value = 1; } @@ -137,7 +137,7 @@ public: virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) { - if (pname == cc::GraphicsContext3D::COMPILE_STATUS) + if (pname == GL_COMPILE_STATUS) *value = 1; } @@ -244,11 +244,11 @@ public: virtual WebGLId createQueryEXT() { return 1; } virtual void deleteQueryEXT(WebGLId) { } - virtual GC3Dboolean isQueryEXT(WebGLId) { return true; } - virtual void beginQueryEXT(GC3Denum, WebGLId) { } - virtual void endQueryEXT(GC3Denum) { } - virtual void getQueryivEXT(GC3Denum, GC3Denum, GC3Dint*) { } - virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { } + virtual WGC3Dboolean isQueryEXT(WebGLId) { return true; } + virtual void beginQueryEXT(WGC3Denum, WebGLId) { } + virtual void endQueryEXT(WGC3Denum) { } + virtual void getQueryivEXT(WGC3Denum, WGC3Denum, WGC3Dint*) { } + virtual void getQueryObjectuivEXT(WebGLId, WGC3Denum, WGC3Duint*) { } protected: unsigned m_nextTextureId; diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc index 5d85d65..7d6dfc1 100644 --- a/cc/test/tiled_layer_test_common.cc +++ b/cc/test/tiled_layer_test_common.cc @@ -68,7 +68,7 @@ scoped_ptr<LayerTextureUpdater::Texture> FakeLayerTextureUpdater::createTexture( return scoped_ptr<LayerTextureUpdater::Texture>(new Texture(this, CCPrioritizedTexture::create(manager))); } -LayerTextureUpdater::SampledTexelFormat FakeLayerTextureUpdater::sampledTexelFormat(GC3Denum) +LayerTextureUpdater::SampledTexelFormat FakeLayerTextureUpdater::sampledTexelFormat(GLenum) { return SampledTexelFormatRGBA; } @@ -88,7 +88,7 @@ FakeTiledLayerChromium::FakeTiledLayerChromium(CCPrioritizedTextureManager* text , m_textureManager(textureManager) { setTileSize(tileSize()); - setTextureFormat(GraphicsContext3D::RGBA); + setTextureFormat(GL_RGBA); setBorderTexelOption(CCLayerTilingData::NoBorderTexels); setIsDrawable(true); // So that we don't get false positives if any of these tests expect to return false from drawsContent() for other reasons. } diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h index 5a2064d..8d6b156 100644 --- a/cc/test/tiled_layer_test_common.h +++ b/cc/test/tiled_layer_test_common.h @@ -39,7 +39,7 @@ public: FakeLayerTextureUpdater(); virtual scoped_ptr<cc::LayerTextureUpdater::Texture> createTexture(cc::CCPrioritizedTextureManager*) OVERRIDE; - virtual SampledTexelFormat sampledTexelFormat(GC3Denum) OVERRIDE; + virtual SampledTexelFormat sampledTexelFormat(GLenum) OVERRIDE; virtual void prepareToUpdate(const cc::IntRect& contentRect, const cc::IntSize&, float, float, cc::IntRect& resultingOpaqueRect, cc::CCRenderingStats&) OVERRIDE; // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next diff --git a/cc/texture.cc b/cc/texture.cc index add8429..beeff6b 100644 --- a/cc/texture.cc +++ b/cc/texture.cc @@ -8,7 +8,7 @@ namespace cc { -void CCTexture::setDimensions(const IntSize& size, GC3Denum format) +void CCTexture::setDimensions(const IntSize& size, GLenum format) { m_size = size; m_format = format; @@ -22,7 +22,7 @@ size_t CCTexture::bytes() const return memorySizeBytes(m_size, m_format); } -size_t CCTexture::memorySizeBytes(const IntSize& size, GC3Denum format) +size_t CCTexture::memorySizeBytes(const IntSize& size, GLenum format) { unsigned int componentsPerPixel = 4; unsigned int bytesPerComponent = 1; diff --git a/cc/texture.h b/cc/texture.h index 8d0def3..d2e30cd 100644 --- a/cc/texture.h +++ b/cc/texture.h @@ -5,9 +5,9 @@ #ifndef CCTexture_h #define CCTexture_h +#include "third_party/khronos/GLES2/gl2.h" #include "CCResourceProvider.h" #include "CCTexture.h" -#include "GraphicsContext3D.h" #include "IntSize.h" namespace cc { @@ -15,26 +15,26 @@ namespace cc { class CCTexture { public: CCTexture() : m_id(0) { } - CCTexture(unsigned id, IntSize size, GC3Denum format) + CCTexture(unsigned id, IntSize size, GLenum format) : m_id(id) , m_size(size) , m_format(format) { } CCResourceProvider::ResourceId id() const { return m_id; } const IntSize& size() const { return m_size; } - GC3Denum format() const { return m_format; } + GLenum format() const { return m_format; } void setId(CCResourceProvider::ResourceId id) { m_id = id; } - void setDimensions(const IntSize&, GC3Denum format); + void setDimensions(const IntSize&, GLenum format); size_t bytes() const; - static size_t memorySizeBytes(const IntSize&, GC3Denum format); + static size_t memorySizeBytes(const IntSize&, GLenum format); private: CCResourceProvider::ResourceId m_id; IntSize m_size; - GC3Denum m_format; + GLenum m_format; }; } diff --git a/cc/texture_copier.cc b/cc/texture_copier.cc index dd515f4..d53eda1 100644 --- a/cc/texture_copier.cc +++ b/cc/texture_copier.cc @@ -6,6 +6,7 @@ #include "cc/texture_copier.h" +#include "third_party/khronos/GLES2/gl2.h" #include "CCRendererGL.h" // For the GLC() macro. #include "base/debug/trace_event.h" #include <public/WebGraphicsContext3D.h> @@ -27,9 +28,9 @@ AcceleratedTextureCopier::AcceleratedTextureCopier(WebKit::WebGraphicsContext3D* {-1, 1, 0, 1} }; - 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)); + GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, m_positionBuffer)); + GLC(m_context, m_context->bufferData(GL_ARRAY_BUFFER, sizeof(kPositions), kPositions, GL_STATIC_DRAW)); + GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, 0)); m_blitProgram.reset(new BlitProgram(m_context)); } @@ -49,18 +50,18 @@ void AcceleratedTextureCopier::copyTexture(Parameters parameters) TRACE_EVENT0("cc", "TextureCopier::copyTexture"); // Note: this code does not restore the viewport, bound program, 2D texture, framebuffer, buffer or blend enable. - GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo)); - GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, parameters.destTexture, 0)); + GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo)); + GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, parameters.destTexture, 0)); #if OS(ANDROID) // Clear destination to improve performance on tiling GPUs. // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. - GLC(m_context, m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT)); + GLC(m_context, m_context->clear(GL_COLOR_BUFFER_BIT)); #endif - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, parameters.sourceTexture)); - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); - GLC(m_context, m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); + GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, parameters.sourceTexture)); + GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); + GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); if (!m_blitProgram->initialized()) m_blitProgram->initialize(m_context, m_usingBindUniforms); @@ -69,24 +70,24 @@ void AcceleratedTextureCopier::copyTexture(Parameters parameters) GLC(m_context, m_context->useProgram(m_blitProgram->program())); const int kPositionAttribute = 0; - GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_positionBuffer)); - GLC(m_context, m_context->vertexAttribPointer(kPositionAttribute, 4, GraphicsContext3D::FLOAT, false, 0, 0)); + GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, m_positionBuffer)); + GLC(m_context, m_context->vertexAttribPointer(kPositionAttribute, 4, GL_FLOAT, false, 0, 0)); GLC(m_context, m_context->enableVertexAttribArray(kPositionAttribute)); - GLC(m_context, m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0)); + GLC(m_context, m_context->bindBuffer(GL_ARRAY_BUFFER, 0)); GLC(m_context, m_context->viewport(0, 0, parameters.size.width(), parameters.size.height())); - GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); - GLC(m_context, m_context->drawArrays(GraphicsContext3D::TRIANGLE_FAN, 0, 4)); + GLC(m_context, m_context->disable(GL_BLEND)); + GLC(m_context, m_context->drawArrays(GL_TRIANGLE_FAN, 0, 4)); - 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(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); GLC(m_context, m_context->disableVertexAttribArray(kPositionAttribute)); GLC(m_context, m_context->useProgram(0)); - GLC(m_context, m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, 0, 0)); - GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); - GLC(m_context, m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); + GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0)); + GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); + GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0)); } void AcceleratedTextureCopier::flush() diff --git a/cc/texture_copier.h b/cc/texture_copier.h index 81feb9c..e2b8d17 100644 --- a/cc/texture_copier.h +++ b/cc/texture_copier.h @@ -9,15 +9,14 @@ #include "base/memory/scoped_ptr.h" #include "cc/program_binding.h" #include "cc/shader.h" -#include "GraphicsContext3D.h" #include "IntSize.h" +#include "third_party/khronos/GLES2/gl2.h" namespace WebKit { class WebGraphicsContext3D; } namespace cc { -class IntSize; class TextureCopier { public: @@ -53,8 +52,8 @@ private: typedef ProgramBinding<VertexShaderPosTexIdentity, FragmentShaderRGBATex> BlitProgram; WebKit::WebGraphicsContext3D* m_context; - Platform3DObject m_fbo; - Platform3DObject m_positionBuffer; + GLuint m_fbo; + GLuint m_positionBuffer; scoped_ptr<BlitProgram> m_blitProgram; bool m_usingBindUniforms; diff --git a/cc/texture_copier_unittest.cc b/cc/texture_copier_unittest.cc index e804aaf..0a4c425 100644 --- a/cc/texture_copier_unittest.cc +++ b/cc/texture_copier_unittest.cc @@ -6,10 +6,10 @@ #include "cc/texture_copier.h" -#include "GraphicsContext3D.h" #include "cc/test/fake_web_graphics_context_3d.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/khronos/GLES2/gl2.h" using namespace cc; using namespace WebKit; @@ -33,20 +33,20 @@ TEST(TextureCopierTest, testDrawArraysCopy) InSequence sequence; // Here we check just some essential properties of copyTexture() to avoid mirroring the full implementation. - EXPECT_CALL(*mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, _)); + EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, _)); // Make sure linear filtering is disabled during the copy. - EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::NEAREST)); - EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::NEAREST)); + EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); + EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); EXPECT_CALL(*mockContext, drawArrays(_, _, _)); // Linear filtering should be restored. - EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - EXPECT_CALL(*mockContext, texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); + EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); // Default framebuffer should be restored - EXPECT_CALL(*mockContext, bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); + EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, 0)); } int sourceTextureId = 1; diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc index 2b37e6d..aa7e344 100644 --- a/cc/texture_layer.cc +++ b/cc/texture_layer.cc @@ -6,6 +6,7 @@ #include "cc/texture_layer.h" +#include "third_party/khronos/GLES2/gl2.h" #include "CCLayerTreeHost.h" #include "CCTextureLayerImpl.h" #include "cc/texture_layer_client.h" @@ -110,7 +111,7 @@ void TextureLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusion { if (m_client) { m_textureId = m_client->prepareTexture(queue); - m_contextLost = m_client->context()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR; + m_contextLost = m_client->context()->getGraphicsResetStatusARB() != GL_NO_ERROR; } m_needsDisplay = false; diff --git a/cc/texture_update_controller.cc b/cc/texture_update_controller.cc index 2389779..29d26272 100644 --- a/cc/texture_update_controller.cc +++ b/cc/texture_update_controller.cc @@ -6,6 +6,7 @@ #include "CCTextureUpdateController.h" +#include "third_party/khronos/GLES2/gl2.h" #include "CCResourceProvider.h" #include "base/debug/trace_event.h" #include "cc/prioritized_texture.h" diff --git a/cc/threaded_unittest.h b/cc/threaded_unittest.h index 5a241b0..5aa4cef 100644 --- a/cc/threaded_unittest.h +++ b/cc/threaded_unittest.h @@ -19,7 +19,6 @@ class CCLayerImpl; class CCLayerTreeHost; class CCLayerTreeHostClient; class CCLayerTreeHostImpl; -class GraphicsContext3D; } namespace WebKitTests { diff --git a/cc/throttled_texture_uploader.cc b/cc/throttled_texture_uploader.cc index 3a241b22..13b39da 100644 --- a/cc/throttled_texture_uploader.cc +++ b/cc/throttled_texture_uploader.cc @@ -6,9 +6,10 @@ #include "cc/throttled_texture_uploader.h" #include "CCPrioritizedTexture.h" -#include "Extensions3DChromium.h" #include "base/debug/trace_event.h" #include "base/metrics/histogram.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" #include <algorithm> #include <public/WebGraphicsContext3D.h> #include <vector> @@ -46,18 +47,18 @@ void ThrottledTextureUploader::Query::begin() { m_hasValue = false; m_isNonBlocking = false; - m_context->beginQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM, m_queryId); + m_context->beginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, m_queryId); } void ThrottledTextureUploader::Query::end() { - m_context->endQueryEXT(Extensions3DChromium::COMMANDS_ISSUED_CHROMIUM); + m_context->endQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); } bool ThrottledTextureUploader::Query::isPending() { unsigned available = 1; - m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT, &available); + m_context->getQueryObjectuivEXT(m_queryId, GL_QUERY_RESULT_AVAILABLE_EXT, &available); return !available; } @@ -70,7 +71,7 @@ void ThrottledTextureUploader::Query::wait() unsigned ThrottledTextureUploader::Query::value() { if (!m_hasValue) { - m_context->getQueryObjectuivEXT(m_queryId, Extensions3DChromium::QUERY_RESULT_EXT, &m_value); + m_context->getQueryObjectuivEXT(m_queryId, GL_QUERY_RESULT_EXT, &m_value); m_hasValue = true; } return m_value; diff --git a/cc/throttled_texture_uploader_unittest.cc b/cc/throttled_texture_uploader_unittest.cc index fb346da..83f4415 100644 --- a/cc/throttled_texture_uploader_unittest.cc +++ b/cc/throttled_texture_uploader_unittest.cc @@ -7,11 +7,11 @@ #include "cc/throttled_texture_uploader.h" #include "CCPrioritizedTexture.h" -#include "Extensions3DChromium.h" -#include "GraphicsContext3D.h" #include "cc/test/fake_web_graphics_context_3d.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" using namespace cc; using namespace WebKit; @@ -24,10 +24,10 @@ public: { } - virtual void getQueryObjectuivEXT(WebGLId, GC3Denum type, GC3Duint* value) + virtual void getQueryObjectuivEXT(WebGLId, WGC3Denum type, WGC3Duint* value) { switch (type) { - case Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT: + case GL_QUERY_RESULT_AVAILABLE_EXT: *value = m_resultAvailable; break; default: diff --git a/cc/tile_draw_quad.cc b/cc/tile_draw_quad.cc index 0ffe46c..e50861e 100644 --- a/cc/tile_draw_quad.cc +++ b/cc/tile_draw_quad.cc @@ -7,15 +7,16 @@ #include "CCTileDrawQuad.h" #include "base/logging.h" +#include "third_party/khronos/GLES2/gl2.h" namespace cc { -scoped_ptr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +scoped_ptr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) { return make_scoped_ptr(new CCTileDrawQuad(sharedQuadState, quadRect, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } -CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) : CCDrawQuad(sharedQuadState, CCDrawQuad::TiledContent, quadRect) , m_resourceId(resourceId) , m_textureOffset(textureOffset) diff --git a/cc/tile_draw_quad.h b/cc/tile_draw_quad.h index 21a98cf..4802d82 100644 --- a/cc/tile_draw_quad.h +++ b/cc/tile_draw_quad.h @@ -6,7 +6,7 @@ #define CCTileDrawQuad_h #include "CCDrawQuad.h" -#include "GraphicsTypes3D.h" +#include "third_party/khronos/GLES2/gl2.h" #include "IntPoint.h" #include "IntSize.h" #include "base/memory/scoped_ptr.h" @@ -17,12 +17,12 @@ namespace cc { class CCTileDrawQuad : public CCDrawQuad { public: - static scoped_ptr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); + static scoped_ptr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); unsigned resourceId() const { return m_resourceId; } IntPoint textureOffset() const { return m_textureOffset; } IntSize textureSize() const { return m_textureSize; } - GC3Dint textureFilter() const { return m_textureFilter; } + GLint textureFilter() const { return m_textureFilter; } bool swizzleContents() const { return m_swizzleContents; } bool leftEdgeAA() const { return m_leftEdgeAA; } @@ -34,12 +34,12 @@ public: static const CCTileDrawQuad* materialCast(const CCDrawQuad*); private: - CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); + CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, unsigned resourceId, const IntPoint& textureOffset, const IntSize& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); unsigned m_resourceId; IntPoint m_textureOffset; IntSize m_textureSize; - GC3Dint m_textureFilter; + GLint m_textureFilter; bool m_swizzleContents; bool m_leftEdgeAA; bool m_topEdgeAA; diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index e7adf54..3b0e61c 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -13,6 +13,7 @@ #include "CCTiledLayerImpl.h" #include "Region.h" #include "base/basictypes.h" +#include "third_party/khronos/GLES2/gl2.h" using namespace std; using WebKit::WebTransformationMatrix; @@ -77,7 +78,7 @@ private: TiledLayerChromium::TiledLayerChromium() : LayerChromium() - , m_textureFormat(GraphicsContext3D::INVALID_ENUM) + , m_textureFormat(GL_INVALID_ENUM) , m_skipsDraw(false) , m_failedUpdate(false) , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid) diff --git a/cc/tiled_layer.h b/cc/tiled_layer.h index 6163391..fa701e0 100644 --- a/cc/tiled_layer.h +++ b/cc/tiled_layer.h @@ -46,7 +46,7 @@ protected: // Exposed to subclasses for testing. void setTileSize(const IntSize&); - void setTextureFormat(GC3Denum textureFormat) { m_textureFormat = textureFormat; } + void setTextureFormat(GLenum textureFormat) { m_textureFormat = textureFormat; } void setBorderTexelOption(CCLayerTilingData::BorderTexelOption); void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; } size_t numPaintedTiles() { return m_tiler->tiles().size(); } @@ -88,7 +88,7 @@ private: UpdatableTile* tileAt(int, int) const; UpdatableTile* createTile(int, int); - GC3Denum m_textureFormat; + GLenum m_textureFormat; bool m_skipsDraw; bool m_failedUpdate; LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat; diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc index 7cd33d2..aee3f7293 100644 --- a/cc/tiled_layer_impl.cc +++ b/cc/tiled_layer_impl.cc @@ -6,8 +6,6 @@ #include "CCTiledLayerImpl.h" -#include "base/basictypes.h" -#include "base/stringprintf.h" #include "CCAppendQuadsData.h" #include "CCCheckerboardDrawQuad.h" #include "CCDebugBorderDrawQuad.h" @@ -17,7 +15,9 @@ #include "CCSolidColorDrawQuad.h" #include "CCTileDrawQuad.h" #include "FloatQuad.h" -#include "GraphicsContext3D.h" +#include "base/basictypes.h" +#include "base/stringprintf.h" +#include "third_party/khronos/GLES2/gl2.h" #include "third_party/skia/include/core/SkColor.h" using namespace std; @@ -194,7 +194,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe bool rightEdgeAA = i == m_tiler->numTilesX() - 1 && useAA; bool bottomEdgeAA = j == m_tiler->numTilesY() - 1 && useAA; - const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; + const GLint textureFilter = m_tiler->hasBorderTexels() ? GL_LINEAR : GL_NEAREST; quadSink.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tileOpaqueRect, tile->resourceId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA).PassAs<CCDrawQuad>(), appendQuadsData); } } diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc index 4da86d7..f2a8e23 100644 --- a/cc/video_layer_impl.cc +++ b/cc/video_layer_impl.cc @@ -6,6 +6,8 @@ #include "CCVideoLayerImpl.h" +#include "third_party/khronos/GLES2/gl2ext.h" +#include "third_party/khronos/GLES2/gl2.h" #include "CCIOSurfaceDrawQuad.h" #include "CCLayerTreeHostImpl.h" #include "CCProxy.h" @@ -14,8 +16,6 @@ #include "CCStreamVideoDrawQuad.h" #include "CCTextureDrawQuad.h" #include "CCYUVVideoDrawQuad.h" -#include "Extensions3DChromium.h" -#include "GraphicsContext3D.h" #include "NotImplemented.h" #include <public/WebVideoFrame.h> @@ -69,12 +69,12 @@ void CCVideoLayerImpl::stopUsingProvider() } // Convert WebKit::WebVideoFrame::Format to GraphicsContext3D's format enum values. -static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) +static GLenum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) { switch (frame.format()) { case WebKit::WebVideoFrame::FormatYV12: case WebKit::WebVideoFrame::FormatYV16: - return GraphicsContext3D::LUMINANCE; + return GL_LUMINANCE; case WebKit::WebVideoFrame::FormatNativeTexture: return frame.textureTarget(); case WebKit::WebVideoFrame::FormatInvalid: @@ -83,7 +83,7 @@ static GC3Denum convertVFCFormatToGC3DFormat(const WebKit::WebVideoFrame& frame) case WebKit::WebVideoFrame::FormatI420: notImplemented(); } - return GraphicsContext3D::INVALID_VALUE; + return GL_INVALID_VALUE; } void CCVideoLayerImpl::willDraw(CCResourceProvider* resourceProvider) @@ -124,7 +124,7 @@ void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) m_format = convertVFCFormatToGC3DFormat(*m_frame); - if (m_format == GraphicsContext3D::INVALID_VALUE) { + if (m_format == GL_INVALID_VALUE) { m_provider->putCurrentFrame(m_frame); m_frame = 0; return; @@ -148,7 +148,7 @@ void CCVideoLayerImpl::willDrawInternal(CCResourceProvider* resourceProvider) return; } - if (m_format == GraphicsContext3D::TEXTURE_2D) + if (m_format == GL_TEXTURE_2D) m_externalTextureResource = resourceProvider->createResourceFromExternalTexture(m_frame->textureId()); } @@ -168,7 +168,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe IntRect quadRect(IntPoint(), contentBounds()); switch (m_format) { - case GraphicsContext3D::LUMINANCE: { + case GL_LUMINANCE: { // YUV software decoder. const FramePlane& yPlane = m_framePlanes[WebKit::WebVideoFrame::yPlane]; const FramePlane& uPlane = m_framePlanes[WebKit::WebVideoFrame::uPlane]; @@ -177,7 +177,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe quadSink.append(yuvVideoQuad.PassAs<CCDrawQuad>(), appendQuadsData); break; } - case GraphicsContext3D::RGBA: { + case GL_RGBA: { // RGBA software decoder. const FramePlane& plane = m_framePlanes[WebKit::WebVideoFrame::rgbPlane]; float widthScaleFactor = static_cast<float>(plane.visibleSize.width()) / plane.size.width(); @@ -189,7 +189,7 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe quadSink.append(textureQuad.PassAs<CCDrawQuad>(), appendQuadsData); break; } - case GraphicsContext3D::TEXTURE_2D: { + case GL_TEXTURE_2D: { // NativeTexture hardware decoder. bool premultipliedAlpha = true; FloatRect uvRect(0, 0, 1, 1); @@ -198,13 +198,13 @@ void CCVideoLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appe quadSink.append(textureQuad.PassAs<CCDrawQuad>(), appendQuadsData); break; } - case Extensions3D::TEXTURE_RECTANGLE_ARB: { + case GL_TEXTURE_RECTANGLE_ARB: { IntSize textureSize(m_frame->width(), m_frame->height()); scoped_ptr<CCIOSurfaceDrawQuad> ioSurfaceQuad = CCIOSurfaceDrawQuad::create(sharedQuadState, quadRect, textureSize, m_frame->textureId(), CCIOSurfaceDrawQuad::Unflipped); quadSink.append(ioSurfaceQuad.PassAs<CCDrawQuad>(), appendQuadsData); break; } - case Extensions3DChromium::GL_TEXTURE_EXTERNAL_OES: { + case GL_TEXTURE_EXTERNAL_OES: { // StreamTexture hardware decoder. scoped_ptr<CCStreamVideoDrawQuad> streamVideoQuad = CCStreamVideoDrawQuad::create(sharedQuadState, quadRect, m_frame->textureId(), m_streamTextureMatrix); quadSink.append(streamVideoQuad.PassAs<CCDrawQuad>(), appendQuadsData); @@ -223,7 +223,7 @@ void CCVideoLayerImpl::didDraw(CCResourceProvider* resourceProvider) if (!m_frame) return; - if (m_format == GraphicsContext3D::TEXTURE_2D) { + if (m_format == GL_TEXTURE_2D) { DCHECK(m_externalTextureResource); // FIXME: the following assert will not be true when sending resources to a // parent compositor. We will probably need to hold on to m_frame for diff --git a/cc/video_layer_impl.h b/cc/video_layer_impl.h index 677c4ef..6b97643c 100644 --- a/cc/video_layer_impl.h +++ b/cc/video_layer_impl.h @@ -7,7 +7,7 @@ #include "base/synchronization/lock.h" #include "CCLayerImpl.h" -#include "GraphicsContext3D.h" +#include "third_party/khronos/GLES2/gl2.h" #include "IntSize.h" #include <public/WebTransformationMatrix.h> #include <public/WebVideoFrameProvider.h> @@ -49,7 +49,7 @@ public: struct FramePlane { CCResourceProvider::ResourceId resourceId; IntSize size; - GC3Denum format; + GLenum format; IntSize visibleSize; FramePlane() : resourceId(0) { } @@ -77,7 +77,7 @@ private: WebKit::WebTransformationMatrix m_streamTextureMatrix; WebKit::WebVideoFrame* m_frame; - GC3Denum m_format; + GLenum m_format; CCResourceProvider::ResourceId m_externalTextureResource; // Each index in this array corresponds to a plane in WebKit::WebVideoFrame. |