Chromium Code Reviews| 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 83% |
| copy from Source/core/html/canvas/WebGLRenderingContext.cpp |
| copy to Source/core/html/canvas/WebGLRenderingContextBase.cpp |
| index edf54952969cbc2dae7a9f2933d60c4519430a5b..e283e3f5d6547a9d57d02603aea47cafeed5c575 100644 |
| --- a/Source/core/html/canvas/WebGLRenderingContext.cpp |
| +++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
| @@ -1,30 +1,9 @@ |
| -/* |
| - * Copyright (C) 2009 Apple Inc. All rights reserved. |
| - * |
| - * Redistribution and use in source and binary forms, with or without |
| - * modification, are permitted provided that the following conditions |
| - * are met: |
| - * 1. Redistributions of source code must retain the above copyright |
| - * notice, this list of conditions and the following disclaimer. |
| - * 2. Redistributions in binary form must reproduce the above copyright |
| - * notice, this list of conditions and the following disclaimer in the |
| - * documentation and/or other materials provided with the distribution. |
| - * |
| - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| - */ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| #include "config.h" |
| -#include "core/html/canvas/WebGLRenderingContext.h" |
| +#include "core/html/canvas/WebGLRenderingContextBase.h" |
| #include "RuntimeEnabledFeatures.h" |
| #include "bindings/v8/ExceptionMessages.h" |
| @@ -88,25 +67,25 @@ const double secondsBetweenRestoreAttempts = 1.0; |
| const int maxGLErrorsAllowedToConsole = 256; |
| const unsigned 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) |
| { |
| size_t candidateID = oldestContextIndex(); |
| if (candidateID >= activeContexts().size()) |
| return; |
| - WebGLRenderingContext* candidate = activeContexts()[candidateID]; |
| + WebGLRenderingContextBase* candidate = activeContexts()[candidateID]; |
| activeContexts().remove(candidateID); |
| @@ -114,18 +93,18 @@ void WebGLRenderingContext::forciblyLoseOldestContext(const String& reason) |
| InspectorInstrumentation::didFireWebGLWarning(candidate->canvas()); |
| // This will call deactivateContext once the context has actually been lost. |
| - candidate->forceLostContext(WebGLRenderingContext::SyntheticLostContext); |
| + candidate->forceLostContext(WebGLRenderingContextBase::SyntheticLostContext); |
| } |
| -size_t WebGLRenderingContext::oldestContextIndex() |
| +size_t WebGLRenderingContextBase::oldestContextIndex() |
| { |
| if (!activeContexts().size()) |
| return maxGLActiveContexts; |
| - WebGLRenderingContext* candidate = activeContexts().first(); |
| + WebGLRenderingContextBase* candidate = activeContexts().first(); |
| size_t candidateID = 0; |
| for (size_t ii = 1; ii < activeContexts().size(); ++ii) { |
| - WebGLRenderingContext* context = activeContexts()[ii]; |
| + WebGLRenderingContextBase* context = activeContexts()[ii]; |
| if (context->webGraphicsContext3D() && candidate->webGraphicsContext3D() && context->webGraphicsContext3D()->lastFlushID() < candidate->webGraphicsContext3D()->lastFlushID()) { |
| candidate = context; |
| candidateID = ii; |
| @@ -135,13 +114,13 @@ size_t WebGLRenderingContext::oldestContextIndex() |
| return candidateID; |
| } |
| -IntSize WebGLRenderingContext::oldestContextSize() |
| +IntSize WebGLRenderingContextBase::oldestContextSize() |
| { |
| IntSize size; |
| size_t candidateID = oldestContextIndex(); |
| if (candidateID < activeContexts().size()) { |
| - WebGLRenderingContext* candidate = activeContexts()[candidateID]; |
| + WebGLRenderingContextBase* candidate = activeContexts()[candidateID]; |
| size.setWidth(candidate->drawingBufferWidth()); |
| size.setHeight(candidate->drawingBufferHeight()); |
| } |
| @@ -149,7 +128,7 @@ IntSize WebGLRenderingContext::oldestContextSize() |
| return size; |
| } |
| -void WebGLRenderingContext::activateContext(WebGLRenderingContext* context) |
| +void WebGLRenderingContextBase::activateContext(WebGLRenderingContextBase* context) |
| { |
| unsigned removedContexts = 0; |
| while (activeContexts().size() >= maxGLActiveContexts && removedContexts < maxGLActiveContexts) { |
| @@ -161,7 +140,7 @@ void WebGLRenderingContext::activateContext(WebGLRenderingContext* context) |
| activeContexts().append(context); |
| } |
| -void WebGLRenderingContext::deactivateContext(WebGLRenderingContext* context, bool addToEvictedList) |
| +void WebGLRenderingContextBase::deactivateContext(WebGLRenderingContextBase* context, bool addToEvictedList) |
| { |
| size_t position = activeContexts().find(context); |
| if (position != WTF::kNotFound) |
| @@ -171,7 +150,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::kNotFound) |
| @@ -181,7 +160,7 @@ void WebGLRenderingContext::willDestroyContext(WebGLRenderingContext* context) |
| // Try to re-enable the oldest inactive contexts. |
| while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContexts().size()) { |
| - WebGLRenderingContext* evictedContext = forciblyEvictedContexts().first(); |
| + WebGLRenderingContextBase* evictedContext = forciblyEvictedContexts().first(); |
| if (!evictedContext->m_restoreAllowed) { |
| forciblyEvictedContexts().remove(0); |
| continue; |
| @@ -202,10 +181,10 @@ void WebGLRenderingContext::willDestroyContext(WebGLRenderingContext* context) |
| class WebGLRenderingContextEvictionManager : public ContextEvictionManager { |
| public: |
| void forciblyLoseOldestContext(const String& reason) { |
| - WebGLRenderingContext::forciblyLoseOldestContext(reason); |
| + WebGLRenderingContextBase::forciblyLoseOldestContext(reason); |
| }; |
| IntSize oldestContextSize() { |
| - return WebGLRenderingContext::oldestContextSize(); |
| + return WebGLRenderingContextBase::oldestContextSize(); |
| }; |
| }; |
| @@ -458,17 +437,17 @@ namespace { |
| class WebGLRenderingContextLostCallback : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| WTF_MAKE_FAST_ALLOCATED; |
| public: |
| - explicit WebGLRenderingContextLostCallback(WebGLRenderingContext* cb) : m_context(cb) { } |
| - virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingContext::RealLostContext); } |
| + 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 blink::WebGraphicsContext3D::WebGraphicsErrorMessageCallback { |
| WTF_MAKE_FAST_ALLOCATED; |
| public: |
| - explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContext* cb) : m_context(cb) { } |
| + explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase* cb) : m_context(cb) { } |
| virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint) |
| { |
| if (m_context->m_synthesizedErrorsToConsole) |
| @@ -477,60 +456,17 @@ public: |
| } |
| virtual ~WebGLRenderingContextErrorMessageCallback() { } |
| private: |
| - WebGLRenderingContext* m_context; |
| + WebGLRenderingContextBase* m_context; |
| }; |
| -PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs) |
| -{ |
| - 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(EventTypeNames::webglcontextcreationerror, false, true, "Web page was not allowed to create a WebGL context.")); |
| - return nullptr; |
| - } |
| - |
| - // The only situation that attrs is null is through Document::getCSSCanvasContext(). |
| - RefPtr<WebGLContextAttributes> defaultAttrs; |
| - if (!attrs) { |
| - defaultAttrs = WebGLContextAttributes::create(); |
| - attrs = defaultAttrs.get(); |
| - } |
| - blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(document.topDocument()->url().string(), settings); |
| - OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::current()->createOffscreenGraphicsContext3D(attributes)); |
| - if (!context || !context->makeContextCurrent()) { |
| - canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL context.")); |
| - return nullptr; |
| - } |
| - |
| - Extensions3DUtil extensionsUtil(context.get()); |
| - if (extensionsUtil.supportsExtension("GL_EXT_debug_marker")) |
| - context->pushGroupMarkerEXT("WebGLRenderingContext"); |
| - |
| - OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, context.release(), attrs)); |
| - renderingContext->suspendIfNeeded(); |
| - |
| - if (renderingContext->m_drawingBuffer->isZeroSized()) { |
| - canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextcreationerror, false, true, "Could not create a WebGL context.")); |
| - return nullptr; |
| - } |
| - |
| - return renderingContext.release(); |
| -} |
| - |
| -WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* requestedAttributes) |
| +WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* requestedAttributes) |
| : CanvasRenderingContext(passedCanvas) |
| , ActiveDOMObject(&passedCanvas->document()) |
| , 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_generatedImageCache(4) |
| , m_contextLost(false) |
| , m_contextLostMode(SyntheticLostContext) |
| @@ -562,36 +498,9 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa |
| setupFlags(); |
| initializeNewContext(); |
| } |
| - |
| - // Register extensions. |
| - static const char* const webkitPrefix[] = { "WEBKIT_", 0, }; |
| - static const char* const 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<WebGLDrawBuffers>(m_webglDrawBuffers); |
| - registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, bothPrefixes); |
| - |
| - // Register draft extensions. |
| - registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); |
| - |
| - // Register privileged extensions. |
| - registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDebugRendererInfoExtension); |
| - registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtension); |
| } |
| -void WebGLRenderingContext::initializeNewContext() |
| +void WebGLRenderingContextBase::initializeNewContext() |
| { |
| ASSERT(!isContextLost()); |
| m_needsUpdate = true; |
| @@ -670,10 +579,13 @@ void WebGLRenderingContext::initializeNewContext() |
| // This ensures that the context has a valid "lastFlushID" and won't be mistakenly identified as the "least recently used" context. |
| m_context->flush(); |
| + for (int i = 0; i < WebGLExtensionNameCount; ++i) |
| + m_extensionEnabled[i] = false; |
| + |
| activateContext(this); |
| } |
| -void WebGLRenderingContext::setupFlags() |
| +void WebGLRenderingContextBase::setupFlags() |
| { |
| ASSERT(m_context); |
| if (Page* p = canvas()->document().page()) { |
| @@ -690,30 +602,38 @@ void WebGLRenderingContext::setupFlags() |
| m_isDepthStencilSupported = extensionsUtil()->isExtensionEnabled("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; |
| } |
| -bool WebGLRenderingContext::allowWebGLDebugRendererInfo() const |
| +bool WebGLRenderingContextBase::allowWebGLDebugRendererInfo() const |
| { |
| return true; |
| } |
| -void WebGLRenderingContext::addCompressedTextureFormat(GLenum format) |
| +void WebGLRenderingContextBase::addCompressedTextureFormat(GLenum format) |
| { |
| if (!m_compressedTextureFormats.contains(format)) |
| m_compressedTextureFormats.append(format); |
| } |
| -void WebGLRenderingContext::removeAllCompressedTextureFormats() |
| +void WebGLRenderingContextBase::removeAllCompressedTextureFormats() |
| { |
| m_compressedTextureFormats.clear(); |
| } |
| -WebGLRenderingContext::~WebGLRenderingContext() |
| +// Helper function for V8 bindings to identify what version of WebGL a CanvasRenderingContext supports. |
| +unsigned WebGLRenderingContextBase::getWebGLVersion(CanvasRenderingContext* context) |
| +{ |
| + if (!context->is3d()) |
| + return 0; |
| + return static_cast<WebGLRenderingContextBase*>(context)->version(); |
| +} |
| + |
| +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. |
| @@ -754,7 +674,7 @@ WebGLRenderingContext::~WebGLRenderingContext() |
| willDestroyContext(this); |
| } |
| -void WebGLRenderingContext::destroyContext() |
| +void WebGLRenderingContextBase::destroyContext() |
| { |
| m_contextLost = true; |
| @@ -771,7 +691,7 @@ void WebGLRenderingContext::destroyContext() |
| } |
| } |
| -void WebGLRenderingContext::markContextChanged() |
| +void WebGLRenderingContextBase::markContextChanged() |
| { |
| if (m_framebufferBinding || isContextLost()) |
| return; |
| @@ -792,7 +712,7 @@ void WebGLRenderingContext::markContextChanged() |
| } |
| } |
| -bool WebGLRenderingContext::clearIfComposited(GLbitfield mask) |
| +bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask) |
| { |
| if (isContextLost()) |
| return false; |
| @@ -841,7 +761,7 @@ bool WebGLRenderingContext::clearIfComposited(GLbitfield mask) |
| return combinedClear; |
| } |
| -void WebGLRenderingContext::restoreStateAfterClear() |
| +void WebGLRenderingContextBase::restoreStateAfterClear() |
| { |
| if (isContextLost()) |
| return; |
| @@ -859,13 +779,13 @@ void WebGLRenderingContext::restoreStateAfterClear() |
| m_context->depthMask(m_depthMask); |
| } |
| -void WebGLRenderingContext::markLayerComposited() |
| +void WebGLRenderingContextBase::markLayerComposited() |
| { |
| if (!isContextLost()) |
| m_drawingBuffer->markLayerComposited(); |
| } |
| -void WebGLRenderingContext::paintRenderingResultsToCanvas() |
| +void WebGLRenderingContextBase::paintRenderingResultsToCanvas() |
| { |
| if (isContextLost()) { |
| canvas()->clearPresentationCopy(); |
| @@ -904,7 +824,7 @@ void WebGLRenderingContext::paintRenderingResultsToCanvas() |
| m_drawingBuffer->bind(); |
| } |
| -PassRefPtr<ImageData> WebGLRenderingContext::paintRenderingResultsToImageData() |
| +PassRefPtr<ImageData> WebGLRenderingContextBase::paintRenderingResultsToImageData() |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -924,12 +844,12 @@ PassRefPtr<ImageData> WebGLRenderingContext::paintRenderingResultsToImageData() |
| return ImageData::create(IntSize(width, height), imageDataPixels); |
| } |
| -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. |
| GLint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize); |
| // Limit drawing buffer size to 4k to avoid memory exhaustion. |
| @@ -958,17 +878,17 @@ void WebGLRenderingContext::reshape(int width, int height) |
| m_context->bindFramebuffer(GL_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 WebGLRenderingContext::sizeInBytes(GLenum type) |
| +unsigned WebGLRenderingContextBase::sizeInBytes(GLenum type) |
| { |
| switch (type) { |
| case GL_BYTE: |
| @@ -990,7 +910,7 @@ unsigned WebGLRenderingContext::sizeInBytes(GLenum type) |
| return 0; |
| } |
| -void WebGLRenderingContext::activeTexture(GLenum texture) |
| +void WebGLRenderingContextBase::activeTexture(GLenum texture) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1005,7 +925,7 @@ void WebGLRenderingContext::activeTexture(GLenum texture) |
| } |
| -void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* shader) |
| +void WebGLRenderingContextBase::attachShader(WebGLProgram* program, WebGLShader* shader) |
| { |
| if (isContextLost() || !validateWebGLObject("attachShader", program) || !validateWebGLObject("attachShader", shader)) |
| return; |
| @@ -1017,7 +937,7 @@ void WebGLRenderingContext::attachShader(WebGLProgram* program, WebGLShader* sha |
| shader->onAttached(); |
| } |
| -void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GLuint index, const String& name) |
| +void WebGLRenderingContextBase::bindAttribLocation(WebGLProgram* program, GLuint index, const String& name) |
| { |
| if (isContextLost() || !validateWebGLObject("bindAttribLocation", program)) |
| return; |
| @@ -1036,7 +956,7 @@ void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GLuint ind |
| m_context->bindAttribLocation(objectOrZero(program), index, name.utf8().data()); |
| } |
| -bool WebGLRenderingContext::checkObjectToBeBound(const char* functionName, WebGLObject* object, bool& deleted) |
| +bool WebGLRenderingContextBase::checkObjectToBeBound(const char* functionName, WebGLObject* object, bool& deleted) |
| { |
| deleted = false; |
| if (isContextLost()) |
| @@ -1051,7 +971,7 @@ bool WebGLRenderingContext::checkObjectToBeBound(const char* functionName, WebGL |
| return true; |
| } |
| -void WebGLRenderingContext::bindBuffer(GLenum target, WebGLBuffer* buffer) |
| +void WebGLRenderingContextBase::bindBuffer(GLenum target, WebGLBuffer* buffer) |
| { |
| bool deleted; |
| if (!checkObjectToBeBound("bindBuffer", buffer, deleted)) |
| @@ -1076,7 +996,7 @@ void WebGLRenderingContext::bindBuffer(GLenum target, WebGLBuffer* buffer) |
| buffer->setTarget(target); |
| } |
| -void WebGLRenderingContext::bindFramebuffer(GLenum target, WebGLFramebuffer* buffer) |
| +void WebGLRenderingContextBase::bindFramebuffer(GLenum target, WebGLFramebuffer* buffer) |
| { |
| bool deleted; |
| if (!checkObjectToBeBound("bindFramebuffer", buffer, deleted)) |
| @@ -1099,7 +1019,7 @@ void WebGLRenderingContext::bindFramebuffer(GLenum target, WebGLFramebuffer* buf |
| applyStencilTest(); |
| } |
| -void WebGLRenderingContext::bindRenderbuffer(GLenum target, WebGLRenderbuffer* renderBuffer) |
| +void WebGLRenderingContextBase::bindRenderbuffer(GLenum target, WebGLRenderbuffer* renderBuffer) |
| { |
| bool deleted; |
| if (!checkObjectToBeBound("bindRenderbuffer", renderBuffer, deleted)) |
| @@ -1116,7 +1036,7 @@ void WebGLRenderingContext::bindRenderbuffer(GLenum target, WebGLRenderbuffer* r |
| renderBuffer->setHasEverBeenBound(); |
| } |
| -void WebGLRenderingContext::bindTexture(GLenum target, WebGLTexture* texture) |
| +void WebGLRenderingContextBase::bindTexture(GLenum target, WebGLTexture* texture) |
| { |
| bool deleted; |
| if (!checkObjectToBeBound("bindTexture", texture, deleted)) |
| @@ -1165,21 +1085,21 @@ void WebGLRenderingContext::bindTexture(GLenum target, WebGLTexture* texture) |
| } |
| -void WebGLRenderingContext::blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) |
| +void WebGLRenderingContextBase::blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) |
| { |
| if (isContextLost()) |
| return; |
| m_context->blendColor(red, green, blue, alpha); |
| } |
| -void WebGLRenderingContext::blendEquation(GLenum mode) |
| +void WebGLRenderingContextBase::blendEquation(GLenum mode) |
| { |
| if (isContextLost() || !validateBlendEquation("blendEquation", mode)) |
| return; |
| m_context->blendEquation(mode); |
| } |
| -void WebGLRenderingContext::blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) |
| +void WebGLRenderingContextBase::blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) |
| { |
| if (isContextLost() || !validateBlendEquation("blendEquationSeparate", modeRGB) || !validateBlendEquation("blendEquationSeparate", modeAlpha)) |
| return; |
| @@ -1187,14 +1107,14 @@ void WebGLRenderingContext::blendEquationSeparate(GLenum modeRGB, GLenum modeAlp |
| } |
| -void WebGLRenderingContext::blendFunc(GLenum sfactor, GLenum dfactor) |
| +void WebGLRenderingContextBase::blendFunc(GLenum sfactor, GLenum dfactor) |
| { |
| if (isContextLost() || !validateBlendFuncFactors("blendFunc", sfactor, dfactor)) |
| return; |
| m_context->blendFunc(sfactor, dfactor); |
| } |
| -void WebGLRenderingContext::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
| +void WebGLRenderingContextBase::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
| { |
| // Note: Alpha does not have the same restrictions as RGB. |
| if (isContextLost() || !validateBlendFuncFactors("blendFuncSeparate", srcRGB, dstRGB)) |
| @@ -1202,7 +1122,7 @@ void WebGLRenderingContext::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLen |
| m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
| } |
| -void WebGLRenderingContext::bufferData(GLenum target, long long size, GLenum usage) |
| +void WebGLRenderingContextBase::bufferData(GLenum target, long long size, GLenum usage) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1221,7 +1141,7 @@ void WebGLRenderingContext::bufferData(GLenum target, long long size, GLenum usa |
| m_context->bufferData(target, static_cast<GLsizeiptr>(size), 0, usage); |
| } |
| -void WebGLRenderingContext::bufferData(GLenum target, ArrayBuffer* data, GLenum usage) |
| +void WebGLRenderingContextBase::bufferData(GLenum target, ArrayBuffer* data, GLenum usage) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1235,7 +1155,7 @@ void WebGLRenderingContext::bufferData(GLenum target, ArrayBuffer* data, GLenum |
| m_context->bufferData(target, data->byteLength(), data->data(), usage); |
| } |
| -void WebGLRenderingContext::bufferData(GLenum target, ArrayBufferView* data, GLenum usage) |
| +void WebGLRenderingContextBase::bufferData(GLenum target, ArrayBufferView* data, GLenum usage) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1250,7 +1170,7 @@ void WebGLRenderingContext::bufferData(GLenum target, ArrayBufferView* data, GLe |
| m_context->bufferData(target, data->byteLength(), data->baseAddress(), usage); |
| } |
| -void WebGLRenderingContext::bufferSubData(GLenum target, long long offset, ArrayBuffer* data) |
| +void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, ArrayBuffer* data) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1267,7 +1187,7 @@ void WebGLRenderingContext::bufferSubData(GLenum target, long long offset, Array |
| m_context->bufferSubData(target, static_cast<GLintptr>(offset), data->byteLength(), data->data()); |
| } |
| -void WebGLRenderingContext::bufferSubData(GLenum target, long long offset, ArrayBufferView* data) |
| +void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, ArrayBufferView* data) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1284,7 +1204,7 @@ void WebGLRenderingContext::bufferSubData(GLenum target, long long offset, Array |
| m_context->bufferSubData(target, static_cast<GLintptr>(offset), data->byteLength(), data->baseAddress()); |
| } |
| -GLenum WebGLRenderingContext::checkFramebufferStatus(GLenum target) |
| +GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) |
| { |
| if (isContextLost()) |
| return GL_FRAMEBUFFER_UNSUPPORTED; |
| @@ -1304,7 +1224,7 @@ GLenum WebGLRenderingContext::checkFramebufferStatus(GLenum target) |
| return result; |
| } |
| -void WebGLRenderingContext::clear(GLbitfield mask) |
| +void WebGLRenderingContextBase::clear(GLbitfield mask) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1322,7 +1242,7 @@ void WebGLRenderingContext::clear(GLbitfield mask) |
| markContextChanged(); |
| } |
| -void WebGLRenderingContext::clearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) |
| +void WebGLRenderingContextBase::clearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1341,7 +1261,7 @@ void WebGLRenderingContext::clearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat |
| m_context->clearColor(r, g, b, a); |
| } |
| -void WebGLRenderingContext::clearDepth(GLfloat depth) |
| +void WebGLRenderingContextBase::clearDepth(GLfloat depth) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1349,7 +1269,7 @@ void WebGLRenderingContext::clearDepth(GLfloat depth) |
| m_context->clearDepth(depth); |
| } |
| -void WebGLRenderingContext::clearStencil(GLint s) |
| +void WebGLRenderingContextBase::clearStencil(GLint s) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1357,7 +1277,7 @@ void WebGLRenderingContext::clearStencil(GLint s) |
| m_context->clearStencil(s); |
| } |
| -void WebGLRenderingContext::colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
| +void WebGLRenderingContextBase::colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1368,14 +1288,14 @@ void WebGLRenderingContext::colorMask(GLboolean red, GLboolean green, GLboolean |
| 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(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBufferView* data) |
| +void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBufferView* data) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1409,7 +1329,7 @@ void WebGLRenderingContext::compressedTexImage2D(GLenum target, GLint level, GLe |
| tex->setLevelInfo(target, level, internalformat, width, height, GL_UNSIGNED_BYTE); |
| } |
| -void WebGLRenderingContext::compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* data) |
| +void WebGLRenderingContextBase::compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* data) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1438,7 +1358,7 @@ void WebGLRenderingContext::compressedTexSubImage2D(GLenum target, GLint level, |
| width, height, format, data->byteLength(), data->baseAddress()); |
| } |
| -bool WebGLRenderingContext::validateSettableTexFormat(const char* functionName, GLenum format) |
| +bool WebGLRenderingContextBase::validateSettableTexFormat(const char* functionName, GLenum format) |
| { |
| if (WebGLImageConversion::getClearBitsByFormat(format) & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) { |
| synthesizeGLError(GL_INVALID_OPERATION, functionName, "format can not be set, only rendered to"); |
| @@ -1447,7 +1367,7 @@ bool WebGLRenderingContext::validateSettableTexFormat(const char* functionName, |
| return true; |
| } |
| -void WebGLRenderingContext::copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
| +void WebGLRenderingContextBase::copyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1478,7 +1398,7 @@ void WebGLRenderingContext::copyTexImage2D(GLenum target, GLint level, GLenum in |
| tex->setLevelInfo(target, level, internalformat, width, height, GL_UNSIGNED_BYTE); |
| } |
| -void WebGLRenderingContext::copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| +void WebGLRenderingContextBase::copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1519,7 +1439,7 @@ void WebGLRenderingContext::copyTexSubImage2D(GLenum target, GLint level, GLint |
| m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); |
| } |
| -PassRefPtr<WebGLBuffer> WebGLRenderingContext::createBuffer() |
| +PassRefPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -1528,7 +1448,7 @@ PassRefPtr<WebGLBuffer> WebGLRenderingContext::createBuffer() |
| return o; |
| } |
| -PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer() |
| +PassRefPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer() |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -1537,7 +1457,7 @@ PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer() |
| return o; |
| } |
| -PassRefPtr<WebGLTexture> WebGLRenderingContext::createTexture() |
| +PassRefPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -1546,7 +1466,7 @@ PassRefPtr<WebGLTexture> WebGLRenderingContext::createTexture() |
| return o; |
| } |
| -PassRefPtr<WebGLProgram> WebGLRenderingContext::createProgram() |
| +PassRefPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -1555,7 +1475,7 @@ PassRefPtr<WebGLProgram> WebGLRenderingContext::createProgram() |
| return o; |
| } |
| -PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::createRenderbuffer() |
| +PassRefPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer() |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -1564,7 +1484,7 @@ PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::createRenderbuffer() |
| return o; |
| } |
| -WebGLRenderbuffer* WebGLRenderingContext::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) |
| +WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -1576,7 +1496,7 @@ WebGLRenderbuffer* WebGLRenderingContext::ensureEmulatedStencilBuffer(GLenum tar |
| return renderbuffer->emulatedStencilBuffer(); |
| } |
| -PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GLenum type) |
| +PassRefPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type) |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -1590,7 +1510,7 @@ PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GLenum type) |
| return o; |
| } |
| -void WebGLRenderingContext::cullFace(GLenum mode) |
| +void WebGLRenderingContextBase::cullFace(GLenum mode) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1606,7 +1526,7 @@ void WebGLRenderingContext::cullFace(GLenum mode) |
| m_context->cullFace(mode); |
| } |
| -bool WebGLRenderingContext::deleteObject(WebGLObject* object) |
| +bool WebGLRenderingContextBase::deleteObject(WebGLObject* object) |
| { |
| if (isContextLost() || !object) |
| return false; |
| @@ -1622,7 +1542,7 @@ bool WebGLRenderingContext::deleteObject(WebGLObject* object) |
| return true; |
| } |
| -void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer) |
| +void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) |
| { |
| if (!deleteObject(buffer)) |
| return; |
| @@ -1632,7 +1552,7 @@ void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer) |
| m_boundVertexArrayObject->unbindBuffer(buffer); |
| } |
| -void WebGLRenderingContext::deleteFramebuffer(WebGLFramebuffer* framebuffer) |
| +void WebGLRenderingContextBase::deleteFramebuffer(WebGLFramebuffer* framebuffer) |
| { |
| if (!deleteObject(framebuffer)) |
| return; |
| @@ -1644,14 +1564,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; |
| @@ -1661,12 +1581,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; |
| @@ -1693,7 +1613,7 @@ void WebGLRenderingContext::deleteTexture(WebGLTexture* texture) |
| } |
| } |
| -void WebGLRenderingContext::depthFunc(GLenum func) |
| +void WebGLRenderingContextBase::depthFunc(GLenum func) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1702,7 +1622,7 @@ void WebGLRenderingContext::depthFunc(GLenum func) |
| m_context->depthFunc(func); |
| } |
| -void WebGLRenderingContext::depthMask(GLboolean flag) |
| +void WebGLRenderingContextBase::depthMask(GLboolean flag) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1710,7 +1630,7 @@ void WebGLRenderingContext::depthMask(GLboolean flag) |
| m_context->depthMask(flag); |
| } |
| -void WebGLRenderingContext::depthRange(GLfloat zNear, GLfloat zFar) |
| +void WebGLRenderingContextBase::depthRange(GLfloat zNear, GLfloat zFar) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1721,7 +1641,7 @@ void WebGLRenderingContext::depthRange(GLfloat zNear, GLfloat 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; |
| @@ -1733,7 +1653,7 @@ void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* sha |
| shader->onDetached(m_context.get()); |
| } |
| -void WebGLRenderingContext::disable(GLenum cap) |
| +void WebGLRenderingContextBase::disable(GLenum cap) |
| { |
| if (isContextLost() || !validateCapability("disable", cap)) |
| return; |
| @@ -1749,7 +1669,7 @@ void WebGLRenderingContext::disable(GLenum cap) |
| m_context->disable(cap); |
| } |
| -void WebGLRenderingContext::disableVertexAttribArray(GLuint index) |
| +void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1769,7 +1689,7 @@ void WebGLRenderingContext::disableVertexAttribArray(GLuint index) |
| m_context->disableVertexAttribArray(index); |
| } |
| -bool WebGLRenderingContext::validateRenderingState(const char* functionName) |
| +bool WebGLRenderingContextBase::validateRenderingState(const char* functionName) |
| { |
| if (!m_currentProgram) { |
| synthesizeGLError(GL_INVALID_OPERATION, functionName, "no valid shader program in use"); |
| @@ -1789,7 +1709,7 @@ bool WebGLRenderingContext::validateRenderingState(const char* functionName) |
| return true; |
| } |
| -bool WebGLRenderingContext::validateWebGLObject(const char* functionName, WebGLObject* object) |
| +bool WebGLRenderingContextBase::validateWebGLObject(const char* functionName, WebGLObject* object) |
| { |
| if (!object || !object->object()) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no object or object deleted"); |
| @@ -1802,7 +1722,7 @@ bool WebGLRenderingContext::validateWebGLObject(const char* functionName, WebGLO |
| return true; |
| } |
| -void WebGLRenderingContext::drawArrays(GLenum mode, GLint first, GLsizei count) |
| +void WebGLRenderingContextBase::drawArrays(GLenum mode, GLint first, GLsizei count) |
| { |
| if (!validateDrawArrays("drawArrays", mode, first, count)) |
| return; |
| @@ -1815,7 +1735,7 @@ void WebGLRenderingContext::drawArrays(GLenum mode, GLint first, GLsizei count) |
| markContextChanged(); |
| } |
| -void WebGLRenderingContext::drawElements(GLenum mode, GLsizei count, GLenum type, long long offset) |
| +void WebGLRenderingContextBase::drawElements(GLenum mode, GLsizei count, GLenum type, long long offset) |
| { |
| if (!validateDrawElements("drawElements", mode, count, type, offset)) |
| return; |
| @@ -1828,7 +1748,7 @@ void WebGLRenderingContext::drawElements(GLenum mode, GLsizei count, GLenum type |
| markContextChanged(); |
| } |
| -void WebGLRenderingContext::drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) |
| +void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) |
| { |
| if (!validateDrawArrays("drawArraysInstancedANGLE", mode, first, count)) |
| return; |
| @@ -1844,7 +1764,7 @@ void WebGLRenderingContext::drawArraysInstancedANGLE(GLenum mode, GLint first, G |
| markContextChanged(); |
| } |
| -void WebGLRenderingContext::drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount) |
| +void WebGLRenderingContextBase::drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount) |
| { |
| if (!validateDrawElements("drawElementsInstancedANGLE", mode, count, type, offset)) |
| return; |
| @@ -1860,7 +1780,7 @@ void WebGLRenderingContext::drawElementsInstancedANGLE(GLenum mode, GLsizei coun |
| markContextChanged(); |
| } |
| -void WebGLRenderingContext::enable(GLenum cap) |
| +void WebGLRenderingContextBase::enable(GLenum cap) |
| { |
| if (isContextLost() || !validateCapability("enable", cap)) |
| return; |
| @@ -1876,7 +1796,7 @@ void WebGLRenderingContext::enable(GLenum cap) |
| m_context->enable(cap); |
| } |
| -void WebGLRenderingContext::enableVertexAttribArray(GLuint index) |
| +void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) |
| { |
| if (isContextLost()) |
| return; |
| @@ -1893,21 +1813,21 @@ void WebGLRenderingContext::enableVertexAttribArray(GLuint 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(GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer* buffer) |
| +void WebGLRenderingContextBase::framebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, WebGLRenderbuffer* buffer) |
| { |
| if (isContextLost() || !validateFramebufferFuncParameters("framebufferRenderbuffer", target, attachment)) |
| return; |
| @@ -1949,7 +1869,7 @@ void WebGLRenderingContext::framebufferRenderbuffer(GLenum target, GLenum attach |
| applyStencilTest(); |
| } |
| -void WebGLRenderingContext::framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, WebGLTexture* texture, GLint level) |
| +void WebGLRenderingContextBase::framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, WebGLTexture* texture, GLint level) |
| { |
| if (isContextLost() || !validateFramebufferFuncParameters("framebufferTexture2D", target, attachment)) |
| return; |
| @@ -1987,7 +1907,7 @@ void WebGLRenderingContext::framebufferTexture2D(GLenum target, GLenum attachmen |
| applyStencilTest(); |
| } |
| -void WebGLRenderingContext::frontFace(GLenum mode) |
| +void WebGLRenderingContextBase::frontFace(GLenum mode) |
| { |
| if (isContextLost()) |
| return; |
| @@ -2002,7 +1922,7 @@ void WebGLRenderingContext::frontFace(GLenum mode) |
| m_context->frontFace(mode); |
| } |
| -void WebGLRenderingContext::generateMipmap(GLenum target) |
| +void WebGLRenderingContextBase::generateMipmap(GLenum target) |
| { |
| if (isContextLost()) |
| return; |
| @@ -2033,7 +1953,7 @@ void WebGLRenderingContext::generateMipmap(GLenum target) |
| tex->generateMipmapLevelInfo(); |
| } |
| -PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram* program, GLuint index) |
| +PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* program, GLuint index) |
| { |
| if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) |
| return 0; |
| @@ -2043,7 +1963,7 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram* |
| return WebGLActiveInfo::create(info.name, info.type, info.size); |
| } |
| -PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram* program, GLuint index) |
| +PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLProgram* program, GLuint index) |
| { |
| if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) |
| return 0; |
| @@ -2053,7 +1973,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)) |
| @@ -2071,7 +1991,7 @@ bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<Ref |
| return true; |
| } |
| -GLint WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String& name) |
| +GLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const String& name) |
| { |
| if (isContextLost() || !validateWebGLObject("getAttribLocation", program)) |
| return -1; |
| @@ -2088,7 +2008,7 @@ GLint WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const Stri |
| return m_context->getAttribLocation(objectOrZero(program), name.utf8().data()); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getBufferParameter(GLenum target, GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getBufferParameter(GLenum target, GLenum pname) |
| { |
| if (isContextLost()) |
| return WebGLGetInfo(); |
| @@ -2109,7 +2029,7 @@ WebGLGetInfo WebGLRenderingContext::getBufferParameter(GLenum target, GLenum pna |
| return WebGLGetInfo(static_cast<unsigned>(value)); |
| } |
| -PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes() |
| +PassRefPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes() |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -2127,7 +2047,7 @@ PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes() |
| return attributes.release(); |
| } |
| -GLenum WebGLRenderingContext::getError() |
| +GLenum WebGLRenderingContextBase::getError() |
| { |
| if (m_lostContextErrors.size()) { |
| GLenum err = m_lostContextErrors.first(); |
| @@ -2141,7 +2061,7 @@ GLenum 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* const unprefixed[] = { "", 0, }; |
| @@ -2155,7 +2075,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; |
| @@ -2171,14 +2091,18 @@ PassRefPtr<WebGLExtension> WebGLRenderingContext::getExtension(const String& nam |
| return 0; |
| if (!tracker->supported(this)) |
| return 0; |
| - return tracker->getExtension(this); |
| + |
| + RefPtr<WebGLExtension> extension = tracker->getExtension(this); |
| + if (extension) |
| + m_extensionEnabled[extension->name()] = true; |
| + return extension.release(); |
| } |
| } |
| return 0; |
| } |
| -WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname) |
| { |
| if (isContextLost() || !validateFramebufferFuncParameters("getFramebufferAttachmentParameter", target, attachment)) |
| return WebGLGetInfo(); |
| @@ -2229,7 +2153,7 @@ WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GLenum tar |
| } |
| } |
| -WebGLGetInfo WebGLRenderingContext::getParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname) |
| { |
| if (isContextLost()) |
| return WebGLGetInfo(); |
| @@ -2413,22 +2337,22 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GLenum pname) |
| case GL_VIEWPORT: |
| return getWebGLIntArrayParameter(pname); |
| case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives |
| - if (m_oesStandardDerivatives) |
| + if (extensionEnabled(OESStandardDerivativesName)) |
| return getUnsignedIntParameter(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, OES_standard_derivatives not enabled"); |
| return WebGLGetInfo(); |
| case WebGLDebugRendererInfo::UNMASKED_RENDERER_WEBGL: |
| - if (m_webglDebugRendererInfo) |
| + if (extensionEnabled(WebGLDebugRendererInfoName)) |
| return WebGLGetInfo(m_context->getString(GL_RENDERER)); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_debug_renderer_info not enabled"); |
| return WebGLGetInfo(); |
| case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: |
| - if (m_webglDebugRendererInfo) |
| + if (extensionEnabled(WebGLDebugRendererInfoName)) |
| return WebGLGetInfo(m_context->getString(GL_VENDOR)); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_debug_renderer_info not enabled"); |
| return WebGLGetInfo(); |
| case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object |
| - if (m_oesVertexArrayObject) { |
| + if (extensionEnabled(OESVertexArrayObjectName)) { |
| if (!m_boundVertexArrayObject->isDefaultObject()) |
| return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>(m_boundVertexArrayObject)); |
| return WebGLGetInfo(); |
| @@ -2436,22 +2360,22 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GLenum pname) |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, OES_vertex_array_object not enabled"); |
| return WebGLGetInfo(); |
| case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| - if (m_extTextureFilterAnisotropic) |
| + if (extensionEnabled(EXTTextureFilterAnisotropicName)) |
| return getUnsignedIntParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled"); |
| return WebGLGetInfo(); |
| case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN |
| - if (m_webglDrawBuffers) |
| + if (extensionEnabled(WebGLDrawBuffersName)) |
| return WebGLGetInfo(maxColorAttachments()); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_draw_buffers not enabled"); |
| return WebGLGetInfo(); |
| case GL_MAX_DRAW_BUFFERS_EXT: |
| - if (m_webglDrawBuffers) |
| + if (extensionEnabled(WebGLDrawBuffersName)) |
| return WebGLGetInfo(maxDrawBuffers()); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_draw_buffers not enabled"); |
| return WebGLGetInfo(); |
| default: |
| - if (m_webglDrawBuffers |
| + if (extensionEnabled(WebGLDrawBuffersName) |
| && pname >= GL_DRAW_BUFFER0_EXT |
| && pname < static_cast<GLenum>(GL_DRAW_BUFFER0_EXT + maxDrawBuffers())) { |
| GLint value = GL_NONE; |
| @@ -2466,7 +2390,7 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GLenum pname) |
| } |
| } |
| -WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getProgramParameter(WebGLProgram* program, GLenum pname) |
| { |
| if (isContextLost() || !validateWebGLObject("getProgramParameter", program)) |
| return WebGLGetInfo(); |
| @@ -2491,7 +2415,7 @@ WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, G |
| } |
| } |
| -String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program) |
| +String WebGLRenderingContextBase::getProgramInfoLog(WebGLProgram* program) |
| { |
| if (isContextLost()) |
| return String(); |
| @@ -2500,7 +2424,7 @@ String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program) |
| return ensureNotNull(m_context->getProgramInfoLog(objectOrZero(program))); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GLenum target, GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getRenderbufferParameter(GLenum target, GLenum pname) |
| { |
| if (isContextLost()) |
| return WebGLGetInfo(); |
| @@ -2541,7 +2465,7 @@ WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GLenum target, GLen |
| } |
| } |
| -WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getShaderParameter(WebGLShader* shader, GLenum pname) |
| { |
| if (isContextLost() || !validateWebGLObject("getShaderParameter", shader)) |
| return WebGLGetInfo(); |
| @@ -2561,7 +2485,7 @@ WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GLen |
| } |
| } |
| -String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader) |
| +String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) |
| { |
| if (isContextLost()) |
| return String(); |
| @@ -2570,7 +2494,7 @@ String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader) |
| return ensureNotNull(m_context->getShaderInfoLog(objectOrZero(shader))); |
| } |
| -PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContext::getShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) |
| +PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -2601,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(); |
| @@ -2610,7 +2534,7 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader) |
| return ensureNotNull(shader->source()); |
| } |
| -Vector<String> WebGLRenderingContext::getSupportedExtensions() |
| +Vector<String> WebGLRenderingContextBase::getSupportedExtensions() |
| { |
| Vector<String> result; |
| if (isContextLost()) |
| @@ -2631,7 +2555,7 @@ Vector<String> WebGLRenderingContext::getSupportedExtensions() |
| return result; |
| } |
| -WebGLGetInfo WebGLRenderingContext::getTexParameter(GLenum target, GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getTexParameter(GLenum target, GLenum pname) |
| { |
| if (isContextLost()) |
| return WebGLGetInfo(); |
| @@ -2647,7 +2571,7 @@ WebGLGetInfo WebGLRenderingContext::getTexParameter(GLenum target, GLenum pname) |
| m_context->getTexParameteriv(target, pname, &value); |
| return WebGLGetInfo(static_cast<unsigned>(value)); |
| case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| - if (m_extTextureFilterAnisotropic) { |
| + if (extensionEnabled(EXTTextureFilterAnisotropicName)) { |
| m_context->getTexParameteriv(target, pname, &value); |
| return WebGLGetInfo(static_cast<unsigned>(value)); |
| } |
| @@ -2659,7 +2583,7 @@ WebGLGetInfo WebGLRenderingContext::getTexParameter(GLenum target, GLenum pname) |
| } |
| } |
| -WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation) |
| +WebGLGetInfo WebGLRenderingContextBase::getUniform(WebGLProgram* program, const WebGLUniformLocation* uniformLocation) |
| { |
| if (isContextLost() || !validateWebGLObject("getUniform", program)) |
| return WebGLGetInfo(); |
| @@ -2804,7 +2728,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; |
| @@ -2824,7 +2748,7 @@ PassRefPtr<WebGLUniformLocation> WebGLRenderingContext::getUniformLocation(WebGL |
| return WebGLUniformLocation::create(program, uniformLocation); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GLuint index, GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getVertexAttrib(GLuint index, GLenum pname) |
| { |
| if (isContextLost()) |
| return WebGLGetInfo(); |
| @@ -2834,7 +2758,7 @@ WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GLuint index, GLenum pname) |
| } |
| const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); |
| - if (m_angleInstancedArrays && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) |
| + if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) |
| return WebGLGetInfo(state.divisor); |
| switch (pname) { |
| @@ -2860,7 +2784,7 @@ WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GLuint index, GLenum pname) |
| } |
| } |
| -long long WebGLRenderingContext::getVertexAttribOffset(GLuint index, GLenum pname) |
| +long long WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum pname) |
| { |
| if (isContextLost()) |
| return 0; |
| @@ -2872,7 +2796,7 @@ long long WebGLRenderingContext::getVertexAttribOffset(GLuint index, GLenum pnam |
| return static_cast<long long>(result); |
| } |
| -void WebGLRenderingContext::hint(GLenum target, GLenum mode) |
| +void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) |
| { |
| if (isContextLost()) |
| return; |
| @@ -2882,7 +2806,7 @@ void WebGLRenderingContext::hint(GLenum target, GLenum mode) |
| isValid = true; |
| break; |
| case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives |
| - if (m_oesStandardDerivatives) |
| + if (extensionEnabled(OESStandardDerivativesName)) |
| isValid = true; |
| break; |
| } |
| @@ -2893,7 +2817,7 @@ void WebGLRenderingContext::hint(GLenum target, GLenum mode) |
| m_context->hint(target, mode); |
| } |
| -GLboolean WebGLRenderingContext::isBuffer(WebGLBuffer* buffer) |
| +GLboolean WebGLRenderingContextBase::isBuffer(WebGLBuffer* buffer) |
| { |
| if (!buffer || isContextLost()) |
| return 0; |
| @@ -2904,12 +2828,12 @@ GLboolean WebGLRenderingContext::isBuffer(WebGLBuffer* buffer) |
| return m_context->isBuffer(buffer->object()); |
| } |
| -bool WebGLRenderingContext::isContextLost() |
| +bool WebGLRenderingContextBase::isContextLost() |
| { |
| return m_contextLost; |
| } |
| -GLboolean WebGLRenderingContext::isEnabled(GLenum cap) |
| +GLboolean WebGLRenderingContextBase::isEnabled(GLenum cap) |
| { |
| if (isContextLost() || !validateCapability("isEnabled", cap)) |
| return 0; |
| @@ -2918,7 +2842,7 @@ GLboolean WebGLRenderingContext::isEnabled(GLenum cap) |
| return m_context->isEnabled(cap); |
| } |
| -GLboolean WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer) |
| +GLboolean WebGLRenderingContextBase::isFramebuffer(WebGLFramebuffer* framebuffer) |
| { |
| if (!framebuffer || isContextLost()) |
| return 0; |
| @@ -2929,7 +2853,7 @@ GLboolean WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer) |
| return m_context->isFramebuffer(framebuffer->object()); |
| } |
| -GLboolean WebGLRenderingContext::isProgram(WebGLProgram* program) |
| +GLboolean WebGLRenderingContextBase::isProgram(WebGLProgram* program) |
| { |
| if (!program || isContextLost()) |
| return 0; |
| @@ -2937,7 +2861,7 @@ GLboolean WebGLRenderingContext::isProgram(WebGLProgram* program) |
| return m_context->isProgram(program->object()); |
| } |
| -GLboolean WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer) |
| +GLboolean WebGLRenderingContextBase::isRenderbuffer(WebGLRenderbuffer* renderbuffer) |
| { |
| if (!renderbuffer || isContextLost()) |
| return 0; |
| @@ -2948,7 +2872,7 @@ GLboolean WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer) |
| return m_context->isRenderbuffer(renderbuffer->object()); |
| } |
| -GLboolean WebGLRenderingContext::isShader(WebGLShader* shader) |
| +GLboolean WebGLRenderingContextBase::isShader(WebGLShader* shader) |
| { |
| if (!shader || isContextLost()) |
| return 0; |
| @@ -2956,7 +2880,7 @@ GLboolean WebGLRenderingContext::isShader(WebGLShader* shader) |
| return m_context->isShader(shader->object()); |
| } |
| -GLboolean WebGLRenderingContext::isTexture(WebGLTexture* texture) |
| +GLboolean WebGLRenderingContextBase::isTexture(WebGLTexture* texture) |
| { |
| if (!texture || isContextLost()) |
| return 0; |
| @@ -2967,14 +2891,14 @@ GLboolean WebGLRenderingContext::isTexture(WebGLTexture* texture) |
| return m_context->isTexture(texture->object()); |
| } |
| -void WebGLRenderingContext::lineWidth(GLfloat width) |
| +void WebGLRenderingContextBase::lineWidth(GLfloat width) |
| { |
| if (isContextLost()) |
| return; |
| m_context->lineWidth(width); |
| } |
| -void WebGLRenderingContext::linkProgram(WebGLProgram* program) |
| +void WebGLRenderingContextBase::linkProgram(WebGLProgram* program) |
| { |
| if (isContextLost() || !validateWebGLObject("linkProgram", program)) |
| return; |
| @@ -2983,7 +2907,7 @@ void WebGLRenderingContext::linkProgram(WebGLProgram* program) |
| program->increaseLinkCount(); |
| } |
| -void WebGLRenderingContext::pixelStorei(GLenum pname, GLint param) |
| +void WebGLRenderingContextBase::pixelStorei(GLenum pname, GLint param) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3023,14 +2947,14 @@ void WebGLRenderingContext::pixelStorei(GLenum pname, GLint param) |
| } |
| } |
| -void WebGLRenderingContext::polygonOffset(GLfloat factor, GLfloat units) |
| +void WebGLRenderingContextBase::polygonOffset(GLfloat factor, GLfloat units) |
| { |
| if (isContextLost()) |
| return; |
| m_context->polygonOffset(factor, units); |
| } |
| -void WebGLRenderingContext::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels) |
| +void WebGLRenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3112,7 +3036,7 @@ void WebGLRenderingContext::readPixels(GLint x, GLint y, GLsizei width, GLsizei |
| #endif |
| } |
| -void WebGLRenderingContext::renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) |
| +void WebGLRenderingContextBase::renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3163,14 +3087,14 @@ void WebGLRenderingContext::renderbufferStorage(GLenum target, GLenum internalfo |
| applyStencilTest(); |
| } |
| -void WebGLRenderingContext::sampleCoverage(GLfloat value, GLboolean invert) |
| +void WebGLRenderingContextBase::sampleCoverage(GLfloat value, GLboolean invert) |
| { |
| if (isContextLost()) |
| return; |
| m_context->sampleCoverage(value, invert); |
| } |
| -void WebGLRenderingContext::scissor(GLint x, GLint y, GLsizei width, GLsizei height) |
| +void WebGLRenderingContextBase::scissor(GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3179,7 +3103,7 @@ void WebGLRenderingContext::scissor(GLint x, GLint y, GLsizei width, GLsizei hei |
| 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; |
| @@ -3190,7 +3114,7 @@ void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& stri |
| m_context->shaderSource(objectOrZero(shader), stringWithoutComments.utf8().data()); |
| } |
| -void WebGLRenderingContext::stencilFunc(GLenum func, GLint ref, GLuint mask) |
| +void WebGLRenderingContextBase::stencilFunc(GLenum func, GLint ref, GLuint mask) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3203,7 +3127,7 @@ void WebGLRenderingContext::stencilFunc(GLenum func, GLint ref, GLuint mask) |
| m_context->stencilFunc(func, ref, mask); |
| } |
| -void WebGLRenderingContext::stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) |
| +void WebGLRenderingContextBase::stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3231,7 +3155,7 @@ void WebGLRenderingContext::stencilFuncSeparate(GLenum face, GLenum func, GLint |
| m_context->stencilFuncSeparate(face, func, ref, mask); |
| } |
| -void WebGLRenderingContext::stencilMask(GLuint mask) |
| +void WebGLRenderingContextBase::stencilMask(GLuint mask) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3240,7 +3164,7 @@ void WebGLRenderingContext::stencilMask(GLuint mask) |
| m_context->stencilMask(mask); |
| } |
| -void WebGLRenderingContext::stencilMaskSeparate(GLenum face, GLuint mask) |
| +void WebGLRenderingContextBase::stencilMaskSeparate(GLenum face, GLuint mask) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3262,21 +3186,21 @@ void WebGLRenderingContext::stencilMaskSeparate(GLenum face, GLuint mask) |
| m_context->stencilMaskSeparate(face, mask); |
| } |
| -void WebGLRenderingContext::stencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
| +void WebGLRenderingContextBase::stencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
| { |
| if (isContextLost()) |
| return; |
| m_context->stencilOp(fail, zfail, zpass); |
| } |
| -void WebGLRenderingContext::stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
| +void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
| { |
| if (isContextLost()) |
| return; |
| m_context->stencilOpSeparate(face, fail, zfail, zpass); |
| } |
| -GLenum WebGLRenderingContext::convertTexInternalFormat(GLenum internalformat, GLenum type) |
| +GLenum WebGLRenderingContextBase::convertTexInternalFormat(GLenum internalformat, GLenum type) |
| { |
| // Convert to sized internal formats that are renderable with GL_CHROMIUM_color_buffer_float_rgb(a). |
| if (type == GL_FLOAT && internalformat == GL_RGBA |
| @@ -3288,7 +3212,7 @@ GLenum WebGLRenderingContext::convertTexInternalFormat(GLenum internalformat, GL |
| return internalformat; |
| } |
| -void WebGLRenderingContext::texImage2DBase(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels, ExceptionState& exceptionState) |
| +void WebGLRenderingContextBase::texImage2DBase(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels, ExceptionState& exceptionState) |
| { |
| // All calling functions check isContextLost, so a duplicate check is not needed here. |
| // FIXME: Handle errors. |
| @@ -3301,7 +3225,7 @@ void WebGLRenderingContext::texImage2DBase(GLenum target, GLint level, GLenum in |
| tex->setLevelInfo(target, level, internalformat, width, height, type); |
| } |
| -void WebGLRenderingContext::texImage2DImpl(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, Image* image, WebGLImageConversion::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& exceptionState) |
| +void WebGLRenderingContextBase::texImage2DImpl(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, Image* image, WebGLImageConversion::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& exceptionState) |
| { |
| // All calling functions check isContextLost, so a duplicate check is not needed here. |
| Vector<uint8_t> data; |
| @@ -3331,7 +3255,7 @@ void WebGLRenderingContext::texImage2DImpl(GLenum target, GLint level, GLenum in |
| m_context->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| } |
| -bool WebGLRenderingContext::validateTexFunc(const char* functionName, TexFuncValidationFunctionType functionType, TexFuncValidationSourceType sourceType, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint xoffset, GLint yoffset) |
| +bool WebGLRenderingContextBase::validateTexFunc(const char* functionName, TexFuncValidationFunctionType functionType, TexFuncValidationSourceType sourceType, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint xoffset, GLint yoffset) |
| { |
| if (!validateTexFuncParameters(functionName, functionType, target, level, internalformat, width, height, border, format, type)) |
| return false; |
| @@ -3374,7 +3298,7 @@ bool WebGLRenderingContext::validateTexFunc(const char* functionName, TexFuncVal |
| return true; |
| } |
| -PassRefPtr<Image> WebGLRenderingContext::drawImageIntoBuffer(Image* image, int width, int height) |
| +PassRefPtr<Image> WebGLRenderingContextBase::drawImageIntoBuffer(Image* image, int width, int height) |
| { |
| IntSize size(width, height); |
| ImageBuffer* buf = m_generatedImageCache.imageBuffer(size); |
| @@ -3389,7 +3313,7 @@ PassRefPtr<Image> WebGLRenderingContext::drawImageIntoBuffer(Image* image, int w |
| return buf->copyImage(ImageBuffer::fastCopyImageMode()); |
| } |
| -void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| +void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| GLsizei width, GLsizei height, GLint border, |
| GLenum format, GLenum type, ArrayBufferView* pixels, ExceptionState& exceptionState) |
| { |
| @@ -3412,7 +3336,7 @@ void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum intern |
| m_context->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| } |
| -void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| +void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| GLenum format, GLenum type, ImageData* pixels, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !pixels || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceImageData, target, level, internalformat, pixels->width(), pixels->height(), 0, format, type, 0, 0)) |
| @@ -3436,7 +3360,7 @@ void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum intern |
| m_context->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| } |
| -void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| +void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| GLenum format, GLenum type, HTMLImageElement* image, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !validateHTMLImageElement("texImage2D", image, exceptionState)) |
| @@ -3452,7 +3376,7 @@ void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum intern |
| texImage2DImpl(target, level, internalformat, format, type, imageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState); |
| } |
| -void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| +void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !validateHTMLCanvasElement("texImage2D", canvas, exceptionState) || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLCanvasElement, target, level, internalformat, canvas->width(), canvas->height(), 0, format, type, 0, 0)) |
| @@ -3470,7 +3394,7 @@ void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum intern |
| return; |
| } |
| } else { |
| - WebGLRenderingContext* gl = toWebGLRenderingContext(canvas->renderingContext()); |
| + WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->renderingContext()); |
| if (gl && gl->m_drawingBuffer->copyToPlatformTexture(m_context.get(), texture->object(), internalformat, type, |
| level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |
| texture->setLevelInfo(target, level, internalformat, canvas->width(), canvas->height(), type); |
| @@ -3486,7 +3410,7 @@ void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum intern |
| texImage2DImpl(target, level, internalformat, format, type, canvas->copiedImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState); |
| } |
| -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_generatedImageCache.imageBuffer(size); |
| @@ -3500,7 +3424,7 @@ PassRefPtr<Image> WebGLRenderingContext::videoFrameToImage(HTMLVideoElement* vid |
| return buf->copyImage(backingStoreCopy); |
| } |
| -void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| +void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum internalformat, |
| GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, exceptionState) |
| @@ -3524,7 +3448,7 @@ void WebGLRenderingContext::texImage2D(GLenum target, GLint level, GLenum intern |
| texImage2DImpl(target, level, internalformat, format, type, image.get(), WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState); |
| } |
| -void WebGLRenderingContext::texParameter(GLenum target, GLenum pname, GLfloat paramf, GLint parami, bool isFloat) |
| +void WebGLRenderingContextBase::texParameter(GLenum target, GLenum pname, GLfloat paramf, GLint parami, bool isFloat) |
| { |
| if (isContextLost()) |
| return; |
| @@ -3544,7 +3468,7 @@ void WebGLRenderingContext::texParameter(GLenum target, GLenum pname, GLfloat pa |
| } |
| break; |
| case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| - if (!m_extTextureFilterAnisotropic) { |
| + if (!extensionEnabled(EXTTextureFilterAnisotropicName)) { |
| synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid parameter, EXT_texture_filter_anisotropic not enabled"); |
| return; |
| } |
| @@ -3562,17 +3486,17 @@ void WebGLRenderingContext::texParameter(GLenum target, GLenum pname, GLfloat pa |
| } |
| } |
| -void WebGLRenderingContext::texParameterf(GLenum target, GLenum pname, GLfloat param) |
| +void WebGLRenderingContextBase::texParameterf(GLenum target, GLenum pname, GLfloat param) |
| { |
| texParameter(target, pname, param, 0, true); |
| } |
| -void WebGLRenderingContext::texParameteri(GLenum target, GLenum pname, GLint param) |
| +void WebGLRenderingContextBase::texParameteri(GLenum target, GLenum pname, GLint param) |
| { |
| texParameter(target, pname, 0, param, false); |
| } |
| -void WebGLRenderingContext::texSubImage2DBase(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels, ExceptionState& exceptionState) |
| +void WebGLRenderingContextBase::texSubImage2DBase(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels, ExceptionState& exceptionState) |
| { |
| // FIXME: Handle errors. |
| ASSERT(!isContextLost()); |
| @@ -3593,7 +3517,7 @@ void WebGLRenderingContext::texSubImage2DBase(GLenum target, GLint level, GLint |
| m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); |
| } |
| -void WebGLRenderingContext::texSubImage2DImpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, Image* image, WebGLImageConversion::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& exceptionState) |
| +void WebGLRenderingContextBase::texSubImage2DImpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, Image* image, WebGLImageConversion::ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha, ExceptionState& exceptionState) |
| { |
| // All calling functions check isContextLost, so a duplicate check is not needed here. |
| Vector<uint8_t> data; |
| @@ -3623,7 +3547,7 @@ void WebGLRenderingContext::texSubImage2DImpl(GLenum target, GLint level, GLint |
| m_context->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| } |
| -void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| +void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| GLsizei width, GLsizei height, |
| GLenum format, GLenum type, ArrayBufferView* pixels, ExceptionState& exceptionState) |
| { |
| @@ -3650,7 +3574,7 @@ void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoff |
| m_context->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| } |
| -void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| +void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| GLenum format, GLenum type, ImageData* pixels, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !pixels || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceImageData, target, level, format, pixels->width(), pixels->height(), 0, format, type, xoffset, yoffset)) |
| @@ -3675,7 +3599,7 @@ void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoff |
| m_context->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| } |
| -void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| +void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| GLenum format, GLenum type, HTMLImageElement* image, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !validateHTMLImageElement("texSubImage2D", image, exceptionState)) |
| @@ -3691,7 +3615,7 @@ void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoff |
| texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRender.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState); |
| } |
| -void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| +void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, exceptionState) |
| @@ -3705,7 +3629,7 @@ void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoff |
| texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas->copiedImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState); |
| } |
| -void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| +void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, |
| GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exceptionState) |
| { |
| if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, exceptionState) |
| @@ -3718,7 +3642,7 @@ void WebGLRenderingContext::texSubImage2D(GLenum target, GLint level, GLint xoff |
| texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), WebGLImageConversion::HtmlDomVideo, m_unpackFlipY, m_unpackPremultiplyAlpha, exceptionState); |
| } |
| -void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GLfloat x) |
| +void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, GLfloat x) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3731,7 +3655,7 @@ void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GLfl |
| 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; |
| @@ -3739,7 +3663,7 @@ void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, Flo |
| m_context->uniform1fv(location->location(), v->length(), v->data()); |
| } |
| -void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform1fv", location, v, size, 1)) |
| return; |
| @@ -3747,7 +3671,7 @@ void WebGLRenderingContext::uniform1fv(const WebGLUniformLocation* location, GLf |
| m_context->uniform1fv(location->location(), size, v); |
| } |
| -void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, GLint x) |
| +void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GLint x) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3760,7 +3684,7 @@ void WebGLRenderingContext::uniform1i(const WebGLUniformLocation* location, GLin |
| 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; |
| @@ -3768,7 +3692,7 @@ void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, Int |
| m_context->uniform1iv(location->location(), v->length(), v->data()); |
| } |
| -void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform1iv", location, v, size, 1)) |
| return; |
| @@ -3776,7 +3700,7 @@ void WebGLRenderingContext::uniform1iv(const WebGLUniformLocation* location, GLi |
| m_context->uniform1iv(location->location(), size, v); |
| } |
| -void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, GLfloat x, GLfloat y) |
| +void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, GLfloat x, GLfloat y) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3789,7 +3713,7 @@ void WebGLRenderingContext::uniform2f(const WebGLUniformLocation* location, GLfl |
| 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; |
| @@ -3797,7 +3721,7 @@ void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, Flo |
| m_context->uniform2fv(location->location(), v->length() / 2, v->data()); |
| } |
| -void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform2fv", location, v, size, 2)) |
| return; |
| @@ -3805,7 +3729,7 @@ void WebGLRenderingContext::uniform2fv(const WebGLUniformLocation* location, GLf |
| m_context->uniform2fv(location->location(), size / 2, v); |
| } |
| -void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, GLint x, GLint y) |
| +void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, GLint x, GLint y) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3818,7 +3742,7 @@ void WebGLRenderingContext::uniform2i(const WebGLUniformLocation* location, GLin |
| 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; |
| @@ -3826,7 +3750,7 @@ void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, Int |
| m_context->uniform2iv(location->location(), v->length() / 2, v->data()); |
| } |
| -void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform2iv", location, v, size, 2)) |
| return; |
| @@ -3834,7 +3758,7 @@ void WebGLRenderingContext::uniform2iv(const WebGLUniformLocation* location, GLi |
| m_context->uniform2iv(location->location(), size / 2, v); |
| } |
| -void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, GLfloat x, GLfloat y, GLfloat z) |
| +void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, GLfloat x, GLfloat y, GLfloat z) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3847,7 +3771,7 @@ void WebGLRenderingContext::uniform3f(const WebGLUniformLocation* location, GLfl |
| 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; |
| @@ -3855,7 +3779,7 @@ void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, Flo |
| m_context->uniform3fv(location->location(), v->length() / 3, v->data()); |
| } |
| -void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform3fv", location, v, size, 3)) |
| return; |
| @@ -3863,7 +3787,7 @@ void WebGLRenderingContext::uniform3fv(const WebGLUniformLocation* location, GLf |
| m_context->uniform3fv(location->location(), size / 3, v); |
| } |
| -void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, GLint x, GLint y, GLint z) |
| +void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, GLint x, GLint y, GLint z) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3876,7 +3800,7 @@ void WebGLRenderingContext::uniform3i(const WebGLUniformLocation* location, GLin |
| 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; |
| @@ -3884,7 +3808,7 @@ void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, Int |
| m_context->uniform3iv(location->location(), v->length() / 3, v->data()); |
| } |
| -void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform3iv", location, v, size, 3)) |
| return; |
| @@ -3892,7 +3816,7 @@ void WebGLRenderingContext::uniform3iv(const WebGLUniformLocation* location, GLi |
| m_context->uniform3iv(location->location(), size / 3, v); |
| } |
| -void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| +void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3905,7 +3829,7 @@ void WebGLRenderingContext::uniform4f(const WebGLUniformLocation* location, GLfl |
| 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; |
| @@ -3913,7 +3837,7 @@ void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, Flo |
| m_context->uniform4fv(location->location(), v->length() / 4, v->data()); |
| } |
| -void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, GLfloat* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform4fv", location, v, size, 4)) |
| return; |
| @@ -3921,7 +3845,7 @@ void WebGLRenderingContext::uniform4fv(const WebGLUniformLocation* location, GLf |
| m_context->uniform4fv(location->location(), size / 4, v); |
| } |
| -void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, GLint x, GLint y, GLint z, GLint w) |
| +void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, GLint x, GLint y, GLint z, GLint w) |
| { |
| if (isContextLost() || !location) |
| return; |
| @@ -3934,7 +3858,7 @@ void WebGLRenderingContext::uniform4i(const WebGLUniformLocation* location, GLin |
| 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; |
| @@ -3942,7 +3866,7 @@ void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, Int |
| m_context->uniform4iv(location->location(), v->length() / 4, v->data()); |
| } |
| -void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, GLint* v, GLsizei size) |
| { |
| if (isContextLost() || !validateUniformParameters("uniform4iv", location, v, size, 4)) |
| return; |
| @@ -3950,49 +3874,49 @@ void WebGLRenderingContext::uniform4iv(const WebGLUniformLocation* location, GLi |
| m_context->uniform4iv(location->location(), size / 4, v); |
| } |
| -void WebGLRenderingContext::uniformMatrix2fv(const WebGLUniformLocation* location, GLboolean transpose, Float32Array* v) |
| +void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GLboolean 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, GLboolean transpose, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GLboolean transpose, GLfloat* v, GLsizei 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, GLboolean transpose, Float32Array* v) |
| +void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GLboolean 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, GLboolean transpose, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GLboolean transpose, GLfloat* v, GLsizei 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, GLboolean transpose, Float32Array* v) |
| +void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GLboolean 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, GLboolean transpose, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GLboolean transpose, GLfloat* v, GLsizei 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)) |
| @@ -4013,74 +3937,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(GLuint index, GLfloat v0) |
| +void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) |
| { |
| vertexAttribfImpl("vertexAttrib1f", index, 1, v0, 0.0f, 0.0f, 1.0f); |
| } |
| -void WebGLRenderingContext::vertexAttrib1fv(GLuint index, Float32Array* v) |
| +void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, Float32Array* v) |
| { |
| vertexAttribfvImpl("vertexAttrib1fv", index, v, 1); |
| } |
| -void WebGLRenderingContext::vertexAttrib1fv(GLuint index, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, GLfloat* v, GLsizei size) |
| { |
| vertexAttribfvImpl("vertexAttrib1fv", index, v, size, 1); |
| } |
| -void WebGLRenderingContext::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) |
| +void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) |
| { |
| vertexAttribfImpl("vertexAttrib2f", index, 2, v0, v1, 0.0f, 1.0f); |
| } |
| -void WebGLRenderingContext::vertexAttrib2fv(GLuint index, Float32Array* v) |
| +void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, Float32Array* v) |
| { |
| vertexAttribfvImpl("vertexAttrib2fv", index, v, 2); |
| } |
| -void WebGLRenderingContext::vertexAttrib2fv(GLuint index, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, GLfloat* v, GLsizei size) |
| { |
| vertexAttribfvImpl("vertexAttrib2fv", index, v, size, 2); |
| } |
| -void WebGLRenderingContext::vertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2) |
| +void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2) |
| { |
| vertexAttribfImpl("vertexAttrib3f", index, 3, v0, v1, v2, 1.0f); |
| } |
| -void WebGLRenderingContext::vertexAttrib3fv(GLuint index, Float32Array* v) |
| +void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, Float32Array* v) |
| { |
| vertexAttribfvImpl("vertexAttrib3fv", index, v, 3); |
| } |
| -void WebGLRenderingContext::vertexAttrib3fv(GLuint index, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, GLfloat* v, GLsizei size) |
| { |
| vertexAttribfvImpl("vertexAttrib3fv", index, v, size, 3); |
| } |
| -void WebGLRenderingContext::vertexAttrib4f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) |
| +void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) |
| { |
| vertexAttribfImpl("vertexAttrib4f", index, 4, v0, v1, v2, v3); |
| } |
| -void WebGLRenderingContext::vertexAttrib4fv(GLuint index, Float32Array* v) |
| +void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, Float32Array* v) |
| { |
| vertexAttribfvImpl("vertexAttrib4fv", index, v, 4); |
| } |
| -void WebGLRenderingContext::vertexAttrib4fv(GLuint index, GLfloat* v, GLsizei size) |
| +void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, GLfloat* v, GLsizei size) |
| { |
| vertexAttribfvImpl("vertexAttrib4fv", index, v, size, 4); |
| } |
| -void WebGLRenderingContext::vertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, long long offset) |
| +void WebGLRenderingContextBase::vertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, long long offset) |
| { |
| if (isContextLost()) |
| return; |
| @@ -4123,7 +4047,7 @@ void WebGLRenderingContext::vertexAttribPointer(GLuint index, GLint size, GLenum |
| m_context->vertexAttribPointer(index, size, type, normalized, stride, static_cast<GLintptr>(offset)); |
| } |
| -void WebGLRenderingContext::vertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
| +void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
| { |
| if (isContextLost()) |
| return; |
| @@ -4137,7 +4061,7 @@ void WebGLRenderingContext::vertexAttribDivisorANGLE(GLuint index, GLuint diviso |
| m_context->vertexAttribDivisorANGLE(index, divisor); |
| } |
| -void WebGLRenderingContext::viewport(GLint x, GLint y, GLsizei width, GLsizei height) |
| +void WebGLRenderingContextBase::viewport(GLint x, GLint y, GLsizei width, GLsizei height) |
| { |
| if (isContextLost()) |
| return; |
| @@ -4146,7 +4070,7 @@ void WebGLRenderingContext::viewport(GLint x, GLint y, GLsizei width, GLsizei he |
| m_context->viewport(x, y, width, height); |
| } |
| -void WebGLRenderingContext::forceLostContext(WebGLRenderingContext::LostContextMode mode) |
| +void WebGLRenderingContextBase::forceLostContext(WebGLRenderingContextBase::LostContextMode mode) |
| { |
| if (isContextLost()) { |
| synthesizeGLError(GL_INVALID_OPERATION, "loseContext", "context already lost"); |
| @@ -4156,7 +4080,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; |
| @@ -4183,6 +4107,9 @@ void WebGLRenderingContext::loseContextImpl(WebGLRenderingContext::LostContextMo |
| tracker->loseExtension(); |
| } |
| + for (size_t i = 0; i < WebGLExtensionNameCount; ++i) |
| + m_extensionEnabled[i] = 0; |
|
Ken Russell (switch to Gerrit)
2014/02/21 23:40:20
Use false instead of 0?
Can this code be shared w
|
| + |
| removeAllCompressedTextureFormats(); |
| if (mode != RealLostContext) |
| @@ -4200,7 +4127,7 @@ void WebGLRenderingContext::loseContextImpl(WebGLRenderingContext::LostContextMo |
| m_dispatchContextLostEventTimer.startOneShot(0); |
| } |
| -void WebGLRenderingContext::forceRestoreContext() |
| +void WebGLRenderingContextBase::forceRestoreContext() |
| { |
| if (!isContextLost()) { |
| synthesizeGLError(GL_INVALID_OPERATION, "restoreContext", "context not lost"); |
| @@ -4217,41 +4144,41 @@ void WebGLRenderingContext::forceRestoreContext() |
| m_restoreTimer.startOneShot(0); |
| } |
| -blink::WebLayer* WebGLRenderingContext::platformLayer() const |
| +blink::WebLayer* WebGLRenderingContextBase::platformLayer() const |
| { |
| return m_drawingBuffer->platformLayer(); |
| } |
| -Extensions3DUtil* WebGLRenderingContext::extensionsUtil() |
| +Extensions3DUtil* WebGLRenderingContextBase::extensionsUtil() |
| { |
| if (!m_extensionsUtil) |
| m_extensionsUtil = adoptPtr(new Extensions3DUtil(m_context.get())); |
| return m_extensionsUtil.get(); |
| } |
| -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(); |
| @@ -4259,12 +4186,12 @@ void WebGLRenderingContext::detachAndRemoveAllObjects() |
| } |
| } |
| -bool WebGLRenderingContext::hasPendingActivity() const |
| +bool WebGLRenderingContextBase::hasPendingActivity() const |
| { |
| return false; |
| } |
| -void WebGLRenderingContext::stop() |
| +void WebGLRenderingContextBase::stop() |
| { |
| if (!isContextLost()) { |
| forceLostContext(SyntheticLostContext); |
| @@ -4272,7 +4199,7 @@ void WebGLRenderingContext::stop() |
| } |
| } |
| -WebGLGetInfo WebGLRenderingContext::getBooleanParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getBooleanParameter(GLenum pname) |
| { |
| GLboolean value = 0; |
| if (!isContextLost()) |
| @@ -4280,7 +4207,7 @@ WebGLGetInfo WebGLRenderingContext::getBooleanParameter(GLenum pname) |
| return WebGLGetInfo(static_cast<bool>(value)); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getBooleanArrayParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getBooleanArrayParameter(GLenum pname) |
| { |
| if (pname != GL_COLOR_WRITEMASK) { |
| notImplemented(); |
| @@ -4295,7 +4222,7 @@ WebGLGetInfo WebGLRenderingContext::getBooleanArrayParameter(GLenum pname) |
| return WebGLGetInfo(boolValue, 4); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getFloatParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getFloatParameter(GLenum pname) |
| { |
| GLfloat value = 0; |
| if (!isContextLost()) |
| @@ -4303,7 +4230,7 @@ WebGLGetInfo WebGLRenderingContext::getFloatParameter(GLenum pname) |
| return WebGLGetInfo(value); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getIntParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getIntParameter(GLenum pname) |
| { |
| GLint value = 0; |
| if (!isContextLost()) |
| @@ -4311,7 +4238,7 @@ WebGLGetInfo WebGLRenderingContext::getIntParameter(GLenum pname) |
| return WebGLGetInfo(value); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getUnsignedIntParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getUnsignedIntParameter(GLenum pname) |
| { |
| GLint value = 0; |
| if (!isContextLost()) |
| @@ -4319,7 +4246,7 @@ WebGLGetInfo WebGLRenderingContext::getUnsignedIntParameter(GLenum pname) |
| return WebGLGetInfo(static_cast<unsigned>(value)); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getWebGLFloatArrayParameter(GLenum pname) |
| { |
| GLfloat value[4] = {0}; |
| if (!isContextLost()) |
| @@ -4341,7 +4268,7 @@ WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(GLenum pname) |
| return WebGLGetInfo(Float32Array::create(value, length)); |
| } |
| -WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(GLenum pname) |
| +WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GLenum pname) |
| { |
| GLint value[4] = {0}; |
| if (!isContextLost()) |
| @@ -4361,12 +4288,12 @@ WebGLGetInfo WebGLRenderingContext::getWebGLIntArrayParameter(GLenum 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; |
| - WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureExtensionFlag>((m_oesTextureFloatLinear ? WebGLTexture::TextureFloatLinearExtensionEnabled : 0) |
| - | (m_oesTextureHalfFloatLinear ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); |
| + WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureExtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::TextureFloatLinearExtensionEnabled : 0) |
| + | (extensionEnabled(OESTextureHalfFloatLinearName) ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); |
| for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { |
| if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture(flag)) |
| || (m_textureUnits[ii].m_textureCubeMapBinding.get() && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))) { |
| @@ -4400,7 +4327,7 @@ 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}; |
| @@ -4426,14 +4353,14 @@ void WebGLRenderingContext::createFallbackBlackTextures1x1() |
| m_context->bindTexture(GL_TEXTURE_CUBE_MAP, 0); |
| } |
| -bool WebGLRenderingContext::isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat, GLenum colorBufferFormat) |
| +bool WebGLRenderingContextBase::isTexInternalFormatColorBufferCombinationValid(GLenum texInternalFormat, GLenum colorBufferFormat) |
| { |
| unsigned need = WebGLImageConversion::getChannelBitsByFormat(texInternalFormat); |
| unsigned have = WebGLImageConversion::getChannelBitsByFormat(colorBufferFormat); |
| return (need & have) == need; |
| } |
| -GLenum WebGLRenderingContext::boundFramebufferColorFormat() |
| +GLenum WebGLRenderingContextBase::boundFramebufferColorFormat() |
| { |
| if (m_framebufferBinding && m_framebufferBinding->object()) |
| return m_framebufferBinding->colorBufferFormat(); |
| @@ -4442,21 +4369,21 @@ GLenum WebGLRenderingContext::boundFramebufferColorFormat() |
| return GL_RGB; |
| } |
| -int WebGLRenderingContext::boundFramebufferWidth() |
| +int WebGLRenderingContextBase::boundFramebufferWidth() |
| { |
| if (m_framebufferBinding && m_framebufferBinding->object()) |
| return m_framebufferBinding->colorBufferWidth(); |
| return m_drawingBuffer->size().width(); |
| } |
| -int WebGLRenderingContext::boundFramebufferHeight() |
| +int WebGLRenderingContextBase::boundFramebufferHeight() |
| { |
| if (m_framebufferBinding && m_framebufferBinding->object()) |
| return m_framebufferBinding->colorBufferHeight(); |
| return m_drawingBuffer->size().height(); |
| } |
| -WebGLTexture* WebGLRenderingContext::validateTextureBinding(const char* functionName, GLenum target, bool useSixEnumsForCubeMap) |
| +WebGLTexture* WebGLRenderingContextBase::validateTextureBinding(const char* functionName, GLenum target, bool useSixEnumsForCubeMap) |
| { |
| WebGLTexture* tex = 0; |
| switch (target) { |
| @@ -4491,7 +4418,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) { |
| @@ -4501,7 +4428,7 @@ bool WebGLRenderingContext::validateLocationLength(const char* functionName, con |
| return true; |
| } |
| -bool WebGLRenderingContext::validateSize(const char* functionName, GLint x, GLint y) |
| +bool WebGLRenderingContextBase::validateSize(const char* functionName, GLint x, GLint y) |
| { |
| if (x < 0 || y < 0) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "size < 0"); |
| @@ -4510,7 +4437,7 @@ bool WebGLRenderingContext::validateSize(const char* functionName, GLint x, GLin |
| 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])) { |
| @@ -4521,7 +4448,7 @@ bool WebGLRenderingContext::validateString(const char* functionName, const Strin |
| return true; |
| } |
| -bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionName, GLenum format, GLenum type, GLint level) |
| +bool WebGLRenderingContextBase::validateTexFuncFormatAndType(const char* functionName, GLenum format, GLenum type, GLint level) |
| { |
| switch (format) { |
| case GL_ALPHA: |
| @@ -4532,7 +4459,7 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam |
| break; |
| case GL_DEPTH_STENCIL_OES: |
| case GL_DEPTH_COMPONENT: |
| - if (m_webglDepthTexture) |
| + if (extensionEnabled(WebGLDepthTextureName)) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "depth texture formats not enabled"); |
| return false; |
| @@ -4548,19 +4475,19 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam |
| case GL_UNSIGNED_SHORT_5_5_5_1: |
| break; |
| case GL_FLOAT: |
| - if (m_oesTextureFloat) |
| + if (extensionEnabled(OESTextureFloatName)) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type"); |
| return false; |
| case GL_HALF_FLOAT_OES: |
| - if (m_oesTextureHalfFloat) |
| + if (extensionEnabled(OESTextureHalfFloatName)) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type"); |
| return false; |
| case GL_UNSIGNED_INT: |
| case GL_UNSIGNED_INT_24_8_OES: |
| case GL_UNSIGNED_SHORT: |
| - if (m_webglDepthTexture) |
| + if (extensionEnabled(WebGLDepthTextureName)) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type"); |
| return false; |
| @@ -4601,7 +4528,7 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam |
| } |
| break; |
| case GL_DEPTH_COMPONENT: |
| - if (!m_webglDepthTexture) { |
| + if (!extensionEnabled(WebGLDepthTextureName)) { |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid format. DEPTH_COMPONENT not enabled"); |
| return false; |
| } |
| @@ -4616,7 +4543,7 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam |
| } |
| break; |
| case GL_DEPTH_STENCIL_OES: |
| - if (!m_webglDepthTexture) { |
| + if (!extensionEnabled(WebGLDepthTextureName)) { |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid format. DEPTH_STENCIL not enabled"); |
| return false; |
| } |
| @@ -4636,7 +4563,7 @@ bool WebGLRenderingContext::validateTexFuncFormatAndType(const char* functionNam |
| return true; |
| } |
| -bool WebGLRenderingContext::validateTexFuncLevel(const char* functionName, GLenum target, GLint level) |
| +bool WebGLRenderingContextBase::validateTexFuncLevel(const char* functionName, GLenum target, GLint level) |
| { |
| if (level < 0) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "level < 0"); |
| @@ -4666,7 +4593,7 @@ bool WebGLRenderingContext::validateTexFuncLevel(const char* functionName, GLenu |
| return true; |
| } |
| -bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName, TexFuncValidationFunctionType functionType, |
| +bool WebGLRenderingContextBase::validateTexFuncDimensions(const char* functionName, TexFuncValidationFunctionType functionType, |
| GLenum target, GLint level, GLsizei width, GLsizei height) |
| { |
| if (width < 0 || height < 0) { |
| @@ -4705,7 +4632,7 @@ bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName, |
| return true; |
| } |
| -bool WebGLRenderingContext::validateTexFuncParameters(const char* functionName, TexFuncValidationFunctionType functionType, GLenum target, |
| +bool WebGLRenderingContextBase::validateTexFuncParameters(const char* functionName, TexFuncValidationFunctionType functionType, GLenum target, |
| GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type) |
| { |
| // We absolutely have to validate the format and type combination. |
| @@ -4730,7 +4657,7 @@ bool WebGLRenderingContext::validateTexFuncParameters(const char* functionName, |
| return true; |
| } |
| -bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels, NullDisposition disposition) |
| +bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GLint level, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBufferView* pixels, NullDisposition disposition) |
| { |
| // All calling functions check isContextLost, so a duplicate check is not needed here. |
| if (!pixels) { |
| @@ -4798,12 +4725,12 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, GLint |
| return true; |
| } |
| -bool WebGLRenderingContext::validateCompressedTexFormat(GLenum format) |
| +bool WebGLRenderingContextBase::validateCompressedTexFormat(GLenum format) |
| { |
| return m_compressedTextureFormats.contains(format); |
| } |
| -bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* pixels) |
| +bool WebGLRenderingContextBase::validateCompressedTexFuncData(const char* functionName, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* pixels) |
| { |
| if (!pixels) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no pixels"); |
| @@ -4877,7 +4804,7 @@ bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionNa |
| return true; |
| } |
| -bool WebGLRenderingContext::validateCompressedTexDimensions(const char* functionName, TexFuncValidationFunctionType functionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum format) |
| +bool WebGLRenderingContextBase::validateCompressedTexDimensions(const char* functionName, TexFuncValidationFunctionType functionType, GLenum target, GLint level, GLsizei width, GLsizei height, GLenum format) |
| { |
| if (!validateTexFuncDimensions(functionName, functionType, target, level, width, height)) |
| return false; |
| @@ -4902,7 +4829,7 @@ bool WebGLRenderingContext::validateCompressedTexDimensions(const char* function |
| } |
| } |
| -bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* functionName, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, WebGLTexture* tex) |
| +bool WebGLRenderingContextBase::validateCompressedTexSubDimensions(const char* functionName, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, WebGLTexture* tex) |
| { |
| if (xoffset < 0 || yoffset < 0) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "xoffset or yoffset < 0"); |
| @@ -4932,7 +4859,7 @@ bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* funct |
| } |
| } |
| -bool WebGLRenderingContext::validateDrawMode(const char* functionName, GLenum mode) |
| +bool WebGLRenderingContextBase::validateDrawMode(const char* functionName, GLenum mode) |
| { |
| switch (mode) { |
| case GL_POINTS: |
| @@ -4949,7 +4876,7 @@ bool WebGLRenderingContext::validateDrawMode(const char* functionName, GLenum mo |
| } |
| } |
| -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(GL_INVALID_OPERATION, functionName, "front and back stencils settings do not match"); |
| @@ -4958,7 +4885,7 @@ bool WebGLRenderingContext::validateStencilSettings(const char* functionName) |
| return true; |
| } |
| -bool WebGLRenderingContext::validateStencilOrDepthFunc(const char* functionName, GLenum func) |
| +bool WebGLRenderingContextBase::validateStencilOrDepthFunc(const char* functionName, GLenum func) |
| { |
| switch (func) { |
| case GL_NEVER: |
| @@ -4976,7 +4903,7 @@ bool WebGLRenderingContext::validateStencilOrDepthFunc(const char* functionName, |
| } |
| } |
| -void WebGLRenderingContext::printGLErrorToConsole(const String& message) |
| +void WebGLRenderingContextBase::printGLErrorToConsole(const String& message) |
| { |
| if (!m_numGLErrorsToConsoleAllowed) |
| return; |
| @@ -4990,14 +4917,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, GLenum target, GLenum attachment) |
| +bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* functionName, GLenum target, GLenum attachment) |
| { |
| if (target != GL_FRAMEBUFFER) { |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); |
| @@ -5010,7 +4937,7 @@ bool WebGLRenderingContext::validateFramebufferFuncParameters(const char* functi |
| case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: |
| break; |
| default: |
| - if (m_webglDrawBuffers |
| + if (extensionEnabled(WebGLDrawBuffersName) |
| && attachment > GL_COLOR_ATTACHMENT0 |
| && attachment < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + maxColorAttachments())) |
| break; |
| @@ -5020,7 +4947,7 @@ bool WebGLRenderingContext::validateFramebufferFuncParameters(const char* functi |
| return true; |
| } |
| -bool WebGLRenderingContext::validateBlendEquation(const char* functionName, GLenum mode) |
| +bool WebGLRenderingContextBase::validateBlendEquation(const char* functionName, GLenum mode) |
| { |
| switch (mode) { |
| case GL_FUNC_ADD: |
| @@ -5033,7 +4960,7 @@ bool WebGLRenderingContext::validateBlendEquation(const char* functionName, GLen |
| } |
| } |
| -bool WebGLRenderingContext::validateBlendFuncFactors(const char* functionName, GLenum src, GLenum dst) |
| +bool WebGLRenderingContextBase::validateBlendFuncFactors(const char* functionName, GLenum src, GLenum dst) |
| { |
| if (((src == GL_CONSTANT_COLOR || src == GL_ONE_MINUS_CONSTANT_COLOR) |
| && (dst == GL_CONSTANT_ALPHA || dst == GL_ONE_MINUS_CONSTANT_ALPHA)) |
| @@ -5045,7 +4972,7 @@ bool WebGLRenderingContext::validateBlendFuncFactors(const char* functionName, G |
| return true; |
| } |
| -bool WebGLRenderingContext::validateCapability(const char* functionName, GLenum cap) |
| +bool WebGLRenderingContextBase::validateCapability(const char* functionName, GLenum cap) |
| { |
| switch (cap) { |
| case GL_BLEND: |
| @@ -5064,7 +4991,7 @@ bool WebGLRenderingContext::validateCapability(const char* functionName, GLenum |
| } |
| } |
| -bool WebGLRenderingContext::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Float32Array* v, GLsizei requiredMinSize) |
| +bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Float32Array* v, GLsizei requiredMinSize) |
| { |
| if (!v) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
| @@ -5073,7 +5000,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, GLsizei requiredMinSize) |
| +bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Int32Array* v, GLsizei requiredMinSize) |
| { |
| if (!v) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
| @@ -5082,12 +5009,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, GLsizei size, GLsizei requiredMinSize) |
| +bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, void* v, GLsizei size, GLsizei requiredMinSize) |
| { |
| return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize); |
| } |
| -bool WebGLRenderingContext::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GLboolean transpose, Float32Array* v, GLsizei requiredMinSize) |
| +bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GLboolean transpose, Float32Array* v, GLsizei requiredMinSize) |
| { |
| if (!v) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
| @@ -5096,7 +5023,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, GLboolean transpose, void* v, GLsizei size, GLsizei requiredMinSize) |
| +bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GLboolean transpose, void* v, GLsizei size, GLsizei requiredMinSize) |
| { |
| if (!location) |
| return false; |
| @@ -5119,7 +5046,7 @@ bool WebGLRenderingContext::validateUniformMatrixParameters(const char* function |
| return true; |
| } |
| -WebGLBuffer* WebGLRenderingContext::validateBufferDataParameters(const char* functionName, GLenum target, GLenum usage) |
| +WebGLBuffer* WebGLRenderingContextBase::validateBufferDataParameters(const char* functionName, GLenum target, GLenum usage) |
| { |
| WebGLBuffer* buffer = 0; |
| switch (target) { |
| @@ -5147,7 +5074,7 @@ WebGLBuffer* WebGLRenderingContext::validateBufferDataParameters(const char* fun |
| return 0; |
| } |
| -bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, HTMLImageElement* image, ExceptionState& exceptionState) |
| +bool WebGLRenderingContextBase::validateHTMLImageElement(const char* functionName, HTMLImageElement* image, ExceptionState& exceptionState) |
| { |
| if (!image || !image->cachedImage()) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no image"); |
| @@ -5165,7 +5092,7 @@ bool WebGLRenderingContext::validateHTMLImageElement(const char* functionName, H |
| return true; |
| } |
| -bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& exceptionState) |
| +bool WebGLRenderingContextBase::validateHTMLCanvasElement(const char* functionName, HTMLCanvasElement* canvas, ExceptionState& exceptionState) |
| { |
| if (!canvas || !canvas->buffer()) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no canvas"); |
| @@ -5178,7 +5105,7 @@ bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName, |
| return true; |
| } |
| -bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, HTMLVideoElement* video, ExceptionState& exceptionState) |
| +bool WebGLRenderingContextBase::validateHTMLVideoElement(const char* functionName, HTMLVideoElement* video, ExceptionState& exceptionState) |
| { |
| if (!video || !video->videoWidth() || !video->videoHeight()) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "no video"); |
| @@ -5191,7 +5118,7 @@ bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, H |
| return true; |
| } |
| -bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GLenum mode, GLint first, GLsizei count) |
| +bool WebGLRenderingContextBase::validateDrawArrays(const char* functionName, GLenum mode, GLint first, GLsizei count) |
| { |
| if (isContextLost() || !validateDrawMode(functionName, mode)) |
| return false; |
| @@ -5222,7 +5149,7 @@ bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GLenum |
| return true; |
| } |
| -bool WebGLRenderingContext::validateDrawElements(const char* functionName, GLenum mode, GLsizei count, GLenum type, long long offset) |
| +bool WebGLRenderingContextBase::validateDrawElements(const char* functionName, GLenum mode, GLsizei count, GLenum type, long long offset) |
| { |
| if (isContextLost() || !validateDrawMode(functionName, mode)) |
| return false; |
| @@ -5235,7 +5162,7 @@ bool WebGLRenderingContext::validateDrawElements(const char* functionName, GLenu |
| case GL_UNSIGNED_SHORT: |
| break; |
| case GL_UNSIGNED_INT: |
| - if (m_oesElementIndexUint) |
| + if (extensionEnabled(OESElementIndexUintName)) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid type"); |
| return false; |
| @@ -5273,7 +5200,7 @@ bool WebGLRenderingContext::validateDrawElements(const char* functionName, GLenu |
| } |
| // Helper function to validate draw*Instanced calls |
| -bool WebGLRenderingContext::validateDrawInstanced(const char* functionName, GLsizei primcount) |
| +bool WebGLRenderingContextBase::validateDrawInstanced(const char* functionName, GLsizei primcount) |
| { |
| if (primcount < 0) { |
| synthesizeGLError(GL_INVALID_VALUE, functionName, "primcount < 0"); |
| @@ -5291,7 +5218,7 @@ bool WebGLRenderingContext::validateDrawInstanced(const char* functionName, GLsi |
| return false; |
| } |
| -void WebGLRenderingContext::vertexAttribfImpl(const char* functionName, GLuint index, GLsizei expectedSize, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) |
| +void WebGLRenderingContextBase::vertexAttribfImpl(const char* functionName, GLuint index, GLsizei expectedSize, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) |
| { |
| if (isContextLost()) |
| return; |
| @@ -5321,7 +5248,7 @@ void WebGLRenderingContext::vertexAttribfImpl(const char* functionName, GLuint i |
| attribValue.value[3] = v3; |
| } |
| -void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GLuint index, Float32Array* v, GLsizei expectedSize) |
| +void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GLuint index, Float32Array* v, GLsizei expectedSize) |
| { |
| if (isContextLost()) |
| return; |
| @@ -5332,7 +5259,7 @@ void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GLuint |
| vertexAttribfvImpl(functionName, index, v->data(), v->length(), expectedSize); |
| } |
| -void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GLuint index, GLfloat* v, GLsizei size, GLsizei expectedSize) |
| +void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GLuint index, GLfloat* v, GLsizei size, GLsizei expectedSize) |
| { |
| if (isContextLost()) |
| return; |
| @@ -5369,7 +5296,7 @@ void WebGLRenderingContext::vertexAttribfvImpl(const char* functionName, GLuint |
| attribValue.value[ii] = v[ii]; |
| } |
| -void WebGLRenderingContext::dispatchContextLostEvent(Timer<WebGLRenderingContext>*) |
| +void WebGLRenderingContextBase::dispatchContextLostEvent(Timer<WebGLRenderingContextBase>*) |
| { |
| RefPtr<WebGLContextEvent> event = WebGLContextEvent::create(EventTypeNames::webglcontextlost, false, true, ""); |
| canvas()->dispatchEvent(event); |
| @@ -5379,7 +5306,7 @@ void WebGLRenderingContext::dispatchContextLostEvent(Timer<WebGLRenderingContext |
| m_restoreTimer.startOneShot(0); |
| } |
| -void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*) |
| +void WebGLRenderingContextBase::maybeRestoreContext(Timer<WebGLRenderingContextBase>*) |
| { |
| ASSERT(isContextLost()); |
| @@ -5435,20 +5362,20 @@ void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*) |
| canvas()->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontextrestored, 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) { |
| @@ -5472,7 +5399,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]); |
| @@ -5502,7 +5429,7 @@ namespace { |
| } // namespace anonymous |
| -void WebGLRenderingContext::synthesizeGLError(GLenum error, const char* functionName, const char* description, ConsoleDisplayPreference display) |
| +void WebGLRenderingContextBase::synthesizeGLError(GLenum error, const char* functionName, const char* description, ConsoleDisplayPreference display) |
| { |
| String errorType = GetErrorString(error); |
| if (m_synthesizedErrorsToConsole && display == DisplayInConsole) { |
| @@ -5518,7 +5445,7 @@ void WebGLRenderingContext::synthesizeGLError(GLenum error, const char* function |
| 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); |
| @@ -5527,7 +5454,7 @@ void WebGLRenderingContext::emitGLWarning(const char* functionName, const char* |
| InspectorInstrumentation::didFireWebGLWarning(canvas()); |
| } |
| -void WebGLRenderingContext::applyStencilTest() |
| +void WebGLRenderingContextBase::applyStencilTest() |
| { |
| bool haveStencilBuffer = false; |
| @@ -5541,7 +5468,7 @@ void WebGLRenderingContext::applyStencilTest() |
| m_stencilEnabled && haveStencilBuffer); |
| } |
| -void WebGLRenderingContext::enableOrDisable(GLenum capability, bool enable) |
| +void WebGLRenderingContextBase::enableOrDisable(GLenum capability, bool enable) |
| { |
| if (isContextLost()) |
| return; |
| @@ -5551,15 +5478,15 @@ void WebGLRenderingContext::enableOrDisable(GLenum 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])); |
| } |
| -GLint WebGLRenderingContext::maxDrawBuffers() |
| +GLint WebGLRenderingContextBase::maxDrawBuffers() |
| { |
| - if (isContextLost() || !m_webglDrawBuffers) |
| + if (isContextLost() || !extensionEnabled(WebGLDrawBuffersName)) |
| return 0; |
| if (!m_maxDrawBuffers) |
| m_context->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &m_maxDrawBuffers); |
| @@ -5569,39 +5496,39 @@ GLint WebGLRenderingContext::maxDrawBuffers() |
| return std::min(m_maxDrawBuffers, m_maxColorAttachments); |
| } |
| -GLint WebGLRenderingContext::maxColorAttachments() |
| +GLint WebGLRenderingContextBase::maxColorAttachments() |
| { |
| - if (isContextLost() || !m_webglDrawBuffers) |
| + if (isContextLost() || !extensionEnabled(WebGLDrawBuffersName)) |
| return 0; |
| if (!m_maxColorAttachments) |
| m_context->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttachments); |
| return m_maxColorAttachments; |
| } |
| -void WebGLRenderingContext::setBackDrawBuffer(GLenum buf) |
| +void WebGLRenderingContextBase::setBackDrawBuffer(GLenum buf) |
| { |
| m_backDrawBuffer = buf; |
| } |
| -void WebGLRenderingContext::restoreCurrentFramebuffer() |
| +void WebGLRenderingContextBase::restoreCurrentFramebuffer() |
| { |
| bindFramebuffer(GL_FRAMEBUFFER, m_framebufferBinding.get()); |
| } |
| -void WebGLRenderingContext::restoreCurrentTexture2D() |
| +void WebGLRenderingContextBase::restoreCurrentTexture2D() |
| { |
| bindTexture(GL_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; |
| @@ -5614,7 +5541,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; |