Index: cc/gl_renderer.cc |
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc |
index db0c69413c9e663168eb0b7e2c53d8d3694bef4e..8cfb6da97fe6d31e77ffd96f1545eb282baf4f3b 100644 |
--- a/cc/gl_renderer.cc |
+++ b/cc/gl_renderer.cc |
@@ -7,6 +7,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" |
@@ -17,7 +19,6 @@ |
#include "CCSettings.h" |
#include "CCSingleThreadProxy.h" |
#include "CCVideoLayerImpl.h" |
-#include "Extensions3D.h" |
#include "FloatQuad.h" |
#include "GeometryBinding.h" |
#include "GrTexture.h" |
@@ -92,7 +93,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()); |
@@ -127,7 +128,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"); |
@@ -162,7 +163,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: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, static_cast<int>(error)); |
} |
@@ -199,7 +200,7 @@ void CCRendererGL::clearFramebuffer(DrawingFrame& frame) |
#if defined(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) |
@@ -223,25 +224,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: |
@@ -325,7 +326,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) |
@@ -395,7 +396,7 @@ PassOwnPtr<CCScopedTexture> CCRendererGL::drawBackgroundFilters(DrawingFrame& fr |
int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); |
OwnPtr<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 nullptr; |
const CCRenderPass* targetRenderPass = frame.currentRenderPass; |
@@ -482,8 +483,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; |
@@ -535,12 +536,12 @@ void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra |
if (shaderMaskSamplerLocation != -1) { |
ASSERT(shaderMaskTexCoordScaleLocation != 1); |
ASSERT(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) { |
@@ -666,11 +667,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) { |
@@ -777,12 +778,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())); |
@@ -822,7 +823,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) |
@@ -837,8 +838,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)); |
@@ -884,16 +885,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) |
@@ -904,14 +905,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) |
@@ -927,13 +928,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) |
@@ -941,8 +942,8 @@ void CCRendererGL::finishDrawingFrame(DrawingFrame& frame) |
m_currentFramebufferLock.clear(); |
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 |
@@ -1001,19 +1002,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)); |
@@ -1094,7 +1095,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. |
@@ -1130,8 +1131,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 |
@@ -1140,24 +1141,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)); |
- ASSERT(m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); |
+ ASSERT(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); |
} |
OwnArrayPtr<uint8_t> srcPixels = adoptArrayPtr(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; |
@@ -1177,8 +1178,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)); |
} |
@@ -1194,14 +1195,14 @@ void CCRendererGL::getFramebufferPixels(void *pixels, const IntRect& rect) |
bool CCRendererGL::getFramebufferTexture(CCScopedTexture* texture, const IntRect& deviceRect) |
{ |
- ASSERT(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GraphicsContext3D::RGB)); |
+ ASSERT(!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; |
} |
@@ -1218,20 +1219,20 @@ bool CCRendererGL::useScopedTexture(DrawingFrame& frame, const CCScopedTexture* |
void CCRendererGL::bindFramebufferToOutputSurface(DrawingFrame& frame) |
{ |
m_currentFramebufferLock.clear(); |
- 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) |
{ |
ASSERT(texture->id()); |
- GLC(m_context, m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_offscreenFramebufferId)); |
+ GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebufferId)); |
m_currentFramebufferLock = adoptPtr(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)); |
#if !defined ( NDEBUG ) |
- if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { |
+ if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { |
ASSERT_NOT_REACHED(); |
return false; |
} |
@@ -1245,13 +1246,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) |
@@ -1521,7 +1522,7 @@ void CCRendererGL::cleanupSharedObjects() |
bool CCRendererGL::isContextLost() |
{ |
- return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR); |
+ return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
} |
} // namespace cc |