Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 24096029: Moved the majority of WebGL functionality into WebGLRenderingContextBase (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/canvas/WebGLRenderingContextBase.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
similarity index 82%
copy from Source/core/html/canvas/WebGLRenderingContext.cpp
copy to Source/core/html/canvas/WebGLRenderingContextBase.cpp
index a7066052202f8058402387903970cc5523665039..21d222535abc251393b23f38d8e2241b27656fc0 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
@@ -24,7 +24,7 @@
*/
#include "config.h"
-#include "core/html/canvas/WebGLRenderingContext.h"
+#include "core/html/canvas/WebGLRenderingContextBase.h"
#include "RuntimeEnabledFeatures.h"
#include "bindings/v8/ExceptionMessages.h"
@@ -89,38 +89,38 @@ const double secondsBetweenRestoreAttempts = 1.0;
const int maxGLErrorsAllowedToConsole = 256;
const int maxGLActiveContexts = 16;
-Vector<WebGLRenderingContext*>& WebGLRenderingContext::activeContexts()
+Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts()
{
- DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContext*>, activeContexts, ());
+ DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ());
return activeContexts;
}
-Vector<WebGLRenderingContext*>& WebGLRenderingContext::forciblyEvictedContexts()
+Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::forciblyEvictedContexts()
{
- DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContext*>, forciblyEvictedContexts, ());
+ DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, forciblyEvictedContexts, ());
return forciblyEvictedContexts;
}
-void WebGLRenderingContext::forciblyLoseOldestContext(const String& reason)
+void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason)
{
if (activeContexts().size()) {
- WebGLRenderingContext* oldestActiveContext = activeContexts().first();
+ WebGLRenderingContextBase* oldestActiveContext = activeContexts().first();
activeContexts().remove(0);
oldestActiveContext->printWarningToConsole(reason);
InspectorInstrumentation::didFireWebGLWarning(oldestActiveContext->canvas());
// This will call deactivateContext once the context has actually been lost.
- oldestActiveContext->forceLostContext(WebGLRenderingContext::SyntheticLostContext);
+ oldestActiveContext->forceLostContext(WebGLRenderingContextBase::SyntheticLostContext);
}
}
-IntSize WebGLRenderingContext::oldestContextSize()
+IntSize WebGLRenderingContextBase::oldestContextSize()
{
IntSize size;
if (activeContexts().size()) {
- WebGLRenderingContext* oldestActiveContext = activeContexts().first();
+ WebGLRenderingContextBase* oldestActiveContext = activeContexts().first();
size.setWidth(oldestActiveContext->drawingBufferWidth());
size.setHeight(oldestActiveContext->drawingBufferHeight());
}
@@ -128,7 +128,7 @@ IntSize WebGLRenderingContext::oldestContextSize()
return size;
}
-void WebGLRenderingContext::activateContext(WebGLRenderingContext* context)
+void WebGLRenderingContextBase::activateContext(WebGLRenderingContextBase* context)
{
if (!activeContexts().contains(context))
activeContexts().append(context);
@@ -137,7 +137,7 @@ void WebGLRenderingContext::activateContext(WebGLRenderingContext* context)
forciblyLoseOldestContext("WARNING: Too many active WebGL contexts. Oldest context will be lost.");
}
-void WebGLRenderingContext::deactivateContext(WebGLRenderingContext* context, bool addToEvictedList)
+void WebGLRenderingContextBase::deactivateContext(WebGLRenderingContextBase* context, bool addToEvictedList)
{
size_t position = activeContexts().find(context);
if (position != WTF::notFound)
@@ -147,7 +147,7 @@ void WebGLRenderingContext::deactivateContext(WebGLRenderingContext* context, bo
forciblyEvictedContexts().append(context);
}
-void WebGLRenderingContext::willDestroyContext(WebGLRenderingContext* context)
+void WebGLRenderingContextBase::willDestroyContext(WebGLRenderingContextBase* context)
{
size_t position = forciblyEvictedContexts().find(context);
if (position != WTF::notFound)
@@ -156,8 +156,8 @@ void WebGLRenderingContext::willDestroyContext(WebGLRenderingContext* context)
deactivateContext(context, false);
// Try to re-enable the oldest inactive contexts.
- while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContexts().size()) {
- WebGLRenderingContext* evictedContext = forciblyEvictedContexts().first();
+ while (activeContexts().size() < maxGLActiveContexts && forciblyEvictedContexts().size()) {
+ WebGLRenderingContextBase* evictedContext = forciblyEvictedContexts().first();
if (!evictedContext->m_restoreAllowed) {
forciblyEvictedContexts().remove(0);
continue;
@@ -177,11 +177,13 @@ void WebGLRenderingContext::willDestroyContext(WebGLRenderingContext* context)
class WebGLRenderingContextEvictionManager : public ContextEvictionManager {
public:
- void forciblyLoseOldestContext(const String& reason) {
- WebGLRenderingContext::forciblyLoseOldestContext(reason);
+ void forciblyLoseOldestContext(const String& reason)
+ {
+ WebGLRenderingContextBase::forciblyLoseOldestContext(reason);
};
- IntSize oldestContextSize() {
- return WebGLRenderingContext::oldestContextSize();
+ IntSize oldestContextSize()
+ {
+ return WebGLRenderingContextBase::oldestContextSize();
};
};
@@ -231,8 +233,8 @@ namespace {
// Returns false if no clipping is necessary, i.e., x, y, width, height stay the same.
bool clip2D(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height,
- GC3Dsizei sourceWidth, GC3Dsizei sourceHeight,
- GC3Dint* clippedX, GC3Dint* clippedY, GC3Dsizei* clippedWidth, GC3Dsizei*clippedHeight)
+ GC3Dsizei sourceWidth, GC3Dsizei sourceHeight,
+ GC3Dint* clippedX, GC3Dint* clippedY, GC3Dsizei* clippedWidth, GC3Dsizei*clippedHeight)
{
ASSERT(clippedX && clippedY && clippedWidth && clippedHeight);
clip1D(x, width, sourceWidth, clippedX, clippedWidth);
@@ -454,33 +456,22 @@ namespace {
break;
}
}
-
- GraphicsContext3D::Attributes adjustAttributes(const GraphicsContext3D::Attributes& attributes, Settings* settings)
- {
- GraphicsContext3D::Attributes adjustedAttributes = attributes;
- if (adjustedAttributes.antialias) {
- if (settings && !settings->openGLMultisamplingEnabled())
- adjustedAttributes.antialias = false;
- }
-
- return adjustedAttributes;
- }
} // namespace anonymous
class WebGLRenderingContextLostCallback : public GraphicsContext3D::ContextLostCallback {
WTF_MAKE_FAST_ALLOCATED;
public:
- explicit WebGLRenderingContextLostCallback(WebGLRenderingContext* cb) : m_context(cb) { }
- virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingContext::RealLostContext); }
- virtual ~WebGLRenderingContextLostCallback() {}
+ explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* cb) : m_context(cb) { }
+ virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingContextBase::RealLostContext); }
+ virtual ~WebGLRenderingContextLostCallback() { }
private:
- WebGLRenderingContext* m_context;
+ WebGLRenderingContextBase* m_context;
};
class WebGLRenderingContextErrorMessageCallback : public GraphicsContext3D::ErrorMessageCallback {
WTF_MAKE_FAST_ALLOCATED;
public:
- explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContext* cb) : m_context(cb) { }
+ explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase* cb) : m_context(cb) { }
virtual void onErrorMessage(const String& message, GC3Dint)
{
if (m_context->m_synthesizedErrorsToConsole)
@@ -489,62 +480,29 @@ public:
}
virtual ~WebGLRenderingContextErrorMessageCallback() { }
private:
- WebGLRenderingContext* m_context;
+ WebGLRenderingContextBase* m_context;
};
-PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs)
+GraphicsContext3D::Attributes WebGLRenderingContextBase::adjustAttributes(const GraphicsContext3D::Attributes& attributes, Settings* settings)
{
- Document& document = canvas->document();
- Frame* frame = document.frame();
- if (!frame)
- return nullptr;
- Settings* settings = frame->settings();
-
- // The FrameLoaderClient might block creation of a new WebGL context despite the page settings; in
- // particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension.
- if (!frame->loader()->client()->allowWebGL(settings && settings->webGLEnabled())) {
- canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Web page was not allowed to create a WebGL context."));
- return nullptr;
- }
-
- GraphicsContext3D::Attributes requestedAttributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
- requestedAttributes.noExtensions = true;
- requestedAttributes.shareResources = true;
- requestedAttributes.preferDiscreteGPU = true;
- requestedAttributes.topDocumentURL = document.topDocument()->url();
-
- GraphicsContext3D::Attributes attributes = adjustAttributes(requestedAttributes, settings);
-
- RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes));
-
- if (!context || !context->makeContextCurrent()) {
- canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
- return nullptr;
+ GraphicsContext3D::Attributes adjustedAttributes = attributes;
+ if (adjustedAttributes.antialias) {
+ if (settings && !settings->openGLMultisamplingEnabled())
+ adjustedAttributes.antialias = false;
}
- Extensions3D* extensions = context->getExtensions();
- if (extensions->supports("GL_EXT_debug_marker"))
- extensions->pushGroupMarkerEXT("WebGLRenderingContext");
-
- OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, context, attributes, requestedAttributes));
- renderingContext->suspendIfNeeded();
-
- if (renderingContext->m_drawingBuffer->isZeroSized()) {
- canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
- return nullptr;
- }
-
- return renderingContext.release();
+ return adjustedAttributes;
}
-WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context, GraphicsContext3D::Attributes attributes, GraphicsContext3D::Attributes requestedAttributes)
+WebGLRenderingContextBase::WebGLRenderingContextBase(const String& contextName, HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context, GraphicsContext3D::Attributes attributes, GraphicsContext3D::Attributes requestedAttributes)
: CanvasRenderingContext(passedCanvas)
, ActiveDOMObject(&passedCanvas->document())
+ , m_contextName(contextName)
, m_context(context)
, m_drawingBuffer(0)
- , m_dispatchContextLostEventTimer(this, &WebGLRenderingContext::dispatchContextLostEvent)
+ , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatchContextLostEvent)
, m_restoreAllowed(false)
- , m_restoreTimer(this, &WebGLRenderingContext::maybeRestoreContext)
+ , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext)
, m_videoCache(4)
, m_contextLost(false)
, m_contextLostMode(SyntheticLostContext)
@@ -577,36 +535,9 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa
setupFlags();
initializeNewContext();
}
-
- // Register extensions.
- static const char* webkitPrefix[] = { "WEBKIT_", 0, };
- static const char* bothPrefixes[] = { "", "WEBKIT_", 0, };
-
- registerExtension<ANGLEInstancedArrays>(m_angleInstancedArrays);
- registerExtension<EXTTextureFilterAnisotropic>(m_extTextureFilterAnisotropic, PrefixedExtension, webkitPrefix);
- registerExtension<OESElementIndexUint>(m_oesElementIndexUint);
- registerExtension<OESStandardDerivatives>(m_oesStandardDerivatives);
- registerExtension<OESTextureFloat>(m_oesTextureFloat);
- registerExtension<OESTextureFloatLinear>(m_oesTextureFloatLinear);
- registerExtension<OESTextureHalfFloat>(m_oesTextureHalfFloat);
- registerExtension<OESTextureHalfFloatLinear>(m_oesTextureHalfFloatLinear);
- registerExtension<OESVertexArrayObject>(m_oesVertexArrayObject);
- registerExtension<WebGLCompressedTextureATC>(m_webglCompressedTextureATC, PrefixedExtension, webkitPrefix);
- registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC, PrefixedExtension, webkitPrefix);
- registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC, PrefixedExtension, bothPrefixes);
- registerExtension<WebGLDepthTexture>(m_webglDepthTexture, PrefixedExtension, bothPrefixes);
- registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, bothPrefixes);
-
- // Register draft extensions.
- registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension);
- registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers, DraftExtension);
-
- // Register privileged extensions.
- registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, PrivilegedExtension);
- registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtension);
}
-void WebGLRenderingContext::initializeNewContext()
+void WebGLRenderingContextBase::initializeNewContext()
{
ASSERT(!isContextLost());
m_needsUpdate = true;
@@ -682,7 +613,7 @@ void WebGLRenderingContext::initializeNewContext()
activateContext(this);
}
-void WebGLRenderingContext::setupFlags()
+void WebGLRenderingContextBase::setupFlags()
{
ASSERT(m_context);
if (Page* p = canvas()->document().page()) {
@@ -699,25 +630,25 @@ void WebGLRenderingContext::setupFlags()
m_isDepthStencilSupported = m_context->getExtensions()->isEnabled("GL_OES_packed_depth_stencil");
}
-bool WebGLRenderingContext::allowPrivilegedExtensions() const
+bool WebGLRenderingContextBase::allowPrivilegedExtensions() const
{
if (Page* p = canvas()->document().page())
return p->settings().privilegedWebGLExtensionsEnabled();
return false;
}
-void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format)
+void WebGLRenderingContextBase::addCompressedTextureFormat(GC3Denum format)
{
if (!m_compressedTextureFormats.contains(format))
m_compressedTextureFormats.append(format);
}
-void WebGLRenderingContext::removeAllCompressedTextureFormats()
+void WebGLRenderingContextBase::removeAllCompressedTextureFormats()
{
m_compressedTextureFormats.clear();
}
-WebGLRenderingContext::~WebGLRenderingContext()
+WebGLRenderingContextBase::~WebGLRenderingContextBase()
{
// Remove all references to WebGLObjects so if they are the last reference
// they will be freed before the last context is removed from the context group.
@@ -730,8 +661,8 @@ WebGLRenderingContext::~WebGLRenderingContext()
m_renderbufferBinding = 0;
for (size_t i = 0; i < m_textureUnits.size(); ++i) {
- m_textureUnits[i].m_texture2DBinding = 0;
- m_textureUnits[i].m_textureCubeMapBinding = 0;
+ m_textureUnits[i].m_texture2DBinding = 0;
+ m_textureUnits[i].m_textureCubeMapBinding = 0;
}
m_blackTexture2D = 0;
@@ -758,7 +689,7 @@ WebGLRenderingContext::~WebGLRenderingContext()
willDestroyContext(this);
}
-void WebGLRenderingContext::destroyGraphicsContext3D()
+void WebGLRenderingContextBase::destroyGraphicsContext3D()
{
m_contextLost = true;
@@ -773,7 +704,7 @@ void WebGLRenderingContext::destroyGraphicsContext3D()
}
}
-void WebGLRenderingContext::markContextChanged()
+void WebGLRenderingContextBase::markContextChanged()
{
if (m_framebufferBinding || isContextLost())
return;
@@ -795,7 +726,7 @@ void WebGLRenderingContext::markContextChanged()
}
}
-bool WebGLRenderingContext::clearIfComposited(GC3Dbitfield mask)
+bool WebGLRenderingContextBase::clearIfComposited(GC3Dbitfield mask)
{
if (isContextLost())
return false;
@@ -810,13 +741,15 @@ bool WebGLRenderingContext::clearIfComposited(GC3Dbitfield mask)
bool combinedClear = mask && !m_scissorEnabled;
m_context->disable(GraphicsContext3D::SCISSOR_TEST);
- if (combinedClear && (mask & GraphicsContext3D::COLOR_BUFFER_BIT))
- m_context->clearColor(m_colorMask[0] ? m_clearColor[0] : 0,
- m_colorMask[1] ? m_clearColor[1] : 0,
- m_colorMask[2] ? m_clearColor[2] : 0,
- m_colorMask[3] ? m_clearColor[3] : 0);
- else
+ if (combinedClear && (mask & GraphicsContext3D::COLOR_BUFFER_BIT)) {
+ m_context->clearColor(
+ m_colorMask[0] ? m_clearColor[0] : 0,
+ m_colorMask[1] ? m_clearColor[1] : 0,
+ m_colorMask[2] ? m_clearColor[2] : 0,
+ m_colorMask[3] ? m_clearColor[3] : 0);
+ } else {
m_context->clearColor(0, 0, 0, 0);
+ }
m_context->colorMask(true, true, true, true);
GC3Dbitfield clearMask = GraphicsContext3D::COLOR_BUFFER_BIT;
if (contextAttributes->depth()) {
@@ -844,7 +777,7 @@ bool WebGLRenderingContext::clearIfComposited(GC3Dbitfield mask)
return combinedClear;
}
-void WebGLRenderingContext::restoreStateAfterClear()
+void WebGLRenderingContextBase::restoreStateAfterClear()
{
if (isContextLost())
return;
@@ -852,23 +785,21 @@ void WebGLRenderingContext::restoreStateAfterClear()
// Restore the state that the context set.
if (m_scissorEnabled)
m_context->enable(GraphicsContext3D::SCISSOR_TEST);
- m_context->clearColor(m_clearColor[0], m_clearColor[1],
- m_clearColor[2], m_clearColor[3]);
- m_context->colorMask(m_colorMask[0], m_colorMask[1],
- m_colorMask[2], m_colorMask[3]);
+ m_context->clearColor(m_clearColor[0], m_clearColor[1], m_clearColor[2], m_clearColor[3]);
+ m_context->colorMask(m_colorMask[0], m_colorMask[1], m_colorMask[2], m_colorMask[3]);
m_context->clearDepth(m_clearDepth);
m_context->clearStencil(m_clearStencil);
m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, m_stencilMask);
m_context->depthMask(m_depthMask);
}
-void WebGLRenderingContext::markLayerComposited()
+void WebGLRenderingContextBase::markLayerComposited()
{
if (!isContextLost())
m_context->markLayerComposited();
}
-void WebGLRenderingContext::paintRenderingResultsToCanvas()
+void WebGLRenderingContextBase::paintRenderingResultsToCanvas()
{
if (isContextLost()) {
canvas()->clearPresentationCopy();
@@ -884,8 +815,9 @@ void WebGLRenderingContext::paintRenderingResultsToCanvas()
m_drawingBuffer->paintCompositedResultsToCanvas(canvas()->buffer());
canvas()->makePresentationCopy();
- } else
+ } else {
canvas()->clearPresentationCopy();
+ }
clearIfComposited();
if (!m_markedCanvasDirty && !m_layerCleared)
@@ -903,7 +835,7 @@ void WebGLRenderingContext::paintRenderingResultsToCanvas()
m_drawingBuffer->bind();
}
-PassRefPtr<ImageData> WebGLRenderingContext::paintRenderingResultsToImageData()
+PassRefPtr<ImageData> WebGLRenderingContextBase::paintRenderingResultsToImageData()
{
if (isContextLost())
return 0;
@@ -920,12 +852,12 @@ PassRefPtr<ImageData> WebGLRenderingContext::paintRenderingResultsToImageData()
return imageData;
}
-void WebGLRenderingContext::reshape(int width, int height)
+void WebGLRenderingContextBase::reshape(int width, int height)
{
if (isContextLost())
return;
- // This is an approximation because at WebGLRenderingContext level we don't
+ // This is an approximation because at WebGLRenderingContextBase level we don't
// know if the underlying FBO uses textures or renderbuffers.
GC3Dint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize);
// Limit drawing buffer size to 4k to avoid memory exhaustion.
@@ -951,20 +883,20 @@ void WebGLRenderingContext::reshape(int width, int height)
m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, objectOrZero(m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get()));
m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, objectOrZero(m_renderbufferBinding.get()));
if (m_framebufferBinding)
- m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
+ m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, objectOrZero(m_framebufferBinding.get()));
}
-int WebGLRenderingContext::drawingBufferWidth() const
+int WebGLRenderingContextBase::drawingBufferWidth() const
{
return m_drawingBuffer->size().width();
}
-int WebGLRenderingContext::drawingBufferHeight() const
+int WebGLRenderingContextBase::drawingBufferHeight() const
{
return m_drawingBuffer->size().height();
}
-unsigned int WebGLRenderingContext::sizeInBytes(GC3Denum type)
+unsigned WebGLRenderingContextBase::sizeInBytes(GC3Denum type)
{
switch (type) {
case GraphicsContext3D::BYTE:
@@ -986,7 +918,7 @@ unsigned int WebGLRenderingContext::sizeInBytes(GC3Denum type)
return 0;
}
-void WebGLRenderingContext::activeTexture(GC3Denum texture)
+void WebGLRenderingContextBase::activeTexture(GC3Denum texture)
{
if (isContextLost())
return;
@@ -1001,7 +933,7 @@ void WebGLRenderingContext::activeTexture(GC3Denum texture)
}
-void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* shader)
+void WebGLRenderingContextBase::attachShader(WebGLProgram* program, WebGLShader* shader)
{
if (isContextLost() || !validateWebGLObject("attachShader", program) || !validateWebGLObject("attachShader", shader))
return;
@@ -1013,7 +945,7 @@ void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* sha
shader->onAttached();
}
-void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GC3Duint index, const String& name)
+void WebGLRenderingContextBase::bindAttribLocation(WebGLProgram* program, GC3Duint index, const String& name)
{
if (isContextLost() || !validateWebGLObject("bindAttribLocation", program))
return;
@@ -1032,7 +964,7 @@ void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GC3Duint i
m_context->bindAttribLocation(objectOrZero(program), index, name);
}
-bool WebGLRenderingContext::checkObjectToBeBound(const char* functionName, WebGLObject* object, bool& deleted)
+bool WebGLRenderingContextBase::checkObjectToBeBound(const char* functionName, WebGLObject* object, bool& deleted)
{
deleted = false;
if (isContextLost())
@@ -1047,7 +979,7 @@ bool WebGLRenderingContext::checkObjectToBeBound(const char* functionName, WebGL
return true;
}
-void WebGLRenderingContext::bindBuffer(GC3Denum target, WebGLBuffer* buffer)
+void WebGLRenderingContextBase::bindBuffer(GC3Denum target, WebGLBuffer* buffer)
{
bool deleted;
if (!checkObjectToBeBound("bindBuffer", buffer, deleted))
@@ -1058,11 +990,11 @@ void WebGLRenderingContext::bindBuffer(GC3Denum target, WebGLBuffer* buffer)
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "bindBuffer", "buffers can not be used with multiple targets");
return;
}
- if (target == GraphicsContext3D::ARRAY_BUFFER)
+ if (target == GraphicsContext3D::ARRAY_BUFFER) {
m_boundArrayBuffer = buffer;
- else if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER)
+ } else if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER) {
m_boundVertexArrayObject->setElementArrayBuffer(buffer);
- else {
+ } else {
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "bindBuffer", "invalid target");
return;
}
@@ -1072,7 +1004,7 @@ void WebGLRenderingContext::bindBuffer(GC3Denum target, WebGLBuffer* buffer)
buffer->setTarget(target);
}
-void WebGLRenderingContext::bindFramebuffer(GC3Denum target, WebGLFramebuffer* buffer)
+void WebGLRenderingContextBase::bindFramebuffer(GC3Denum target, WebGLFramebuffer* buffer)
{
bool deleted;
if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted))
@@ -1088,14 +1020,15 @@ void WebGLRenderingContext::bindFramebuffer(GC3Denum target, WebGLFramebuffer* b
if (!m_framebufferBinding) {
// Instead of binding fb 0, bind the drawing buffer.
m_drawingBuffer->bind();
- } else
+ } else {
m_context->bindFramebuffer(target, objectOrZero(buffer));
+ }
if (buffer)
buffer->setHasEverBeenBound();
applyStencilTest();
}
-void WebGLRenderingContext::bindRenderbuffer(GC3Denum target, WebGLRenderbuffer* renderBuffer)
+void WebGLRenderingContextBase::bindRenderbuffer(GC3Denum target, WebGLRenderbuffer* renderBuffer)
{
bool deleted;
if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer, deleted))
@@ -1112,7 +1045,7 @@ void WebGLRenderingContext::bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*
renderBuffer->setHasEverBeenBound();
}
-void WebGLRenderingContext::bindTexture(GC3Denum target, WebGLTexture* texture)
+void WebGLRenderingContextBase::bindTexture(GC3Denum target, WebGLTexture* texture)
{
bool deleted;
if (!checkObjectToBeBound("bindTexture", texture, deleted))
@@ -1161,21 +1094,21 @@ void WebGLRenderingContext::bindTexture(GC3Denum target, WebGLTexture* texture)
}
-void WebGLRenderingContext::blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat alpha)
+void WebGLRenderingContextBase::blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat alpha)
{
if (isContextLost())
return;
m_context->blendColor(red, green, blue, alpha);
}
-void WebGLRenderingContext::blendEquation(GC3Denum mode)
+void WebGLRenderingContextBase::blendEquation(GC3Denum mode)
{
if (isContextLost() || !validateBlendEquation("blendEquation", mode))
return;
m_context->blendEquation(mode);
}
-void WebGLRenderingContext::blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha)
+void WebGLRenderingContextBase::blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha)
{
if (isContextLost() || !validateBlendEquation("blendEquationSeparate", modeRGB) || !validateBlendEquation("blendEquationSeparate", modeAlpha))
return;
@@ -1183,14 +1116,14 @@ void WebGLRenderingContext::blendEquationSeparate(GC3Denum modeRGB, GC3Denum mod
}
-void WebGLRenderingContext::blendFunc(GC3Denum sfactor, GC3Denum dfactor)
+void WebGLRenderingContextBase::blendFunc(GC3Denum sfactor, GC3Denum dfactor)
{
if (isContextLost() || !validateBlendFuncFactors("blendFunc", sfactor, dfactor))
return;
m_context->blendFunc(sfactor, dfactor);
}
-void WebGLRenderingContext::blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha)
+void WebGLRenderingContextBase::blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha)
{
// Note: Alpha does not have the same restrictions as RGB.
if (isContextLost() || !validateBlendFuncFactors("blendFuncSeparate", srcRGB, dstRGB))
@@ -1198,7 +1131,7 @@ void WebGLRenderingContext::blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB,
m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
-void WebGLRenderingContext::bufferData(GC3Denum target, long long size, GC3Denum usage)
+void WebGLRenderingContextBase::bufferData(GC3Denum target, long long size, GC3Denum usage)
{
if (isContextLost())
return;
@@ -1217,7 +1150,7 @@ void WebGLRenderingContext::bufferData(GC3Denum target, long long size, GC3Denum
m_context->bufferData(target, static_cast<GC3Dsizeiptr>(size), usage);
}
-void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage)
+void WebGLRenderingContextBase::bufferData(GC3Denum target, ArrayBuffer* data, GC3Denum usage)
{
if (isContextLost())
return;
@@ -1231,7 +1164,7 @@ void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBuffer* data, GC3De
m_context->bufferData(target, data->byteLength(), data->data(), usage);
}
-void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBufferView* data, GC3Denum usage)
+void WebGLRenderingContextBase::bufferData(GC3Denum target, ArrayBufferView* data, GC3Denum usage)
{
if (isContextLost())
return;
@@ -1246,7 +1179,7 @@ void WebGLRenderingContext::bufferData(GC3Denum target, ArrayBufferView* data, G
m_context->bufferData(target, data->byteLength(), data->baseAddress(), usage);
}
-void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data)
+void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset, ArrayBuffer* data)
{
if (isContextLost())
return;
@@ -1263,7 +1196,7 @@ void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, Arr
m_context->bufferSubData(target, static_cast<GC3Dintptr>(offset), data->byteLength(), data->data());
}
-void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data)
+void WebGLRenderingContextBase::bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data)
{
if (isContextLost())
return;
@@ -1280,7 +1213,7 @@ void WebGLRenderingContext::bufferSubData(GC3Denum target, long long offset, Arr
m_context->bufferSubData(target, static_cast<GC3Dintptr>(offset), data->byteLength(), data->baseAddress());
}
-GC3Denum WebGLRenderingContext::checkFramebufferStatus(GC3Denum target)
+GC3Denum WebGLRenderingContextBase::checkFramebufferStatus(GC3Denum target)
{
if (isContextLost())
return GraphicsContext3D::FRAMEBUFFER_UNSUPPORTED;
@@ -1300,7 +1233,7 @@ GC3Denum WebGLRenderingContext::checkFramebufferStatus(GC3Denum target)
return result;
}
-void WebGLRenderingContext::clear(GC3Dbitfield mask)
+void WebGLRenderingContextBase::clear(GC3Dbitfield mask)
{
if (isContextLost())
return;
@@ -1318,7 +1251,7 @@ void WebGLRenderingContext::clear(GC3Dbitfield mask)
markContextChanged();
}
-void WebGLRenderingContext::clearColor(GC3Dfloat r, GC3Dfloat g, GC3Dfloat b, GC3Dfloat a)
+void WebGLRenderingContextBase::clearColor(GC3Dfloat r, GC3Dfloat g, GC3Dfloat b, GC3Dfloat a)
{
if (isContextLost())
return;
@@ -1337,7 +1270,7 @@ void WebGLRenderingContext::clearColor(GC3Dfloat r, GC3Dfloat g, GC3Dfloat b, GC
m_context->clearColor(r, g, b, a);
}
-void WebGLRenderingContext::clearDepth(GC3Dfloat depth)
+void WebGLRenderingContextBase::clearDepth(GC3Dfloat depth)
{
if (isContextLost())
return;
@@ -1345,7 +1278,7 @@ void WebGLRenderingContext::clearDepth(GC3Dfloat depth)
m_context->clearDepth(depth);
}
-void WebGLRenderingContext::clearStencil(GC3Dint s)
+void WebGLRenderingContextBase::clearStencil(GC3Dint s)
{
if (isContextLost())
return;
@@ -1353,7 +1286,7 @@ void WebGLRenderingContext::clearStencil(GC3Dint s)
m_context->clearStencil(s);
}
-void WebGLRenderingContext::colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha)
+void WebGLRenderingContextBase::colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha)
{
if (isContextLost())
return;
@@ -1364,15 +1297,15 @@ void WebGLRenderingContext::colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dbo
m_context->colorMask(red, green, blue, alpha);
}
-void WebGLRenderingContext::compileShader(WebGLShader* shader)
+void WebGLRenderingContextBase::compileShader(WebGLShader* shader)
{
if (isContextLost() || !validateWebGLObject("compileShader", shader))
return;
m_context->compileShader(objectOrZero(shader));
}
-void WebGLRenderingContext::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width,
- GC3Dsizei height, GC3Dint border, ArrayBufferView* data)
+void WebGLRenderingContextBase::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width,
+ GC3Dsizei height, GC3Dint border, ArrayBufferView* data)
{
if (isContextLost())
return;
@@ -1402,12 +1335,12 @@ void WebGLRenderingContext::compressedTexImage2D(GC3Denum target, GC3Dint level,
}
}
graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height,
- border, data->byteLength(), data->baseAddress());
+ border, data->byteLength(), data->baseAddress());
tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
}
-void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data)
+void WebGLRenderingContextBase::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+ GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data)
{
if (isContextLost())
return;
@@ -1433,10 +1366,10 @@ void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum target, GC3Dint lev
return;
graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset,
- width, height, format, data->byteLength(), data->baseAddress());
+ width, height, format, data->byteLength(), data->baseAddress());
}
-bool WebGLRenderingContext::validateSettableTexFormat(const char* functionName, GC3Denum format)
+bool WebGLRenderingContextBase::validateSettableTexFormat(const char* functionName, GC3Denum format)
{
if (GraphicsContext3D::getClearBitsByFormat(format) & (GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "format can not be set, only rendered to");
@@ -1445,7 +1378,7 @@ bool WebGLRenderingContext::validateSettableTexFormat(const char* functionName,
return true;
}
-void WebGLRenderingContext::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border)
+void WebGLRenderingContextBase::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border)
{
if (isContextLost())
return;
@@ -1476,7 +1409,7 @@ void WebGLRenderingContext::copyTexImage2D(GC3Denum target, GC3Dint level, GC3De
tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
}
-void WebGLRenderingContext::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
+void WebGLRenderingContextBase::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
{
if (isContextLost())
return;
@@ -1513,7 +1446,7 @@ void WebGLRenderingContext::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC
m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}
-PassRefPtr<WebGLBuffer> WebGLRenderingContext::createBuffer()
+PassRefPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer()
{
if (isContextLost())
return 0;
@@ -1522,7 +1455,7 @@ PassRefPtr<WebGLBuffer> WebGLRenderingContext::createBuffer()
return o;
}
-PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer()
+PassRefPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer()
{
if (isContextLost())
return 0;
@@ -1531,7 +1464,7 @@ PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer()
return o;
}
-PassRefPtr<WebGLTexture> WebGLRenderingContext::createTexture()
+PassRefPtr<WebGLTexture> WebGLRenderingContextBase::createTexture()
{
if (isContextLost())
return 0;
@@ -1540,7 +1473,7 @@ PassRefPtr<WebGLTexture> WebGLRenderingContext::createTexture()
return o;
}
-PassRefPtr<WebGLProgram> WebGLRenderingContext::createProgram()
+PassRefPtr<WebGLProgram> WebGLRenderingContextBase::createProgram()
{
if (isContextLost())
return 0;
@@ -1549,7 +1482,7 @@ PassRefPtr<WebGLProgram> WebGLRenderingContext::createProgram()
return o;
}
-PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::createRenderbuffer()
+PassRefPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer()
{
if (isContextLost())
return 0;
@@ -1558,7 +1491,7 @@ PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::createRenderbuffer()
return o;
}
-WebGLRenderbuffer* WebGLRenderingContext::ensureEmulatedStencilBuffer(GC3Denum target, WebGLRenderbuffer* renderbuffer)
+WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GC3Denum target, WebGLRenderbuffer* renderbuffer)
{
if (isContextLost())
return 0;
@@ -1570,7 +1503,7 @@ WebGLRenderbuffer* WebGLRenderingContext::ensureEmulatedStencilBuffer(GC3Denum t
return renderbuffer->emulatedStencilBuffer();
}
-PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GC3Denum type)
+PassRefPtr<WebGLShader> WebGLRenderingContextBase::createShader(GC3Denum type)
{
if (isContextLost())
return 0;
@@ -1584,7 +1517,7 @@ PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GC3Denum type)
return o;
}
-void WebGLRenderingContext::cullFace(GC3Denum mode)
+void WebGLRenderingContextBase::cullFace(GC3Denum mode)
{
if (isContextLost())
return;
@@ -1600,7 +1533,7 @@ void WebGLRenderingContext::cullFace(GC3Denum mode)
m_context->cullFace(mode);
}
-bool WebGLRenderingContext::deleteObject(WebGLObject* object)
+bool WebGLRenderingContextBase::deleteObject(WebGLObject* object)
{
if (isContextLost() || !object)
return false;
@@ -1608,14 +1541,15 @@ bool WebGLRenderingContext::deleteObject(WebGLObject* object)
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "delete", "object does not belong to this context");
return false;
}
- if (object->object())
+ if (object->object()) {
// We need to pass in context here because we want
// things in this context unbound.
object->deleteObject(graphicsContext3D());
+ }
return true;
}
-void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer)
+void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer)
{
if (!deleteObject(buffer))
return;
@@ -1625,7 +1559,7 @@ void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer)
m_boundVertexArrayObject->unbindBuffer(buffer);
}
-void WebGLRenderingContext::deleteFramebuffer(WebGLFramebuffer* framebuffer)
+void WebGLRenderingContextBase::deleteFramebuffer(WebGLFramebuffer* framebuffer)
{
if (!deleteObject(framebuffer))
return;
@@ -1637,14 +1571,14 @@ void WebGLRenderingContext::deleteFramebuffer(WebGLFramebuffer* framebuffer)
}
}
-void WebGLRenderingContext::deleteProgram(WebGLProgram* program)
+void WebGLRenderingContextBase::deleteProgram(WebGLProgram* program)
{
deleteObject(program);
// We don't reset m_currentProgram to 0 here because the deletion of the
// current program is delayed.
}
-void WebGLRenderingContext::deleteRenderbuffer(WebGLRenderbuffer* renderbuffer)
+void WebGLRenderingContextBase::deleteRenderbuffer(WebGLRenderbuffer* renderbuffer)
{
if (!deleteObject(renderbuffer))
return;
@@ -1654,12 +1588,12 @@ void WebGLRenderingContext::deleteRenderbuffer(WebGLRenderbuffer* renderbuffer)
m_framebufferBinding->removeAttachmentFromBoundFramebuffer(renderbuffer);
}
-void WebGLRenderingContext::deleteShader(WebGLShader* shader)
+void WebGLRenderingContextBase::deleteShader(WebGLShader* shader)
{
deleteObject(shader);
}
-void WebGLRenderingContext::deleteTexture(WebGLTexture* texture)
+void WebGLRenderingContextBase::deleteTexture(WebGLTexture* texture)
{
if (!deleteObject(texture))
return;
@@ -1686,7 +1620,7 @@ void WebGLRenderingContext::deleteTexture(WebGLTexture* texture)
}
}
-void WebGLRenderingContext::depthFunc(GC3Denum func)
+void WebGLRenderingContextBase::depthFunc(GC3Denum func)
{
if (isContextLost())
return;
@@ -1695,7 +1629,7 @@ void WebGLRenderingContext::depthFunc(GC3Denum func)
m_context->depthFunc(func);
}
-void WebGLRenderingContext::depthMask(GC3Dboolean flag)
+void WebGLRenderingContextBase::depthMask(GC3Dboolean flag)
{
if (isContextLost())
return;
@@ -1703,7 +1637,7 @@ void WebGLRenderingContext::depthMask(GC3Dboolean flag)
m_context->depthMask(flag);
}
-void WebGLRenderingContext::depthRange(GC3Dfloat zNear, GC3Dfloat zFar)
+void WebGLRenderingContextBase::depthRange(GC3Dfloat zNear, GC3Dfloat zFar)
{
if (isContextLost())
return;
@@ -1714,7 +1648,7 @@ void WebGLRenderingContext::depthRange(GC3Dfloat zNear, GC3Dfloat zFar)
m_context->depthRange(zNear, zFar);
}
-void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* shader)
+void WebGLRenderingContextBase::detachShader(WebGLProgram* program, WebGLShader* shader)
{
if (isContextLost() || !validateWebGLObject("detachShader", program) || !validateWebGLObject("detachShader", shader))
return;
@@ -1726,7 +1660,7 @@ void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* sha
shader->onDetached(graphicsContext3D());
}
-void WebGLRenderingContext::disable(GC3Denum cap)
+void WebGLRenderingContextBase::disable(GC3Denum cap)
{
if (isContextLost() || !validateCapability("disable", cap))
return;
@@ -1742,7 +1676,7 @@ void WebGLRenderingContext::disable(GC3Denum cap)
m_context->disable(cap);
}
-void WebGLRenderingContext::disableVertexAttribArray(GC3Duint index)
+void WebGLRenderingContextBase::disableVertexAttribArray(GC3Duint index)
{
if (isContextLost())
return;
@@ -1762,7 +1696,7 @@ void WebGLRenderingContext::disableVertexAttribArray(GC3Duint index)
m_context->disableVertexAttribArray(index);
}
-bool WebGLRenderingContext::validateRenderingState()
+bool WebGLRenderingContextBase::validateRenderingState()
{
if (!m_currentProgram)
return false;
@@ -1778,7 +1712,7 @@ bool WebGLRenderingContext::validateRenderingState()
return true;
}
-bool WebGLRenderingContext::validateWebGLObject(const char* functionName, WebGLObject* object)
+bool WebGLRenderingContextBase::validateWebGLObject(const char* functionName, WebGLObject* object)
{
if (!object || !object->object()) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no object or object deleted");
@@ -1791,7 +1725,7 @@ bool WebGLRenderingContext::validateWebGLObject(const char* functionName, WebGLO
return true;
}
-void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count)
+void WebGLRenderingContextBase::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count)
{
if (!validateDrawArrays("drawArrays", mode, first, count))
return;
@@ -1804,7 +1738,7 @@ void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei c
markContextChanged();
}
-void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset)
+void WebGLRenderingContextBase::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset)
{
if (!validateDrawElements("drawElements", mode, count, type, offset))
return;
@@ -1817,7 +1751,7 @@ void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denu
markContextChanged();
}
-void WebGLRenderingContext::drawArraysInstancedANGLE(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
+void WebGLRenderingContextBase::drawArraysInstancedANGLE(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount)
{
if (!validateDrawArrays("drawArraysInstancedANGLE", mode, first, count))
return;
@@ -1833,7 +1767,7 @@ void WebGLRenderingContext::drawArraysInstancedANGLE(GC3Denum mode, GC3Dint firs
markContextChanged();
}
-void WebGLRenderingContext::drawElementsInstancedANGLE(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)
+void WebGLRenderingContextBase::drawElementsInstancedANGLE(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset, GC3Dsizei primcount)
{
if (!validateDrawElements("drawElementsInstancedANGLE", mode, count, type, offset))
return;
@@ -1849,7 +1783,7 @@ void WebGLRenderingContext::drawElementsInstancedANGLE(GC3Denum mode, GC3Dsizei
markContextChanged();
}
-void WebGLRenderingContext::enable(GC3Denum cap)
+void WebGLRenderingContextBase::enable(GC3Denum cap)
{
if (isContextLost() || !validateCapability("enable", cap))
return;
@@ -1865,7 +1799,7 @@ void WebGLRenderingContext::enable(GC3Denum cap)
m_context->enable(cap);
}
-void WebGLRenderingContext::enableVertexAttribArray(GC3Duint index)
+void WebGLRenderingContextBase::enableVertexAttribArray(GC3Duint index)
{
if (isContextLost())
return;
@@ -1882,21 +1816,21 @@ void WebGLRenderingContext::enableVertexAttribArray(GC3Duint index)
m_context->enableVertexAttribArray(index);
}
-void WebGLRenderingContext::finish()
+void WebGLRenderingContextBase::finish()
{
if (isContextLost())
return;
m_context->flush(); // Intentionally a flush, not a finish.
}
-void WebGLRenderingContext::flush()
+void WebGLRenderingContextBase::flush()
{
if (isContextLost())
return;
m_context->flush();
}
-void WebGLRenderingContext::framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer* buffer)
+void WebGLRenderingContextBase::framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer* buffer)
{
if (isContextLost() || !validateFramebufferFuncParameters("framebufferRenderbuffer", target, attachment))
return;
@@ -1938,7 +1872,7 @@ void WebGLRenderingContext::framebufferRenderbuffer(GC3Denum target, GC3Denum at
applyStencilTest();
}
-void WebGLRenderingContext::framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture* texture, GC3Dint level)
+void WebGLRenderingContextBase::framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture* texture, GC3Dint level)
{
if (isContextLost() || !validateFramebufferFuncParameters("framebufferTexture2D", target, attachment))
return;
@@ -1976,7 +1910,7 @@ void WebGLRenderingContext::framebufferTexture2D(GC3Denum target, GC3Denum attac
applyStencilTest();
}
-void WebGLRenderingContext::frontFace(GC3Denum mode)
+void WebGLRenderingContextBase::frontFace(GC3Denum mode)
{
if (isContextLost())
return;
@@ -1991,7 +1925,7 @@ void WebGLRenderingContext::frontFace(GC3Denum mode)
m_context->frontFace(mode);
}
-void WebGLRenderingContext::generateMipmap(GC3Denum target)
+void WebGLRenderingContextBase::generateMipmap(GC3Denum target)
{
if (isContextLost())
return;
@@ -2006,7 +1940,7 @@ void WebGLRenderingContext::generateMipmap(GC3Denum target)
return;
// generateMipmap won't work properly if minFilter is not NEAREST_MIPMAP_LINEAR
- // on Mac. Remove the hack once this driver bug is fixed.
+ // on Mac. Remove the hack once this driver bug is fixed.
#if OS(MACOSX)
bool needToResetMinFilter = false;
if (tex->getMinFilter() != GraphicsContext3D::NEAREST_MIPMAP_LINEAR) {
@@ -2022,7 +1956,7 @@ void WebGLRenderingContext::generateMipmap(GC3Denum target)
tex->generateMipmapLevelInfo();
}
-PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram* program, GC3Duint index)
+PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* program, GC3Duint index)
{
if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
return 0;
@@ -2032,7 +1966,7 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram*
return WebGLActiveInfo::create(info.name, info.type, info.size);
}
-PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram* program, GC3Duint index)
+PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLProgram* program, GC3Duint index)
{
if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
return 0;
@@ -2042,7 +1976,7 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram
return WebGLActiveInfo::create(info.name, info.type, info.size);
}
-bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<RefPtr<WebGLShader> >& shaderObjects)
+bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, Vector<RefPtr<WebGLShader> >& shaderObjects)
{
shaderObjects.clear();
if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
@@ -2060,7 +1994,7 @@ bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<Ref
return true;
}
-GC3Dint WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String& name)
+GC3Dint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const String& name)
{
if (isContextLost() || !validateWebGLObject("getAttribLocation", program))
return -1;
@@ -2077,7 +2011,7 @@ GC3Dint WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const St
return m_context->getAttribLocation(objectOrZero(program), name);
}
-WebGLGetInfo WebGLRenderingContext::getBufferParameter(GC3Denum target, GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getBufferParameter(GC3Denum target, GC3Denum pname)
{
if (isContextLost())
return WebGLGetInfo();
@@ -2095,10 +2029,10 @@ WebGLGetInfo WebGLRenderingContext::getBufferParameter(GC3Denum target, GC3Denum
m_context->getBufferParameteriv(target, pname, &value);
if (pname == GraphicsContext3D::BUFFER_SIZE)
return WebGLGetInfo(value);
- return WebGLGetInfo(static_cast<unsigned int>(value));
+ return WebGLGetInfo(static_cast<unsigned>(value));
}
-PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes()
+PassRefPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes()
{
if (isContextLost())
return 0;
@@ -2119,11 +2053,11 @@ PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes()
return attributes.release();
}
-GC3Denum WebGLRenderingContext::getError()
+GC3Denum WebGLRenderingContextBase::getError()
{
- if (lost_context_errors_.size()) {
- GC3Denum err = lost_context_errors_.first();
- lost_context_errors_.remove(0);
+ if (m_lostContextErrors.size()) {
+ GC3Denum err = m_lostContextErrors.first();
+ m_lostContextErrors.remove(0);
return err;
}
@@ -2133,7 +2067,7 @@ GC3Denum WebGLRenderingContext::getError()
return m_context->getError();
}
-bool WebGLRenderingContext::ExtensionTracker::matchesNameWithPrefixes(const String& name) const
+bool WebGLRenderingContextBase::ExtensionTracker::matchesNameWithPrefixes(const String& name) const
{
static const char* unprefixed[] = { "", 0, };
@@ -2147,7 +2081,7 @@ bool WebGLRenderingContext::ExtensionTracker::matchesNameWithPrefixes(const Stri
return false;
}
-PassRefPtr<WebGLExtension> WebGLRenderingContext::getExtension(const String& name)
+PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String& name)
{
if (isContextLost())
return 0;
@@ -2168,7 +2102,7 @@ PassRefPtr<WebGLExtension> WebGLRenderingContext::getExtension(const String& nam
return 0;
}
-WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname)
{
if (isContextLost() || !validateFramebufferFuncParameters("getFramebufferAttachmentParameter", target, attachment))
return WebGLGetInfo();
@@ -2219,7 +2153,7 @@ WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum t
}
}
-WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getParameter(GC3Denum pname)
{
if (isContextLost())
return WebGLGetInfo();
@@ -2456,7 +2390,7 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname)
}
}
-WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getProgramParameter(WebGLProgram* program, GC3Denum pname)
{
if (isContextLost() || !validateWebGLObject("getProgramParameter", program))
return WebGLGetInfo();
@@ -2481,7 +2415,7 @@ WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, G
}
}
-String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program)
+String WebGLRenderingContextBase::getProgramInfoLog(WebGLProgram* program)
{
if (isContextLost())
return String();
@@ -2490,7 +2424,7 @@ String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program)
return ensureNotNull(m_context->getProgramInfoLog(objectOrZero(program)));
}
-WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getRenderbufferParameter(GC3Denum target, GC3Denum pname)
{
if (isContextLost())
return WebGLGetInfo();
@@ -2531,7 +2465,7 @@ WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC
}
}
-WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getShaderParameter(WebGLShader* shader, GC3Denum pname)
{
if (isContextLost() || !validateWebGLObject("getShaderParameter", shader))
return WebGLGetInfo();
@@ -2544,14 +2478,14 @@ WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GC3D
return WebGLGetInfo(static_cast<bool>(value));
case GraphicsContext3D::SHADER_TYPE:
m_context->getShaderiv(objectOrZero(shader), pname, &value);
- return WebGLGetInfo(static_cast<unsigned int>(value));
+ return WebGLGetInfo(static_cast<unsigned>(value));
default:
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getShaderParameter", "invalid parameter name");
return WebGLGetInfo();
}
}
-String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader)
+String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader)
{
if (isContextLost())
return String();
@@ -2560,7 +2494,7 @@ String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader)
return ensureNotNull(m_context->getShaderInfoLog(objectOrZero(shader)));
}
-PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContext::getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType)
+PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType)
{
if (isContextLost())
return 0;
@@ -2591,7 +2525,7 @@ PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContext::getShaderPrecision
return WebGLShaderPrecisionFormat::create(range[0], range[1], precision);
}
-String WebGLRenderingContext::getShaderSource(WebGLShader* shader)
+String WebGLRenderingContextBase::getShaderSource(WebGLShader* shader)
{
if (isContextLost())
return String();
@@ -2600,7 +2534,7 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader)
return ensureNotNull(shader->getSource());
}
-Vector<String> WebGLRenderingContext::getSupportedExtensions()
+Vector<String> WebGLRenderingContextBase::getSupportedExtensions()
{
Vector<String> result;
if (isContextLost())
@@ -2619,7 +2553,7 @@ Vector<String> WebGLRenderingContext::getSupportedExtensions()
return result;
}
-WebGLGetInfo WebGLRenderingContext::getTexParameter(GC3Denum target, GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getTexParameter(GC3Denum target, GC3Denum pname)
{
if (isContextLost())
return WebGLGetInfo();
@@ -2633,11 +2567,11 @@ WebGLGetInfo WebGLRenderingContext::getTexParameter(GC3Denum target, GC3Denum pn
case GraphicsContext3D::TEXTURE_WRAP_S:
case GraphicsContext3D::TEXTURE_WRAP_T:
m_context->getTexParameteriv(target, pname, &value);
- return WebGLGetInfo(static_cast<unsigned int>(value));
+ return WebGLGetInfo(static_cast<unsigned>(value));
case Extensions3D::TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic
if (m_extTextureFilterAnisotropic) {
m_context->getTexParameteriv(target, pname, &value);
- return WebGLGetInfo(static_cast<unsigned int>(value));
+ return WebGLGetInfo(static_cast<unsigned>(value));
}
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getTexParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled");
return WebGLGetInfo();
@@ -2647,7 +2581,7 @@ WebGLGetInfo WebGLRenderingContext::getTexParameter(GC3Denum target, GC3Denum pn
}
}
-WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation)
+WebGLGetInfo WebGLRenderingContextBase::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation)
{
if (isContextLost() || !validateWebGLObject("getUniform", program))
return WebGLGetInfo();
@@ -2680,7 +2614,7 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
if (loc == location) {
// Found it. Use the type in the ActiveInfo to determine the return type.
GC3Denum baseType;
- unsigned int length;
+ unsigned length;
switch (info.type) {
case GraphicsContext3D::BOOL:
baseType = GraphicsContext3D::BOOL;
@@ -2789,7 +2723,7 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
return WebGLGetInfo();
}
-PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGLProgram* program, const String& name)
+PassRefPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(WebGLProgram* program, const String& name)
{
if (isContextLost() || !validateWebGLObject("getUniformLocation", program))
return 0;
@@ -2809,7 +2743,7 @@ PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGL
return WebGLUniformLocation::create(program, uniformLocation);
}
-WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GC3Duint index, GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getVertexAttrib(GC3Duint index, GC3Denum pname)
{
if (isContextLost())
return WebGLGetInfo();
@@ -2845,7 +2779,7 @@ WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GC3Duint index, GC3Denum pna
}
}
-long long WebGLRenderingContext::getVertexAttribOffset(GC3Duint index, GC3Denum pname)
+long long WebGLRenderingContextBase::getVertexAttribOffset(GC3Duint index, GC3Denum pname)
{
if (isContextLost())
return 0;
@@ -2857,7 +2791,7 @@ long long WebGLRenderingContext::getVertexAttribOffset(GC3Duint index, GC3Denum
return static_cast<long long>(result);
}
-void WebGLRenderingContext::hint(GC3Denum target, GC3Denum mode)
+void WebGLRenderingContextBase::hint(GC3Denum target, GC3Denum mode)
{
if (isContextLost())
return;
@@ -2878,7 +2812,7 @@ void WebGLRenderingContext::hint(GC3Denum target, GC3Denum mode)
m_context->hint(target, mode);
}
-GC3Dboolean WebGLRenderingContext::isBuffer(WebGLBuffer* buffer)
+GC3Dboolean WebGLRenderingContextBase::isBuffer(WebGLBuffer* buffer)
{
if (!buffer || isContextLost())
return 0;
@@ -2889,12 +2823,12 @@ GC3Dboolean WebGLRenderingContext::isBuffer(WebGLBuffer* buffer)
return m_context->isBuffer(buffer->object());
}
-bool WebGLRenderingContext::isContextLost()
+bool WebGLRenderingContextBase::isContextLost()
{
return m_contextLost;
}
-GC3Dboolean WebGLRenderingContext::isEnabled(GC3Denum cap)
+GC3Dboolean WebGLRenderingContextBase::isEnabled(GC3Denum cap)
{
if (isContextLost() || !validateCapability("isEnabled", cap))
return 0;
@@ -2903,7 +2837,7 @@ GC3Dboolean WebGLRenderingContext::isEnabled(GC3Denum cap)
return m_context->isEnabled(cap);
}
-GC3Dboolean WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer)
+GC3Dboolean WebGLRenderingContextBase::isFramebuffer(WebGLFramebuffer* framebuffer)
{
if (!framebuffer || isContextLost())
return 0;
@@ -2914,7 +2848,7 @@ GC3Dboolean WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer)
return m_context->isFramebuffer(framebuffer->object());
}
-GC3Dboolean WebGLRenderingContext::isProgram(WebGLProgram* program)
+GC3Dboolean WebGLRenderingContextBase::isProgram(WebGLProgram* program)
{
if (!program || isContextLost())
return 0;
@@ -2922,7 +2856,7 @@ GC3Dboolean WebGLRenderingContext::isProgram(WebGLProgram* program)
return m_context->isProgram(program->object());
}
-GC3Dboolean WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
+GC3Dboolean WebGLRenderingContextBase::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
{
if (!renderbuffer || isContextLost())
return 0;
@@ -2933,7 +2867,7 @@ GC3Dboolean WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffe
return m_context->isRenderbuffer(renderbuffer->object());
}
-GC3Dboolean WebGLRenderingContext::isShader(WebGLShader* shader)
+GC3Dboolean WebGLRenderingContextBase::isShader(WebGLShader* shader)
{
if (!shader || isContextLost())
return 0;
@@ -2941,7 +2875,7 @@ GC3Dboolean WebGLRenderingContext::isShader(WebGLShader* shader)
return m_context->isShader(shader->object());
}
-GC3Dboolean WebGLRenderingContext::isTexture(WebGLTexture* texture)
+GC3Dboolean WebGLRenderingContextBase::isTexture(WebGLTexture* texture)
{
if (!texture || isContextLost())
return 0;
@@ -2952,14 +2886,14 @@ GC3Dboolean WebGLRenderingContext::isTexture(WebGLTexture* texture)
return m_context->isTexture(texture->object());
}
-void WebGLRenderingContext::lineWidth(GC3Dfloat width)
+void WebGLRenderingContextBase::lineWidth(GC3Dfloat width)
{
if (isContextLost())
return;
m_context->lineWidth(width);
}
-void WebGLRenderingContext::linkProgram(WebGLProgram* program)
+void WebGLRenderingContextBase::linkProgram(WebGLProgram* program)
{
if (isContextLost() || !validateWebGLObject("linkProgram", program))
return;
@@ -2968,7 +2902,7 @@ void WebGLRenderingContext::linkProgram(WebGLProgram* program)
program->increaseLinkCount();
}
-void WebGLRenderingContext::pixelStorei(GC3Denum pname, GC3Dint param)
+void WebGLRenderingContextBase::pixelStorei(GC3Denum pname, GC3Dint param)
{
if (isContextLost())
return;
@@ -2980,9 +2914,9 @@ void WebGLRenderingContext::pixelStorei(GC3Denum pname, GC3Dint param)
m_unpackPremultiplyAlpha = param;
break;
case GraphicsContext3D::UNPACK_COLORSPACE_CONVERSION_WEBGL:
- if (param == GraphicsContext3D::BROWSER_DEFAULT_WEBGL || param == GraphicsContext3D::NONE)
+ if (param == GraphicsContext3D::BROWSER_DEFAULT_WEBGL || param == GraphicsContext3D::NONE) {
m_unpackColorspaceConversion = static_cast<GC3Denum>(param);
- else {
+ } else {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "pixelStorei", "invalid parameter for UNPACK_COLORSPACE_CONVERSION_WEBGL");
return;
}
@@ -3006,14 +2940,14 @@ void WebGLRenderingContext::pixelStorei(GC3Denum pname, GC3Dint param)
}
}
-void WebGLRenderingContext::polygonOffset(GC3Dfloat factor, GC3Dfloat units)
+void WebGLRenderingContextBase::polygonOffset(GC3Dfloat factor, GC3Dfloat units)
{
if (isContextLost())
return;
m_context->polygonOffset(factor, units);
}
-void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, ArrayBufferView* pixels)
+void WebGLRenderingContextBase::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, ArrayBufferView* pixels)
{
if (isContextLost())
return;
@@ -3059,8 +2993,8 @@ void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC
return;
}
// Calculate array size, taking into consideration of PACK_ALIGNMENT.
- unsigned int totalBytesRequired = 0;
- unsigned int padding = 0;
+ unsigned totalBytesRequired = 0;
+ unsigned padding = 0;
GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_packAlignment, &totalBytesRequired, &padding);
if (error != GraphicsContext3D::NO_ERROR) {
synthesizeGLError(error, "readPixels", "invalid dimensions");
@@ -3095,7 +3029,7 @@ void WebGLRenderingContext::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC
#endif
}
-void WebGLRenderingContext::renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height)
+void WebGLRenderingContextBase::renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height)
{
if (isContextLost())
return;
@@ -3146,14 +3080,14 @@ void WebGLRenderingContext::renderbufferStorage(GC3Denum target, GC3Denum intern
applyStencilTest();
}
-void WebGLRenderingContext::sampleCoverage(GC3Dfloat value, GC3Dboolean invert)
+void WebGLRenderingContextBase::sampleCoverage(GC3Dfloat value, GC3Dboolean invert)
{
if (isContextLost())
return;
m_context->sampleCoverage(value, invert);
}
-void WebGLRenderingContext::scissor(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
+void WebGLRenderingContextBase::scissor(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
{
if (isContextLost())
return;
@@ -3162,7 +3096,7 @@ void WebGLRenderingContext::scissor(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Ds
m_context->scissor(x, y, width, height);
}
-void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& string)
+void WebGLRenderingContextBase::shaderSource(WebGLShader* shader, const String& string)
{
if (isContextLost() || !validateWebGLObject("shaderSource", shader))
return;
@@ -3173,7 +3107,7 @@ void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& stri
m_context->shaderSource(objectOrZero(shader), stringWithoutComments);
}
-void WebGLRenderingContext::stencilFunc(GC3Denum func, GC3Dint ref, GC3Duint mask)
+void WebGLRenderingContextBase::stencilFunc(GC3Denum func, GC3Dint ref, GC3Duint mask)
{
if (isContextLost())
return;
@@ -3186,7 +3120,7 @@ void WebGLRenderingContext::stencilFunc(GC3Denum func, GC3Dint ref, GC3Duint mas
m_context->stencilFunc(func, ref, mask);
}
-void WebGLRenderingContext::stencilFuncSeparate(GC3Denum face, GC3Denum func, GC3Dint ref, GC3Duint mask)
+void WebGLRenderingContextBase::stencilFuncSeparate(GC3Denum face, GC3Denum func, GC3Dint ref, GC3Duint mask)
{
if (isContextLost())
return;
@@ -3214,7 +3148,7 @@ void WebGLRenderingContext::stencilFuncSeparate(GC3Denum face, GC3Denum func, GC
m_context->stencilFuncSeparate(face, func, ref, mask);
}
-void WebGLRenderingContext::stencilMask(GC3Duint mask)
+void WebGLRenderingContextBase::stencilMask(GC3Duint mask)
{
if (isContextLost())
return;
@@ -3223,7 +3157,7 @@ void WebGLRenderingContext::stencilMask(GC3Duint mask)
m_context->stencilMask(mask);
}
-void WebGLRenderingContext::stencilMaskSeparate(GC3Denum face, GC3Duint mask)
+void WebGLRenderingContextBase::stencilMaskSeparate(GC3Denum face, GC3Duint mask)
{
if (isContextLost())
return;
@@ -3245,21 +3179,21 @@ void WebGLRenderingContext::stencilMaskSeparate(GC3Denum face, GC3Duint mask)
m_context->stencilMaskSeparate(face, mask);
}
-void WebGLRenderingContext::stencilOp(GC3Denum fail, GC3Denum zfail, GC3Denum zpass)
+void WebGLRenderingContextBase::stencilOp(GC3Denum fail, GC3Denum zfail, GC3Denum zpass)
{
if (isContextLost())
return;
m_context->stencilOp(fail, zfail, zpass);
}
-void WebGLRenderingContext::stencilOpSeparate(GC3Denum face, GC3Denum fail, GC3Denum zfail, GC3Denum zpass)
+void WebGLRenderingContextBase::stencilOpSeparate(GC3Denum face, GC3Denum fail, GC3Denum zfail, GC3Denum zpass)
{
if (isContextLost())
return;
m_context->stencilOpSeparate(face, fail, zfail, zpass);
}
-void WebGLRenderingContext::texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState& es)
+void WebGLRenderingContextBase::texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState& es)
{
// All calling functions check isContextLost, so a duplicate check is not needed here.
// FIXME: Handle errors.
@@ -3269,11 +3203,11 @@ void WebGLRenderingContext::texImage2DBase(GC3Denum target, GC3Dint level, GC3De
ASSERT(!level || !WebGLTexture::isNPOT(width, height));
ASSERT(!pixels || validateSettableTexFormat("texImage2D", internalformat));
m_context->texImage2D(target, level, internalformat, width, height,
- border, format, type, pixels);
+ border, format, type, pixels);
tex->setLevelInfo(target, level, internalformat, width, height, type);
}
-void WebGLRenderingContext::texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
+void WebGLRenderingContextBase::texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
{
// All calling functions check isContextLost, so a duplicate check is not needed here.
Vector<uint8_t> data;
@@ -3287,9 +3221,9 @@ void WebGLRenderingContext::texImage2DImpl(GC3Denum target, GC3Dint level, GC3De
const void* imagePixelData = imageExtractor.imagePixelData();
bool needConversion = true;
- if (type == GraphicsContext3D::UNSIGNED_BYTE && sourceDataFormat == GraphicsContext3D::DataFormatRGBA8 && format == GraphicsContext3D::RGBA && alphaOp == GraphicsContext3D::AlphaDoNothing && !flipY)
+ if (type == GraphicsContext3D::UNSIGNED_BYTE && sourceDataFormat == GraphicsContext3D::DataFormatRGBA8 && format == GraphicsContext3D::RGBA && alphaOp == GraphicsContext3D::AlphaDoNothing && !flipY) {
needConversion = false;
- else {
+ } else {
if (!m_context->packImageData(image, imagePixelData, format, type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtractor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "packImage error");
return;
@@ -3303,7 +3237,7 @@ void WebGLRenderingContext::texImage2DImpl(GC3Denum target, GC3Dint level, GC3De
m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
}
-bool WebGLRenderingContext::validateTexFunc(const char* functionName, TexFuncValidationFunctionType functionType, TexFuncValidationSourceType sourceType, GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, GC3Dint xoffset, GC3Dint yoffset)
+bool WebGLRenderingContextBase::validateTexFunc(const char* functionName, TexFuncValidationFunctionType functionType, TexFuncValidationSourceType sourceType, GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, GC3Dint xoffset, GC3Dint yoffset)
{
if (!validateTexFuncParameters(functionName, functionType, target, level, internalformat, width, height, border, format, type))
return false;
@@ -3346,7 +3280,7 @@ bool WebGLRenderingContext::validateTexFunc(const char* functionName, TexFuncVal
return true;
}
-void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
+void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
GC3Dsizei width, GC3Dsizei height, GC3Dint border,
GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionState& es)
{
@@ -3358,10 +3292,10 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
bool changeUnpackAlignment = false;
if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
if (!m_context->extractTextureData(width, height, format, type,
- m_unpackAlignment,
- m_unpackFlipY, m_unpackPremultiplyAlpha,
- data,
- tempData))
+ m_unpackAlignment,
+ m_unpackFlipY, m_unpackPremultiplyAlpha,
+ data,
+ tempData))
return;
data = tempData.data();
changeUnpackAlignment = true;
@@ -3373,7 +3307,7 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
}
-void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
+void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionState& es)
{
if (isContextLost() || !pixels || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceImageData, target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, 0, 0))
@@ -3382,9 +3316,9 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
bool needConversion = true;
// The data from ImageData is always of format RGBA8.
// No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required.
- if (!m_unpackFlipY && !m_unpackPremultiplyAlpha && format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE)
+ if (!m_unpackFlipY && !m_unpackPremultiplyAlpha && format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE) {
needConversion = false;
- else {
+ } else {
if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "bad image data");
return;
@@ -3397,7 +3331,7 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
}
-void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
+void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionState& es)
{
if (isContextLost() || !validateHTMLImageElement("texImage2D", image, es))
@@ -3409,7 +3343,7 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
texImage2DImpl(target, level, internalformat, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
}
-void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
+void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionState& es)
{
if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, es) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0))
@@ -3433,7 +3367,7 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
}
-PassRefPtr<Image> WebGLRenderingContext::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy)
+PassRefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy)
{
IntSize size(video->videoWidth(), video->videoHeight());
ImageBuffer* buf = m_videoCache.imageBuffer(size);
@@ -3447,7 +3381,7 @@ PassRefPtr<Image> WebGLRenderingContext::videoFrameToImage(HTMLVideoElement* vid
return buf->copyImage(backingStoreCopy);
}
-void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
+void WebGLRenderingContextBase::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionState& es)
{
if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, es)
@@ -3471,7 +3405,7 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
texImage2DImpl(target, level, internalformat, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
}
-void WebGLRenderingContext::texParameter(GC3Denum target, GC3Denum pname, GC3Dfloat paramf, GC3Dint parami, bool isFloat)
+void WebGLRenderingContextBase::texParameter(GC3Denum target, GC3Denum pname, GC3Dfloat paramf, GC3Dint parami, bool isFloat)
{
if (isContextLost())
return;
@@ -3509,17 +3443,17 @@ void WebGLRenderingContext::texParameter(GC3Denum target, GC3Denum pname, GC3Dfl
}
}
-void WebGLRenderingContext::texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param)
+void WebGLRenderingContextBase::texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param)
{
texParameter(target, pname, param, 0, true);
}
-void WebGLRenderingContext::texParameteri(GC3Denum target, GC3Denum pname, GC3Dint param)
+void WebGLRenderingContextBase::texParameteri(GC3Denum target, GC3Denum pname, GC3Dint param)
{
texParameter(target, pname, 0, param, false);
}
-void WebGLRenderingContext::texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState& es)
+void WebGLRenderingContextBase::texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels, ExceptionState& es)
{
// FIXME: Handle errors.
ASSERT(!isContextLost());
@@ -3540,7 +3474,7 @@ void WebGLRenderingContext::texSubImage2DBase(GC3Denum target, GC3Dint level, GC
m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
}
-void WebGLRenderingContext::texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
+void WebGLRenderingContextBase::texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image* image, GraphicsContext3D::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& es)
{
// All calling functions check isContextLost, so a duplicate check is not needed here.
Vector<uint8_t> data;
@@ -3554,9 +3488,9 @@ void WebGLRenderingContext::texSubImage2DImpl(GC3Denum target, GC3Dint level, GC
const void* imagePixelData = imageExtractor.imagePixelData();
bool needConversion = true;
- if (type == GraphicsContext3D::UNSIGNED_BYTE && sourceDataFormat == GraphicsContext3D::DataFormatRGBA8 && format == GraphicsContext3D::RGBA && alphaOp == GraphicsContext3D::AlphaDoNothing && !flipY)
+ if (type == GraphicsContext3D::UNSIGNED_BYTE && sourceDataFormat == GraphicsContext3D::DataFormatRGBA8 && format == GraphicsContext3D::RGBA && alphaOp == GraphicsContext3D::AlphaDoNothing && !flipY) {
needConversion = false;
- else {
+ } else {
if (!m_context->packImageData(image, imagePixelData, format, type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtractor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texImage2D", "bad image data");
return;
@@ -3570,7 +3504,7 @@ void WebGLRenderingContext::texSubImage2DImpl(GC3Denum target, GC3Dint level, GC
m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
}
-void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Dsizei width, GC3Dsizei height,
GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionState& es)
{
@@ -3582,10 +3516,10 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
bool changeUnpackAlignment = false;
if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) {
if (!m_context->extractTextureData(width, height, format, type,
- m_unpackAlignment,
- m_unpackFlipY, m_unpackPremultiplyAlpha,
- data,
- tempData))
+ m_unpackAlignment,
+ m_unpackFlipY, m_unpackPremultiplyAlpha,
+ data,
+ tempData))
return;
data = tempData.data();
changeUnpackAlignment = true;
@@ -3597,7 +3531,7 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
}
-void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionState& es)
{
if (isContextLost() || !pixels || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceImageData, target, level, format, pixels->width(), pixels->height(), 0, format, type, xoffset, yoffset))
@@ -3607,9 +3541,9 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
bool needConversion = true;
// The data from ImageData is always of format RGBA8.
// No conversion is needed if destination format is RGBA and type is USIGNED_BYTE and no Flip or Premultiply operation is required.
- if (format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE && !m_unpackFlipY && !m_unpackPremultiplyAlpha)
+ if (format == GraphicsContext3D::RGBA && type == GraphicsContext3D::UNSIGNED_BYTE && !m_unpackFlipY && !m_unpackPremultiplyAlpha) {
needConversion = false;
- else {
+ } else {
if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "texSubImage2D", "bad image data");
return;
@@ -3622,7 +3556,7 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
m_context->pixelStorei(GraphicsContext3D::UNPACK_ALIGNMENT, m_unpackAlignment);
}
-void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionState& es)
{
if (isContextLost() || !validateHTMLImageElement("texSubImage2D", image, es))
@@ -3634,7 +3568,7 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRender, GraphicsContext3D::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
}
-void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionState& es)
{
if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, es)
@@ -3648,7 +3582,7 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), GraphicsContext3D::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
}
-void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+void WebGLRenderingContextBase::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionState& es)
{
if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, es)
@@ -3661,7 +3595,7 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), GraphicsContext3D::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, es);
}
-void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GC3Dfloat x)
+void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, GC3Dfloat x)
{
if (isContextLost() || !location)
return;
@@ -3674,7 +3608,7 @@ void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GC3D
m_context->uniform1f(location->location(), x);
}
-void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Float32Array* v)
+void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, Float32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, 1))
return;
@@ -3682,7 +3616,7 @@ void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Flo
m_context->uniform1fv(location->location(), v->length(), v->data());
}
-void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, size, 1))
return;
@@ -3690,7 +3624,7 @@ void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, GC3
m_context->uniform1fv(location->location(), size, v);
}
-void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, GC3Dint x)
+void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GC3Dint x)
{
if (isContextLost() || !location)
return;
@@ -3703,7 +3637,7 @@ void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, GC3D
m_context->uniform1i(location->location(), x);
}
-void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int32Array* v)
+void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, Int32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, 1))
return;
@@ -3711,7 +3645,7 @@ void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int
m_context->uniform1iv(location->location(), v->length(), v->data());
}
-void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, size, 1))
return;
@@ -3719,7 +3653,7 @@ void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, GC3
m_context->uniform1iv(location->location(), size, v);
}
-void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y)
+void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y)
{
if (isContextLost() || !location)
return;
@@ -3732,7 +3666,7 @@ void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, GC3D
m_context->uniform2f(location->location(), x, y);
}
-void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Float32Array* v)
+void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, Float32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, 2))
return;
@@ -3740,7 +3674,7 @@ void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Flo
m_context->uniform2fv(location->location(), v->length() / 2, v->data());
}
-void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, size, 2))
return;
@@ -3748,7 +3682,7 @@ void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, GC3
m_context->uniform2fv(location->location(), size / 2, v);
}
-void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y)
+void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y)
{
if (isContextLost() || !location)
return;
@@ -3761,7 +3695,7 @@ void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, GC3D
m_context->uniform2i(location->location(), x, y);
}
-void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int32Array* v)
+void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Int32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, 2))
return;
@@ -3769,7 +3703,7 @@ void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int
m_context->uniform2iv(location->location(), v->length() / 2, v->data());
}
-void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, size, 2))
return;
@@ -3777,7 +3711,7 @@ void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, GC3
m_context->uniform2iv(location->location(), size / 2, v);
}
-void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z)
+void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z)
{
if (isContextLost() || !location)
return;
@@ -3790,7 +3724,7 @@ void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, GC3D
m_context->uniform3f(location->location(), x, y, z);
}
-void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Float32Array* v)
+void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, Float32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, 3))
return;
@@ -3798,7 +3732,7 @@ void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Flo
m_context->uniform3fv(location->location(), v->length() / 3, v->data());
}
-void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, size, 3))
return;
@@ -3806,7 +3740,7 @@ void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, GC3
m_context->uniform3fv(location->location(), size / 3, v);
}
-void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z)
+void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z)
{
if (isContextLost() || !location)
return;
@@ -3819,7 +3753,7 @@ void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, GC3D
m_context->uniform3i(location->location(), x, y, z);
}
-void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int32Array* v)
+void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Int32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, 3))
return;
@@ -3827,7 +3761,7 @@ void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int
m_context->uniform3iv(location->location(), v->length() / 3, v->data());
}
-void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, size, 3))
return;
@@ -3835,7 +3769,7 @@ void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, GC3
m_context->uniform3iv(location->location(), size / 3, v);
}
-void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w)
+void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w)
{
if (isContextLost() || !location)
return;
@@ -3848,7 +3782,7 @@ void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, GC3D
m_context->uniform4f(location->location(), x, y, z, w);
}
-void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Float32Array* v)
+void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, Float32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, 4))
return;
@@ -3856,7 +3790,7 @@ void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Flo
m_context->uniform4fv(location->location(), v->length() / 4, v->data());
}
-void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, size, 4))
return;
@@ -3864,7 +3798,7 @@ void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, GC3
m_context->uniform4fv(location->location(), size / 4, v);
}
-void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w)
+void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w)
{
if (isContextLost() || !location)
return;
@@ -3877,7 +3811,7 @@ void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, GC3D
m_context->uniform4i(location->location(), x, y, z, w);
}
-void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int32Array* v)
+void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, Int32Array* v)
{
if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, 4))
return;
@@ -3885,7 +3819,7 @@ void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int
m_context->uniform4iv(location->location(), v->length() / 4, v->data());
}
-void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, size, 4))
return;
@@ -3893,49 +3827,49 @@ void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, GC3
m_context->uniform4iv(location->location(), size / 4, v);
}
-void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v)
+void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v)
{
if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4))
return;
m_context->uniformMatrix2fv(location->location(), v->length() / 4, transpose, v->data());
}
-void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, size, 4))
return;
m_context->uniformMatrix2fv(location->location(), size / 4, transpose, v);
}
-void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v)
+void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v)
{
if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9))
return;
m_context->uniformMatrix3fv(location->location(), v->length() / 9, transpose, v->data());
}
-void WebGLRenderingContext::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, size, 9))
return;
m_context->uniformMatrix3fv(location->location(), size / 9, transpose, v);
}
-void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v)
+void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v)
{
if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16))
return;
m_context->uniformMatrix4fv(location->location(), v->length() / 16, transpose, v->data());
}
-void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
{
if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, size, 16))
return;
m_context->uniformMatrix4fv(location->location(), size / 16, transpose, v);
}
-void WebGLRenderingContext::useProgram(WebGLProgram* program)
+void WebGLRenderingContextBase::useProgram(WebGLProgram* program)
{
bool deleted;
if (!checkObjectToBeBound("useProgram", program, deleted))
@@ -3956,74 +3890,74 @@ void WebGLRenderingContext::useProgram(WebGLProgram* program)
}
}
-void WebGLRenderingContext::validateProgram(WebGLProgram* program)
+void WebGLRenderingContextBase::validateProgram(WebGLProgram* program)
{
if (isContextLost() || !validateWebGLObject("validateProgram", program))
return;
m_context->validateProgram(objectOrZero(program));
}
-void WebGLRenderingContext::vertexAttrib1f(GC3Duint index, GC3Dfloat v0)
+void WebGLRenderingContextBase::vertexAttrib1f(GC3Duint index, GC3Dfloat v0)
{
vertexAttribfImpl("vertexAttrib1f", index, 1, v0, 0.0f, 0.0f, 1.0f);
}
-void WebGLRenderingContext::vertexAttrib1fv(GC3Duint index, Float32Array* v)
+void WebGLRenderingContextBase::vertexAttrib1fv(GC3Duint index, Float32Array* v)
{
vertexAttribfvImpl("vertexAttrib1fv", index, v, 1);
}
-void WebGLRenderingContext::vertexAttrib1fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::vertexAttrib1fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
{
vertexAttribfvImpl("vertexAttrib1fv", index, v, size, 1);
}
-void WebGLRenderingContext::vertexAttrib2f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1)
+void WebGLRenderingContextBase::vertexAttrib2f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1)
{
vertexAttribfImpl("vertexAttrib2f", index, 2, v0, v1, 0.0f, 1.0f);
}
-void WebGLRenderingContext::vertexAttrib2fv(GC3Duint index, Float32Array* v)
+void WebGLRenderingContextBase::vertexAttrib2fv(GC3Duint index, Float32Array* v)
{
vertexAttribfvImpl("vertexAttrib2fv", index, v, 2);
}
-void WebGLRenderingContext::vertexAttrib2fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::vertexAttrib2fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
{
vertexAttribfvImpl("vertexAttrib2fv", index, v, size, 2);
}
-void WebGLRenderingContext::vertexAttrib3f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2)
+void WebGLRenderingContextBase::vertexAttrib3f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2)
{
vertexAttribfImpl("vertexAttrib3f", index, 3, v0, v1, v2, 1.0f);
}
-void WebGLRenderingContext::vertexAttrib3fv(GC3Duint index, Float32Array* v)
+void WebGLRenderingContextBase::vertexAttrib3fv(GC3Duint index, Float32Array* v)
{
vertexAttribfvImpl("vertexAttrib3fv", index, v, 3);
}
-void WebGLRenderingContext::vertexAttrib3fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::vertexAttrib3fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
{
vertexAttribfvImpl("vertexAttrib3fv", index, v, size, 3);
}
-void WebGLRenderingContext::vertexAttrib4f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3)
+void WebGLRenderingContextBase::vertexAttrib4f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3)
{
vertexAttribfImpl("vertexAttrib4f", index, 4, v0, v1, v2, v3);
}
-void WebGLRenderingContext::vertexAttrib4fv(GC3Duint index, Float32Array* v)
+void WebGLRenderingContextBase::vertexAttrib4fv(GC3Duint index, Float32Array* v)
{
vertexAttribfvImpl("vertexAttrib4fv", index, v, 4);
}
-void WebGLRenderingContext::vertexAttrib4fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
+void WebGLRenderingContextBase::vertexAttrib4fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
{
vertexAttribfvImpl("vertexAttrib4fv", index, v, size, 4);
}
-void WebGLRenderingContext::vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, long long offset)
+void WebGLRenderingContextBase::vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, long long offset)
{
if (isContextLost())
return;
@@ -4051,7 +3985,7 @@ void WebGLRenderingContext::vertexAttribPointer(GC3Duint index, GC3Dint size, GC
return;
}
// Determine the number of elements the bound buffer can hold, given the offset, size, type and stride
- unsigned int typeSize = sizeInBytes(type);
+ unsigned typeSize = sizeInBytes(type);
if (!typeSize) {
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "vertexAttribPointer", "invalid type");
return;
@@ -4066,7 +4000,7 @@ void WebGLRenderingContext::vertexAttribPointer(GC3Duint index, GC3Dint size, GC
m_context->vertexAttribPointer(index, size, type, normalized, stride, static_cast<GC3Dintptr>(offset));
}
-void WebGLRenderingContext::vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor)
+void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GC3Duint index, GC3Duint divisor)
{
if (isContextLost())
return;
@@ -4080,7 +4014,7 @@ void WebGLRenderingContext::vertexAttribDivisorANGLE(GC3Duint index, GC3Duint di
m_context->getExtensions()->vertexAttribDivisorANGLE(index, divisor);
}
-void WebGLRenderingContext::viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
+void WebGLRenderingContextBase::viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height)
{
if (isContextLost())
return;
@@ -4089,7 +4023,7 @@ void WebGLRenderingContext::viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3D
m_context->viewport(x, y, width, height);
}
-void WebGLRenderingContext::forceLostContext(WebGLRenderingContext::LostContextMode mode)
+void WebGLRenderingContextBase::forceLostContext(WebGLRenderingContextBase::LostContextMode mode)
{
if (isContextLost()) {
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "loseContext", "context already lost");
@@ -4099,7 +4033,7 @@ void WebGLRenderingContext::forceLostContext(WebGLRenderingContext::LostContextM
m_contextGroup->loseContextGroup(mode);
}
-void WebGLRenderingContext::loseContextImpl(WebGLRenderingContext::LostContextMode mode)
+void WebGLRenderingContextBase::loseContextImpl(WebGLRenderingContextBase::LostContextMode mode)
{
if (isContextLost())
return;
@@ -4143,7 +4077,7 @@ void WebGLRenderingContext::loseContextImpl(WebGLRenderingContext::LostContextMo
m_dispatchContextLostEventTimer.startOneShot(0);
}
-void WebGLRenderingContext::forceRestoreContext()
+void WebGLRenderingContextBase::forceRestoreContext()
{
if (!isContextLost()) {
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "restoreContext", "context not lost");
@@ -4160,34 +4094,34 @@ void WebGLRenderingContext::forceRestoreContext()
m_restoreTimer.startOneShot(0);
}
-WebKit::WebLayer* WebGLRenderingContext::platformLayer() const
+WebKit::WebLayer* WebGLRenderingContextBase::platformLayer() const
{
return m_drawingBuffer->platformLayer();
}
-void WebGLRenderingContext::removeSharedObject(WebGLSharedObject* object)
+void WebGLRenderingContextBase::removeSharedObject(WebGLSharedObject* object)
{
m_contextGroup->removeObject(object);
}
-void WebGLRenderingContext::addSharedObject(WebGLSharedObject* object)
+void WebGLRenderingContextBase::addSharedObject(WebGLSharedObject* object)
{
ASSERT(!isContextLost());
m_contextGroup->addObject(object);
}
-void WebGLRenderingContext::removeContextObject(WebGLContextObject* object)
+void WebGLRenderingContextBase::removeContextObject(WebGLContextObject* object)
{
m_contextObjects.remove(object);
}
-void WebGLRenderingContext::addContextObject(WebGLContextObject* object)
+void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object)
{
ASSERT(!isContextLost());
m_contextObjects.add(object);
}
-void WebGLRenderingContext::detachAndRemoveAllObjects()
+void WebGLRenderingContextBase::detachAndRemoveAllObjects()
{
while (m_contextObjects.size() > 0) {
HashSet<WebGLContextObject*>::iterator it = m_contextObjects.begin();
@@ -4195,12 +4129,12 @@ void WebGLRenderingContext::detachAndRemoveAllObjects()
}
}
-bool WebGLRenderingContext::hasPendingActivity() const
+bool WebGLRenderingContextBase::hasPendingActivity() const
{
return false;
}
-void WebGLRenderingContext::stop()
+void WebGLRenderingContextBase::stop()
{
if (!isContextLost()) {
forceLostContext(SyntheticLostContext);
@@ -4208,7 +4142,7 @@ void WebGLRenderingContext::stop()
}
}
-WebGLGetInfo WebGLRenderingContext::getBooleanParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getBooleanParameter(GC3Denum pname)
{
GC3Dboolean value = 0;
if (!isContextLost())
@@ -4216,7 +4150,7 @@ WebGLGetInfo WebGLRenderingContext::getBooleanParameter(GC3Denum pname)
return WebGLGetInfo(static_cast<bool>(value));
}
-WebGLGetInfo WebGLRenderingContext::getBooleanArrayParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getBooleanArrayParameter(GC3Denum pname)
{
if (pname != GraphicsContext3D::COLOR_WRITEMASK) {
notImplemented();
@@ -4231,7 +4165,7 @@ WebGLGetInfo WebGLRenderingContext::getBooleanArrayParameter(GC3Denum pname)
return WebGLGetInfo(boolValue, 4);
}
-WebGLGetInfo WebGLRenderingContext::getFloatParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getFloatParameter(GC3Denum pname)
{
GC3Dfloat value = 0;
if (!isContextLost())
@@ -4239,7 +4173,7 @@ WebGLGetInfo WebGLRenderingContext::getFloatParameter(GC3Denum pname)
return WebGLGetInfo(value);
}
-WebGLGetInfo WebGLRenderingContext::getIntParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getIntParameter(GC3Denum pname)
{
GC3Dint value = 0;
if (!isContextLost())
@@ -4247,15 +4181,15 @@ WebGLGetInfo WebGLRenderingContext::getIntParameter(GC3Denum pname)
return WebGLGetInfo(value);
}
-WebGLGetInfo WebGLRenderingContext::getUnsignedIntParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getUnsignedIntParameter(GC3Denum pname)
{
GC3Dint value = 0;
if (!isContextLost())
m_context->getIntegerv(pname, &value);
- return WebGLGetInfo(static_cast<unsigned int>(value));
+ return WebGLGetInfo(static_cast<unsigned>(value));
}
-WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getWebGLFloatArrayParameter(GC3Denum pname)
{
GC3Dfloat value[4] = {0};
if (!isContextLost())
@@ -4277,7 +4211,7 @@ WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(GC3Denum pname)
return WebGLGetInfo(Float32Array::create(value, length));
}
-WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GC3Denum pname)
{
GC3Dint value[4] = {0};
if (!isContextLost())
@@ -4297,7 +4231,7 @@ WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(GC3Denum pname)
return WebGLGetInfo(Int32Array::create(value, length));
}
-void WebGLRenderingContext::handleTextureCompleteness(const char* functionName, bool prepareToDraw)
+void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionName, bool prepareToDraw)
{
// All calling functions check isContextLost, so a duplicate check is not needed here.
bool resetActiveUnit = false;
@@ -4336,41 +4270,40 @@ void WebGLRenderingContext::handleTextureCompleteness(const char* functionName,
m_context->activeTexture(m_activeTextureUnit);
}
-void WebGLRenderingContext::createFallbackBlackTextures1x1()
+void WebGLRenderingContextBase::createFallbackBlackTextures1x1()
{
// All calling functions check isContextLost, so a duplicate check is not needed here.
unsigned char black[] = {0, 0, 0, 255};
m_blackTexture2D = createTexture();
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);
+ 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->object());
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X, 0, GraphicsContext3D::RGBA, 1, 1,
- 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
+ 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GraphicsContext3D::RGBA, 1, 1,
- 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
+ 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GraphicsContext3D::RGBA, 1, 1,
- 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
+ 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GraphicsContext3D::RGBA, 1, 1,
- 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
+ 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GraphicsContext3D::RGBA, 1, 1,
- 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
+ 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->texImage2D(GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GraphicsContext3D::RGBA, 1, 1,
- 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
+ 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, black);
m_context->bindTexture(GraphicsContext3D::TEXTURE_CUBE_MAP, 0);
}
-bool WebGLRenderingContext::isTexInternalFormatColorBufferCombinationValid(GC3Denum texInternalFormat,
- GC3Denum colorBufferFormat)
+bool WebGLRenderingContextBase::isTexInternalFormatColorBufferCombinationValid(GC3Denum texInternalFormat, GC3Denum colorBufferFormat)
{
unsigned need = GraphicsContext3D::getChannelBitsByFormat(texInternalFormat);
unsigned have = GraphicsContext3D::getChannelBitsByFormat(colorBufferFormat);
return (need & have) == need;
}
-GC3Denum WebGLRenderingContext::getBoundFramebufferColorFormat()
+GC3Denum WebGLRenderingContextBase::getBoundFramebufferColorFormat()
{
if (m_framebufferBinding && m_framebufferBinding->object())
return m_framebufferBinding->getColorBufferFormat();
@@ -4379,21 +4312,21 @@ GC3Denum WebGLRenderingContext::getBoundFramebufferColorFormat()
return GraphicsContext3D::RGB;
}
-int WebGLRenderingContext::getBoundFramebufferWidth()
+int WebGLRenderingContextBase::getBoundFramebufferWidth()
{
if (m_framebufferBinding && m_framebufferBinding->object())
return m_framebufferBinding->getColorBufferWidth();
return m_drawingBuffer->size().width();
}
-int WebGLRenderingContext::getBoundFramebufferHeight()
+int WebGLRenderingContextBase::getBoundFramebufferHeight()
{
if (m_framebufferBinding && m_framebufferBinding->object())
return m_framebufferBinding->getColorBufferHeight();
return m_drawingBuffer->size().height();
}
-WebGLTexture* WebGLRenderingContext::validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap)
+WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* functionName, GC3Denum target, bool useSixEnumsForCubeMap)
{
WebGLTexture* tex = 0;
switch (target) {
@@ -4428,7 +4361,7 @@ WebGLTexture* WebGLRenderingContext::validateTextureBinding(const char* function
return tex;
}
-bool WebGLRenderingContext::validateLocationLength(const char* functionName, const String& string)
+bool WebGLRenderingContextBase::validateLocationLength(const char* functionName, const String& string)
{
const unsigned maxWebGLLocationLength = 256;
if (string.length() > maxWebGLLocationLength) {
@@ -4438,7 +4371,7 @@ bool WebGLRenderingContext::validateLocationLength(const char* functionName, con
return true;
}
-bool WebGLRenderingContext::validateSize(const char* functionName, GC3Dint x, GC3Dint y)
+bool WebGLRenderingContextBase::validateSize(const char* functionName, GC3Dint x, GC3Dint y)
{
if (x < 0 || y < 0) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "size < 0");
@@ -4447,7 +4380,7 @@ bool WebGLRenderingContext::validateSize(const char* functionName, GC3Dint x, GC
return true;
}
-bool WebGLRenderingContext::validateString(const char* functionName, const String& string)
+bool WebGLRenderingContextBase::validateString(const char* functionName, const String& string)
{
for (size_t i = 0; i < string.length(); ++i) {
if (!validateCharacter(string[i])) {
@@ -4458,7 +4391,7 @@ bool WebGLRenderingContext::validateString(const char* functionName, const Strin
return true;
}
-bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionName, GC3Denum format, GC3Denum type, GC3Dint level)
+bool WebGLRenderingContextBase::validateTexFuncFormatAndType(const char* functionName, GC3Denum format, GC3Denum type, GC3Dint level)
{
switch (format) {
case GraphicsContext3D::ALPHA:
@@ -4548,8 +4481,8 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam
return false;
}
if (level > 0) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "level must be 0 for DEPTH_COMPONENT format");
- return false;
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "level must be 0 for DEPTH_COMPONENT format");
+ return false;
}
break;
case GraphicsContext3D::DEPTH_STENCIL:
@@ -4562,8 +4495,8 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam
return false;
}
if (level > 0) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "level must be 0 for DEPTH_STENCIL format");
- return false;
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "level must be 0 for DEPTH_STENCIL format");
+ return false;
}
break;
default:
@@ -4573,7 +4506,7 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam
return true;
}
-bool WebGLRenderingContext::validateTexFuncLevel(const char* functionName, GC3Denum target, GC3Dint level)
+bool WebGLRenderingContextBase::validateTexFuncLevel(const char* functionName, GC3Denum target, GC3Dint level)
{
if (level < 0) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level < 0");
@@ -4603,7 +4536,7 @@ bool WebGLRenderingContext::validateTexFuncLevel(const char* functionName, GC3De
return true;
}
-bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName, TexFuncValidationFunctionType functionType,
+bool WebGLRenderingContextBase::validateTexFuncDimensions(const char* functionName, TexFuncValidationFunctionType functionType,
GC3Denum target, GC3Dint level, GC3Dsizei width, GC3Dsizei height)
{
if (width < 0 || height < 0) {
@@ -4625,8 +4558,8 @@ bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName,
case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z:
case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z:
if (functionType != TexSubImage2D && width != height) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width != height for cube map");
- return false;
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width != height for cube map");
+ return false;
}
// No need to check height here. For texImage width == height.
// For texSubImage that will be checked when checking yoffset + height is in range.
@@ -4642,7 +4575,7 @@ bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName,
return true;
}
-bool WebGLRenderingContext::validateTexFuncParameters(const char* functionName, TexFuncValidationFunctionType functionType, GC3Denum target,
+bool WebGLRenderingContextBase::validateTexFuncParameters(const char* functionName, TexFuncValidationFunctionType functionType, GC3Denum target,
GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type)
{
// We absolutely have to validate the format and type combination.
@@ -4667,11 +4600,11 @@ bool WebGLRenderingContext::validateTexFuncParameters(const char* functionName,
return true;
}
-bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GC3Dint level,
- GC3Dsizei width, GC3Dsizei height,
- GC3Denum format, GC3Denum type,
- ArrayBufferView* pixels,
- NullDisposition disposition)
+bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GC3Dint level,
+ GC3Dsizei width, GC3Dsizei height,
+ GC3Denum format, GC3Denum type,
+ ArrayBufferView* pixels,
+ NullDisposition disposition)
{
// All calling functions check isContextLost, so a duplicate check is not needed here.
if (!pixels) {
@@ -4719,7 +4652,7 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GC3Din
ASSERT_NOT_REACHED();
}
- unsigned int totalBytesRequired;
+ unsigned totalBytesRequired;
GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_unpackAlignment, &totalBytesRequired, 0);
if (error != GraphicsContext3D::NO_ERROR) {
synthesizeGLError(error, functionName, "invalid texture dimensions");
@@ -4727,11 +4660,11 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GC3Din
}
if (pixels->byteLength() < totalBytesRequired) {
if (m_unpackAlignment != 1) {
- error = m_context->computeImageSizeInBytes(format, type, width, height, 1, &totalBytesRequired, 0);
- if (pixels->byteLength() == totalBytesRequired) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not big enough for request with UNPACK_ALIGNMENT > 1");
- return false;
- }
+ error = m_context->computeImageSizeInBytes(format, type, width, height, 1, &totalBytesRequired, 0);
+ if (pixels->byteLength() == totalBytesRequired) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not big enough for request with UNPACK_ALIGNMENT > 1");
+ return false;
+ }
}
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "ArrayBufferView not big enough for request");
return false;
@@ -4739,14 +4672,14 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GC3Din
return true;
}
-bool WebGLRenderingContext::validateCompressedTexFormat(GC3Denum format)
+bool WebGLRenderingContextBase::validateCompressedTexFormat(GC3Denum format)
{
return m_compressedTextureFormats.contains(format);
}
-bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionName,
- GC3Dsizei width, GC3Dsizei height,
- GC3Denum format, ArrayBufferView* pixels)
+bool WebGLRenderingContextBase::validateCompressedTexFuncData(const char* functionName,
+ GC3Dsizei width, GC3Dsizei height,
+ GC3Denum format, ArrayBufferView* pixels)
{
if (!pixels) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels");
@@ -4757,7 +4690,7 @@ bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionNa
return false;
}
- unsigned int bytesRequired = 0;
+ unsigned bytesRequired = 0;
switch (format) {
case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT:
@@ -4819,7 +4752,7 @@ bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionNa
return true;
}
-bool WebGLRenderingContext::validateCompressedTexDimensions(const char* functionName, TexFuncValidationFunctionType functionType, GC3Denum target, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format)
+bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* functionName, TexFuncValidationFunctionType functionType, GC3Denum target, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format)
{
if (!validateTexFuncDimensions(functionName, functionType, target, level, width, height))
return false;
@@ -4834,8 +4767,8 @@ bool WebGLRenderingContext::validateCompressedTexDimensions(const char* function
bool widthValid = (level && width == 1) || (level && width == 2) || !(width % kBlockWidth);
bool heightValid = (level && height == 1) || (level && height == 2) || !(height % kBlockHeight);
if (!widthValid || !heightValid) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "width or height invalid for level");
- return false;
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "width or height invalid for level");
+ return false;
}
return true;
}
@@ -4844,12 +4777,12 @@ bool WebGLRenderingContext::validateCompressedTexDimensions(const char* function
}
}
-bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex)
+bool WebGLRenderingContextBase::validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+ GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex)
{
if (xoffset < 0 || yoffset < 0) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "xoffset or yoffset < 0");
- return false;
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "xoffset or yoffset < 0");
+ return false;
}
switch (format) {
@@ -4875,7 +4808,7 @@ bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* funct
}
}
-bool WebGLRenderingContext::validateDrawMode(const char* functionName, GC3Denum mode)
+bool WebGLRenderingContextBase::validateDrawMode(const char* functionName, GC3Denum mode)
{
switch (mode) {
case GraphicsContext3D::POINTS:
@@ -4892,7 +4825,7 @@ bool WebGLRenderingContext::validateDrawMode(const char* functionName, GC3Denum
}
}
-bool WebGLRenderingContext::validateStencilSettings(const char* functionName)
+bool WebGLRenderingContextBase::validateStencilSettings(const char* functionName)
{
if (m_stencilMask != m_stencilMaskBack || m_stencilFuncRef != m_stencilFuncRefBack || m_stencilFuncMask != m_stencilFuncMaskBack) {
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "front and back stencils settings do not match");
@@ -4901,7 +4834,7 @@ bool WebGLRenderingContext::validateStencilSettings(const char* functionName)
return true;
}
-bool WebGLRenderingContext::validateStencilOrDepthFunc(const char* functionName, GC3Denum func)
+bool WebGLRenderingContextBase::validateStencilOrDepthFunc(const char* functionName, GC3Denum func)
{
switch (func) {
case GraphicsContext3D::NEVER:
@@ -4919,7 +4852,7 @@ bool WebGLRenderingContext::validateStencilOrDepthFunc(const char* functionName,
}
}
-void WebGLRenderingContext::printGLErrorToConsole(const String& message)
+void WebGLRenderingContextBase::printGLErrorToConsole(const String& message)
{
if (!m_numGLErrorsToConsoleAllowed)
return;
@@ -4933,14 +4866,14 @@ void WebGLRenderingContext::printGLErrorToConsole(const String& message)
return;
}
-void WebGLRenderingContext::printWarningToConsole(const String& message)
+void WebGLRenderingContextBase::printWarningToConsole(const String& message)
{
if (!canvas())
return;
canvas()->document().addConsoleMessage(RenderingMessageSource, WarningMessageLevel, message);
}
-bool WebGLRenderingContext::validateFramebufferFuncParameters(const char* functionName, GC3Denum target, GC3Denum attachment)
+bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* functionName, GC3Denum target, GC3Denum attachment)
{
if (target != GraphicsContext3D::FRAMEBUFFER) {
synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid target");
@@ -4963,7 +4896,7 @@ bool WebGLRenderingContext::validateFramebufferFuncParameters(const char* functi
return true;
}
-bool WebGLRenderingContext::validateBlendEquation(const char* functionName, GC3Denum mode)
+bool WebGLRenderingContextBase::validateBlendEquation(const char* functionName, GC3Denum mode)
{
switch (mode) {
case GraphicsContext3D::FUNC_ADD:
@@ -4976,10 +4909,10 @@ bool WebGLRenderingContext::validateBlendEquation(const char* functionName, GC3D
}
}
-bool WebGLRenderingContext::validateBlendFuncFactors(const char* functionName, GC3Denum src, GC3Denum dst)
+bool WebGLRenderingContextBase::validateBlendFuncFactors(const char* functionName, GC3Denum src, GC3Denum dst)
{
if (((src == GraphicsContext3D::CONSTANT_COLOR || src == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
- && (dst == GraphicsContext3D::CONSTANT_ALPHA || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))
+ && (dst == GraphicsContext3D::CONSTANT_ALPHA || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))
|| ((dst == GraphicsContext3D::CONSTANT_COLOR || dst == GraphicsContext3D::ONE_MINUS_CONSTANT_COLOR)
&& (src == GraphicsContext3D::CONSTANT_ALPHA || src == GraphicsContext3D::ONE_MINUS_CONSTANT_ALPHA))) {
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "incompatible src and dst");
@@ -4988,7 +4921,7 @@ bool WebGLRenderingContext::validateBlendFuncFactors(const char* functionName, G
return true;
}
-bool WebGLRenderingContext::validateCapability(const char* functionName, GC3Denum cap)
+bool WebGLRenderingContextBase::validateCapability(const char* functionName, GC3Denum cap)
{
switch (cap) {
case GraphicsContext3D::BLEND:
@@ -5007,7 +4940,7 @@ bool WebGLRenderingContext::validateCapability(const char* functionName, GC3Denu
}
}
-bool WebGLRenderingContext::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Float32Array* v, GC3Dsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Float32Array* v, GC3Dsizei requiredMinSize)
{
if (!v) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
@@ -5016,7 +4949,7 @@ bool WebGLRenderingContext::validateUniformParameters(const char* functionName,
return validateUniformMatrixParameters(functionName, location, false, v->data(), v->length(), requiredMinSize);
}
-bool WebGLRenderingContext::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Int32Array* v, GC3Dsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Int32Array* v, GC3Dsizei requiredMinSize)
{
if (!v) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
@@ -5025,12 +4958,12 @@ bool WebGLRenderingContext::validateUniformParameters(const char* functionName,
return validateUniformMatrixParameters(functionName, location, false, v->data(), v->length(), requiredMinSize);
}
-bool WebGLRenderingContext::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, void* v, GC3Dsizei size, GC3Dsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, void* v, GC3Dsizei size, GC3Dsizei requiredMinSize)
{
return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize);
}
-bool WebGLRenderingContext::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, GC3Dsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, GC3Dsizei requiredMinSize)
{
if (!v) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
@@ -5039,7 +4972,7 @@ bool WebGLRenderingContext::validateUniformMatrixParameters(const char* function
return validateUniformMatrixParameters(functionName, location, transpose, v->data(), v->length(), requiredMinSize);
}
-bool WebGLRenderingContext::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GC3Dboolean transpose, void* v, GC3Dsizei size, GC3Dsizei requiredMinSize)
+bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GC3Dboolean transpose, void* v, GC3Dsizei size, GC3Dsizei requiredMinSize)
{
if (!location)
return false;
@@ -5062,7 +4995,7 @@ bool WebGLRenderingContext::validateUniformMatrixParameters(const char* function
return true;
}
-WebGLBuffer* WebGLRenderingContext::validateBufferDataParameters(const char* functionName, GC3Denum target, GC3Denum usage)
+WebGLBuffer* WebGLRenderingContextBase::validateBufferDataParameters(const char* functionName, GC3Denum target, GC3Denum usage)
{
WebGLBuffer* buffer = 0;
switch (target) {
@@ -5090,7 +5023,7 @@ WebGLBuffer* WebGLRenderingContext::validateBufferDataParameters(const char* fun
return 0;
}
-bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, HTMLImageElement* image, ExceptionState& es)
+bool WebGLRenderingContextBase::validateHTMLImageElement(const char* functionName, HTMLImageElement* image, ExceptionState& es)
{
if (!image || !image->cachedImage()) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no image");
@@ -5102,39 +5035,39 @@ bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, H
return false;
}
if (wouldTaintOrigin(image)) {
- es.throwSecurityError(ExceptionMessages::failedToExecute(functionName, "WebGLRenderingContext", "the cross-origin image at " + url.elidedString() + " may not be loaded."));
+ es.throwSecurityError(ExceptionMessages::failedToExecute(functionName, m_contextName, "the cross-origin image at " + url.elidedString() + " may not be loaded."));
return false;
}
return true;
}
-bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& es)
+bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& es)
{
if (!canvas || !canvas->buffer()) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no canvas");
return false;
}
if (wouldTaintOrigin(canvas)) {
- es.throwSecurityError(ExceptionMessages::failedToExecute(functionName, "WebGLRenderingContext", "tainted canvases may not be loded."));
+ es.throwSecurityError(ExceptionMessages::failedToExecute(functionName, m_contextName, "tainted canvases may not be loded."));
return false;
}
return true;
}
-bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, HTMLVideoElement* video, ExceptionState& es)
+bool WebGLRenderingContextBase::validateHTMLVideoElement(const char* functionName, HTMLVideoElement* video, ExceptionState& es)
{
if (!video || !video->videoWidth() || !video->videoHeight()) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no video");
return false;
}
if (wouldTaintOrigin(video)) {
- es.throwSecurityError(ExceptionMessages::failedToExecute(functionName, "WebGLRenderingContext", "the video element contains cross-origin data, and may not be loaded."));
+ es.throwSecurityError(ExceptionMessages::failedToExecute(functionName, m_contextName, "the video element contains cross-origin data, and may not be loaded."));
return false;
}
return true;
}
-bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denum mode, GC3Dint first, GC3Dsizei count)
+bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GC3Denum mode, GC3Dint first, GC3Dsizei count)
{
if (isContextLost() || !validateDrawMode(functionName, mode))
return false;
@@ -5166,7 +5099,7 @@ bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denu
return true;
}
-bool WebGLRenderingContext::validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset)
+bool WebGLRenderingContextBase::validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset)
{
if (isContextLost() || !validateDrawMode(functionName, mode))
return false;
@@ -5218,7 +5151,7 @@ bool WebGLRenderingContext::validateDrawElements(const char* functionName, GC3De
}
// Helper function to validate draw*Instanced calls
-bool WebGLRenderingContext::validateDrawInstanced(const char* functionName, GC3Dsizei primcount)
+bool WebGLRenderingContextBase::validateDrawInstanced(const char* functionName, GC3Dsizei primcount)
{
if (primcount < 0) {
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "primcount < 0");
@@ -5236,7 +5169,7 @@ bool WebGLRenderingContext::validateDrawInstanced(const char* functionName, GC3D
return false;
}
-void WebGLRenderingContext::vertexAttribfImpl(const char* functionName, GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3)
+void WebGLRenderingContextBase::vertexAttribfImpl(const char* functionName, GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3)
{
if (isContextLost())
return;
@@ -5266,7 +5199,7 @@ void WebGLRenderingContext::vertexAttribfImpl(const char* functionName, GC3Duint
attribValue.value[3] = v3;
}
-void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32Array* v, GC3Dsizei expectedSize)
+void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32Array* v, GC3Dsizei expectedSize)
{
if (isContextLost())
return;
@@ -5277,7 +5210,7 @@ void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GC3Duin
vertexAttribfvImpl(functionName, index, v->data(), v->length(), expectedSize);
}
-void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GC3Duint index, GC3Dfloat* v, GC3Dsizei size, GC3Dsizei expectedSize)
+void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GC3Duint index, GC3Dfloat* v, GC3Dsizei size, GC3Dsizei expectedSize)
{
if (isContextLost())
return;
@@ -5314,7 +5247,7 @@ void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GC3Duin
attribValue.value[ii] = v[ii];
}
-void WebGLRenderingContext::dispatchContextLostEvent(Timer<WebGLRenderingContext>*)
+void WebGLRenderingContextBase::dispatchContextLostEvent(Timer<WebGLRenderingContextBase>*)
{
RefPtr<WebGLContextEvent> event = WebGLContextEvent::create(eventNames().webglcontextlostEvent, false, true, "");
canvas()->dispatchEvent(event);
@@ -5324,7 +5257,7 @@ void WebGLRenderingContext::dispatchContextLostEvent(Timer<WebGLRenderingContext
m_restoreTimer.startOneShot(0);
}
-void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*)
+void WebGLRenderingContextBase::maybeRestoreContext(Timer<WebGLRenderingContextBase>*)
{
ASSERT(isContextLost());
@@ -5347,16 +5280,17 @@ void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*)
return;
// Reset the context attributes back to the requested attributes and re-apply restrictions
- m_attributes = adjustAttributes(m_requestedAttributes, settings);
+ m_attributes = WebGLRenderingContextBase::adjustAttributes(m_requestedAttributes, settings);
RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(m_attributes));
if (!context) {
- if (m_contextLostMode == RealLostContext)
+ if (m_contextLostMode == RealLostContext) {
m_restoreTimer.startOneShot(secondsBetweenRestoreAttempts);
- else
+ } else {
// This likely shouldn't happen but is the best way to report it to the WebGL app.
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "", "error restoring context");
+ }
return;
}
@@ -5372,7 +5306,7 @@ void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*)
m_drawingBuffer->bind();
- lost_context_errors_.clear();
+ m_lostContextErrors.clear();
m_context = context;
m_contextLost = false;
@@ -5382,20 +5316,20 @@ void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*)
canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, ""));
}
-String WebGLRenderingContext::ensureNotNull(const String& text) const
+String WebGLRenderingContextBase::ensureNotNull(const String& text) const
{
if (text.isNull())
return WTF::emptyString();
return text;
}
-WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity)
+WebGLRenderingContextBase::LRUImageBufferCache::LRUImageBufferCache(int capacity)
: m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity]))
, m_capacity(capacity)
{
}
-ImageBuffer* WebGLRenderingContext::LRUImageBufferCache::imageBuffer(const IntSize& size)
+ImageBuffer* WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer(const IntSize& size)
{
int i;
for (i = 0; i < m_capacity; ++i) {
@@ -5419,7 +5353,7 @@ ImageBuffer* WebGLRenderingContext::LRUImageBufferCache::imageBuffer(const IntSi
return buf;
}
-void WebGLRenderingContext::LRUImageBufferCache::bubbleToFront(int idx)
+void WebGLRenderingContextBase::LRUImageBufferCache::bubbleToFront(int idx)
{
for (int i = idx; i > 0; --i)
m_buffers[i].swap(m_buffers[i-1]);
@@ -5449,23 +5383,23 @@ namespace {
} // namespace anonymous
-void WebGLRenderingContext::synthesizeGLError(GC3Denum error, const char* functionName, const char* description, ConsoleDisplayPreference display)
+void WebGLRenderingContextBase::synthesizeGLError(GC3Denum error, const char* functionName, const char* description, ConsoleDisplayPreference display)
{
String errorType = GetErrorString(error);
if (m_synthesizedErrorsToConsole && display == DisplayInConsole) {
String message = String("WebGL: ") + errorType + ": " + String(functionName) + ": " + String(description);
printGLErrorToConsole(message);
}
- if (!isContextLost())
+ if (!isContextLost()) {
m_context->synthesizeGLError(error);
- else {
- if (lost_context_errors_.find(error) == WTF::notFound)
- lost_context_errors_.append(error);
+ } else {
+ if (m_lostContextErrors.find(error) == WTF::notFound)
+ m_lostContextErrors.append(error);
}
InspectorInstrumentation::didFireWebGLError(canvas(), errorType);
}
-void WebGLRenderingContext::emitGLWarning(const char* functionName, const char* description)
+void WebGLRenderingContextBase::emitGLWarning(const char* functionName, const char* description)
{
if (m_synthesizedErrorsToConsole) {
String message = String("WebGL: ") + String(functionName) + ": " + String(description);
@@ -5474,21 +5408,20 @@ void WebGLRenderingContext::emitGLWarning(const char* functionName, const char*
InspectorInstrumentation::didFireWebGLWarning(canvas());
}
-void WebGLRenderingContext::applyStencilTest()
+void WebGLRenderingContextBase::applyStencilTest()
{
bool haveStencilBuffer = false;
- if (m_framebufferBinding)
+ if (m_framebufferBinding) {
haveStencilBuffer = m_framebufferBinding->hasStencilBuffer();
- else {
+ } else {
RefPtr<WebGLContextAttributes> attributes = getContextAttributes();
haveStencilBuffer = attributes->stencil();
}
- enableOrDisable(GraphicsContext3D::STENCIL_TEST,
- m_stencilEnabled && haveStencilBuffer);
+ enableOrDisable(GraphicsContext3D::STENCIL_TEST, m_stencilEnabled && haveStencilBuffer);
}
-void WebGLRenderingContext::enableOrDisable(GC3Denum capability, bool enable)
+void WebGLRenderingContextBase::enableOrDisable(GC3Denum capability, bool enable)
{
if (isContextLost())
return;
@@ -5498,13 +5431,12 @@ void WebGLRenderingContext::enableOrDisable(GC3Denum capability, bool enable)
m_context->disable(capability);
}
-IntSize WebGLRenderingContext::clampedCanvasSize()
+IntSize WebGLRenderingContextBase::clampedCanvasSize()
{
- return IntSize(clamp(canvas()->width(), 1, m_maxViewportDims[0]),
- clamp(canvas()->height(), 1, m_maxViewportDims[1]));
+ return IntSize(clamp(canvas()->width(), 1, m_maxViewportDims[0]), clamp(canvas()->height(), 1, m_maxViewportDims[1]));
}
-GC3Dint WebGLRenderingContext::getMaxDrawBuffers()
+GC3Dint WebGLRenderingContextBase::getMaxDrawBuffers()
{
if (isContextLost() || !m_webglDrawBuffers)
return 0;
@@ -5516,7 +5448,7 @@ GC3Dint WebGLRenderingContext::getMaxDrawBuffers()
return std::min(m_maxDrawBuffers, m_maxColorAttachments);
}
-GC3Dint WebGLRenderingContext::getMaxColorAttachments()
+GC3Dint WebGLRenderingContextBase::getMaxColorAttachments()
{
if (isContextLost() || !m_webglDrawBuffers)
return 0;
@@ -5525,30 +5457,30 @@ GC3Dint WebGLRenderingContext::getMaxColorAttachments()
return m_maxColorAttachments;
}
-void WebGLRenderingContext::setBackDrawBuffer(GC3Denum buf)
+void WebGLRenderingContextBase::setBackDrawBuffer(GC3Denum buf)
{
m_backDrawBuffer = buf;
}
-void WebGLRenderingContext::restoreCurrentFramebuffer()
+void WebGLRenderingContextBase::restoreCurrentFramebuffer()
{
bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBinding.get());
}
-void WebGLRenderingContext::restoreCurrentTexture2D()
+void WebGLRenderingContextBase::restoreCurrentTexture2D()
{
bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get());
}
-void WebGLRenderingContext::multisamplingChanged(bool enabled)
+void WebGLRenderingContextBase::multisamplingChanged(bool enabled)
{
if (m_multisamplingAllowed != enabled) {
m_multisamplingAllowed = enabled;
- forceLostContext(WebGLRenderingContext::AutoRecoverSyntheticLostContext);
+ forceLostContext(WebGLRenderingContextBase::AutoRecoverSyntheticLostContext);
}
}
-void WebGLRenderingContext::findNewMaxEnabledAttribIndex()
+void WebGLRenderingContextBase::findNewMaxEnabledAttribIndex()
{
// Trace backwards from the current max to find the new max enabled attrib index
int startIndex = m_onePlusMaxEnabledAttribIndex - 1;
@@ -5561,7 +5493,7 @@ void WebGLRenderingContext::findNewMaxEnabledAttribIndex()
m_onePlusMaxEnabledAttribIndex = 0;
}
-void WebGLRenderingContext::findNewMaxNonDefaultTextureUnit()
+void WebGLRenderingContextBase::findNewMaxNonDefaultTextureUnit()
{
// Trace backwards from the current max to find the new max non-default texture unit
int startIndex = m_onePlusMaxNonDefaultTextureUnit - 1;

Powered by Google App Engine
This is Rietveld 408576698