Chromium Code Reviews| Index: Source/core/html/canvas/WebGLRenderingContextBase.cpp |
| diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
| index 570060b5da1f96e4a0ed4aa092b75463bfa28793..c0002f86788a0e1b2cdef23864a6d97fa1eabff7 100644 |
| --- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
| +++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp |
| @@ -2466,7 +2466,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| case GL_VIEWPORT: |
| return getWebGLIntArrayParameter(scriptState, pname); |
| case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives |
| - if (extensionEnabled(OESStandardDerivativesName)) |
| + if (extensionEnabled(OESStandardDerivativesName) || version() > 1) |
|
Ken Russell (switch to Gerrit)
2015/02/03 01:23:25
Could you add a private isVersion2OrHigher() helpe
|
| return getUnsignedIntParameter(scriptState, GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, OES_standard_derivatives not enabled"); |
| return ScriptValue::createNull(scriptState); |
| @@ -2481,7 +2481,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_debug_renderer_info not enabled"); |
| return ScriptValue::createNull(scriptState); |
| case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object |
| - if (extensionEnabled(OESVertexArrayObjectName)) { |
| + if (extensionEnabled(OESVertexArrayObjectName) || version() > 1) { |
| if (!m_boundVertexArrayObject->isDefaultObject()) |
| return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_boundVertexArrayObject.get())); |
| return ScriptValue::createNull(scriptState); |
| @@ -2489,22 +2489,22 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, OES_vertex_array_object not enabled"); |
| return ScriptValue::createNull(scriptState); |
| case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| - if (extensionEnabled(EXTTextureFilterAnisotropicName)) |
| + if (extensionEnabled(EXTTextureFilterAnisotropicName) || version() > 1) |
| return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled"); |
| return ScriptValue::createNull(scriptState); |
| case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN |
| - if (extensionEnabled(WebGLDrawBuffersName)) |
| + if (extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| return WebGLAny(scriptState, maxColorAttachments()); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_draw_buffers not enabled"); |
| return ScriptValue::createNull(scriptState); |
| case GL_MAX_DRAW_BUFFERS_EXT: |
| - if (extensionEnabled(WebGLDrawBuffersName)) |
| + if (extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| return WebGLAny(scriptState, maxDrawBuffers()); |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, WEBGL_draw_buffers not enabled"); |
| return ScriptValue::createNull(scriptState); |
| default: |
| - if (extensionEnabled(WebGLDrawBuffersName) |
| + if ((extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| && pname >= GL_DRAW_BUFFER0_EXT |
| && pname < static_cast<GLenum>(GL_DRAW_BUFFER0_EXT + maxDrawBuffers())) { |
| GLint value = GL_NONE; |
| @@ -2696,7 +2696,7 @@ ScriptValue WebGLRenderingContextBase::getTexParameter(ScriptState* scriptState, |
| return WebGLAny(scriptState, static_cast<unsigned>(value)); |
| } |
| case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| - if (extensionEnabled(EXTTextureFilterAnisotropicName)) { |
| + if (extensionEnabled(EXTTextureFilterAnisotropicName) || version() > 1) { |
| GLfloat value = 0.f; |
| webContext()->getTexParameterfv(target, pname, &value); |
| return WebGLAny(scriptState, value); |
| @@ -2884,7 +2884,8 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, |
| } |
| const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); |
| - if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) |
| + if ((extensionEnabled(ANGLEInstancedArraysName) || version() > 1) |
| + && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) |
| return WebGLAny(scriptState, state.divisor); |
| switch (pname) { |
| @@ -2932,7 +2933,7 @@ void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) |
| isValid = true; |
| break; |
| case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives |
| - if (extensionEnabled(OESStandardDerivativesName)) |
| + if (extensionEnabled(OESStandardDerivativesName) || version() > 1) |
| isValid = true; |
| break; |
| } |
| @@ -3766,7 +3767,7 @@ void WebGLRenderingContextBase::texParameter(GLenum target, GLenum pname, GLfloa |
| } |
| break; |
| case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| - if (!extensionEnabled(EXTTextureFilterAnisotropicName)) { |
| + if (!extensionEnabled(EXTTextureFilterAnisotropicName) || version() > 1) { |
| synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid parameter, EXT_texture_filter_anisotropic not enabled"); |
| return; |
| } |
| @@ -4607,8 +4608,8 @@ void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa |
| { |
| // All calling functions check isContextLost, so a duplicate check is not needed here. |
| bool resetActiveUnit = false; |
| - WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureExtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::TextureFloatLinearExtensionEnabled : 0) |
| - | (extensionEnabled(OESTextureHalfFloatLinearName) ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); |
| + WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureExtensionFlag>(((extensionEnabled(OESTextureFloatLinearName) || version() > 1) ? WebGLTexture::TextureFloatLinearExtensionEnabled : 0) |
| + | ((extensionEnabled(OESTextureHalfFloatLinearName) || version() > 1) ? 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))) { |
| @@ -4760,7 +4761,7 @@ bool WebGLRenderingContextBase::validateTexFuncFormatAndType(const char* functio |
| break; |
| case GL_DEPTH_STENCIL_OES: |
| case GL_DEPTH_COMPONENT: |
| - if (extensionEnabled(WebGLDepthTextureName)) |
| + if (extensionEnabled(WebGLDepthTextureName) || version() > 1) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "depth texture formats not enabled"); |
| return false; |
| @@ -4782,19 +4783,19 @@ bool WebGLRenderingContextBase::validateTexFuncFormatAndType(const char* functio |
| case GL_UNSIGNED_SHORT_5_5_5_1: |
| break; |
| case GL_FLOAT: |
| - if (extensionEnabled(OESTextureFloatName)) |
| + if (extensionEnabled(OESTextureFloatName) || version() > 1) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type"); |
| return false; |
| case GL_HALF_FLOAT_OES: |
| - if (extensionEnabled(OESTextureHalfFloatName)) |
| + if (extensionEnabled(OESTextureHalfFloatName) || version() > 1) |
| 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 (extensionEnabled(WebGLDepthTextureName)) |
| + if (extensionEnabled(WebGLDepthTextureName) || version() > 1) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type"); |
| return false; |
| @@ -5289,7 +5290,7 @@ bool WebGLRenderingContextBase::validateFramebufferFuncParameters(const char* fu |
| case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: |
| break; |
| default: |
| - if (extensionEnabled(WebGLDrawBuffersName) |
| + if ((extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| && attachment > GL_COLOR_ATTACHMENT0 |
| && attachment < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + maxColorAttachments())) |
| break; |
| @@ -5515,7 +5516,7 @@ bool WebGLRenderingContextBase::validateDrawElements(const char* functionName, G |
| case GL_UNSIGNED_SHORT: |
| break; |
| case GL_UNSIGNED_INT: |
| - if (extensionEnabled(OESElementIndexUintName)) |
| + if (extensionEnabled(OESElementIndexUintName) || version() > 1) |
| break; |
| synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid type"); |
| return false; |
| @@ -5851,7 +5852,7 @@ IntSize WebGLRenderingContextBase::clampedCanvasSize() |
| GLint WebGLRenderingContextBase::maxDrawBuffers() |
| { |
| - if (isContextLost() || !extensionEnabled(WebGLDrawBuffersName)) |
| + if (isContextLost() || !(extensionEnabled(WebGLDrawBuffersName) || version() > 1)) |
| return 0; |
| if (!m_maxDrawBuffers) |
| webContext()->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &m_maxDrawBuffers); |
| @@ -5863,7 +5864,7 @@ GLint WebGLRenderingContextBase::maxDrawBuffers() |
| GLint WebGLRenderingContextBase::maxColorAttachments() |
| { |
| - if (isContextLost() || !extensionEnabled(WebGLDrawBuffersName)) |
| + if (isContextLost() || !(extensionEnabled(WebGLDrawBuffersName) || version() > 1)) |
| return 0; |
| if (!m_maxColorAttachments) |
| webContext()->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttachments); |