summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp')
-rw-r--r--Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp51
1 files changed, 30 insertions, 21 deletions
diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
index dc12f6c5d..7033fa6da 100644
--- a/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
+++ b/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp
@@ -30,12 +30,10 @@
#if USE(3D_GRAPHICS)
-#include "Extensions3DOpenGL.h"
#include "GraphicsContext3DPrivate.h"
#include "Image.h"
#include "ImageSource.h"
#include "NotImplemented.h"
-#include "OpenGLShims.h"
#include "PlatformContextCairo.h"
#include "RefPtrCairo.h"
#include "ShaderLang.h"
@@ -44,6 +42,13 @@
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
+#if USE(OPENGL_ES_2)
+#include "Extensions3DOpenGLES.h"
+#else
+#include "Extensions3DOpenGL.h"
+#include "OpenGLShims.h"
+#endif
+
namespace WebCore {
PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
@@ -55,7 +60,9 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
static bool initialized = false;
static bool success = true;
if (!initialized) {
+#if !USE(OPENGL_ES_2)
success = initializeOpenGLShims();
+#endif
initialized = true;
}
if (!success)
@@ -90,26 +97,26 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, H
::glBindTexture(GL_TEXTURE_2D, m_texture);
::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
::glBindTexture(GL_TEXTURE_2D, 0);
// Create an FBO.
- ::glGenFramebuffersEXT(1, &m_fbo);
- ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
+ ::glGenFramebuffers(1, &m_fbo);
+ ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
m_boundFBO = m_fbo;
if (!m_attrs.antialias && (m_attrs.stencil || m_attrs.depth))
- ::glGenRenderbuffersEXT(1, &m_depthStencilBuffer);
+ ::glGenRenderbuffers(1, &m_depthStencilBuffer);
// Create a multisample FBO.
if (m_attrs.antialias) {
- ::glGenFramebuffersEXT(1, &m_multisampleFBO);
- ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO);
+ ::glGenFramebuffers(1, &m_multisampleFBO);
+ ::glBindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
m_boundFBO = m_multisampleFBO;
- ::glGenRenderbuffersEXT(1, &m_multisampleColorBuffer);
+ ::glGenRenderbuffers(1, &m_multisampleColorBuffer);
if (m_attrs.stencil || m_attrs.depth)
- ::glGenRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer);
+ ::glGenRenderbuffers(1, &m_multisampleDepthStencilBuffer);
}
}
@@ -129,8 +136,11 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, H
ANGLEResources.MaxDrawBuffers = 1;
m_compiler.setResources(ANGLEResources);
+#if !USE(OPENGL_ES_2)
::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
::glEnable(GL_POINT_SPRITE);
+#endif
+
::glClearColor(0, 0, 0, 0);
}
@@ -142,20 +152,15 @@ GraphicsContext3D::~GraphicsContext3D()
makeContextCurrent();
::glDeleteTextures(1, &m_texture);
if (m_attrs.antialias) {
- ::glDeleteRenderbuffersEXT(1, &m_multisampleColorBuffer);
+ ::glDeleteRenderbuffers(1, &m_multisampleColorBuffer);
if (m_attrs.stencil || m_attrs.depth)
- ::glDeleteRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer);
- ::glDeleteFramebuffersEXT(1, &m_multisampleFBO);
+ ::glDeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
+ ::glDeleteFramebuffers(1, &m_multisampleFBO);
} else {
if (m_attrs.stencil || m_attrs.depth)
- ::glDeleteRenderbuffersEXT(1, &m_depthStencilBuffer);
+ ::glDeleteRenderbuffers(1, &m_depthStencilBuffer);
}
- ::glDeleteFramebuffersEXT(1, &m_fbo);
-}
-
-void GraphicsContext3D::releaseShaderCompiler()
-{
- notImplemented();
+ ::glDeleteFramebuffers(1, &m_fbo);
}
bool GraphicsContext3D::getImageData(Image* image, unsigned int format, unsigned int type, bool premultiplyAlpha, bool ignoreGammaAndColorProfile, Vector<uint8_t>& outputVector)
@@ -258,7 +263,11 @@ PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D()
bool GraphicsContext3D::isGLES2Compliant() const
{
+#if USE(OPENGL_ES_2)
+ return true;
+#else
return false;
+#endif
}
#if USE(ACCELERATED_COMPOSITING)