[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jamesr at google.com
jamesr at google.com
Wed Dec 22 11:41:05 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 363377fc6f8c51a33278ddcf5012ca8a9798343c
Author: jamesr at google.com <jamesr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 3 19:47:46 2010 +0000
2010-08-03 James Robinson <jamesr at chromium.org>
Reviewed by Darin Fisher.
Move WebGL-specific code out of GraphicsContext3D so that G3D can be used as a generic accelerated drawing API
https://bugs.webkit.org/show_bug.cgi?id=43221
Implements functions in term of Platform3DObjects instead of WebGL types.
* src/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas):
(WebCore::GraphicsContext3DInternal::beginPaint):
(WebCore::GraphicsContext3DInternal::bindAttribLocation):
(WebCore::GraphicsContext3DInternal::getActiveAttrib):
(WebCore::GraphicsContext3DInternal::getActiveUniform):
(WebCore::GraphicsContext3DInternal::getAttribLocation):
(WebCore::GraphicsContext3DInternal::getProgramInfoLog):
(WebCore::GraphicsContext3DInternal::getShaderInfoLog):
(WebCore::GraphicsContext3DInternal::getShaderSource):
(WebCore::GraphicsContext3DInternal::getUniformLocation):
(WebCore::GraphicsContext3DInternal::shaderSource):
2010-08-03 James Robinson <jamesr at chromium.org>
Reviewed by Darin Fisher.
Move WebGL-specific code out of GraphicsContext3D so that G3D can be used as a generic accelerated drawing API
https://bugs.webkit.org/show_bug.cgi?id=43221
Changes the GraphicsContext3D API to use Platform3DObjects instead of WebGLFoo* types like WebGLTexture.
WebGLRenderingContext still uses WebGLFoo types and converts to Platform3DObjects internally. Other
consumers of the GraphicsContext3D can use the Platform3DObject APIs directly without any ties to WebGL.
The majority of this change is purely mechanical. The less obvious changes are:
- move all null checking on WebGLFoo types to WebGLRenderingContext, instead of mixing them
between WebGLRenderingContext and the various port-specific implementations of GraphicsContext3D
- add a GraphicsContext3D getter to CanvasRenderingContext. This is needed for the readback
path on Chromium/mac. It may be possible to remove this, but I would prefer to do that
in a follow-up patch to minimize churn.
- move some texture cube map logic that existed only in the Chromium port of GC3D to
WebGLRenderingContext behind #if PLATFORM(CHROMIUM). I think this logic should either
exist for all ports or exist for none, but again I would rather change the behavior
in a different patch from this one.
* html/canvas/CanvasRenderingContext.h:
(WebCore::CanvasRenderingContext::graphicsContext3D):
* html/canvas/WebGLProgram.cpp:
(WebCore::WebGLProgram::cacheActiveAttribLocations):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::attachShader):
(WebCore::WebGLRenderingContext::bindAttribLocation):
(WebCore::WebGLRenderingContext::bindBuffer):
(WebCore::WebGLRenderingContext::bindFramebuffer):
(WebCore::WebGLRenderingContext::bindRenderbuffer):
(WebCore::WebGLRenderingContext::bindTexture):
(WebCore::WebGLRenderingContext::compileShader):
(WebCore::WebGLRenderingContext::detachShader):
(WebCore::WebGLRenderingContext::framebufferRenderbuffer):
(WebCore::WebGLRenderingContext::framebufferTexture2D):
(WebCore::WebGLRenderingContext::getActiveAttrib):
(WebCore::WebGLRenderingContext::getActiveUniform):
(WebCore::WebGLRenderingContext::getAttachedShaders):
(WebCore::WebGLRenderingContext::getAttribLocation):
(WebCore::WebGLRenderingContext::getProgramParameter):
(WebCore::WebGLRenderingContext::getProgramInfoLog):
(WebCore::WebGLRenderingContext::getShaderParameter):
(WebCore::WebGLRenderingContext::getShaderInfoLog):
(WebCore::WebGLRenderingContext::getShaderSource):
(WebCore::WebGLRenderingContext::getUniform):
(WebCore::WebGLRenderingContext::getUniformLocation):
(WebCore::WebGLRenderingContext::isBuffer):
(WebCore::WebGLRenderingContext::isFramebuffer):
(WebCore::WebGLRenderingContext::isProgram):
(WebCore::WebGLRenderingContext::isRenderbuffer):
(WebCore::WebGLRenderingContext::isShader):
(WebCore::WebGLRenderingContext::isTexture):
(WebCore::WebGLRenderingContext::linkProgram):
(WebCore::WebGLRenderingContext::shaderSource):
(WebCore::WebGLRenderingContext::useProgram):
(WebCore::WebGLRenderingContext::validateProgram):
(WebCore::WebGLRenderingContext::handleNPOTTextures):
(WebCore::WebGLRenderingContext::createFallbackBlackTextures1x1):
(WebCore::WebGLRenderingContext::initVertexAttrib0):
(WebCore::WebGLRenderingContext::simulateVertexAttrib0):
(WebCore::WebGLRenderingContext::restoreStatesAfterVertexAttrib0Simulation):
* html/canvas/WebGLRenderingContext.h:
(WebCore::WebGLRenderingContext::graphicsContext3D):
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
(WebCore::GraphicsContext3D::beginPaint):
(WebCore::GraphicsContext3D::attachShader):
(WebCore::GraphicsContext3D::bindAttribLocation):
(WebCore::GraphicsContext3D::bindBuffer):
(WebCore::GraphicsContext3D::bindFramebuffer):
(WebCore::GraphicsContext3D::bindRenderbuffer):
(WebCore::GraphicsContext3D::bindTexture):
(WebCore::GraphicsContext3D::compileShader):
(WebCore::GraphicsContext3D::detachShader):
(WebCore::GraphicsContext3D::framebufferRenderbuffer):
(WebCore::GraphicsContext3D::framebufferTexture2D):
(WebCore::GraphicsContext3D::getActiveAttrib):
(WebCore::GraphicsContext3D::getActiveUniform):
(WebCore::GraphicsContext3D::getAttachedShaders):
(WebCore::GraphicsContext3D::getAttribLocation):
(WebCore::GraphicsContext3D::isBuffer):
(WebCore::GraphicsContext3D::isFramebuffer):
(WebCore::GraphicsContext3D::isProgram):
(WebCore::GraphicsContext3D::isRenderbuffer):
(WebCore::GraphicsContext3D::isShader):
(WebCore::GraphicsContext3D::isTexture):
(WebCore::GraphicsContext3D::linkProgram):
(WebCore::GraphicsContext3D::shaderSource):
(WebCore::GraphicsContext3D::useProgram):
(WebCore::GraphicsContext3D::validateProgram):
(WebCore::GraphicsContext3D::getProgramiv):
(WebCore::GraphicsContext3D::getProgramInfoLog):
(WebCore::GraphicsContext3D::getShaderiv):
(WebCore::GraphicsContext3D::getShaderInfoLog):
(WebCore::GraphicsContext3D::getShaderSource):
(WebCore::GraphicsContext3D::getUniformfv):
(WebCore::GraphicsContext3D::getUniformiv):
(WebCore::GraphicsContext3D::getUniformLocation):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::beginPaint):
(WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
(WebCore::GraphicsContext3D::attachShader):
(WebCore::GraphicsContext3D::bindAttribLocation):
(WebCore::GraphicsContext3D::bindBuffer):
(WebCore::GraphicsContext3D::bindFramebuffer):
(WebCore::GraphicsContext3D::bindRenderbuffer):
(WebCore::GraphicsContext3D::bindTexture):
(WebCore::GraphicsContext3D::compileShader):
(WebCore::GraphicsContext3D::detachShader):
(WebCore::GraphicsContext3D::framebufferRenderbuffer):
(WebCore::GraphicsContext3D::framebufferTexture2D):
(WebCore::GraphicsContext3D::getActiveAttrib):
(WebCore::GraphicsContext3D::getActiveUniform):
(WebCore::GraphicsContext3D::getAttribLocation):
(WebCore::GraphicsContext3D::isBuffer):
(WebCore::GraphicsContext3D::isFramebuffer):
(WebCore::GraphicsContext3D::isProgram):
(WebCore::GraphicsContext3D::isRenderbuffer):
(WebCore::GraphicsContext3D::isShader):
(WebCore::GraphicsContext3D::isTexture):
(WebCore::GraphicsContext3D::linkProgram):
(WebCore::GraphicsContext3D::shaderSource):
(WebCore::GraphicsContext3D::useProgram):
(WebCore::GraphicsContext3D::validateProgram):
(WebCore::GraphicsContext3D::getProgramiv):
(WebCore::GraphicsContext3D::getProgramInfoLog):
(WebCore::GraphicsContext3D::getShaderiv):
(WebCore::GraphicsContext3D::getShaderInfoLog):
(WebCore::GraphicsContext3D::getShaderSource):
(WebCore::GraphicsContext3D::getUniformfv):
(WebCore::GraphicsContext3D::getUniformiv):
(WebCore::GraphicsContext3D::getUniformLocation):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4002195..b49b63a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,139 @@
+2010-08-03 James Robinson <jamesr at chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Move WebGL-specific code out of GraphicsContext3D so that G3D can be used as a generic accelerated drawing API
+ https://bugs.webkit.org/show_bug.cgi?id=43221
+
+ Changes the GraphicsContext3D API to use Platform3DObjects instead of WebGLFoo* types like WebGLTexture.
+ WebGLRenderingContext still uses WebGLFoo types and converts to Platform3DObjects internally. Other
+ consumers of the GraphicsContext3D can use the Platform3DObject APIs directly without any ties to WebGL.
+
+ The majority of this change is purely mechanical. The less obvious changes are:
+ - move all null checking on WebGLFoo types to WebGLRenderingContext, instead of mixing them
+ between WebGLRenderingContext and the various port-specific implementations of GraphicsContext3D
+ - add a GraphicsContext3D getter to CanvasRenderingContext. This is needed for the readback
+ path on Chromium/mac. It may be possible to remove this, but I would prefer to do that
+ in a follow-up patch to minimize churn.
+ - move some texture cube map logic that existed only in the Chromium port of GC3D to
+ WebGLRenderingContext behind #if PLATFORM(CHROMIUM). I think this logic should either
+ exist for all ports or exist for none, but again I would rather change the behavior
+ in a different patch from this one.
+
+ * html/canvas/CanvasRenderingContext.h:
+ (WebCore::CanvasRenderingContext::graphicsContext3D):
+ * html/canvas/WebGLProgram.cpp:
+ (WebCore::WebGLProgram::cacheActiveAttribLocations):
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::attachShader):
+ (WebCore::WebGLRenderingContext::bindAttribLocation):
+ (WebCore::WebGLRenderingContext::bindBuffer):
+ (WebCore::WebGLRenderingContext::bindFramebuffer):
+ (WebCore::WebGLRenderingContext::bindRenderbuffer):
+ (WebCore::WebGLRenderingContext::bindTexture):
+ (WebCore::WebGLRenderingContext::compileShader):
+ (WebCore::WebGLRenderingContext::detachShader):
+ (WebCore::WebGLRenderingContext::framebufferRenderbuffer):
+ (WebCore::WebGLRenderingContext::framebufferTexture2D):
+ (WebCore::WebGLRenderingContext::getActiveAttrib):
+ (WebCore::WebGLRenderingContext::getActiveUniform):
+ (WebCore::WebGLRenderingContext::getAttachedShaders):
+ (WebCore::WebGLRenderingContext::getAttribLocation):
+ (WebCore::WebGLRenderingContext::getProgramParameter):
+ (WebCore::WebGLRenderingContext::getProgramInfoLog):
+ (WebCore::WebGLRenderingContext::getShaderParameter):
+ (WebCore::WebGLRenderingContext::getShaderInfoLog):
+ (WebCore::WebGLRenderingContext::getShaderSource):
+ (WebCore::WebGLRenderingContext::getUniform):
+ (WebCore::WebGLRenderingContext::getUniformLocation):
+ (WebCore::WebGLRenderingContext::isBuffer):
+ (WebCore::WebGLRenderingContext::isFramebuffer):
+ (WebCore::WebGLRenderingContext::isProgram):
+ (WebCore::WebGLRenderingContext::isRenderbuffer):
+ (WebCore::WebGLRenderingContext::isShader):
+ (WebCore::WebGLRenderingContext::isTexture):
+ (WebCore::WebGLRenderingContext::linkProgram):
+ (WebCore::WebGLRenderingContext::shaderSource):
+ (WebCore::WebGLRenderingContext::useProgram):
+ (WebCore::WebGLRenderingContext::validateProgram):
+ (WebCore::WebGLRenderingContext::handleNPOTTextures):
+ (WebCore::WebGLRenderingContext::createFallbackBlackTextures1x1):
+ (WebCore::WebGLRenderingContext::initVertexAttrib0):
+ (WebCore::WebGLRenderingContext::simulateVertexAttrib0):
+ (WebCore::WebGLRenderingContext::restoreStatesAfterVertexAttrib0Simulation):
+ * html/canvas/WebGLRenderingContext.h:
+ (WebCore::WebGLRenderingContext::graphicsContext3D):
+ * platform/graphics/GraphicsContext3D.h:
+ * platform/graphics/mac/GraphicsContext3DMac.mm:
+ (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
+ (WebCore::GraphicsContext3D::beginPaint):
+ (WebCore::GraphicsContext3D::attachShader):
+ (WebCore::GraphicsContext3D::bindAttribLocation):
+ (WebCore::GraphicsContext3D::bindBuffer):
+ (WebCore::GraphicsContext3D::bindFramebuffer):
+ (WebCore::GraphicsContext3D::bindRenderbuffer):
+ (WebCore::GraphicsContext3D::bindTexture):
+ (WebCore::GraphicsContext3D::compileShader):
+ (WebCore::GraphicsContext3D::detachShader):
+ (WebCore::GraphicsContext3D::framebufferRenderbuffer):
+ (WebCore::GraphicsContext3D::framebufferTexture2D):
+ (WebCore::GraphicsContext3D::getActiveAttrib):
+ (WebCore::GraphicsContext3D::getActiveUniform):
+ (WebCore::GraphicsContext3D::getAttachedShaders):
+ (WebCore::GraphicsContext3D::getAttribLocation):
+ (WebCore::GraphicsContext3D::isBuffer):
+ (WebCore::GraphicsContext3D::isFramebuffer):
+ (WebCore::GraphicsContext3D::isProgram):
+ (WebCore::GraphicsContext3D::isRenderbuffer):
+ (WebCore::GraphicsContext3D::isShader):
+ (WebCore::GraphicsContext3D::isTexture):
+ (WebCore::GraphicsContext3D::linkProgram):
+ (WebCore::GraphicsContext3D::shaderSource):
+ (WebCore::GraphicsContext3D::useProgram):
+ (WebCore::GraphicsContext3D::validateProgram):
+ (WebCore::GraphicsContext3D::getProgramiv):
+ (WebCore::GraphicsContext3D::getProgramInfoLog):
+ (WebCore::GraphicsContext3D::getShaderiv):
+ (WebCore::GraphicsContext3D::getShaderInfoLog):
+ (WebCore::GraphicsContext3D::getShaderSource):
+ (WebCore::GraphicsContext3D::getUniformfv):
+ (WebCore::GraphicsContext3D::getUniformiv):
+ (WebCore::GraphicsContext3D::getUniformLocation):
+ * platform/graphics/qt/GraphicsContext3DQt.cpp:
+ (WebCore::GraphicsContext3D::beginPaint):
+ (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
+ (WebCore::GraphicsContext3D::attachShader):
+ (WebCore::GraphicsContext3D::bindAttribLocation):
+ (WebCore::GraphicsContext3D::bindBuffer):
+ (WebCore::GraphicsContext3D::bindFramebuffer):
+ (WebCore::GraphicsContext3D::bindRenderbuffer):
+ (WebCore::GraphicsContext3D::bindTexture):
+ (WebCore::GraphicsContext3D::compileShader):
+ (WebCore::GraphicsContext3D::detachShader):
+ (WebCore::GraphicsContext3D::framebufferRenderbuffer):
+ (WebCore::GraphicsContext3D::framebufferTexture2D):
+ (WebCore::GraphicsContext3D::getActiveAttrib):
+ (WebCore::GraphicsContext3D::getActiveUniform):
+ (WebCore::GraphicsContext3D::getAttribLocation):
+ (WebCore::GraphicsContext3D::isBuffer):
+ (WebCore::GraphicsContext3D::isFramebuffer):
+ (WebCore::GraphicsContext3D::isProgram):
+ (WebCore::GraphicsContext3D::isRenderbuffer):
+ (WebCore::GraphicsContext3D::isShader):
+ (WebCore::GraphicsContext3D::isTexture):
+ (WebCore::GraphicsContext3D::linkProgram):
+ (WebCore::GraphicsContext3D::shaderSource):
+ (WebCore::GraphicsContext3D::useProgram):
+ (WebCore::GraphicsContext3D::validateProgram):
+ (WebCore::GraphicsContext3D::getProgramiv):
+ (WebCore::GraphicsContext3D::getProgramInfoLog):
+ (WebCore::GraphicsContext3D::getShaderiv):
+ (WebCore::GraphicsContext3D::getShaderInfoLog):
+ (WebCore::GraphicsContext3D::getShaderSource):
+ (WebCore::GraphicsContext3D::getUniformfv):
+ (WebCore::GraphicsContext3D::getUniformiv):
+ (WebCore::GraphicsContext3D::getUniformLocation):
+
2010-08-03 Xan Lopez <xlopez at igalia.com>
Reviewed by Gustavo Noronha.
diff --git a/WebCore/html/canvas/CanvasRenderingContext.h b/WebCore/html/canvas/CanvasRenderingContext.h
index 2ee1693..436eead 100644
--- a/WebCore/html/canvas/CanvasRenderingContext.h
+++ b/WebCore/html/canvas/CanvasRenderingContext.h
@@ -31,6 +31,7 @@
namespace WebCore {
class CanvasObject;
+ class GraphicsContext3D;
class HTMLCanvasElement;
class CanvasRenderingContext : public Noncopyable {
@@ -47,6 +48,10 @@ namespace WebCore {
virtual bool is2d() const { return false; }
virtual bool is3d() const { return false; }
virtual bool isAccelerated() const { return false; }
+
+ // For accelerated canvases, returns a pointer to the underlying GraphicsContext3D.
+ // For non accelerated canvases returns 0.
+ virtual GraphicsContext3D* graphicsContext3D() const { return 0; }
private:
HTMLCanvasElement* m_canvas;
diff --git a/WebCore/html/canvas/WebGLProgram.cpp b/WebCore/html/canvas/WebGLProgram.cpp
index 0004465..d13ae3d 100644
--- a/WebCore/html/canvas/WebGLProgram.cpp
+++ b/WebCore/html/canvas/WebGLProgram.cpp
@@ -56,17 +56,17 @@ bool WebGLProgram::cacheActiveAttribLocations()
return false;
GraphicsContext3D* context3d = context()->graphicsContext3D();
int linkStatus;
- context3d->getProgramiv(this, GraphicsContext3D::LINK_STATUS, &linkStatus);
+ context3d->getProgramiv(object(), GraphicsContext3D::LINK_STATUS, &linkStatus);
if (!linkStatus)
return false;
int numAttribs = 0;
- context3d->getProgramiv(this, GraphicsContext3D::ACTIVE_ATTRIBUTES, &numAttribs);
+ context3d->getProgramiv(object(), GraphicsContext3D::ACTIVE_ATTRIBUTES, &numAttribs);
m_activeAttribLocations.resize(static_cast<size_t>(numAttribs));
for (int i = 0; i < numAttribs; ++i) {
ActiveInfo info;
- context3d->getActiveAttrib(this, i, info);
- m_activeAttribLocations[i] = context3d->getAttribLocation(this, info.name.charactersWithNullTermination());
+ context3d->getActiveAttrib(object(), i, info);
+ m_activeAttribLocations[i] = context3d->getAttribLocation(object(), info.name.charactersWithNullTermination());
}
return true;
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index fb17db9..235a500 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -220,7 +220,7 @@ void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* sha
UNUSED_PARAM(ec);
if (!validateWebGLObject(program) || !validateWebGLObject(shader))
return;
- m_context->attachShader(program, shader);
+ m_context->attachShader(program ? program->object() : 0, shader ? shader->object() : 0);
cleanupAfterGraphicsCall(false);
}
@@ -229,7 +229,7 @@ void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, unsigned l
UNUSED_PARAM(ec);
if (!validateWebGLObject(program))
return;
- m_context->bindAttribLocation(program, index, name);
+ m_context->bindAttribLocation(program ? program->object() : 0, index, name);
cleanupAfterGraphicsCall(false);
}
@@ -254,7 +254,7 @@ void WebGLRenderingContext::bindBuffer(unsigned long target, WebGLBuffer* buffer
return;
}
- m_context->bindBuffer(target, buffer);
+ m_context->bindBuffer(target, buffer ? buffer->object() : 0);
if (buffer)
buffer->setTarget(target);
cleanupAfterGraphicsCall(false);
@@ -273,7 +273,7 @@ void WebGLRenderingContext::bindFramebuffer(unsigned long target, WebGLFramebuff
return;
}
m_framebufferBinding = buffer;
- m_context->bindFramebuffer(target, buffer);
+ m_context->bindFramebuffer(target, buffer ? buffer->object() : 0);
if (m_framebufferBinding)
m_framebufferBinding->onBind();
cleanupAfterGraphicsCall(false);
@@ -291,7 +291,7 @@ void WebGLRenderingContext::bindRenderbuffer(unsigned long target, WebGLRenderbu
return;
}
m_renderbufferBinding = renderBuffer;
- m_context->bindRenderbuffer(target, renderBuffer);
+ m_context->bindRenderbuffer(target, renderBuffer ? renderBuffer->object() : 0);
cleanupAfterGraphicsCall(false);
}
@@ -314,9 +314,28 @@ void WebGLRenderingContext::bindTexture(unsigned long target, WebGLTexture* text
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return;
}
- m_context->bindTexture(target, texture);
+ m_context->bindTexture(target, texture ? texture->object() : 0);
if (!isGLES2Compliant() && texture)
texture->setTarget(target, maxLevel);
+
+ // FIXME: do we want to do this on all platforms?
+#if PLATFORM(CHROMIUM)
+ // FIXME: GL_TEXTURE_WRAP_R isn't exposed in the OpenGL ES 2.0
+ // API. On desktop OpenGL implementations it seems necessary to
+ // set this wrap mode to GL_CLAMP_TO_EDGE to get correct behavior
+ // of cube maps.
+ if (texture) {
+ if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) {
+ if (!texture->isCubeMapRWrapModeInitialized()) {
+ static const int textureWrapR = 0x8072;
+ texParameteri(GraphicsContext3D::TEXTURE_CUBE_MAP, textureWrapR, GraphicsContext3D::CLAMP_TO_EDGE);
+ texture->setCubeMapRWrapModeInitialized(true);
+ }
+ } else
+ texture->setCubeMapRWrapModeInitialized(false);
+ }
+#endif
+
cleanupAfterGraphicsCall(false);
}
@@ -497,7 +516,7 @@ void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionCode& ec
UNUSED_PARAM(ec);
if (!validateWebGLObject(shader))
return;
- m_context->compileShader(shader);
+ m_context->compileShader(shader ? shader->object() : 0);
cleanupAfterGraphicsCall(false);
}
@@ -687,7 +706,7 @@ void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* sha
UNUSED_PARAM(ec);
if (!validateWebGLObject(program) || !validateWebGLObject(shader))
return;
- m_context->detachShader(program, shader);
+ m_context->detachShader(program ? program->object() : 0, shader ? shader->object() : 0);
cleanupAfterGraphicsCall(false);
}
@@ -1056,7 +1075,7 @@ void WebGLRenderingContext::framebufferRenderbuffer(unsigned long target, unsign
return;
}
}
- m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer);
+ m_context->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer ? buffer->object() : 0);
m_framebufferBinding->setAttachment(attachment, buffer);
cleanupAfterGraphicsCall(false);
}
@@ -1081,7 +1100,7 @@ void WebGLRenderingContext::framebufferTexture2D(unsigned long target, unsigned
m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
return;
}
- m_context->framebufferTexture2D(target, attachment, textarget, texture, level);
+ m_context->framebufferTexture2D(target, attachment, textarget, texture ? texture->object() : 0, level);
m_framebufferBinding->setAttachment(attachment, texture);
cleanupAfterGraphicsCall(false);
}
@@ -1119,7 +1138,7 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram*
ActiveInfo info;
if (!validateWebGLObject(program))
return 0;
- if (!m_context->getActiveAttrib(program, index, info)) {
+ if (!m_context->getActiveAttrib(program ? program->object() : 0, index, info)) {
return 0;
}
return WebGLActiveInfo::create(info.name, info.type, info.size);
@@ -1131,7 +1150,7 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram
ActiveInfo info;
if (!validateWebGLObject(program))
return 0;
- if (!m_context->getActiveUniform(program, index, info)) {
+ if (!m_context->getActiveUniform(program ? program->object() : 0, index, info)) {
return 0;
}
if (!isGLES2Compliant()) {
@@ -1148,11 +1167,11 @@ bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<Web
if (!validateWebGLObject(program))
return false;
int numShaders = 0;
- m_context->getProgramiv(program, GraphicsContext3D::ATTACHED_SHADERS, &numShaders);
+ m_context->getProgramiv(program ? program->object() : 0, GraphicsContext3D::ATTACHED_SHADERS, &numShaders);
if (numShaders) {
OwnArrayPtr<unsigned int> shaders(new unsigned int[numShaders]);
int count;
- m_context->getAttachedShaders(program, numShaders, &count, shaders.get());
+ m_context->getAttachedShaders(program ? program->object() : 0, numShaders, &count, shaders.get());
if (count != numShaders)
return false;
shaderObjects.resize(numShaders);
@@ -1170,7 +1189,7 @@ bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<Web
int WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String& name)
{
- return m_context->getAttribLocation(program, name);
+ return m_context->getAttribLocation(program ? program->object() : 0, name);
}
WebGLGetInfo WebGLRenderingContext::getBufferParameter(unsigned long target, unsigned long pname, ExceptionCode& ec)
@@ -1448,12 +1467,12 @@ WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, u
switch (pname) {
case GraphicsContext3D::DELETE_STATUS:
case GraphicsContext3D::VALIDATE_STATUS:
- m_context->getProgramiv(program, pname, &value);
+ m_context->getProgramiv(program ? program->object() : 0, pname, &value);
return WebGLGetInfo(static_cast<bool>(value));
case GraphicsContext3D::LINK_STATUS:
if (program->isLinkFailureFlagSet())
return WebGLGetInfo(false);
- m_context->getProgramiv(program, pname, &value);
+ m_context->getProgramiv(program ? program->object() : 0, pname, &value);
return WebGLGetInfo(static_cast<bool>(value));
case GraphicsContext3D::INFO_LOG_LENGTH:
case GraphicsContext3D::ATTACHED_SHADERS:
@@ -1461,7 +1480,7 @@ WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, u
case GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH:
case GraphicsContext3D::ACTIVE_UNIFORMS:
case GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH:
- m_context->getProgramiv(program, pname, &value);
+ m_context->getProgramiv(program ? program->object() : 0, pname, &value);
return WebGLGetInfo(static_cast<long>(value));
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
@@ -1475,7 +1494,7 @@ String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, Exception
if (!validateWebGLObject(program))
return "";
WebGLStateRestorer(this, false);
- return m_context->getProgramInfoLog(program);
+ return m_context->getProgramInfoLog(program ? program->object() : 0);
}
WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(unsigned long target, unsigned long pname, ExceptionCode& ec)
@@ -1521,14 +1540,14 @@ WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, unsi
switch (pname) {
case GraphicsContext3D::DELETE_STATUS:
case GraphicsContext3D::COMPILE_STATUS:
- m_context->getShaderiv(shader, pname, &value);
+ m_context->getShaderiv(shader ? shader->object() : 0, pname, &value);
return WebGLGetInfo(static_cast<bool>(value));
case GraphicsContext3D::SHADER_TYPE:
- m_context->getShaderiv(shader, pname, &value);
+ m_context->getShaderiv(shader ? shader->object() : 0, pname, &value);
return WebGLGetInfo(static_cast<unsigned long>(value));
case GraphicsContext3D::INFO_LOG_LENGTH:
case GraphicsContext3D::SHADER_SOURCE_LENGTH:
- m_context->getShaderiv(shader, pname, &value);
+ m_context->getShaderiv(shader ? shader->object() : 0, pname, &value);
return WebGLGetInfo(static_cast<long>(value));
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
@@ -1542,7 +1561,7 @@ String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCod
if (!validateWebGLObject(shader))
return "";
WebGLStateRestorer(this, false);
- return m_context->getShaderInfoLog(shader);
+ return m_context->getShaderInfoLog(shader ? shader->object() : 0);
}
String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec)
@@ -1551,7 +1570,7 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode
if (!validateWebGLObject(shader))
return "";
WebGLStateRestorer(this, false);
- return m_context->getShaderSource(shader);
+ return m_context->getShaderSource(shader ? shader->object() : 0);
}
String WebGLRenderingContext::getString(unsigned long name)
@@ -1601,10 +1620,10 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
WebGLStateRestorer(this, false);
// FIXME: make this more efficient using WebGLUniformLocation and caching types in it
int activeUniforms = 0;
- m_context->getProgramiv(program, GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms);
+ m_context->getProgramiv(program ? program->object() : 0, GraphicsContext3D::ACTIVE_UNIFORMS, &activeUniforms);
for (int i = 0; i < activeUniforms; i++) {
ActiveInfo info;
- if (!m_context->getActiveUniform(program, i, info))
+ if (!m_context->getActiveUniform(program ? program->object() : 0, i, info))
return WebGLGetInfo();
// Strip "[0]" from the name if it's an array.
if (info.size > 1)
@@ -1618,7 +1637,7 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
name.append(']');
}
// Now need to look this up by name again to find its location
- long loc = m_context->getUniformLocation(program, name);
+ long loc = m_context->getUniformLocation(program ? program->object() : 0, name);
if (loc == location) {
// Found it. Use the type in the ActiveInfo to determine the return type.
GraphicsContext3D::WebGLEnumType baseType;
@@ -1693,21 +1712,21 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
switch (baseType) {
case GraphicsContext3D::FLOAT: {
float value[16] = {0};
- m_context->getUniformfv(program, location, value);
+ m_context->getUniformfv(program ? program->object() : 0, location, value);
if (length == 1)
return WebGLGetInfo(value[0]);
return WebGLGetInfo(Float32Array::create(value, length));
}
case GraphicsContext3D::INT: {
int value[16] = {0};
- m_context->getUniformiv(program, location, value);
+ m_context->getUniformiv(program ? program->object() : 0, location, value);
if (length == 1)
return WebGLGetInfo(static_cast<long>(value[0]));
return WebGLGetInfo(Int32Array::create(value, length));
}
case GraphicsContext3D::BOOL: {
int value[16] = {0};
- m_context->getUniformiv(program, location, value);
+ m_context->getUniformiv(program ? program->object() : 0, location, value);
if (length > 1) {
unsigned char boolValue[16] = {0};
for (unsigned j = 0; j < length; j++)
@@ -1733,7 +1752,7 @@ PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGL
if (!validateWebGLObject(program))
return 0;
WebGLStateRestorer(this, false);
- long uniformLocation = m_context->getUniformLocation(program, name);
+ long uniformLocation = m_context->getUniformLocation(program ? program->object() : 0, name);
if (uniformLocation == -1)
return 0;
return WebGLUniformLocation::create(program, uniformLocation);
@@ -1811,7 +1830,7 @@ bool WebGLRenderingContext::isBuffer(WebGLBuffer* buffer)
if (!buffer)
return false;
- return m_context->isBuffer(buffer);
+ return m_context->isBuffer(buffer->object());
}
bool WebGLRenderingContext::isEnabled(unsigned long cap)
@@ -1828,7 +1847,7 @@ bool WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer)
if (!framebuffer)
return false;
- return m_context->isFramebuffer(framebuffer);
+ return m_context->isFramebuffer(framebuffer->object());
}
bool WebGLRenderingContext::isProgram(WebGLProgram* program)
@@ -1836,7 +1855,7 @@ bool WebGLRenderingContext::isProgram(WebGLProgram* program)
if (!program)
return false;
- return m_context->isProgram(program);
+ return m_context->isProgram(program->object());
}
bool WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
@@ -1844,7 +1863,7 @@ bool WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
if (!renderbuffer)
return false;
- return m_context->isRenderbuffer(renderbuffer);
+ return m_context->isRenderbuffer(renderbuffer->object());
}
bool WebGLRenderingContext::isShader(WebGLShader* shader)
@@ -1852,7 +1871,7 @@ bool WebGLRenderingContext::isShader(WebGLShader* shader)
if (!shader)
return false;
- return m_context->isShader(shader);
+ return m_context->isShader(shader->object());
}
bool WebGLRenderingContext::isTexture(WebGLTexture* texture)
@@ -1860,7 +1879,7 @@ bool WebGLRenderingContext::isTexture(WebGLTexture* texture)
if (!texture)
return false;
- return m_context->isTexture(texture);
+ return m_context->isTexture(texture->object());
}
void WebGLRenderingContext::lineWidth(double width)
@@ -1896,7 +1915,7 @@ void WebGLRenderingContext::linkProgram(WebGLProgram* program, ExceptionCode& ec
program->setLinkFailureFlag(false);
}
- m_context->linkProgram(program);
+ m_context->linkProgram(program ? program->object() : 0);
program->cacheActiveAttribLocations();
cleanupAfterGraphicsCall(false);
}
@@ -2041,7 +2060,7 @@ void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& stri
UNUSED_PARAM(ec);
if (!validateWebGLObject(shader))
return;
- m_context->shaderSource(shader, string);
+ m_context->shaderSource(shader ? shader->object() : 0, string);
cleanupAfterGraphicsCall(false);
}
@@ -2930,7 +2949,7 @@ void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec)
return;
}
m_currentProgram = program;
- m_context->useProgram(program);
+ m_context->useProgram(program ? program->object() : 0);
cleanupAfterGraphicsCall(false);
}
@@ -2939,7 +2958,7 @@ void WebGLRenderingContext::validateProgram(WebGLProgram* program, ExceptionCode
UNUSED_PARAM(ec);
if (!validateWebGLObject(program))
return;
- m_context->validateProgram(program);
+ m_context->validateProgram(program ? program->object() : 0);
cleanupAfterGraphicsCall(false);
}
@@ -3242,9 +3261,9 @@ void WebGLRenderingContext::handleNPOTTextures(bool prepareToDraw)
texCubeMap = m_textureUnits[ii].m_textureCubeMapBinding.get();
}
if (m_textureUnits[ii].m_texture2DBinding && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture())
- m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, tex2D);
+ m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, tex2D->object());
if (m_textureUnits[ii].m_textureCubeMapBinding && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture())
- m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, texCubeMap);
+ m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, texCubeMap->object());
}
}
if (resetActiveUnit)
@@ -3255,12 +3274,12 @@ void WebGLRenderingContext::createFallbackBlackTextures1x1()
{
unsigned char black[] = {0, 0, 0, 255};
m_blackTexture2D = createTexture();
- m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_blackTexture2D.get());
+ m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_blackTexture2D->object());
m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 1, 1,
0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0);
m_blackTextureCubeMap = createTexture();
- m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, m_blackTextureCubeMap.get());
+ m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, m_blackTextureCubeMap->object());
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X, 0, GraphicsContext3D::RGBA, 1, 1,
0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GraphicsContext3D::RGBA, 1, 1,
@@ -3716,7 +3735,7 @@ void WebGLRenderingContext::initVertexAttrib0()
{
m_vertexAttribState.resize(1);
m_vertexAttrib0Buffer = createBuffer();
- m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer.get());
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer->object());
m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, 0, GraphicsContext3D::DYNAMIC_DRAW);
m_context->vertexAttribPointer(0, 4, GraphicsContext3D::FLOAT, false, 0, 0);
m_vertexAttribState[0].bufferBinding = m_vertexAttrib0Buffer;
@@ -3735,7 +3754,7 @@ bool WebGLRenderingContext::simulateVertexAttrib0(long numVertex)
if (state.enabled || !m_currentProgram || !m_currentProgram->object()
|| !m_currentProgram->isUsingVertexAttrib0())
return false;
- m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer.get());
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer->object());
long bufferDataSize = (numVertex + 1) * 4 * sizeof(float);
if (bufferDataSize > m_vertexAttrib0BufferSize
|| state.value[0] != m_vertexAttrib0BufferValue[0]
@@ -3764,10 +3783,10 @@ void WebGLRenderingContext::restoreStatesAfterVertexAttrib0Simulation()
{
const VertexAttribState& state = m_vertexAttribState[0];
if (state.bufferBinding != m_vertexAttrib0Buffer) {
- m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, state.bufferBinding.get());
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, state.bufferBinding->object());
m_context->vertexAttribPointer(0, state.size, state.type, state.normalized, state.originalStride, state.offset);
}
- m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_boundArrayBuffer.get());
+ m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_boundArrayBuffer->object());
}
} // namespace WebCore
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index 017570b..c973aa8 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -303,7 +303,7 @@ class WebKitCSSMatrix;
void viewport(long x, long y, unsigned long width, unsigned long height);
- GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
+ virtual GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
void reshape(int width, int height);
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 28388f4..1c06ef1 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -73,22 +73,16 @@ const Platform3DObject NullPlatform3DObject = 0;
#endif
namespace WebCore {
- class WebGLActiveInfo;
class ArrayBuffer;
class ArrayBufferView;
- class WebGLBuffer;
- class Uint8Array;
+ class CanvasRenderingContext;
class Float32Array;
- class WebGLFramebuffer;
- class Int32Array;
- class WebGLProgram;
- class WebGLRenderbuffer;
- class WebGLRenderingContext;
- class WebGLShader;
- class WebGLTexture;
+ class HostWindow;
class Image;
class ImageData;
- class HostWindow;
+ class Int32Array;
+ class Uint8Array;
+ class WebGLActiveInfo;
struct ActiveInfo {
String name;
@@ -543,12 +537,12 @@ namespace WebCore {
//
void activeTexture(unsigned long texture);
- void attachShader(WebGLProgram* program, WebGLShader* shader);
- void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name);
- void bindBuffer(unsigned long target, WebGLBuffer*);
- void bindFramebuffer(unsigned long target, WebGLFramebuffer*);
- void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*);
- void bindTexture(unsigned long target, WebGLTexture* texture);
+ void attachShader(Platform3DObject program, Platform3DObject shader);
+ void bindAttribLocation(Platform3DObject, unsigned long index, const String& name);
+ void bindBuffer(unsigned long target, Platform3DObject);
+ void bindFramebuffer(unsigned long target, Platform3DObject);
+ void bindRenderbuffer(unsigned long target, Platform3DObject);
+ void bindTexture(unsigned long target, Platform3DObject texture);
void blendColor(double red, double green, double blue, double alpha);
void blendEquation(unsigned long mode);
void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
@@ -567,7 +561,7 @@ namespace WebCore {
void clearDepth(double depth);
void clearStencil(long s);
void colorMask(bool red, bool green, bool blue, bool alpha);
- void compileShader(WebGLShader*);
+ void compileShader(Platform3DObject);
//void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data);
//void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data);
@@ -578,7 +572,7 @@ namespace WebCore {
void depthFunc(unsigned long func);
void depthMask(bool flag);
void depthRange(double zNear, double zFar);
- void detachShader(WebGLProgram*, WebGLShader*);
+ void detachShader(Platform3DObject, Platform3DObject);
void disable(unsigned long cap);
void disableVertexAttribArray(unsigned long index);
void drawArrays(unsigned long mode, long first, long count);
@@ -588,17 +582,17 @@ namespace WebCore {
void enableVertexAttribArray(unsigned long index);
void finish();
void flush();
- void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*);
- void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level);
+ void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject);
+ void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level);
void frontFace(unsigned long mode);
void generateMipmap(unsigned long target);
- bool getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo&);
- bool getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo&);
+ bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&);
+ bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&);
- void getAttachedShaders(WebGLProgram* program, int maxCount, int* count, unsigned int* shaders);
+ void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders);
- int getAttribLocation(WebGLProgram*, const String& name);
+ int getAttribLocation(Platform3DObject, const String& name);
void getBooleanv(unsigned long pname, unsigned char* value);
@@ -614,29 +608,29 @@ namespace WebCore {
void getIntegerv(unsigned long pname, int* value);
- void getProgramiv(WebGLProgram* program, unsigned long pname, int* value);
+ void getProgramiv(Platform3DObject program, unsigned long pname, int* value);
- String getProgramInfoLog(WebGLProgram*);
+ String getProgramInfoLog(Platform3DObject);
void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
- void getShaderiv(WebGLShader*, unsigned long pname, int* value);
+ void getShaderiv(Platform3DObject, unsigned long pname, int* value);
- String getShaderInfoLog(WebGLShader*);
+ String getShaderInfoLog(Platform3DObject);
// TBD
// void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- String getShaderSource(WebGLShader*);
+ String getShaderSource(Platform3DObject);
String getString(unsigned long name);
void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
- void getUniformfv(WebGLProgram* program, long location, float* value);
- void getUniformiv(WebGLProgram* program, long location, int* value);
+ void getUniformfv(Platform3DObject program, long location, float* value);
+ void getUniformiv(Platform3DObject program, long location, int* value);
- long getUniformLocation(WebGLProgram*, const String& name);
+ long getUniformLocation(Platform3DObject, const String& name);
void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
@@ -644,15 +638,15 @@ namespace WebCore {
long getVertexAttribOffset(unsigned long index, unsigned long pname);
void hint(unsigned long target, unsigned long mode);
- bool isBuffer(WebGLBuffer*);
+ bool isBuffer(Platform3DObject);
bool isEnabled(unsigned long cap);
- bool isFramebuffer(WebGLFramebuffer*);
- bool isProgram(WebGLProgram*);
- bool isRenderbuffer(WebGLRenderbuffer*);
- bool isShader(WebGLShader*);
- bool isTexture(WebGLTexture*);
+ bool isFramebuffer(Platform3DObject);
+ bool isProgram(Platform3DObject);
+ bool isRenderbuffer(Platform3DObject);
+ bool isShader(Platform3DObject);
+ bool isTexture(Platform3DObject);
void lineWidth(double);
- void linkProgram(WebGLProgram*);
+ void linkProgram(Platform3DObject);
void pixelStorei(unsigned long pname, long param);
void polygonOffset(double factor, double units);
@@ -662,7 +656,7 @@ namespace WebCore {
void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
void sampleCoverage(double value, bool invert);
void scissor(long x, long y, unsigned long width, unsigned long height);
- void shaderSource(WebGLShader*, const String& string);
+ void shaderSource(Platform3DObject, const String& string);
void stencilFunc(unsigned long func, long ref, unsigned long mask);
void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
void stencilMask(unsigned long mask);
@@ -697,8 +691,8 @@ namespace WebCore {
void uniformMatrix3fv(long location, bool transpose, float* value, int size);
void uniformMatrix4fv(long location, bool transpose, float* value, int size);
- void useProgram(WebGLProgram*);
- void validateProgram(WebGLProgram*);
+ void useProgram(Platform3DObject);
+ void validateProgram(Platform3DObject);
void vertexAttrib1f(unsigned long indx, float x);
void vertexAttrib1fv(unsigned long indx, float* values);
@@ -720,10 +714,10 @@ namespace WebCore {
int canvasWidth, int canvasHeight, CGContextRef context);
#endif
- void paintRenderingResultsToCanvas(WebGLRenderingContext* context);
+ void paintRenderingResultsToCanvas(CanvasRenderingContext* context);
// Helpers for notification about paint events
- void beginPaint(WebGLRenderingContext* context);
+ void beginPaint(CanvasRenderingContext* context);
void endPaint();
#if PLATFORM(QT)
void paint(QPainter* painter, const QRect& rect) const;
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
index 30c3b8e..a1555fb 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
@@ -30,25 +30,19 @@
#include "GraphicsContext3D.h"
#import "BlockExceptions.h"
-#include "CanvasObject.h"
-#include "ImageBuffer.h"
-#include "NotImplemented.h"
-#include "WebGLActiveInfo.h"
+
#include "ArrayBuffer.h"
#include "ArrayBufferView.h"
-#include "WebGLBuffer.h"
+#include "CanvasObject.h"
+#include "CanvasRenderingContext.h"
#include "Float32Array.h"
-#include "WebGLFramebuffer.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
+#include "ImageBuffer.h"
#include "Int32Array.h"
-#include "WebGLLayer.h"
-#include "WebGLProgram.h"
-#include "WebGLRenderbuffer.h"
-#include "WebGLRenderingContext.h"
-#include "WebGLShader.h"
-#include "WebGLTexture.h"
+#include "NotImplemented.h"
#include "Uint8Array.h"
+#include "WebGLLayer.h"
#include <CoreGraphics/CGBitmapContext.h>
#include <OpenGL/CGLRenderers.h>
#include <OpenGL/gl.h>
@@ -240,7 +234,7 @@ void GraphicsContext3D::makeContextCurrent()
CGLSetCurrentContext(m_contextObj);
}
-void GraphicsContext3D::paintRenderingResultsToCanvas(WebGLRenderingContext* context)
+void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
{
HTMLCanvasElement* canvas = context->canvas();
ImageBuffer* imageBuffer = canvas->buffer();
@@ -288,7 +282,7 @@ void GraphicsContext3D::paintRenderingResultsToCanvas(WebGLRenderingContext* con
canvas->width(), canvas->height(), imageBuffer->context()->platformContext());
}
-void GraphicsContext3D::beginPaint(WebGLRenderingContext* context)
+void GraphicsContext3D::beginPaint(CanvasRenderingContext* context)
{
UNUSED_PARAM(context);
}
@@ -461,34 +455,34 @@ void GraphicsContext3D::activeTexture(unsigned long texture)
::glActiveTexture(texture);
}
-void GraphicsContext3D::attachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::attachShader(Platform3DObject program, Platform3DObject shader)
{
ASSERT(program);
ASSERT(shader);
ensureContext(m_contextObj);
- ::glAttachShader((GLuint) program->object(), (GLuint) shader->object());
+ ::glAttachShader((GLuint) program, (GLuint) shader);
}
-void GraphicsContext3D::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name)
+void GraphicsContext3D::bindAttribLocation(Platform3DObject program, unsigned long index, const String& name)
{
ASSERT(program);
ensureContext(m_contextObj);
- ::glBindAttribLocation((GLuint) program->object(), index, name.utf8().data());
+ ::glBindAttribLocation((GLuint) program, index, name.utf8().data());
}
-void GraphicsContext3D::bindBuffer(unsigned long target, WebGLBuffer* buffer)
+void GraphicsContext3D::bindBuffer(unsigned long target, Platform3DObject buffer)
{
ensureContext(m_contextObj);
- ::glBindBuffer(target, buffer ? (GLuint) buffer->object() : 0);
+ ::glBindBuffer(target, (GLuint) buffer);
}
-void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* buffer)
+void GraphicsContext3D::bindFramebuffer(unsigned long target, Platform3DObject buffer)
{
ensureContext(m_contextObj);
GLuint fbo;
- if (buffer && buffer->object())
- fbo = (GLuint)buffer->object();
+ if (buffer)
+ fbo = (GLuint)buffer;
else
fbo = (m_attrs.antialias ? m_multisampleFBO : m_fbo);
if (fbo != m_boundFBO) {
@@ -497,17 +491,17 @@ void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer*
}
}
-void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer* renderbuffer)
+void GraphicsContext3D::bindRenderbuffer(unsigned long target, Platform3DObject renderbuffer)
{
ensureContext(m_contextObj);
- ::glBindRenderbufferEXT(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);
+ ::glBindRenderbufferEXT(target, (GLuint) renderbuffer);
}
-void GraphicsContext3D::bindTexture(unsigned long target, WebGLTexture* texture)
+void GraphicsContext3D::bindTexture(unsigned long target, Platform3DObject texture)
{
ensureContext(m_contextObj);
- ::glBindTexture(target, texture ? (GLuint) texture->object() : 0);
+ ::glBindTexture(target, (GLuint) texture);
}
void GraphicsContext3D::blendColor(double red, double green, double blue, double alpha)
@@ -619,11 +613,11 @@ void GraphicsContext3D::colorMask(bool red, bool green, bool blue, bool alpha)
::glColorMask(red, green, blue, alpha);
}
-void GraphicsContext3D::compileShader(WebGLShader* shader)
+void GraphicsContext3D::compileShader(Platform3DObject shader)
{
ASSERT(shader);
ensureContext(m_contextObj);
- ::glCompileShader((GLuint) shader->object());
+ ::glCompileShader((GLuint) shader);
}
void GraphicsContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border)
@@ -678,12 +672,12 @@ void GraphicsContext3D::depthRange(double zNear, double zFar)
::glDepthRange(zNear, zFar);
}
-void GraphicsContext3D::detachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::detachShader(Platform3DObject program, Platform3DObject shader)
{
ASSERT(program);
ASSERT(shader);
ensureContext(m_contextObj);
- ::glDetachShader((GLuint) program->object(), (GLuint) shader->object());
+ ::glDetachShader((GLuint) program, (GLuint) shader);
}
void GraphicsContext3D::disable(unsigned long cap)
@@ -734,10 +728,10 @@ void GraphicsContext3D::flush()
::glFlush();
}
-void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer* buffer)
+void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject buffer)
{
ensureContext(m_contextObj);
- GLuint renderbuffer = (buffer ? (GLuint) buffer->object() : 0);
+ GLuint renderbuffer = (GLuint) buffer;
if (attachment == DEPTH_STENCIL_ATTACHMENT) {
::glFramebufferRenderbufferEXT(target, DEPTH_ATTACHMENT, renderbuffertarget, renderbuffer);
::glFramebufferRenderbufferEXT(target, STENCIL_ATTACHMENT, renderbuffertarget, renderbuffer);
@@ -745,10 +739,10 @@ void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned l
::glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
}
-void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture* texture, long level)
+void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject texture, long level)
{
ensureContext(m_contextObj);
- ::glFramebufferTexture2DEXT(target, attachment, textarget, texture ? (GLuint) texture->object() : 0, level);
+ ::glFramebufferTexture2DEXT(target, attachment, textarget, (GLuint) texture, level);
}
void GraphicsContext3D::frontFace(unsigned long mode)
@@ -763,20 +757,20 @@ void GraphicsContext3D::generateMipmap(unsigned long target)
::glGenerateMipmapEXT(target);
}
-bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
ensureContext(m_contextObj);
GLint maxAttributeSize = 0;
- ::glGetProgramiv(static_cast<GLuint>(program->object()), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);
+ ::glGetProgramiv(static_cast<GLuint>(program), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize);
GLchar name[maxAttributeSize]; // GL_ACTIVE_ATTRIBUTE_MAX_LENGTH includes null termination
GLsizei nameLength = 0;
GLint size = 0;
GLenum type = 0;
- ::glGetActiveAttrib(static_cast<GLuint>(program->object()), index, maxAttributeSize, &nameLength, &size, &type, name);
+ ::glGetActiveAttrib(static_cast<GLuint>(program), index, maxAttributeSize, &nameLength, &size, &type, name);
if (!nameLength)
return false;
info.name = String(name, nameLength);
@@ -785,20 +779,20 @@ bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long ind
return true;
}
-bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
ensureContext(m_contextObj);
GLint maxUniformSize = 0;
- ::glGetProgramiv(static_cast<GLuint>(program->object()), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);
+ ::glGetProgramiv(static_cast<GLuint>(program), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize);
GLchar name[maxUniformSize]; // GL_ACTIVE_UNIFORM_MAX_LENGTH includes null termination
GLsizei nameLength = 0;
GLint size = 0;
GLenum type = 0;
- ::glGetActiveUniform(static_cast<GLuint>(program->object()), index, maxUniformSize, &nameLength, &size, &type, name);
+ ::glGetActiveUniform(static_cast<GLuint>(program), index, maxUniformSize, &nameLength, &size, &type, name);
if (!nameLength)
return false;
info.name = String(name, nameLength);
@@ -807,23 +801,23 @@ bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long in
return true;
}
-void GraphicsContext3D::getAttachedShaders(WebGLProgram* program, int maxCount, int* count, unsigned int* shaders)
+void GraphicsContext3D::getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders)
{
- if (!program || !program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return;
}
ensureContext(m_contextObj);
- ::glGetAttachedShaders(static_cast<GLuint>(program->object()), maxCount, count, shaders);
+ ::glGetAttachedShaders(static_cast<GLuint>(program), maxCount, count, shaders);
}
-int GraphicsContext3D::getAttribLocation(WebGLProgram* program, const String& name)
+int GraphicsContext3D::getAttribLocation(Platform3DObject program, const String& name)
{
if (!program)
return -1;
ensureContext(m_contextObj);
- return ::glGetAttribLocation((GLuint) program->object(), name.utf8().data());
+ return ::glGetAttribLocation((GLuint) program, name.utf8().data());
}
GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes()
@@ -856,13 +850,13 @@ void GraphicsContext3D::hint(unsigned long target, unsigned long mode)
::glHint(target, mode);
}
-bool GraphicsContext3D::isBuffer(WebGLBuffer* buffer)
+bool GraphicsContext3D::isBuffer(Platform3DObject buffer)
{
if (!buffer)
return false;
ensureContext(m_contextObj);
- return ::glIsBuffer((GLuint) buffer->object());
+ return ::glIsBuffer((GLuint) buffer);
}
bool GraphicsContext3D::isEnabled(unsigned long cap)
@@ -871,49 +865,49 @@ bool GraphicsContext3D::isEnabled(unsigned long cap)
return ::glIsEnabled(cap);
}
-bool GraphicsContext3D::isFramebuffer(WebGLFramebuffer* framebuffer)
+bool GraphicsContext3D::isFramebuffer(Platform3DObject framebuffer)
{
if (!framebuffer)
return false;
ensureContext(m_contextObj);
- return ::glIsFramebufferEXT((GLuint) framebuffer->object());
+ return ::glIsFramebufferEXT((GLuint) framebuffer);
}
-bool GraphicsContext3D::isProgram(WebGLProgram* program)
+bool GraphicsContext3D::isProgram(Platform3DObject program)
{
if (!program)
return false;
ensureContext(m_contextObj);
- return ::glIsProgram((GLuint) program->object());
+ return ::glIsProgram((GLuint) program);
}
-bool GraphicsContext3D::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
+bool GraphicsContext3D::isRenderbuffer(Platform3DObject renderbuffer)
{
if (!renderbuffer)
return false;
ensureContext(m_contextObj);
- return ::glIsRenderbufferEXT((GLuint) renderbuffer->object());
+ return ::glIsRenderbufferEXT((GLuint) renderbuffer);
}
-bool GraphicsContext3D::isShader(WebGLShader* shader)
+bool GraphicsContext3D::isShader(Platform3DObject shader)
{
if (!shader)
return false;
ensureContext(m_contextObj);
- return ::glIsShader((GLuint) shader->object());
+ return ::glIsShader((GLuint) shader);
}
-bool GraphicsContext3D::isTexture(WebGLTexture* texture)
+bool GraphicsContext3D::isTexture(Platform3DObject texture)
{
if (!texture)
return false;
ensureContext(m_contextObj);
- return ::glIsTexture((GLuint) texture->object());
+ return ::glIsTexture((GLuint) texture);
}
void GraphicsContext3D::lineWidth(double width)
@@ -922,11 +916,11 @@ void GraphicsContext3D::lineWidth(double width)
::glLineWidth(static_cast<float>(width));
}
-void GraphicsContext3D::linkProgram(WebGLProgram* program)
+void GraphicsContext3D::linkProgram(Platform3DObject program)
{
ASSERT(program);
ensureContext(m_contextObj);
- ::glLinkProgram((GLuint) program->object());
+ ::glLinkProgram((GLuint) program);
}
void GraphicsContext3D::pixelStorei(unsigned long pname, long param)
@@ -999,7 +993,7 @@ void GraphicsContext3D::scissor(long x, long y, unsigned long width, unsigned lo
::glScissor(x, y, width, height);
}
-void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& string)
+void GraphicsContext3D::shaderSource(Platform3DObject shader, const String& string)
{
ASSERT(shader);
@@ -1008,7 +1002,7 @@ void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& string)
const char* s = cs.data();
int length = string.length();
- ::glShaderSource((GLuint) shader->object(), 1, &s, &length);
+ ::glShaderSource((GLuint) shader, 1, &s, &length);
}
void GraphicsContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask)
@@ -1182,18 +1176,18 @@ void GraphicsContext3D::uniformMatrix4fv(long location, bool transpose, float* a
::glUniformMatrix4fv(location, size, transpose, array);
}
-void GraphicsContext3D::useProgram(WebGLProgram* program)
+void GraphicsContext3D::useProgram(Platform3DObject program)
{
ensureContext(m_contextObj);
- ::glUseProgram(program ? ((GLuint) program->object()) : 0);
+ ::glUseProgram((GLuint) program);
}
-void GraphicsContext3D::validateProgram(WebGLProgram* program)
+void GraphicsContext3D::validateProgram(Platform3DObject program)
{
ASSERT(program);
ensureContext(m_contextObj);
- ::glValidateProgram((GLuint) program->object());
+ ::glValidateProgram((GLuint) program);
}
void GraphicsContext3D::vertexAttrib1f(unsigned long indx, float v0)
@@ -1316,26 +1310,26 @@ void GraphicsContext3D::getIntegerv(unsigned long pname, int* value)
}
}
-void GraphicsContext3D::getProgramiv(WebGLProgram* program, unsigned long pname, int* value)
+void GraphicsContext3D::getProgramiv(Platform3DObject program, unsigned long pname, int* value)
{
ensureContext(m_contextObj);
- ::glGetProgramiv((GLuint) program->object(), pname, value);
+ ::glGetProgramiv((GLuint) program, pname, value);
}
-String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
+String GraphicsContext3D::getProgramInfoLog(Platform3DObject program)
{
ASSERT(program);
ensureContext(m_contextObj);
GLint length;
- ::glGetProgramiv((GLuint) program->object(), GL_INFO_LOG_LENGTH, &length);
+ ::glGetProgramiv((GLuint) program, GL_INFO_LOG_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- ::glGetProgramInfoLog((GLuint) program->object(), length, &size, info);
+ ::glGetProgramInfoLog((GLuint) program, length, &size, info);
String s(info);
fastFree(info);
return s;
@@ -1347,47 +1341,47 @@ void GraphicsContext3D::getRenderbufferParameteriv(unsigned long target, unsigne
::glGetRenderbufferParameterivEXT(target, pname, value);
}
-void GraphicsContext3D::getShaderiv(WebGLShader* shader, unsigned long pname, int* value)
+void GraphicsContext3D::getShaderiv(Platform3DObject shader, unsigned long pname, int* value)
{
ASSERT(shader);
ensureContext(m_contextObj);
- ::glGetShaderiv((GLuint) shader->object(), pname, value);
+ ::glGetShaderiv((GLuint) shader, pname, value);
}
-String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
+String GraphicsContext3D::getShaderInfoLog(Platform3DObject shader)
{
ASSERT(shader);
ensureContext(m_contextObj);
GLint length;
- ::glGetShaderiv((GLuint) shader->object(), GL_INFO_LOG_LENGTH, &length);
+ ::glGetShaderiv((GLuint) shader, GL_INFO_LOG_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- ::glGetShaderInfoLog((GLuint) shader->object(), length, &size, info);
+ ::glGetShaderInfoLog((GLuint) shader, length, &size, info);
String s(info);
fastFree(info);
return s;
}
-String GraphicsContext3D::getShaderSource(WebGLShader* shader)
+String GraphicsContext3D::getShaderSource(Platform3DObject shader)
{
ASSERT(shader);
ensureContext(m_contextObj);
GLint length;
- ::glGetShaderiv((GLuint) shader->object(), GL_SHADER_SOURCE_LENGTH, &length);
+ ::glGetShaderiv((GLuint) shader, GL_SHADER_SOURCE_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- ::glGetShaderSource((GLuint) shader->object(), length, &size, info);
+ ::glGetShaderSource((GLuint) shader, length, &size, info);
String s(info);
fastFree(info);
return s;
@@ -1406,24 +1400,24 @@ void GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pn
::glGetTexParameteriv(target, pname, value);
}
-void GraphicsContext3D::getUniformfv(WebGLProgram* program, long location, float* value)
+void GraphicsContext3D::getUniformfv(Platform3DObject program, long location, float* value)
{
ensureContext(m_contextObj);
- ::glGetUniformfv((GLuint) program->object(), location, value);
+ ::glGetUniformfv((GLuint) program, location, value);
}
-void GraphicsContext3D::getUniformiv(WebGLProgram* program, long location, int* value)
+void GraphicsContext3D::getUniformiv(Platform3DObject program, long location, int* value)
{
ensureContext(m_contextObj);
- ::glGetUniformiv((GLuint) program->object(), location, value);
+ ::glGetUniformiv((GLuint) program, location, value);
}
-long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String& name)
+long GraphicsContext3D::getUniformLocation(Platform3DObject program, const String& name)
{
ASSERT(program);
ensureContext(m_contextObj);
- return ::glGetUniformLocation((GLuint) program->object(), name.utf8().data());
+ return ::glGetUniformLocation((GLuint) program, name.utf8().data());
}
void GraphicsContext3D::getVertexAttribfv(unsigned long index, unsigned long pname, float* value)
diff --git a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
index 311d3a3..3e43314 100644
--- a/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp
@@ -20,24 +20,17 @@
#include "GraphicsContext3D.h"
+#include "ArrayBufferView.h"
#include "CanvasObject.h"
+#include "CanvasRenderingContext.h"
+#include "Float32Array.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
#include "HostWindow.h"
#include "ImageBuffer.h"
+#include "Int32Array.h"
#include "NotImplemented.h"
#include "QWebPageClient.h"
-#include "WebGLActiveInfo.h"
-#include "ArrayBufferView.h"
-#include "WebGLBuffer.h"
-#include "Float32Array.h"
-#include "WebGLFramebuffer.h"
-#include "Int32Array.h"
-#include "WebGLProgram.h"
-#include "WebGLRenderbuffer.h"
-#include "WebGLRenderingContext.h"
-#include "WebGLShader.h"
-#include "WebGLTexture.h"
#include "Uint8Array.h"
#include <QAbstractScrollArea>
#include <QGLContext>
@@ -519,7 +512,7 @@ void GraphicsContext3D::makeContextCurrent()
m_internal->m_glWidget->makeCurrent();
}
-void GraphicsContext3D::beginPaint(WebGLRenderingContext* context)
+void GraphicsContext3D::beginPaint(CanvasRenderingContext* context)
{
paintRenderingResultsToCanvas();
}
@@ -528,7 +521,7 @@ void GraphicsContext3D::endPaint()
{
}
-void GraphicsContext3D::paintRenderingResultsToCanvas(WebGLRenderingContext* context)
+void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
{
m_internal->m_glWidget->makeCurrent();
HTMLCanvasElement* canvas = context->canvas();
@@ -598,44 +591,44 @@ void GraphicsContext3D::activeTexture(unsigned long texture)
m_internal->activeTexture(texture);
}
-void GraphicsContext3D::attachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::attachShader(PlatformGLObject program, PlatformGLObject shader)
{
ASSERT(program);
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->attachShader((GLuint) program->object(), (GLuint) shader->object());
+ m_internal->attachShader((GLuint) program, (GLuint) shader);
}
-void GraphicsContext3D::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name)
+void GraphicsContext3D::bindAttribLocation(PlatformGLObject program, unsigned long index, const String& name)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->bindAttribLocation((GLuint) program->object(), index, name.utf8().data());
+ m_internal->bindAttribLocation((GLuint) program, index, name.utf8().data());
}
-void GraphicsContext3D::bindBuffer(unsigned long target, WebGLBuffer* buffer)
+void GraphicsContext3D::bindBuffer(unsigned long target, PlatformGLObject buffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->bindBuffer(target, buffer ? (GLuint) buffer->object() : 0);
+ m_internal->bindBuffer(target, (GLuint) buffer->object());
}
-void GraphicsContext3D::bindFramebuffer(unsigned long target, WebGLFramebuffer* buffer)
+void GraphicsContext3D::bindFramebuffer(unsigned long target, PlatformGLObject buffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->m_currentFbo = (buffer && buffer->object()) ? (GLuint) buffer->object() : m_internal->m_mainFbo;
+ m_internal->m_currentFbo = buffer ? (GLuint) buffer : m_internal->m_mainFbo;
m_internal->bindFramebuffer(target, m_internal->m_currentFbo);
}
-void GraphicsContext3D::bindRenderbuffer(unsigned long target, WebGLRenderbuffer* renderbuffer)
+void GraphicsContext3D::bindRenderbuffer(unsigned long target, PlatformGLObject renderbuffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->bindRenderbuffer(target, renderbuffer ? (GLuint) renderbuffer->object() : 0);
+ m_internal->bindRenderbuffer(target, (GLuint) renderbuffer);
}
-void GraphicsContext3D::bindTexture(unsigned long target, WebGLTexture* texture)
+void GraphicsContext3D::bindTexture(unsigned long target, PlatformGLObject texture)
{
m_internal->m_glWidget->makeCurrent();
- glBindTexture(target, texture ? (GLuint) texture->object() : 0);
+ glBindTexture(target, (GLuint) texture);
}
void GraphicsContext3D::blendColor(double red, double green, double blue, double alpha)
@@ -732,11 +725,11 @@ void GraphicsContext3D::colorMask(bool red, bool green, bool blue, bool alpha)
glColorMask(red, green, blue, alpha);
}
-void GraphicsContext3D::compileShader(WebGLShader* shader)
+void GraphicsContext3D::compileShader(PlatformGLObject shader)
{
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->compileShader((GLuint) shader->object());
+ m_internal->compileShader((GLuint) shader);
}
void GraphicsContext3D::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border)
@@ -779,12 +772,12 @@ void GraphicsContext3D::depthRange(double zNear, double zFar)
#endif
}
-void GraphicsContext3D::detachShader(WebGLProgram* program, WebGLShader* shader)
+void GraphicsContext3D::detachShader(PlatformGLObject program, PlatformGLObject shader)
{
ASSERT(program);
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->detachShader((GLuint) program->object(), (GLuint) shader->object());
+ m_internal->detachShader((GLuint) program, (GLuint) shader);
}
void GraphicsContext3D::disable(unsigned long cap)
@@ -835,16 +828,16 @@ void GraphicsContext3D::flush()
glFlush();
}
-void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer* buffer)
+void GraphicsContext3D::framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, PlatformGLObject buffer)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->framebufferRenderbuffer(target, attachment, renderbuffertarget, buffer ? (GLuint) buffer->object() : 0);
+ m_internal->framebufferRenderbuffer(target, attachment, renderbuffertarget, (GLuint) buffer);
}
-void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture* texture, long level)
+void GraphicsContext3D::framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, PlatformGLObject texture, long level)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->framebufferTexture2D(target, attachment, textarget, texture ? (GLuint) texture->object() : 0, level);
+ m_internal->framebufferTexture2D(target, attachment, textarget, (GLuint) texture, level);
}
void GraphicsContext3D::frontFace(unsigned long mode)
@@ -859,9 +852,9 @@ void GraphicsContext3D::generateMipmap(unsigned long target)
m_internal->generateMipmap(target);
}
-bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveAttrib(PlatformGLObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
@@ -869,14 +862,14 @@ bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long ind
m_internal->m_glWidget->makeCurrent();
GLint maxLength;
- m_internal->getProgramiv(static_cast<GLuint>(program->object()), GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);
+ m_internal->getProgramiv(static_cast<GLuint>(program), GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);
GLchar* name = (GLchar*) fastMalloc(maxLength);
GLsizei nameLength;
GLint size;
GLenum type;
- m_internal->getActiveAttrib(static_cast<GLuint>(program->object()), index, maxLength, &nameLength, &size, &type, name);
+ m_internal->getActiveAttrib(static_cast<GLuint>(program), index, maxLength, &nameLength, &size, &type, name);
if (!nameLength) {
fastFree(name);
@@ -891,9 +884,9 @@ bool GraphicsContext3D::getActiveAttrib(WebGLProgram* program, unsigned long ind
return true;
}
-bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3D::getActiveUniform(PlatformGLObject program, unsigned long index, ActiveInfo& info)
{
- if (!program->object()) {
+ if (!program) {
synthesizeGLError(INVALID_VALUE);
return false;
}
@@ -901,14 +894,14 @@ bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long in
m_internal->m_glWidget->makeCurrent();
GLint maxLength;
- m_internal->getProgramiv(static_cast<GLuint>(program->object()), GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
+ m_internal->getProgramiv(static_cast<GLuint>(program), GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
GLchar* name = (GLchar*) fastMalloc(maxLength);
GLsizei nameLength;
GLint size;
GLenum type;
- m_internal->getActiveUniform(static_cast<GLuint>(program->object()), index, maxLength, &nameLength, &size, &type, name);
+ m_internal->getActiveUniform(static_cast<GLuint>(program), index, maxLength, &nameLength, &size, &type, name);
if (!nameLength) {
fastFree(name);
@@ -923,13 +916,13 @@ bool GraphicsContext3D::getActiveUniform(WebGLProgram* program, unsigned long in
return true;
}
-int GraphicsContext3D::getAttribLocation(WebGLProgram* program, const String& name)
+int GraphicsContext3D::getAttribLocation(PlatformGLObject program, const String& name)
{
if (!program)
return -1;
m_internal->m_glWidget->makeCurrent();
- return m_internal->getAttribLocation((GLuint) program->object(), name.utf8().data());
+ return m_internal->getAttribLocation((GLuint) program, name.utf8().data());
}
GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes()
@@ -962,13 +955,13 @@ void GraphicsContext3D::hint(unsigned long target, unsigned long mode)
glHint(target, mode);
}
-bool GraphicsContext3D::isBuffer(WebGLBuffer* buffer)
+bool GraphicsContext3D::isBuffer(PlatformGLObject buffer)
{
if (!buffer)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isBuffer((GLuint) buffer->object());
+ return m_internal->isBuffer((GLuint) buffer);
}
bool GraphicsContext3D::isEnabled(unsigned long cap)
@@ -977,49 +970,49 @@ bool GraphicsContext3D::isEnabled(unsigned long cap)
return glIsEnabled(cap);
}
-bool GraphicsContext3D::isFramebuffer(WebGLFramebuffer* framebuffer)
+bool GraphicsContext3D::isFramebuffer(PlatformGLObject framebuffer)
{
if (!framebuffer)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isFramebuffer((GLuint) framebuffer->object());
+ return m_internal->isFramebuffer((GLuint) framebuffer);
}
-bool GraphicsContext3D::isProgram(WebGLProgram* program)
+bool GraphicsContext3D::isProgram(PlatformGLObject program)
{
if (!program)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isProgram((GLuint) program->object());
+ return m_internal->isProgram((GLuint) program);
}
-bool GraphicsContext3D::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
+bool GraphicsContext3D::isRenderbuffer(PlatformGLObject renderbuffer)
{
if (!renderbuffer)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isRenderbuffer((GLuint) renderbuffer->object());
+ return m_internal->isRenderbuffer((GLuint) renderbuffer);
}
-bool GraphicsContext3D::isShader(WebGLShader* shader)
+bool GraphicsContext3D::isShader(PlatformGLObject shader)
{
if (!shader)
return false;
m_internal->m_glWidget->makeCurrent();
- return m_internal->isShader((GLuint) shader->object());
+ return m_internal->isShader((GLuint) shader);
}
-bool GraphicsContext3D::isTexture(WebGLTexture* texture)
+bool GraphicsContext3D::isTexture(PlatformGLObject texture)
{
if (!texture)
return false;
m_internal->m_glWidget->makeCurrent();
- return glIsTexture((GLuint) texture->object());
+ return glIsTexture((GLuint) texture);
}
void GraphicsContext3D::lineWidth(double width)
@@ -1028,11 +1021,11 @@ void GraphicsContext3D::lineWidth(double width)
glLineWidth(static_cast<float>(width));
}
-void GraphicsContext3D::linkProgram(WebGLProgram* program)
+void GraphicsContext3D::linkProgram(PlatformGLObject program)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->linkProgram((GLuint) program->object());
+ m_internal->linkProgram((GLuint) program);
}
void GraphicsContext3D::pixelStorei(unsigned long paramName, long param)
@@ -1081,7 +1074,7 @@ void GraphicsContext3D::scissor(long x, long y, unsigned long width, unsigned lo
glScissor(x, y, width, height);
}
-void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& source)
+void GraphicsContext3D::shaderSource(PlatformGLObject shader, const String& source)
{
ASSERT(shader);
@@ -1098,7 +1091,7 @@ void GraphicsContext3D::shaderSource(WebGLShader* shader, const String& source)
CString sourceCS = prefixedSource.utf8();
const char* data = sourceCS.data();
int length = prefixedSource.length();
- m_internal->shaderSource((GLuint) shader->object(), /* count */ 1, &data, &length);
+ m_internal->shaderSource((GLuint) shader, /* count */ 1, &data, &length);
}
void GraphicsContext3D::stencilFunc(unsigned long func, long ref, unsigned long mask)
@@ -1263,20 +1256,20 @@ void GraphicsContext3D::uniformMatrix4fv(long location, bool transpose, float* a
m_internal->uniformMatrix4fv(location, size, transpose, array);
}
-void GraphicsContext3D::useProgram(WebGLProgram* program)
+void GraphicsContext3D::useProgram(PlatformGLObject program)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->useProgram((GLuint) program->object());
+ m_internal->useProgram((GLuint) program);
}
-void GraphicsContext3D::validateProgram(WebGLProgram* program)
+void GraphicsContext3D::validateProgram(PlatformGLObject program)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- m_internal->validateProgram((GLuint) program->object());
+ m_internal->validateProgram((GLuint) program);
}
void GraphicsContext3D::vertexAttrib1f(unsigned long indx, float v0)
@@ -1369,18 +1362,18 @@ void GraphicsContext3D::getIntegerv(unsigned long paramName, int* value)
glGetIntegerv(paramName, value);
}
-void GraphicsContext3D::getProgramiv(WebGLProgram* program, unsigned long paramName, int* value)
+void GraphicsContext3D::getProgramiv(PlatformGLObject program, unsigned long paramName, int* value)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->getProgramiv((GLuint) program->object(), paramName, value);
+ m_internal->getProgramiv((GLuint) program, paramName, value);
}
-String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
+String GraphicsContext3D::getProgramInfoLog(PlatformGLObject program)
{
m_internal->m_glWidget->makeCurrent();
GLint length;
- m_internal->getProgramiv((GLuint) program->object(), GraphicsContext3D::INFO_LOG_LENGTH, &length);
+ m_internal->getProgramiv((GLuint) program, GraphicsContext3D::INFO_LOG_LENGTH, &length);
GLsizei size;
@@ -1388,7 +1381,7 @@ String GraphicsContext3D::getProgramInfoLog(WebGLProgram* program)
if (!info)
return "";
- m_internal->getProgramInfoLog((GLuint) program->object(), length, &size, info);
+ m_internal->getProgramInfoLog((GLuint) program, length, &size, info);
String result(info);
fastFree(info);
@@ -1402,26 +1395,26 @@ void GraphicsContext3D::getRenderbufferParameteriv(unsigned long target, unsigne
m_internal->getRenderbufferParameteriv(target, paramName, value);
}
-void GraphicsContext3D::getShaderiv(WebGLShader* shader, unsigned long paramName, int* value)
+void GraphicsContext3D::getShaderiv(PlatformGLObject shader, unsigned long paramName, int* value)
{
ASSERT(shader);
m_internal->m_glWidget->makeCurrent();
- m_internal->getShaderiv((GLuint) shader->object(), paramName, value);
+ m_internal->getShaderiv((GLuint) shader, paramName, value);
}
-String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
+String GraphicsContext3D::getShaderInfoLog(PlatformGLObject shader)
{
m_internal->m_glWidget->makeCurrent();
GLint length;
- m_internal->getShaderiv((GLuint) shader->object(), GraphicsContext3D::INFO_LOG_LENGTH, &length);
+ m_internal->getShaderiv((GLuint) shader, GraphicsContext3D::INFO_LOG_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- m_internal->getShaderInfoLog((GLuint) shader->object(), length, &size, info);
+ m_internal->getShaderInfoLog((GLuint) shader, length, &size, info);
String result(info);
fastFree(info);
@@ -1429,19 +1422,19 @@ String GraphicsContext3D::getShaderInfoLog(WebGLShader* shader)
return result;
}
-String GraphicsContext3D::getShaderSource(WebGLShader* shader)
+String GraphicsContext3D::getShaderSource(PlatformGLObject shader)
{
m_internal->m_glWidget->makeCurrent();
GLint length;
- m_internal->getShaderiv((GLuint) shader->object(), GraphicsContext3D::SHADER_SOURCE_LENGTH, &length);
+ m_internal->getShaderiv((GLuint) shader, GraphicsContext3D::SHADER_SOURCE_LENGTH, &length);
GLsizei size;
GLchar* info = (GLchar*) fastMalloc(length);
if (!info)
return "";
- m_internal->getShaderSource((GLuint) shader->object(), length, &size, info);
+ m_internal->getShaderSource((GLuint) shader, length, &size, info);
String result(info);
fastFree(info);
@@ -1461,24 +1454,24 @@ void GraphicsContext3D::getTexParameteriv(unsigned long target, unsigned long pa
glGetTexParameteriv(target, paramName, value);
}
-void GraphicsContext3D::getUniformfv(WebGLProgram* program, long location, float* value)
+void GraphicsContext3D::getUniformfv(PlatformGLObject program, long location, float* value)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->getUniformfv((GLuint) program->object(), location, value);
+ m_internal->getUniformfv((GLuint) program, location, value);
}
-void GraphicsContext3D::getUniformiv(WebGLProgram* program, long location, int* value)
+void GraphicsContext3D::getUniformiv(PlatformGLObject program, long location, int* value)
{
m_internal->m_glWidget->makeCurrent();
- m_internal->getUniformiv((GLuint) program->object(), location, value);
+ m_internal->getUniformiv((GLuint) program, location, value);
}
-long GraphicsContext3D::getUniformLocation(WebGLProgram* program, const String& name)
+long GraphicsContext3D::getUniformLocation(PlatformGLObject program, const String& name)
{
ASSERT(program);
m_internal->m_glWidget->makeCurrent();
- return m_internal->getUniformLocation((GLuint) program->object(), name.utf8().data());
+ return m_internal->getUniformLocation((GLuint) program, name.utf8().data());
}
void GraphicsContext3D::getVertexAttribfv(unsigned long index, unsigned long paramName, float* value)
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index ddc3884..bbdf035 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,25 @@
+2010-08-03 James Robinson <jamesr at chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Move WebGL-specific code out of GraphicsContext3D so that G3D can be used as a generic accelerated drawing API
+ https://bugs.webkit.org/show_bug.cgi?id=43221
+
+ Implements functions in term of Platform3DObjects instead of WebGL types.
+
+ * src/GraphicsContext3D.cpp:
+ (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas):
+ (WebCore::GraphicsContext3DInternal::beginPaint):
+ (WebCore::GraphicsContext3DInternal::bindAttribLocation):
+ (WebCore::GraphicsContext3DInternal::getActiveAttrib):
+ (WebCore::GraphicsContext3DInternal::getActiveUniform):
+ (WebCore::GraphicsContext3DInternal::getAttribLocation):
+ (WebCore::GraphicsContext3DInternal::getProgramInfoLog):
+ (WebCore::GraphicsContext3DInternal::getShaderInfoLog):
+ (WebCore::GraphicsContext3DInternal::getShaderSource):
+ (WebCore::GraphicsContext3DInternal::getUniformLocation):
+ (WebCore::GraphicsContext3DInternal::shaderSource):
+
2010-08-03 Dimitri Glazkov <dglazkov at chromium.org>
Unreviewed, build fix.
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index fec0b20..ad5c596 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -35,22 +35,16 @@
#include "GraphicsContext3D.h"
#include "CachedImage.h"
+#include "CanvasRenderingContext.h"
#include "Chrome.h"
#include "ChromeClientImpl.h"
#include "HTMLCanvasElement.h"
#include "HTMLImageElement.h"
#include "ImageBuffer.h"
#include "ImageData.h"
-#include "WebGLBuffer.h"
#include "Int8Array.h"
#include "Float32Array.h"
-#include "WebGLFramebuffer.h"
#include "Int32Array.h"
-#include "WebGLProgram.h"
-#include "WebGLRenderbuffer.h"
-#include "WebGLRenderingContext.h"
-#include "WebGLShader.h"
-#include "WebGLTexture.h"
#include "Uint8Array.h"
#include "WebGLLayerChromium.h"
#include "WebGraphicsContext3D.h"
@@ -94,8 +88,6 @@ namespace WebCore {
// Uncomment this to render to a separate window for debugging
// #define RENDER_TO_DEBUGGING_WINDOW
-#define EXTRACT(val) (!val ? 0 : val->object())
-
class GraphicsContext3DInternal {
public:
GraphicsContext3DInternal();
@@ -112,8 +104,8 @@ public:
void reshape(int width, int height);
- void paintRenderingResultsToCanvas(WebGLRenderingContext* context);
- void beginPaint(WebGLRenderingContext* context);
+ void paintRenderingResultsToCanvas(CanvasRenderingContext* context);
+ void beginPaint(CanvasRenderingContext* context);
void endPaint();
void prepareTexture();
@@ -127,12 +119,12 @@ public:
// Entry points for WebGL.
//
void activeTexture(unsigned long texture);
- void attachShader(WebGLProgram* program, WebGLShader* shader);
- void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name);
- void bindBuffer(unsigned long target, WebGLBuffer*);
- void bindFramebuffer(unsigned long target, WebGLFramebuffer*);
- void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*);
- void bindTexture(unsigned long target, WebGLTexture* texture);
+ void attachShader(Platform3DObject program, Platform3DObject shader);
+ void bindAttribLocation(Platform3DObject, unsigned long index, const String& name);
+ void bindBuffer(unsigned long target, Platform3DObject);
+ void bindFramebuffer(unsigned long target, Platform3DObject);
+ void bindRenderbuffer(unsigned long target, Platform3DObject);
+ void bindTexture(unsigned long target, Platform3DObject texture);
void blendColor(double red, double green, double blue, double alpha);
void blendEquation(unsigned long mode);
void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
@@ -151,7 +143,7 @@ public:
void clearDepth(double depth);
void clearStencil(long s);
void colorMask(bool red, bool green, bool blue, bool alpha);
- void compileShader(WebGLShader*);
+ void compileShader(Platform3DObject);
void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
@@ -159,7 +151,7 @@ public:
void depthFunc(unsigned long func);
void depthMask(bool flag);
void depthRange(double zNear, double zFar);
- void detachShader(WebGLProgram*, WebGLShader*);
+ void detachShader(Platform3DObject, Platform3DObject);
void disable(unsigned long cap);
void disableVertexAttribArray(unsigned long index);
void drawArrays(unsigned long mode, long first, long count);
@@ -169,17 +161,17 @@ public:
void enableVertexAttribArray(unsigned long index);
void finish();
void flush();
- void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*);
- void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level);
+ void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject);
+ void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level);
void frontFace(unsigned long mode);
void generateMipmap(unsigned long target);
- bool getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo&);
- bool getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo&);
+ bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&);
+ bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&);
- void getAttachedShaders(WebGLProgram* program, int maxCount, int* count, unsigned int* shaders);
+ void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders);
- int getAttribLocation(WebGLProgram*, const String& name);
+ int getAttribLocation(Platform3DObject, const String& name);
void getBooleanv(unsigned long pname, unsigned char* value);
@@ -195,26 +187,26 @@ public:
void getIntegerv(unsigned long pname, int* value);
- void getProgramiv(WebGLProgram* program, unsigned long pname, int* value);
+ void getProgramiv(Platform3DObject program, unsigned long pname, int* value);
- String getProgramInfoLog(WebGLProgram*);
+ String getProgramInfoLog(Platform3DObject);
void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
- void getShaderiv(WebGLShader*, unsigned long pname, int* value);
+ void getShaderiv(Platform3DObject, unsigned long pname, int* value);
- String getShaderInfoLog(WebGLShader*);
+ String getShaderInfoLog(Platform3DObject);
- String getShaderSource(WebGLShader*);
+ String getShaderSource(Platform3DObject);
String getString(unsigned long name);
void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
- void getUniformfv(WebGLProgram* program, long location, float* value);
- void getUniformiv(WebGLProgram* program, long location, int* value);
+ void getUniformfv(Platform3DObject program, long location, float* value);
+ void getUniformiv(Platform3DObject program, long location, int* value);
- long getUniformLocation(WebGLProgram*, const String& name);
+ long getUniformLocation(Platform3DObject, const String& name);
void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
@@ -222,15 +214,15 @@ public:
long getVertexAttribOffset(unsigned long index, unsigned long pname);
void hint(unsigned long target, unsigned long mode);
- bool isBuffer(WebGLBuffer*);
+ bool isBuffer(Platform3DObject);
bool isEnabled(unsigned long cap);
- bool isFramebuffer(WebGLFramebuffer*);
- bool isProgram(WebGLProgram*);
- bool isRenderbuffer(WebGLRenderbuffer*);
- bool isShader(WebGLShader*);
- bool isTexture(WebGLTexture*);
+ bool isFramebuffer(Platform3DObject);
+ bool isProgram(Platform3DObject);
+ bool isRenderbuffer(Platform3DObject);
+ bool isShader(Platform3DObject);
+ bool isTexture(Platform3DObject);
void lineWidth(double);
- void linkProgram(WebGLProgram*);
+ void linkProgram(Platform3DObject);
void pixelStorei(unsigned long pname, long param);
void polygonOffset(double factor, double units);
@@ -240,7 +232,7 @@ public:
void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
void sampleCoverage(double value, bool invert);
void scissor(long x, long y, unsigned long width, unsigned long height);
- void shaderSource(WebGLShader*, const String& string);
+ void shaderSource(Platform3DObject, const String& string);
void stencilFunc(unsigned long func, long ref, unsigned long mask);
void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
void stencilMask(unsigned long mask);
@@ -277,8 +269,8 @@ public:
void uniformMatrix3fv(long location, bool transpose, float* value, int size);
void uniformMatrix4fv(long location, bool transpose, float* value, int size);
- void useProgram(WebGLProgram*);
- void validateProgram(WebGLProgram*);
+ void useProgram(Platform3DObject);
+ void validateProgram(Platform3DObject);
void vertexAttrib1f(unsigned long indx, float x);
void vertexAttrib1fv(unsigned long indx, float* values);
@@ -400,7 +392,7 @@ WebGLLayerChromium* GraphicsContext3DInternal::platformLayer() const
}
#endif
-void GraphicsContext3DInternal::paintRenderingResultsToCanvas(WebGLRenderingContext* context)
+void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
{
HTMLCanvasElement* canvas = context->canvas();
ImageBuffer* imageBuffer = canvas->buffer();
@@ -459,7 +451,7 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(WebGLRenderingCont
#endif
}
-void GraphicsContext3DInternal::beginPaint(WebGLRenderingContext* context)
+void GraphicsContext3DInternal::beginPaint(CanvasRenderingContext* context)
{
paintRenderingResultsToCanvas(context);
}
@@ -508,42 +500,18 @@ void GraphicsContext3DInternal::name(t1 a1) \
m_impl->name(a1); \
}
-#define DELEGATE_TO_IMPL_1_X(name, t1) \
-void GraphicsContext3DInternal::name(t1 a1) \
-{ \
- m_impl->name(EXTRACT(a1)); \
-}
-
#define DELEGATE_TO_IMPL_1R(name, t1, rt) \
rt GraphicsContext3DInternal::name(t1 a1) \
{ \
return m_impl->name(a1); \
}
-#define DELEGATE_TO_IMPL_1R_X(name, t1, rt) \
-rt GraphicsContext3DInternal::name(t1 a1) \
-{ \
- return m_impl->name(EXTRACT(a1)); \
-}
-
#define DELEGATE_TO_IMPL_2(name, t1, t2) \
void GraphicsContext3DInternal::name(t1 a1, t2 a2) \
{ \
m_impl->name(a1, a2); \
}
-#define DELEGATE_TO_IMPL_2_X12(name, t1, t2) \
-void GraphicsContext3DInternal::name(t1 a1, t2 a2) \
-{ \
- m_impl->name(EXTRACT(a1), EXTRACT(a2)); \
-}
-
-#define DELEGATE_TO_IMPL_2_X2(name, t1, t2) \
-void GraphicsContext3DInternal::name(t1 a1, t2 a2) \
-{ \
- m_impl->name(a1, EXTRACT(a2)); \
-}
-
#define DELEGATE_TO_IMPL_2R(name, t1, t2, rt) \
rt GraphicsContext3DInternal::name(t1 a1, t2 a2) \
{ \
@@ -556,12 +524,6 @@ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \
m_impl->name(a1, a2, a3); \
}
-#define DELEGATE_TO_IMPL_3_X1(name, t1, t2, t3) \
-void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \
-{ \
- m_impl->name(EXTRACT(a1), a2, a3); \
-}
-
#define DELEGATE_TO_IMPL_3R(name, t1, t2, t3, rt) \
rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3) \
{ \
@@ -574,30 +536,12 @@ void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \
m_impl->name(a1, a2, a3, a4); \
}
-#define DELEGATE_TO_IMPL_4_X1(name, t1, t2, t3, t4) \
-void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \
-{ \
- m_impl->name(EXTRACT(a1), a2, a3, a4); \
-}
-
-#define DELEGATE_TO_IMPL_4_X4(name, t1, t2, t3, t4) \
-void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4) \
-{ \
- m_impl->name(a1, a2, a3, EXTRACT(a4)); \
-}
-
#define DELEGATE_TO_IMPL_5(name, t1, t2, t3, t4, t5) \
void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
{ \
m_impl->name(a1, a2, a3, a4, a5); \
}
-#define DELEGATE_TO_IMPL_5_X4(name, t1, t2, t3, t4, t5) \
-void GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
-{ \
- m_impl->name(a1, a2, a3, EXTRACT(a4), a5); \
-}
-
#define DELEGATE_TO_IMPL_5R(name, t1, t2, t3, t4, t5, rt) \
rt GraphicsContext3DInternal::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) \
{ \
@@ -649,43 +593,17 @@ bool GraphicsContext3DInternal::isGLES2Compliant() const
}
DELEGATE_TO_IMPL_1(activeTexture, unsigned long)
-DELEGATE_TO_IMPL_2_X12(attachShader, WebGLProgram*, WebGLShader*)
+DELEGATE_TO_IMPL_2(attachShader, Platform3DObject, Platform3DObject)
-void GraphicsContext3DInternal::bindAttribLocation(WebGLProgram* program, unsigned long index, const String& name)
+void GraphicsContext3DInternal::bindAttribLocation(Platform3DObject program, unsigned long index, const String& name)
{
- m_impl->bindAttribLocation(EXTRACT(program), index, name.utf8().data());
-}
-
-DELEGATE_TO_IMPL_2_X2(bindBuffer, unsigned long, WebGLBuffer*)
-DELEGATE_TO_IMPL_2_X2(bindFramebuffer, unsigned long, WebGLFramebuffer*)
-DELEGATE_TO_IMPL_2_X2(bindRenderbuffer, unsigned long, WebGLRenderbuffer*)
-
-static const int kTextureWrapR = 0x8072;
-
-// If we didn't have to hack GL_TEXTURE_WRAP_R for cube maps,
-// we could just use:
-// DELEGATE_TO_IMPL_2_X2(bindTexture, unsigned long, WebGLTexture*)
-void GraphicsContext3DInternal::bindTexture(unsigned long target,
- WebGLTexture* texture)
-{
- unsigned int textureObject = EXTRACT(texture);
-
- m_impl->bindTexture(target, textureObject);
-
- // FIXME: GL_TEXTURE_WRAP_R isn't exposed in the OpenGL ES 2.0
- // API. On desktop OpenGL implementations it seems necessary to
- // set this wrap mode to GL_CLAMP_TO_EDGE to get correct behavior
- // of cube maps.
- if (texture)
- if (target == GraphicsContext3D::TEXTURE_CUBE_MAP) {
- if (!texture->isCubeMapRWrapModeInitialized()) {
- m_impl->texParameteri(GraphicsContext3D::TEXTURE_CUBE_MAP, kTextureWrapR, GraphicsContext3D::CLAMP_TO_EDGE);
- texture->setCubeMapRWrapModeInitialized(true);
- }
- } else
- texture->setCubeMapRWrapModeInitialized(false);
+ m_impl->bindAttribLocation(program, index, name.utf8().data());
}
+DELEGATE_TO_IMPL_2(bindBuffer, unsigned long, Platform3DObject)
+DELEGATE_TO_IMPL_2(bindFramebuffer, unsigned long, Platform3DObject)
+DELEGATE_TO_IMPL_2(bindRenderbuffer, unsigned long, Platform3DObject)
+DELEGATE_TO_IMPL_2(bindTexture, unsigned long, Platform3DObject)
DELEGATE_TO_IMPL_4(blendColor, double, double, double, double)
DELEGATE_TO_IMPL_1(blendEquation, unsigned long)
DELEGATE_TO_IMPL_2(blendEquationSeparate, unsigned long, unsigned long)
@@ -723,7 +641,7 @@ DELEGATE_TO_IMPL_4(clearColor, double, double, double, double)
DELEGATE_TO_IMPL_1(clearDepth, double)
DELEGATE_TO_IMPL_1(clearStencil, long)
DELEGATE_TO_IMPL_4(colorMask, bool, bool, bool, bool)
-DELEGATE_TO_IMPL_1_X(compileShader, WebGLShader*)
+DELEGATE_TO_IMPL_1(compileShader, Platform3DObject)
DELEGATE_TO_IMPL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long)
DELEGATE_TO_IMPL_8(copyTexSubImage2D, unsigned long, long, long, long, long, long, unsigned long, unsigned long)
@@ -731,7 +649,7 @@ DELEGATE_TO_IMPL_1(cullFace, unsigned long)
DELEGATE_TO_IMPL_1(depthFunc, unsigned long)
DELEGATE_TO_IMPL_1(depthMask, bool)
DELEGATE_TO_IMPL_2(depthRange, double, double)
-DELEGATE_TO_IMPL_2_X12(detachShader, WebGLProgram*, WebGLShader*)
+DELEGATE_TO_IMPL_2(detachShader, Platform3DObject, Platform3DObject)
DELEGATE_TO_IMPL_1(disable, unsigned long)
DELEGATE_TO_IMPL_1(disableVertexAttribArray, unsigned long)
DELEGATE_TO_IMPL_3(drawArrays, unsigned long, long, long)
@@ -741,15 +659,15 @@ DELEGATE_TO_IMPL_1(enable, unsigned long)
DELEGATE_TO_IMPL_1(enableVertexAttribArray, unsigned long)
DELEGATE_TO_IMPL(finish)
DELEGATE_TO_IMPL(flush)
-DELEGATE_TO_IMPL_4_X4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*)
-DELEGATE_TO_IMPL_5_X4(framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long)
+DELEGATE_TO_IMPL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject)
+DELEGATE_TO_IMPL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long)
DELEGATE_TO_IMPL_1(frontFace, unsigned long)
DELEGATE_TO_IMPL_1(generateMipmap, unsigned long)
-bool GraphicsContext3DInternal::getActiveAttrib(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3DInternal::getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo& info)
{
WebKit::WebGraphicsContext3D::ActiveInfo webInfo;
- if (!m_impl->getActiveAttrib(EXTRACT(program), index, webInfo))
+ if (!m_impl->getActiveAttrib(program, index, webInfo))
return false;
info.name = webInfo.name;
info.type = webInfo.type;
@@ -757,10 +675,10 @@ bool GraphicsContext3DInternal::getActiveAttrib(WebGLProgram* program, unsigned
return true;
}
-bool GraphicsContext3DInternal::getActiveUniform(WebGLProgram* program, unsigned long index, ActiveInfo& info)
+bool GraphicsContext3DInternal::getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo& info)
{
WebKit::WebGraphicsContext3D::ActiveInfo webInfo;
- if (!m_impl->getActiveUniform(EXTRACT(program), index, webInfo))
+ if (!m_impl->getActiveUniform(program, index, webInfo))
return false;
info.name = webInfo.name;
info.type = webInfo.type;
@@ -768,11 +686,11 @@ bool GraphicsContext3DInternal::getActiveUniform(WebGLProgram* program, unsigned
return true;
}
-DELEGATE_TO_IMPL_4_X1(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*)
+DELEGATE_TO_IMPL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*)
-int GraphicsContext3DInternal::getAttribLocation(WebGLProgram* program, const String& name)
+int GraphicsContext3DInternal::getAttribLocation(Platform3DObject program, const String& name)
{
- return m_impl->getAttribLocation(EXTRACT(program), name.utf8().data());
+ return m_impl->getAttribLocation(program, name.utf8().data());
}
DELEGATE_TO_IMPL_2(getBooleanv, unsigned long, unsigned char*)
@@ -799,25 +717,25 @@ DELEGATE_TO_IMPL_4(getFramebufferAttachmentParameteriv, unsigned long, unsigned
DELEGATE_TO_IMPL_2(getIntegerv, unsigned long, int*)
-DELEGATE_TO_IMPL_3_X1(getProgramiv, WebGLProgram*, unsigned long, int*)
+DELEGATE_TO_IMPL_3(getProgramiv, Platform3DObject, unsigned long, int*)
-String GraphicsContext3DInternal::getProgramInfoLog(WebGLProgram* program)
+String GraphicsContext3DInternal::getProgramInfoLog(Platform3DObject program)
{
- return m_impl->getProgramInfoLog(EXTRACT(program));
+ return m_impl->getProgramInfoLog(program);
}
DELEGATE_TO_IMPL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*)
-DELEGATE_TO_IMPL_3_X1(getShaderiv, WebGLShader*, unsigned long, int*)
+DELEGATE_TO_IMPL_3(getShaderiv, Platform3DObject, unsigned long, int*)
-String GraphicsContext3DInternal::getShaderInfoLog(WebGLShader* shader)
+String GraphicsContext3DInternal::getShaderInfoLog(Platform3DObject shader)
{
- return m_impl->getShaderInfoLog(EXTRACT(shader));
+ return m_impl->getShaderInfoLog(shader);
}
-String GraphicsContext3DInternal::getShaderSource(WebGLShader* shader)
+String GraphicsContext3DInternal::getShaderSource(Platform3DObject shader)
{
- return m_impl->getShaderSource(EXTRACT(shader));
+ return m_impl->getShaderSource(shader);
}
String GraphicsContext3DInternal::getString(unsigned long name)
@@ -828,12 +746,12 @@ String GraphicsContext3DInternal::getString(unsigned long name)
DELEGATE_TO_IMPL_3(getTexParameterfv, unsigned long, unsigned long, float*)
DELEGATE_TO_IMPL_3(getTexParameteriv, unsigned long, unsigned long, int*)
-DELEGATE_TO_IMPL_3_X1(getUniformfv, WebGLProgram*, long, float*)
-DELEGATE_TO_IMPL_3_X1(getUniformiv, WebGLProgram*, long, int*)
+DELEGATE_TO_IMPL_3(getUniformfv, Platform3DObject, long, float*)
+DELEGATE_TO_IMPL_3(getUniformiv, Platform3DObject, long, int*)
-long GraphicsContext3DInternal::getUniformLocation(WebGLProgram* program, const String& name)
+long GraphicsContext3DInternal::getUniformLocation(Platform3DObject program, const String& name)
{
- return m_impl->getUniformLocation(EXTRACT(program), name.utf8().data());
+ return m_impl->getUniformLocation(program, name.utf8().data());
}
DELEGATE_TO_IMPL_3(getVertexAttribfv, unsigned long, unsigned long, float*)
@@ -842,15 +760,15 @@ DELEGATE_TO_IMPL_3(getVertexAttribiv, unsigned long, unsigned long, int*)
DELEGATE_TO_IMPL_2R(getVertexAttribOffset, unsigned long, unsigned long, long)
DELEGATE_TO_IMPL_2(hint, unsigned long, unsigned long)
-DELEGATE_TO_IMPL_1R_X(isBuffer, WebGLBuffer*, bool)
+DELEGATE_TO_IMPL_1R(isBuffer, Platform3DObject, bool)
DELEGATE_TO_IMPL_1R(isEnabled, unsigned long, bool)
-DELEGATE_TO_IMPL_1R_X(isFramebuffer, WebGLFramebuffer*, bool)
-DELEGATE_TO_IMPL_1R_X(isProgram, WebGLProgram*, bool)
-DELEGATE_TO_IMPL_1R_X(isRenderbuffer, WebGLRenderbuffer*, bool)
-DELEGATE_TO_IMPL_1R_X(isShader, WebGLShader*, bool)
-DELEGATE_TO_IMPL_1R_X(isTexture, WebGLTexture*, bool)
+DELEGATE_TO_IMPL_1R(isFramebuffer, Platform3DObject, bool)
+DELEGATE_TO_IMPL_1R(isProgram, Platform3DObject, bool)
+DELEGATE_TO_IMPL_1R(isRenderbuffer, Platform3DObject, bool)
+DELEGATE_TO_IMPL_1R(isShader, Platform3DObject, bool)
+DELEGATE_TO_IMPL_1R(isTexture, Platform3DObject, bool)
DELEGATE_TO_IMPL_1(lineWidth, double)
-DELEGATE_TO_IMPL_1_X(linkProgram, WebGLProgram*)
+DELEGATE_TO_IMPL_1(linkProgram, Platform3DObject)
DELEGATE_TO_IMPL_2(pixelStorei, unsigned long, long)
DELEGATE_TO_IMPL_2(polygonOffset, double, double)
DELEGATE_TO_IMPL_7(readPixels, long, long, unsigned long, unsigned long, unsigned long, unsigned long, void*)
@@ -859,9 +777,9 @@ DELEGATE_TO_IMPL_4(renderbufferStorage, unsigned long, unsigned long, unsigned l
DELEGATE_TO_IMPL_2(sampleCoverage, double, bool)
DELEGATE_TO_IMPL_4(scissor, long, long, unsigned long, unsigned long)
-void GraphicsContext3DInternal::shaderSource(WebGLShader* shader, const String& string)
+void GraphicsContext3DInternal::shaderSource(Platform3DObject shader, const String& string)
{
- m_impl->shaderSource(EXTRACT(shader), string.utf8().data());
+ m_impl->shaderSource(shader, string.utf8().data());
}
DELEGATE_TO_IMPL_3(stencilFunc, unsigned long, long, unsigned long)
@@ -957,8 +875,8 @@ void GraphicsContext3DInternal::uniformMatrix4fv(long location, bool transpose,
m_impl->uniformMatrix4fv(location, size, transpose, value);
}
-DELEGATE_TO_IMPL_1_X(useProgram, WebGLProgram*)
-DELEGATE_TO_IMPL_1_X(validateProgram, WebGLProgram*)
+DELEGATE_TO_IMPL_1(useProgram, Platform3DObject)
+DELEGATE_TO_IMPL_1(validateProgram, Platform3DObject)
DELEGATE_TO_IMPL_2(vertexAttrib1f, unsigned long, float)
DELEGATE_TO_IMPL_2(vertexAttrib1fv, unsigned long, float*)
@@ -1140,13 +1058,13 @@ DELEGATE_TO_INTERNAL_1R(sizeInBytes, int, int)
DELEGATE_TO_INTERNAL_2(reshape, int, int)
DELEGATE_TO_INTERNAL_1(activeTexture, unsigned long)
-DELEGATE_TO_INTERNAL_2(attachShader, WebGLProgram*, WebGLShader*)
-DELEGATE_TO_INTERNAL_3(bindAttribLocation, WebGLProgram*, unsigned long, const String&)
+DELEGATE_TO_INTERNAL_2(attachShader, Platform3DObject, Platform3DObject)
+DELEGATE_TO_INTERNAL_3(bindAttribLocation, Platform3DObject, unsigned long, const String&)
-DELEGATE_TO_INTERNAL_2(bindBuffer, unsigned long, WebGLBuffer*)
-DELEGATE_TO_INTERNAL_2(bindFramebuffer, unsigned long, WebGLFramebuffer*)
-DELEGATE_TO_INTERNAL_2(bindRenderbuffer, unsigned long, WebGLRenderbuffer*)
-DELEGATE_TO_INTERNAL_2(bindTexture, unsigned long, WebGLTexture*)
+DELEGATE_TO_INTERNAL_2(bindBuffer, unsigned long, Platform3DObject)
+DELEGATE_TO_INTERNAL_2(bindFramebuffer, unsigned long, Platform3DObject)
+DELEGATE_TO_INTERNAL_2(bindRenderbuffer, unsigned long, Platform3DObject)
+DELEGATE_TO_INTERNAL_2(bindTexture, unsigned long, Platform3DObject)
DELEGATE_TO_INTERNAL_4(blendColor, double, double, double, double)
DELEGATE_TO_INTERNAL_1(blendEquation, unsigned long)
DELEGATE_TO_INTERNAL_2(blendEquationSeparate, unsigned long, unsigned long)
@@ -1165,7 +1083,7 @@ DELEGATE_TO_INTERNAL_4(clearColor, double, double, double, double)
DELEGATE_TO_INTERNAL_1(clearDepth, double)
DELEGATE_TO_INTERNAL_1(clearStencil, long)
DELEGATE_TO_INTERNAL_4(colorMask, bool, bool, bool, bool)
-DELEGATE_TO_INTERNAL_1(compileShader, WebGLShader*)
+DELEGATE_TO_INTERNAL_1(compileShader, Platform3DObject)
DELEGATE_TO_INTERNAL_8(copyTexImage2D, unsigned long, long, unsigned long, long, long, unsigned long, unsigned long, long)
DELEGATE_TO_INTERNAL_8(copyTexSubImage2D, unsigned long, long, long, long, long, long, unsigned long, unsigned long)
@@ -1173,7 +1091,7 @@ DELEGATE_TO_INTERNAL_1(cullFace, unsigned long)
DELEGATE_TO_INTERNAL_1(depthFunc, unsigned long)
DELEGATE_TO_INTERNAL_1(depthMask, bool)
DELEGATE_TO_INTERNAL_2(depthRange, double, double)
-DELEGATE_TO_INTERNAL_2(detachShader, WebGLProgram*, WebGLShader*)
+DELEGATE_TO_INTERNAL_2(detachShader, Platform3DObject, Platform3DObject)
DELEGATE_TO_INTERNAL_1(disable, unsigned long)
DELEGATE_TO_INTERNAL_1(disableVertexAttribArray, unsigned long)
DELEGATE_TO_INTERNAL_3(drawArrays, unsigned long, long, long)
@@ -1183,17 +1101,17 @@ DELEGATE_TO_INTERNAL_1(enable, unsigned long)
DELEGATE_TO_INTERNAL_1(enableVertexAttribArray, unsigned long)
DELEGATE_TO_INTERNAL(finish)
DELEGATE_TO_INTERNAL(flush)
-DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, WebGLRenderbuffer*)
-DELEGATE_TO_INTERNAL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, WebGLTexture*, long)
+DELEGATE_TO_INTERNAL_4(framebufferRenderbuffer, unsigned long, unsigned long, unsigned long, Platform3DObject)
+DELEGATE_TO_INTERNAL_5(framebufferTexture2D, unsigned long, unsigned long, unsigned long, Platform3DObject, long)
DELEGATE_TO_INTERNAL_1(frontFace, unsigned long)
DELEGATE_TO_INTERNAL_1(generateMipmap, unsigned long)
-DELEGATE_TO_INTERNAL_3R(getActiveAttrib, WebGLProgram*, unsigned long, ActiveInfo&, bool)
-DELEGATE_TO_INTERNAL_3R(getActiveUniform, WebGLProgram*, unsigned long, ActiveInfo&, bool)
+DELEGATE_TO_INTERNAL_3R(getActiveAttrib, Platform3DObject, unsigned long, ActiveInfo&, bool)
+DELEGATE_TO_INTERNAL_3R(getActiveUniform, Platform3DObject, unsigned long, ActiveInfo&, bool)
-DELEGATE_TO_INTERNAL_4(getAttachedShaders, WebGLProgram*, int, int*, unsigned int*)
+DELEGATE_TO_INTERNAL_4(getAttachedShaders, Platform3DObject, int, int*, unsigned int*)
-DELEGATE_TO_INTERNAL_2R(getAttribLocation, WebGLProgram*, const String&, int)
+DELEGATE_TO_INTERNAL_2R(getAttribLocation, Platform3DObject, const String&, int)
DELEGATE_TO_INTERNAL_2(getBooleanv, unsigned long, unsigned char*)
@@ -1209,26 +1127,26 @@ DELEGATE_TO_INTERNAL_4(getFramebufferAttachmentParameteriv, unsigned long, unsig
DELEGATE_TO_INTERNAL_2(getIntegerv, unsigned long, int*)
-DELEGATE_TO_INTERNAL_3(getProgramiv, WebGLProgram*, unsigned long, int*)
+DELEGATE_TO_INTERNAL_3(getProgramiv, Platform3DObject, unsigned long, int*)
-DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, WebGLProgram*, String)
+DELEGATE_TO_INTERNAL_1R(getProgramInfoLog, Platform3DObject, String)
DELEGATE_TO_INTERNAL_3(getRenderbufferParameteriv, unsigned long, unsigned long, int*)
-DELEGATE_TO_INTERNAL_3(getShaderiv, WebGLShader*, unsigned long, int*)
+DELEGATE_TO_INTERNAL_3(getShaderiv, Platform3DObject, unsigned long, int*)
-DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, WebGLShader*, String)
+DELEGATE_TO_INTERNAL_1R(getShaderInfoLog, Platform3DObject, String)
-DELEGATE_TO_INTERNAL_1R(getShaderSource, WebGLShader*, String)
+DELEGATE_TO_INTERNAL_1R(getShaderSource, Platform3DObject, String)
DELEGATE_TO_INTERNAL_1R(getString, unsigned long, String)
DELEGATE_TO_INTERNAL_3(getTexParameterfv, unsigned long, unsigned long, float*)
DELEGATE_TO_INTERNAL_3(getTexParameteriv, unsigned long, unsigned long, int*)
-DELEGATE_TO_INTERNAL_3(getUniformfv, WebGLProgram*, long, float*)
-DELEGATE_TO_INTERNAL_3(getUniformiv, WebGLProgram*, long, int*)
+DELEGATE_TO_INTERNAL_3(getUniformfv, Platform3DObject, long, float*)
+DELEGATE_TO_INTERNAL_3(getUniformiv, Platform3DObject, long, int*)
-DELEGATE_TO_INTERNAL_2R(getUniformLocation, WebGLProgram*, const String&, long)
+DELEGATE_TO_INTERNAL_2R(getUniformLocation, Platform3DObject, const String&, long)
DELEGATE_TO_INTERNAL_3(getVertexAttribfv, unsigned long, unsigned long, float*)
DELEGATE_TO_INTERNAL_3(getVertexAttribiv, unsigned long, unsigned long, int*)
@@ -1236,15 +1154,15 @@ DELEGATE_TO_INTERNAL_3(getVertexAttribiv, unsigned long, unsigned long, int*)
DELEGATE_TO_INTERNAL_2R(getVertexAttribOffset, unsigned long, unsigned long, long)
DELEGATE_TO_INTERNAL_2(hint, unsigned long, unsigned long)
-DELEGATE_TO_INTERNAL_1R(isBuffer, WebGLBuffer*, bool)
+DELEGATE_TO_INTERNAL_1R(isBuffer, Platform3DObject, bool)
DELEGATE_TO_INTERNAL_1R(isEnabled, unsigned long, bool)
-DELEGATE_TO_INTERNAL_1R(isFramebuffer, WebGLFramebuffer*, bool)
-DELEGATE_TO_INTERNAL_1R(isProgram, WebGLProgram*, bool)
-DELEGATE_TO_INTERNAL_1R(isRenderbuffer, WebGLRenderbuffer*, bool)
-DELEGATE_TO_INTERNAL_1R(isShader, WebGLShader*, bool)
-DELEGATE_TO_INTERNAL_1R(isTexture, WebGLTexture*, bool)
+DELEGATE_TO_INTERNAL_1R(isFramebuffer, Platform3DObject, bool)
+DELEGATE_TO_INTERNAL_1R(isProgram, Platform3DObject, bool)
+DELEGATE_TO_INTERNAL_1R(isRenderbuffer, Platform3DObject, bool)
+DELEGATE_TO_INTERNAL_1R(isShader, Platform3DObject, bool)
+DELEGATE_TO_INTERNAL_1R(isTexture, Platform3DObject, bool)
DELEGATE_TO_INTERNAL_1(lineWidth, double)
-DELEGATE_TO_INTERNAL_1(linkProgram, WebGLProgram*)
+DELEGATE_TO_INTERNAL_1(linkProgram, Platform3DObject)
DELEGATE_TO_INTERNAL_2(pixelStorei, unsigned long, long)
DELEGATE_TO_INTERNAL_2(polygonOffset, double, double)
@@ -1254,7 +1172,7 @@ DELEGATE_TO_INTERNAL(releaseShaderCompiler)
DELEGATE_TO_INTERNAL_4(renderbufferStorage, unsigned long, unsigned long, unsigned long, unsigned long)
DELEGATE_TO_INTERNAL_2(sampleCoverage, double, bool)
DELEGATE_TO_INTERNAL_4(scissor, long, long, unsigned long, unsigned long)
-DELEGATE_TO_INTERNAL_2(shaderSource, WebGLShader*, const String&)
+DELEGATE_TO_INTERNAL_2(shaderSource, Platform3DObject, const String&)
DELEGATE_TO_INTERNAL_3(stencilFunc, unsigned long, long, unsigned long)
DELEGATE_TO_INTERNAL_4(stencilFuncSeparate, unsigned long, unsigned long, long, unsigned long)
DELEGATE_TO_INTERNAL_1(stencilMask, unsigned long)
@@ -1287,8 +1205,8 @@ DELEGATE_TO_INTERNAL_4(uniformMatrix2fv, long, bool, float*, int)
DELEGATE_TO_INTERNAL_4(uniformMatrix3fv, long, bool, float*, int)
DELEGATE_TO_INTERNAL_4(uniformMatrix4fv, long, bool, float*, int)
-DELEGATE_TO_INTERNAL_1(useProgram, WebGLProgram*)
-DELEGATE_TO_INTERNAL_1(validateProgram, WebGLProgram*)
+DELEGATE_TO_INTERNAL_1(useProgram, Platform3DObject)
+DELEGATE_TO_INTERNAL_1(validateProgram, Platform3DObject)
DELEGATE_TO_INTERNAL_2(vertexAttrib1f, unsigned long, float)
DELEGATE_TO_INTERNAL_2(vertexAttrib1fv, unsigned long, float*)
@@ -1302,8 +1220,8 @@ DELEGATE_TO_INTERNAL_6(vertexAttribPointer, unsigned long, int, int, bool, unsig
DELEGATE_TO_INTERNAL_4(viewport, long, long, unsigned long, unsigned long)
-DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, WebGLRenderingContext*)
-DELEGATE_TO_INTERNAL_1(beginPaint, WebGLRenderingContext*)
+DELEGATE_TO_INTERNAL_1(paintRenderingResultsToCanvas, CanvasRenderingContext*)
+DELEGATE_TO_INTERNAL_1(beginPaint, CanvasRenderingContext*)
DELEGATE_TO_INTERNAL(endPaint)
DELEGATE_TO_INTERNAL_R(createBuffer, unsigned)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list