| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2009 Apple Inc. All rights reserved. |     2  * Copyright (C) 2009 Apple Inc. All rights reserved. | 
|     3  * |     3  * | 
|     4  * Redistribution and use in source and binary forms, with or without |     4  * Redistribution and use in source and binary forms, with or without | 
|     5  * modification, are permitted provided that the following conditions |     5  * modification, are permitted provided that the following conditions | 
|     6  * are met: |     6  * are met: | 
|     7  * 1. Redistributions of source code must retain the above copyright |     7  * 1. Redistributions of source code must retain the above copyright | 
|     8  *    notice, this list of conditions and the following disclaimer. |     8  *    notice, this list of conditions and the following disclaimer. | 
|     9  * 2. Redistributions in binary form must reproduce the above copyright |     9  * 2. Redistributions in binary form must reproduce the above copyright | 
|    10  *    notice, this list of conditions and the following disclaimer in the |    10  *    notice, this list of conditions and the following disclaimer in the | 
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   973     // It's not convenient or necessary to pass a ScriptState this far down; whi
      le one is available |   973     // It's not convenient or necessary to pass a ScriptState this far down; whi
      le one is available | 
|   974     // during WebGLRenderingContext construction, the wrapper for the context it
      self hasn't been |   974     // during WebGLRenderingContext construction, the wrapper for the context it
      self hasn't been | 
|   975     // created yet. It's simpler to instead lazily instantiate and preserve the 
      JavaScript wrapper |   975     // created yet. It's simpler to instead lazily instantiate and preserve the 
      JavaScript wrapper | 
|   976     // for the default VAO. (This object is never exposed to JavaScript, but we 
      need to link other |   976     // for the default VAO. (This object is never exposed to JavaScript, but we 
      need to link other | 
|   977     // JavaScript wrappers to it.) |   977     // JavaScript wrappers to it.) | 
|   978     m_preservedDefaultVAOObjectWrapper = false; |   978     m_preservedDefaultVAOObjectWrapper = false; | 
|   979     m_boundVertexArrayObject = m_defaultVertexArrayObject; |   979     m_boundVertexArrayObject = m_defaultVertexArrayObject; | 
|   980  |   980  | 
|   981     m_vertexAttribType.resize(m_maxVertexAttribs); |   981     m_vertexAttribType.resize(m_maxVertexAttribs); | 
|   982  |   982  | 
|   983     webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |   983     contextGL()->Viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 
|   984     contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |   984     contextGL()->Scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 
|   985  |   985  | 
|   986     m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
      s); |   986     m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(thi
      s); | 
|   987     m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
      reate(this); |   987     m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::c
      reate(this); | 
|   988  |   988  | 
|   989     webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); |   989     webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get()); | 
|   990     webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); |   990     webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get()); | 
|   991  |   991  | 
|   992     // This ensures that the context has a valid "lastFlushID" and won't be mist
      akenly identified as the "least recently used" context. |   992     // This ensures that the context has a valid "lastFlushID" and won't be mist
      akenly identified as the "least recently used" context. | 
|   993     contextGL()->Flush(); |   993     contextGL()->Flush(); | 
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1923 { |  1923 { | 
|  1924     if (isContextLost() || !object) |  1924     if (isContextLost() || !object) | 
|  1925         return false; |  1925         return false; | 
|  1926     if (!object->validate(contextGroup(), this)) { |  1926     if (!object->validate(contextGroup(), this)) { | 
|  1927         synthesizeGLError(GL_INVALID_OPERATION, "delete", "object does not belon
      g to this context"); |  1927         synthesizeGLError(GL_INVALID_OPERATION, "delete", "object does not belon
      g to this context"); | 
|  1928         return false; |  1928         return false; | 
|  1929     } |  1929     } | 
|  1930     if (object->hasObject()) { |  1930     if (object->hasObject()) { | 
|  1931         // We need to pass in context here because we want |  1931         // We need to pass in context here because we want | 
|  1932         // things in this context unbound. |  1932         // things in this context unbound. | 
|  1933         object->deleteObject(webContext()); |  1933         object->deleteObject(webContext(), contextGL()); | 
|  1934     } |  1934     } | 
|  1935     return true; |  1935     return true; | 
|  1936 } |  1936 } | 
|  1937  |  1937  | 
|  1938 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) |  1938 void WebGLRenderingContextBase::deleteBuffer(WebGLBuffer* buffer) | 
|  1939 { |  1939 { | 
|  1940     if (!deleteObject(buffer)) |  1940     if (!deleteObject(buffer)) | 
|  1941         return; |  1941         return; | 
|  1942     removeBoundBuffer(buffer); |  1942     removeBoundBuffer(buffer); | 
|  1943 } |  1943 } | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2046  |  2046  | 
|  2047 void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProg
      ram* program, WebGLShader* shader) |  2047 void WebGLRenderingContextBase::detachShader(ScriptState* scriptState, WebGLProg
      ram* program, WebGLShader* shader) | 
|  2048 { |  2048 { | 
|  2049     if (isContextLost() || !validateWebGLObject("detachShader", program) || !val
      idateWebGLObject("detachShader", shader)) |  2049     if (isContextLost() || !validateWebGLObject("detachShader", program) || !val
      idateWebGLObject("detachShader", shader)) | 
|  2050         return; |  2050         return; | 
|  2051     if (!program->detachShader(shader)) { |  2051     if (!program->detachShader(shader)) { | 
|  2052         synthesizeGLError(GL_INVALID_OPERATION, "detachShader", "shader not atta
      ched"); |  2052         synthesizeGLError(GL_INVALID_OPERATION, "detachShader", "shader not atta
      ched"); | 
|  2053         return; |  2053         return; | 
|  2054     } |  2054     } | 
|  2055     contextGL()->DetachShader(objectOrZero(program), objectOrZero(shader)); |  2055     contextGL()->DetachShader(objectOrZero(program), objectOrZero(shader)); | 
|  2056     shader->onDetached(webContext()); |  2056     shader->onDetached(webContext(), contextGL()); | 
|  2057     preserveObjectWrapper(scriptState, program, "shader", shader->type(), nullpt
      r); |  2057     preserveObjectWrapper(scriptState, program, "shader", shader->type(), nullpt
      r); | 
|  2058 } |  2058 } | 
|  2059  |  2059  | 
|  2060 void WebGLRenderingContextBase::disable(GLenum cap) |  2060 void WebGLRenderingContextBase::disable(GLenum cap) | 
|  2061 { |  2061 { | 
|  2062     if (isContextLost() || !validateCapability("disable", cap)) |  2062     if (isContextLost() || !validateCapability("disable", cap)) | 
|  2063         return; |  2063         return; | 
|  2064     if (cap == GL_STENCIL_TEST) { |  2064     if (cap == GL_STENCIL_TEST) { | 
|  2065         m_stencilEnabled = false; |  2065         m_stencilEnabled = false; | 
|  2066         applyStencilTest(); |  2066         applyStencilTest(); | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2133     webContext()->drawElements(mode, count, type, static_cast<GLintptr>(offset))
      ; |  2133     webContext()->drawElements(mode, count, type, static_cast<GLintptr>(offset))
      ; | 
|  2134     markContextChanged(CanvasChanged); |  2134     markContextChanged(CanvasChanged); | 
|  2135 } |  2135 } | 
|  2136  |  2136  | 
|  2137 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs
      t, GLsizei count, GLsizei primcount) |  2137 void WebGLRenderingContextBase::drawArraysInstancedANGLE(GLenum mode, GLint firs
      t, GLsizei count, GLsizei primcount) | 
|  2138 { |  2138 { | 
|  2139     if (!validateDrawArrays("drawArraysInstancedANGLE")) |  2139     if (!validateDrawArrays("drawArraysInstancedANGLE")) | 
|  2140         return; |  2140         return; | 
|  2141  |  2141  | 
|  2142     clearIfComposited(); |  2142     clearIfComposited(); | 
|  2143     webContext()->drawArraysInstancedANGLE(mode, first, count, primcount); |  2143     contextGL()->DrawArraysInstancedANGLE(mode, first, count, primcount); | 
|  2144     markContextChanged(CanvasChanged); |  2144     markContextChanged(CanvasChanged); | 
|  2145 } |  2145 } | 
|  2146  |  2146  | 
|  2147 void WebGLRenderingContextBase::drawElementsInstancedANGLE(GLenum mode, GLsizei 
      count, GLenum type, long long offset, GLsizei primcount) |  2147 void WebGLRenderingContextBase::drawElementsInstancedANGLE(GLenum mode, GLsizei 
      count, GLenum type, long long offset, GLsizei primcount) | 
|  2148 { |  2148 { | 
|  2149     if (!validateDrawElements("drawElementsInstancedANGLE", type, offset)) |  2149     if (!validateDrawElements("drawElementsInstancedANGLE", type, offset)) | 
|  2150         return; |  2150         return; | 
|  2151  |  2151  | 
|  2152     clearIfComposited(); |  2152     clearIfComposited(); | 
|  2153     webContext()->drawElementsInstancedANGLE(mode, count, type, static_cast<GLin
      tptr>(offset), primcount); |  2153     contextGL()->DrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<
      void*>(static_cast<intptr_t>(offset)), primcount); | 
|  2154     markContextChanged(CanvasChanged); |  2154     markContextChanged(CanvasChanged); | 
|  2155 } |  2155 } | 
|  2156  |  2156  | 
|  2157 void WebGLRenderingContextBase::enable(GLenum cap) |  2157 void WebGLRenderingContextBase::enable(GLenum cap) | 
|  2158 { |  2158 { | 
|  2159     if (isContextLost() || !validateCapability("enable", cap)) |  2159     if (isContextLost() || !validateCapability("enable", cap)) | 
|  2160         return; |  2160         return; | 
|  2161     if (cap == GL_STENCIL_TEST) { |  2161     if (cap == GL_STENCIL_TEST) { | 
|  2162         m_stencilEnabled = true; |  2162         m_stencilEnabled = true; | 
|  2163         applyStencilTest(); |  2163         applyStencilTest(); | 
| (...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3807     m_valuebufferBinding = valuebuffer; |  3807     m_valuebufferBinding = valuebuffer; | 
|  3808     contextGL()->BindValuebufferCHROMIUM(target, objectOrZero(valuebuffer)); |  3808     contextGL()->BindValuebufferCHROMIUM(target, objectOrZero(valuebuffer)); | 
|  3809     if (valuebuffer) |  3809     if (valuebuffer) | 
|  3810         valuebuffer->setHasEverBeenBound(); |  3810         valuebuffer->setHasEverBeenBound(); | 
|  3811 } |  3811 } | 
|  3812  |  3812  | 
|  3813 void WebGLRenderingContextBase::subscribeValueCHROMIUM(GLenum target, GLenum sub
      scription) |  3813 void WebGLRenderingContextBase::subscribeValueCHROMIUM(GLenum target, GLenum sub
      scription) | 
|  3814 { |  3814 { | 
|  3815     if (isContextLost()) |  3815     if (isContextLost()) | 
|  3816         return; |  3816         return; | 
|  3817     webContext()->subscribeValueCHROMIUM(target, subscription); |  3817     contextGL()->SubscribeValueCHROMIUM(target, subscription); | 
|  3818 } |  3818 } | 
|  3819  |  3819  | 
|  3820 void WebGLRenderingContextBase::populateSubscribedValuesCHROMIUM(GLenum target) |  3820 void WebGLRenderingContextBase::populateSubscribedValuesCHROMIUM(GLenum target) | 
|  3821 { |  3821 { | 
|  3822     if (isContextLost()) |  3822     if (isContextLost()) | 
|  3823         return; |  3823         return; | 
|  3824     webContext()->populateSubscribedValuesCHROMIUM(target); |  3824     contextGL()->PopulateSubscribedValuesCHROMIUM(target); | 
|  3825 } |  3825 } | 
|  3826  |  3826  | 
|  3827 void WebGLRenderingContextBase::uniformValuebufferCHROMIUM(const WebGLUniformLoc
      ation* location, GLenum target, GLenum subscription) |  3827 void WebGLRenderingContextBase::uniformValuebufferCHROMIUM(const WebGLUniformLoc
      ation* location, GLenum target, GLenum subscription) | 
|  3828 { |  3828 { | 
|  3829     if (isContextLost() || !location) |  3829     if (isContextLost() || !location) | 
|  3830         return; |  3830         return; | 
|  3831     webContext()->uniformValuebufferCHROMIUM(location->location(), target, subsc
      ription); |  3831     contextGL()->UniformValuebufferCHROMIUM(location->location(), target, subscr
      iption); | 
|  3832 } |  3832 } | 
|  3833  |  3833  | 
|  3834 GLenum WebGLRenderingContextBase::convertTexInternalFormat(GLenum internalformat
      , GLenum type) |  3834 GLenum WebGLRenderingContextBase::convertTexInternalFormat(GLenum internalformat
      , GLenum type) | 
|  3835 { |  3835 { | 
|  3836     // Convert to sized internal formats that are renderable with GL_CHROMIUM_co
      lor_buffer_float_rgb(a). |  3836     // Convert to sized internal formats that are renderable with GL_CHROMIUM_co
      lor_buffer_float_rgb(a). | 
|  3837     if (type == GL_FLOAT && internalformat == GL_RGBA |  3837     if (type == GL_FLOAT && internalformat == GL_RGBA | 
|  3838         && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
      rgba")) |  3838         && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
      rgba")) | 
|  3839         return GL_RGBA32F_EXT; |  3839         return GL_RGBA32F_EXT; | 
|  3840     if (type == GL_FLOAT && internalformat == GL_RGB |  3840     if (type == GL_FLOAT && internalformat == GL_RGB | 
|  3841         && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
      rgb")) |  3841         && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
      rgb")) | 
|  3842         return GL_RGB32F_EXT; |  3842         return GL_RGB32F_EXT; | 
|  3843     return internalformat; |  3843     return internalformat; | 
|  3844 } |  3844 } | 
|  3845  |  3845  | 
|  3846 void WebGLRenderingContextBase::texImage2DBase(GLenum target, GLint level, GLint
       internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLe
      num type, const void* pixels) |  3846 void WebGLRenderingContextBase::texImage2DBase(GLenum target, GLint level, GLint
       internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLe
      num type, const void* pixels) | 
|  3847 { |  3847 { | 
|  3848     // All calling functions check isContextLost, so a duplicate check is not ne
      eded here. |  3848     // All calling functions check isContextLost, so a duplicate check is not ne
      eded here. | 
|  3849     webContext()->texImage2D(target, level, convertTexInternalFormat(internalfor
      mat, type), width, height, border, format, type, pixels); |  3849     contextGL()->TexImage2D(target, level, convertTexInternalFormat(internalform
      at, type), width, height, border, format, type, pixels); | 
|  3850 } |  3850 } | 
|  3851  |  3851  | 
|  3852 void WebGLRenderingContextBase::texImage2DImpl(GLenum target, GLint level, GLint
       internalformat, GLenum format, GLenum type, Image* image, WebGLImageConversion:
      :ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha) |  3852 void WebGLRenderingContextBase::texImage2DImpl(GLenum target, GLint level, GLint
       internalformat, GLenum format, GLenum type, Image* image, WebGLImageConversion:
      :ImageHtmlDomSource domSource, bool flipY, bool premultiplyAlpha) | 
|  3853 { |  3853 { | 
|  3854     // All calling functions check isContextLost, so a duplicate check is not ne
      eded here. |  3854     // All calling functions check isContextLost, so a duplicate check is not ne
      eded here. | 
|  3855     if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { |  3855     if (type == GL_UNSIGNED_INT_10F_11F_11F_REV) { | 
|  3856         // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. |  3856         // The UNSIGNED_INT_10F_11F_11F_REV type pack/unpack isn't implemented. | 
|  3857         type = GL_FLOAT; |  3857         type = GL_FLOAT; | 
|  3858     } |  3858     } | 
|  3859     Vector<uint8_t> data; |  3859     Vector<uint8_t> data; | 
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4057         possibleDirectCopy = Extensions3DUtil::canUseCopyTextureCHROMIUM(target,
       internalformat, type, level); |  4057         possibleDirectCopy = Extensions3DUtil::canUseCopyTextureCHROMIUM(target,
       internalformat, type, level); | 
|  4058     } |  4058     } | 
|  4059  |  4059  | 
|  4060     // if direct copy is not possible, create a temporary texture and then copy 
      from canvas to temporary texture to target texture. |  4060     // if direct copy is not possible, create a temporary texture and then copy 
      from canvas to temporary texture to target texture. | 
|  4061     if (!possibleDirectCopy) { |  4061     if (!possibleDirectCopy) { | 
|  4062         targetLevel = 0; |  4062         targetLevel = 0; | 
|  4063         targetInternalformat = GL_RGBA; |  4063         targetInternalformat = GL_RGBA; | 
|  4064         targetType = GL_UNSIGNED_BYTE; |  4064         targetType = GL_UNSIGNED_BYTE; | 
|  4065         targetTexture = webContext()->createTexture(); |  4065         targetTexture = webContext()->createTexture(); | 
|  4066         contextGL()->BindTexture(GL_TEXTURE_2D, targetTexture); |  4066         contextGL()->BindTexture(GL_TEXTURE_2D, targetTexture); | 
|  4067         webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEA
      REST); |  4067         contextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAR
      EST); | 
|  4068         webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEA
      REST); |  4068         contextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAR
      EST); | 
|  4069         webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_T
      O_EDGE); |  4069         contextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO
      _EDGE); | 
|  4070         webContext()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_T
      O_EDGE); |  4070         contextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO
      _EDGE); | 
|  4071         webContext()->texImage2D(GL_TEXTURE_2D, 0, targetInternalformat, canvas-
      >width(), |  4071         contextGL()->TexImage2D(GL_TEXTURE_2D, 0, targetInternalformat, canvas->
      width(), | 
|  4072             canvas->height(), 0, GL_RGBA, targetType, 0); |  4072             canvas->height(), 0, GL_RGBA, targetType, 0); | 
|  4073     } |  4073     } | 
|  4074  |  4074  | 
|  4075     if (!canvas->is3D()) { |  4075     if (!canvas->is3D()) { | 
|  4076         ImageBuffer* buffer = canvas->buffer(); |  4076         ImageBuffer* buffer = canvas->buffer(); | 
|  4077         if (!buffer->copyToPlatformTexture(webContext(), contextGL(), targetText
      ure, targetInternalformat, targetType, |  4077         if (!buffer->copyToPlatformTexture(webContext(), contextGL(), targetText
      ure, targetInternalformat, targetType, | 
|  4078             targetLevel, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |  4078             targetLevel, m_unpackPremultiplyAlpha, m_unpackFlipY)) { | 
|  4079             ASSERT_NOT_REACHED(); |  4079             ASSERT_NOT_REACHED(); | 
|  4080         } |  4080         } | 
|  4081     } else { |  4081     } else { | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4264         if (!isWebGL2OrHigher()) { |  4264         if (!isWebGL2OrHigher()) { | 
|  4265             synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid paramete
      r name"); |  4265             synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid paramete
      r name"); | 
|  4266             return; |  4266             return; | 
|  4267         } |  4267         } | 
|  4268         break; |  4268         break; | 
|  4269     default: |  4269     default: | 
|  4270         synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid parameter na
      me"); |  4270         synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid parameter na
      me"); | 
|  4271         return; |  4271         return; | 
|  4272     } |  4272     } | 
|  4273     if (isFloat) { |  4273     if (isFloat) { | 
|  4274         webContext()->texParameterf(target, pname, paramf); |  4274         contextGL()->TexParameterf(target, pname, paramf); | 
|  4275     } else { |  4275     } else { | 
|  4276         webContext()->texParameteri(target, pname, parami); |  4276         contextGL()->TexParameteri(target, pname, parami); | 
|  4277     } |  4277     } | 
|  4278 } |  4278 } | 
|  4279  |  4279  | 
|  4280 void WebGLRenderingContextBase::texParameterf(GLenum target, GLenum pname, GLflo
      at param) |  4280 void WebGLRenderingContextBase::texParameterf(GLenum target, GLenum pname, GLflo
      at param) | 
|  4281 { |  4281 { | 
|  4282     texParameter(target, pname, param, 0, true); |  4282     texParameter(target, pname, param, 0, true); | 
|  4283 } |  4283 } | 
|  4284  |  4284  | 
|  4285 void WebGLRenderingContextBase::texParameteri(GLenum target, GLenum pname, GLint
       param) |  4285 void WebGLRenderingContextBase::texParameteri(GLenum target, GLenum pname, GLint
       param) | 
|  4286 { |  4286 { | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
|  4308     if (type == GL_UNSIGNED_BYTE && sourceDataFormat == WebGLImageConversion::Da
      taFormatRGBA8 && format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNo
      thing && !flipY) { |  4308     if (type == GL_UNSIGNED_BYTE && sourceDataFormat == WebGLImageConversion::Da
      taFormatRGBA8 && format == GL_RGBA && alphaOp == WebGLImageConversion::AlphaDoNo
      thing && !flipY) { | 
|  4309         needConversion = false; |  4309         needConversion = false; | 
|  4310     } else { |  4310     } else { | 
|  4311         if (!WebGLImageConversion::packImageData(image, imagePixelData, format, 
      type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtrac
      tor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) { |  4311         if (!WebGLImageConversion::packImageData(image, imagePixelData, format, 
      type, flipY, alphaOp, sourceDataFormat, imageExtractor.imageWidth(), imageExtrac
      tor.imageHeight(), imageExtractor.imageSourceUnpackAlignment(), data)) { | 
|  4312             synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "bad image data
      "); |  4312             synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "bad image data
      "); | 
|  4313             return; |  4313             return; | 
|  4314         } |  4314         } | 
|  4315     } |  4315     } | 
|  4316  |  4316  | 
|  4317     resetUnpackParameters(); |  4317     resetUnpackParameters(); | 
|  4318     webContext()->texSubImage2D(target, level, xoffset, yoffset, imageExtractor.
      imageWidth(), imageExtractor.imageHeight(), format, type,  needConversion ? data
      .data() : imagePixelData); |  4318     contextGL()->TexSubImage2D(target, level, xoffset, yoffset, imageExtractor.i
      mageWidth(), imageExtractor.imageHeight(), format, type,  needConversion ? data.
      data() : imagePixelData); | 
|  4319     restoreUnpackParameters(); |  4319     restoreUnpackParameters(); | 
|  4320 } |  4320 } | 
|  4321  |  4321  | 
|  4322 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint 
      xoffset, GLint yoffset, |  4322 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint 
      xoffset, GLint yoffset, | 
|  4323     GLsizei width, GLsizei height, |  4323     GLsizei width, GLsizei height, | 
|  4324     GLenum format, GLenum type, DOMArrayBufferView* pixels) |  4324     GLenum format, GLenum type, DOMArrayBufferView* pixels) | 
|  4325 { |  4325 { | 
|  4326     if (isContextLost()) |  4326     if (isContextLost()) | 
|  4327         return; |  4327         return; | 
|  4328     if (!validateTexture2DBinding("texSubImage2D", target)) |  4328     if (!validateTexture2DBinding("texSubImage2D", target)) | 
|  4329         return; |  4329         return; | 
|  4330     if (!validateTexFunc("texSubImage2D", TexSubImage, SourceArrayBufferView, ta
      rget, level, 0, width, height, 1, 0, format, type, xoffset, yoffset, 0)) |  4330     if (!validateTexFunc("texSubImage2D", TexSubImage, SourceArrayBufferView, ta
      rget, level, 0, width, height, 1, 0, format, type, xoffset, yoffset, 0)) | 
|  4331         return; |  4331         return; | 
|  4332     if (!validateTexFuncData("texSubImage2D", Tex2D, level, width, height, 1, fo
      rmat, type, pixels, NullNotAllowed)) |  4332     if (!validateTexFuncData("texSubImage2D", Tex2D, level, width, height, 1, fo
      rmat, type, pixels, NullNotAllowed)) | 
|  4333         return; |  4333         return; | 
|  4334     void* data = pixels->baseAddress(); |  4334     void* data = pixels->baseAddress(); | 
|  4335     Vector<uint8_t> tempData; |  4335     Vector<uint8_t> tempData; | 
|  4336     bool changeUnpackAlignment = false; |  4336     bool changeUnpackAlignment = false; | 
|  4337     if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |  4337     if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 
|  4338         if (!WebGLImageConversion::extractTextureData(width, height, format, typ
      e, |  4338         if (!WebGLImageConversion::extractTextureData(width, height, format, typ
      e, | 
|  4339             m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, te
      mpData)) |  4339             m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, te
      mpData)) | 
|  4340             return; |  4340             return; | 
|  4341         data = tempData.data(); |  4341         data = tempData.data(); | 
|  4342         changeUnpackAlignment = true; |  4342         changeUnpackAlignment = true; | 
|  4343     } |  4343     } | 
|  4344     if (changeUnpackAlignment) |  4344     if (changeUnpackAlignment) | 
|  4345         resetUnpackParameters(); |  4345         resetUnpackParameters(); | 
|  4346     webContext()->texSubImage2D(target, level, xoffset, yoffset, width, height, 
      format, type, data); |  4346     contextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, f
      ormat, type, data); | 
|  4347     if (changeUnpackAlignment) |  4347     if (changeUnpackAlignment) | 
|  4348         restoreUnpackParameters(); |  4348         restoreUnpackParameters(); | 
|  4349 } |  4349 } | 
|  4350  |  4350  | 
|  4351 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint 
      xoffset, GLint yoffset, |  4351 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint 
      xoffset, GLint yoffset, | 
|  4352     GLenum format, GLenum type, ImageData* pixels) |  4352     GLenum format, GLenum type, ImageData* pixels) | 
|  4353 { |  4353 { | 
|  4354     if (isContextLost()) |  4354     if (isContextLost()) | 
|  4355         return; |  4355         return; | 
|  4356     if (!pixels) { |  4356     if (!pixels) { | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|  4375     // No conversion is needed if destination format is RGBA and type is USIGNED
      _BYTE and no Flip or Premultiply operation is required. |  4375     // No conversion is needed if destination format is RGBA and type is USIGNED
      _BYTE and no Flip or Premultiply operation is required. | 
|  4376     if (format == GL_RGBA && type == GL_UNSIGNED_BYTE && !m_unpackFlipY && !m_un
      packPremultiplyAlpha) { |  4376     if (format == GL_RGBA && type == GL_UNSIGNED_BYTE && !m_unpackFlipY && !m_un
      packPremultiplyAlpha) { | 
|  4377         needConversion = false; |  4377         needConversion = false; | 
|  4378     } else { |  4378     } else { | 
|  4379         if (!WebGLImageConversion::extractImageData(pixels->data()->data(), pixe
      ls->size(), format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { |  4379         if (!WebGLImageConversion::extractImageData(pixels->data()->data(), pixe
      ls->size(), format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) { | 
|  4380             synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "bad image data
      "); |  4380             synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "bad image data
      "); | 
|  4381             return; |  4381             return; | 
|  4382         } |  4382         } | 
|  4383     } |  4383     } | 
|  4384     resetUnpackParameters(); |  4384     resetUnpackParameters(); | 
|  4385     webContext()->texSubImage2D(target, level, xoffset, yoffset, pixels->width()
      , pixels->height(), format, type, needConversion ? data.data() : pixels->data()-
      >data()); |  4385     contextGL()->TexSubImage2D(target, level, xoffset, yoffset, pixels->width(),
       pixels->height(), format, type, needConversion ? data.data() : pixels->data()->
      data()); | 
|  4386     restoreUnpackParameters(); |  4386     restoreUnpackParameters(); | 
|  4387 } |  4387 } | 
|  4388  |  4388  | 
|  4389 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint 
      xoffset, GLint yoffset, |  4389 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint 
      xoffset, GLint yoffset, | 
|  4390     GLenum format, GLenum type, HTMLImageElement* image, ExceptionState& excepti
      onState) |  4390     GLenum format, GLenum type, HTMLImageElement* image, ExceptionState& excepti
      onState) | 
|  4391 { |  4391 { | 
|  4392     if (isContextLost()) |  4392     if (isContextLost()) | 
|  4393         return; |  4393         return; | 
|  4394     if (!validateHTMLImageElement("texSubImage2D", image, exceptionState)) |  4394     if (!validateHTMLImageElement("texSubImage2D", image, exceptionState)) | 
|  4395         return; |  4395         return; | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4480     if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { |  4480     if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { | 
|  4481         needConversion = false; |  4481         needConversion = false; | 
|  4482     } else { |  4482     } else { | 
|  4483         // In the case of ImageBitmap, we do not need to apply flipY or premulti
      plyAlpha. |  4483         // In the case of ImageBitmap, we do not need to apply flipY or premulti
      plyAlpha. | 
|  4484         if (!WebGLImageConversion::extractImageData(pixelData.get(), bitmap->siz
      e(), format, type, false, false, data)) { |  4484         if (!WebGLImageConversion::extractImageData(pixelData.get(), bitmap->siz
      e(), format, type, false, false, data)) { | 
|  4485             synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "bad image data
      "); |  4485             synthesizeGLError(GL_INVALID_VALUE, "texSubImage2D", "bad image data
      "); | 
|  4486             return; |  4486             return; | 
|  4487         } |  4487         } | 
|  4488     } |  4488     } | 
|  4489     resetUnpackParameters(); |  4489     resetUnpackParameters(); | 
|  4490     webContext()->texSubImage2D(target, level, xoffset, yoffset, bitmap->width()
      , bitmap->height(), format, type, needConversion ? data.data() : pixelData.get()
      ); |  4490     contextGL()->TexSubImage2D(target, level, xoffset, yoffset, bitmap->width(),
       bitmap->height(), format, type, needConversion ? data.data() : pixelData.get())
      ; | 
|  4491     restoreUnpackParameters(); |  4491     restoreUnpackParameters(); | 
|  4492 } |  4492 } | 
|  4493  |  4493  | 
|  4494 void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, 
      GLfloat x) |  4494 void WebGLRenderingContextBase::uniform1f(const WebGLUniformLocation* location, 
      GLfloat x) | 
|  4495 { |  4495 { | 
|  4496     if (isContextLost() || !location) |  4496     if (isContextLost() || !location) | 
|  4497         return; |  4497         return; | 
|  4498  |  4498  | 
|  4499     if (location->program() != m_currentProgram) { |  4499     if (location->program() != m_currentProgram) { | 
|  4500         synthesizeGLError(GL_INVALID_OPERATION, "uniform1f", "location not for c
      urrent program"); |  4500         synthesizeGLError(GL_INVALID_OPERATION, "uniform1f", "location not for c
      urrent program"); | 
|  4501         return; |  4501         return; | 
|  4502     } |  4502     } | 
|  4503  |  4503  | 
|  4504     webContext()->uniform1f(location->location(), x); |  4504     contextGL()->Uniform1f(location->location(), x); | 
|  4505 } |  4505 } | 
|  4506  |  4506  | 
|  4507 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) |  4507 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) | 
|  4508 { |  4508 { | 
|  4509     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m1fv", location, v, 1)) |  4509     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m1fv", location, v, 1)) | 
|  4510         return; |  4510         return; | 
|  4511  |  4511  | 
|  4512     webContext()->uniform1fv(location->location(), v.length(), v.dataMaybeOnStac
      k()); |  4512     contextGL()->Uniform1fv(location->location(), v.length(), v.dataMaybeOnStack
      ()); | 
|  4513 } |  4513 } | 
|  4514  |  4514  | 
|  4515 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) |  4515 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) | 
|  4516 { |  4516 { | 
|  4517     if (isContextLost() || !validateUniformParameters("uniform1fv", location, v.
      data(), v.size(), 1)) |  4517     if (isContextLost() || !validateUniformParameters("uniform1fv", location, v.
      data(), v.size(), 1)) | 
|  4518         return; |  4518         return; | 
|  4519  |  4519  | 
|  4520     webContext()->uniform1fv(location->location(), v.size(), v.data()); |  4520     contextGL()->Uniform1fv(location->location(), v.size(), v.data()); | 
|  4521 } |  4521 } | 
|  4522  |  4522  | 
|  4523 void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, 
      GLint x) |  4523 void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, 
      GLint x) | 
|  4524 { |  4524 { | 
|  4525     if (isContextLost() || !location) |  4525     if (isContextLost() || !location) | 
|  4526         return; |  4526         return; | 
|  4527  |  4527  | 
|  4528     if (location->program() != m_currentProgram) { |  4528     if (location->program() != m_currentProgram) { | 
|  4529         synthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for c
      urrent program"); |  4529         synthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for c
      urrent program"); | 
|  4530         return; |  4530         return; | 
|  4531     } |  4531     } | 
|  4532  |  4532  | 
|  4533     webContext()->uniform1i(location->location(), x); |  4533     contextGL()->Uniform1i(location->location(), x); | 
|  4534 } |  4534 } | 
|  4535  |  4535  | 
|  4536 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) |  4536 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) | 
|  4537 { |  4537 { | 
|  4538     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform1
      iv", location, v, 1)) |  4538     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform1
      iv", location, v, 1)) | 
|  4539         return; |  4539         return; | 
|  4540  |  4540  | 
|  4541     webContext()->uniform1iv(location->location(), v.length(), v.dataMaybeOnStac
      k()); |  4541     contextGL()->Uniform1iv(location->location(), v.length(), v.dataMaybeOnStack
      ()); | 
|  4542 } |  4542 } | 
|  4543  |  4543  | 
|  4544 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) |  4544 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) | 
|  4545 { |  4545 { | 
|  4546     if (isContextLost() || !validateUniformParameters("uniform1iv", location, v.
      data(), v.size(), 1)) |  4546     if (isContextLost() || !validateUniformParameters("uniform1iv", location, v.
      data(), v.size(), 1)) | 
|  4547         return; |  4547         return; | 
|  4548  |  4548  | 
|  4549     webContext()->uniform1iv(location->location(), v.size(), v.data()); |  4549     contextGL()->Uniform1iv(location->location(), v.size(), v.data()); | 
|  4550 } |  4550 } | 
|  4551  |  4551  | 
|  4552 void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, 
      GLfloat x, GLfloat y) |  4552 void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, 
      GLfloat x, GLfloat y) | 
|  4553 { |  4553 { | 
|  4554     if (isContextLost() || !location) |  4554     if (isContextLost() || !location) | 
|  4555         return; |  4555         return; | 
|  4556  |  4556  | 
|  4557     if (location->program() != m_currentProgram) { |  4557     if (location->program() != m_currentProgram) { | 
|  4558         synthesizeGLError(GL_INVALID_OPERATION, "uniform2f", "location not for c
      urrent program"); |  4558         synthesizeGLError(GL_INVALID_OPERATION, "uniform2f", "location not for c
      urrent program"); | 
|  4559         return; |  4559         return; | 
|  4560     } |  4560     } | 
|  4561  |  4561  | 
|  4562     webContext()->uniform2f(location->location(), x, y); |  4562     contextGL()->Uniform2f(location->location(), x, y); | 
|  4563 } |  4563 } | 
|  4564  |  4564  | 
|  4565 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) |  4565 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) | 
|  4566 { |  4566 { | 
|  4567     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m2fv", location, v, 2)) |  4567     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m2fv", location, v, 2)) | 
|  4568         return; |  4568         return; | 
|  4569  |  4569  | 
|  4570     webContext()->uniform2fv(location->location(), v.length() >> 1, v.dataMaybeO
      nStack()); |  4570     contextGL()->Uniform2fv(location->location(), v.length() >> 1, v.dataMaybeOn
      Stack()); | 
|  4571 } |  4571 } | 
|  4572  |  4572  | 
|  4573 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) |  4573 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) | 
|  4574 { |  4574 { | 
|  4575     if (isContextLost() || !validateUniformParameters("uniform2fv", location, v.
      data(), v.size(), 2)) |  4575     if (isContextLost() || !validateUniformParameters("uniform2fv", location, v.
      data(), v.size(), 2)) | 
|  4576         return; |  4576         return; | 
|  4577  |  4577  | 
|  4578     webContext()->uniform2fv(location->location(), v.size() >> 1, v.data()); |  4578     contextGL()->Uniform2fv(location->location(), v.size() >> 1, v.data()); | 
|  4579 } |  4579 } | 
|  4580  |  4580  | 
|  4581 void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, 
      GLint x, GLint y) |  4581 void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, 
      GLint x, GLint y) | 
|  4582 { |  4582 { | 
|  4583     if (isContextLost() || !location) |  4583     if (isContextLost() || !location) | 
|  4584         return; |  4584         return; | 
|  4585  |  4585  | 
|  4586     if (location->program() != m_currentProgram) { |  4586     if (location->program() != m_currentProgram) { | 
|  4587         synthesizeGLError(GL_INVALID_OPERATION, "uniform2i", "location not for c
      urrent program"); |  4587         synthesizeGLError(GL_INVALID_OPERATION, "uniform2i", "location not for c
      urrent program"); | 
|  4588         return; |  4588         return; | 
|  4589     } |  4589     } | 
|  4590  |  4590  | 
|  4591     webContext()->uniform2i(location->location(), x, y); |  4591     contextGL()->Uniform2i(location->location(), x, y); | 
|  4592 } |  4592 } | 
|  4593  |  4593  | 
|  4594 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) |  4594 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) | 
|  4595 { |  4595 { | 
|  4596     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform2
      iv", location, v, 2)) |  4596     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform2
      iv", location, v, 2)) | 
|  4597         return; |  4597         return; | 
|  4598  |  4598  | 
|  4599     webContext()->uniform2iv(location->location(), v.length() >> 1, v.dataMaybeO
      nStack()); |  4599     contextGL()->Uniform2iv(location->location(), v.length() >> 1, v.dataMaybeOn
      Stack()); | 
|  4600 } |  4600 } | 
|  4601  |  4601  | 
|  4602 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) |  4602 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) | 
|  4603 { |  4603 { | 
|  4604     if (isContextLost() || !validateUniformParameters("uniform2iv", location, v.
      data(), v.size(), 2)) |  4604     if (isContextLost() || !validateUniformParameters("uniform2iv", location, v.
      data(), v.size(), 2)) | 
|  4605         return; |  4605         return; | 
|  4606  |  4606  | 
|  4607     webContext()->uniform2iv(location->location(), v.size() >> 1, v.data()); |  4607     contextGL()->Uniform2iv(location->location(), v.size() >> 1, v.data()); | 
|  4608 } |  4608 } | 
|  4609  |  4609  | 
|  4610 void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, 
      GLfloat x, GLfloat y, GLfloat z) |  4610 void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, 
      GLfloat x, GLfloat y, GLfloat z) | 
|  4611 { |  4611 { | 
|  4612     if (isContextLost() || !location) |  4612     if (isContextLost() || !location) | 
|  4613         return; |  4613         return; | 
|  4614  |  4614  | 
|  4615     if (location->program() != m_currentProgram) { |  4615     if (location->program() != m_currentProgram) { | 
|  4616         synthesizeGLError(GL_INVALID_OPERATION, "uniform3f", "location not for c
      urrent program"); |  4616         synthesizeGLError(GL_INVALID_OPERATION, "uniform3f", "location not for c
      urrent program"); | 
|  4617         return; |  4617         return; | 
|  4618     } |  4618     } | 
|  4619  |  4619  | 
|  4620     webContext()->uniform3f(location->location(), x, y, z); |  4620     contextGL()->Uniform3f(location->location(), x, y, z); | 
|  4621 } |  4621 } | 
|  4622  |  4622  | 
|  4623 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) |  4623 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) | 
|  4624 { |  4624 { | 
|  4625     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m3fv", location, v, 3)) |  4625     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m3fv", location, v, 3)) | 
|  4626         return; |  4626         return; | 
|  4627  |  4627  | 
|  4628     webContext()->uniform3fv(location->location(), v.length() / 3, v.dataMaybeOn
      Stack()); |  4628     contextGL()->Uniform3fv(location->location(), v.length() / 3, v.dataMaybeOnS
      tack()); | 
|  4629 } |  4629 } | 
|  4630  |  4630  | 
|  4631 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) |  4631 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) | 
|  4632 { |  4632 { | 
|  4633     if (isContextLost() || !validateUniformParameters("uniform3fv", location, v.
      data(), v.size(), 3)) |  4633     if (isContextLost() || !validateUniformParameters("uniform3fv", location, v.
      data(), v.size(), 3)) | 
|  4634         return; |  4634         return; | 
|  4635  |  4635  | 
|  4636     webContext()->uniform3fv(location->location(), v.size() / 3, v.data()); |  4636     contextGL()->Uniform3fv(location->location(), v.size() / 3, v.data()); | 
|  4637 } |  4637 } | 
|  4638  |  4638  | 
|  4639 void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, 
      GLint x, GLint y, GLint z) |  4639 void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, 
      GLint x, GLint y, GLint z) | 
|  4640 { |  4640 { | 
|  4641     if (isContextLost() || !location) |  4641     if (isContextLost() || !location) | 
|  4642         return; |  4642         return; | 
|  4643  |  4643  | 
|  4644     if (location->program() != m_currentProgram) { |  4644     if (location->program() != m_currentProgram) { | 
|  4645         synthesizeGLError(GL_INVALID_OPERATION, "uniform3i", "location not for c
      urrent program"); |  4645         synthesizeGLError(GL_INVALID_OPERATION, "uniform3i", "location not for c
      urrent program"); | 
|  4646         return; |  4646         return; | 
|  4647     } |  4647     } | 
|  4648  |  4648  | 
|  4649     webContext()->uniform3i(location->location(), x, y, z); |  4649     contextGL()->Uniform3i(location->location(), x, y, z); | 
|  4650 } |  4650 } | 
|  4651  |  4651  | 
|  4652 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) |  4652 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) | 
|  4653 { |  4653 { | 
|  4654     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform3
      iv", location, v, 3)) |  4654     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform3
      iv", location, v, 3)) | 
|  4655         return; |  4655         return; | 
|  4656  |  4656  | 
|  4657     webContext()->uniform3iv(location->location(), v.length() / 3, v.dataMaybeOn
      Stack()); |  4657     contextGL()->Uniform3iv(location->location(), v.length() / 3, v.dataMaybeOnS
      tack()); | 
|  4658 } |  4658 } | 
|  4659  |  4659  | 
|  4660 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) |  4660 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) | 
|  4661 { |  4661 { | 
|  4662     if (isContextLost() || !validateUniformParameters("uniform3iv", location, v.
      data(), v.size(), 3)) |  4662     if (isContextLost() || !validateUniformParameters("uniform3iv", location, v.
      data(), v.size(), 3)) | 
|  4663         return; |  4663         return; | 
|  4664  |  4664  | 
|  4665     webContext()->uniform3iv(location->location(), v.size() / 3, v.data()); |  4665     contextGL()->Uniform3iv(location->location(), v.size() / 3, v.data()); | 
|  4666 } |  4666 } | 
|  4667  |  4667  | 
|  4668 void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, 
      GLfloat x, GLfloat y, GLfloat z, GLfloat w) |  4668 void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, 
      GLfloat x, GLfloat y, GLfloat z, GLfloat w) | 
|  4669 { |  4669 { | 
|  4670     if (isContextLost() || !location) |  4670     if (isContextLost() || !location) | 
|  4671         return; |  4671         return; | 
|  4672  |  4672  | 
|  4673     if (location->program() != m_currentProgram) { |  4673     if (location->program() != m_currentProgram) { | 
|  4674         synthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for c
      urrent program"); |  4674         synthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for c
      urrent program"); | 
|  4675         return; |  4675         return; | 
|  4676     } |  4676     } | 
|  4677  |  4677  | 
|  4678     webContext()->uniform4f(location->location(), x, y, z, w); |  4678     contextGL()->Uniform4f(location->location(), x, y, z, w); | 
|  4679 } |  4679 } | 
|  4680  |  4680  | 
|  4681 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) |  4681 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
       const FlexibleFloat32ArrayView& v) | 
|  4682 { |  4682 { | 
|  4683     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m4fv", location, v, 4)) |  4683     if (isContextLost() || !validateUniformParameters<WTF::Float32Array>("unifor
      m4fv", location, v, 4)) | 
|  4684         return; |  4684         return; | 
|  4685  |  4685  | 
|  4686     webContext()->uniform4fv(location->location(), v.length() >> 2, v.dataMaybeO
      nStack()); |  4686     contextGL()->Uniform4fv(location->location(), v.length() >> 2, v.dataMaybeOn
      Stack()); | 
|  4687 } |  4687 } | 
|  4688  |  4688  | 
|  4689 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) |  4689 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
       Vector<GLfloat>& v) | 
|  4690 { |  4690 { | 
|  4691     if (isContextLost() || !validateUniformParameters("uniform4fv", location, v.
      data(), v.size(), 4)) |  4691     if (isContextLost() || !validateUniformParameters("uniform4fv", location, v.
      data(), v.size(), 4)) | 
|  4692         return; |  4692         return; | 
|  4693  |  4693  | 
|  4694     webContext()->uniform4fv(location->location(), v.size() >> 2, v.data()); |  4694     contextGL()->Uniform4fv(location->location(), v.size() >> 2, v.data()); | 
|  4695 } |  4695 } | 
|  4696  |  4696  | 
|  4697 void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, 
      GLint x, GLint y, GLint z, GLint w) |  4697 void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, 
      GLint x, GLint y, GLint z, GLint w) | 
|  4698 { |  4698 { | 
|  4699     if (isContextLost() || !location) |  4699     if (isContextLost() || !location) | 
|  4700         return; |  4700         return; | 
|  4701  |  4701  | 
|  4702     if (location->program() != m_currentProgram) { |  4702     if (location->program() != m_currentProgram) { | 
|  4703         synthesizeGLError(GL_INVALID_OPERATION, "uniform4i", "location not for c
      urrent program"); |  4703         synthesizeGLError(GL_INVALID_OPERATION, "uniform4i", "location not for c
      urrent program"); | 
|  4704         return; |  4704         return; | 
|  4705     } |  4705     } | 
|  4706  |  4706  | 
|  4707     webContext()->uniform4i(location->location(), x, y, z, w); |  4707     contextGL()->Uniform4i(location->location(), x, y, z, w); | 
|  4708 } |  4708 } | 
|  4709  |  4709  | 
|  4710 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) |  4710 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
       const FlexibleInt32ArrayView& v) | 
|  4711 { |  4711 { | 
|  4712     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform4
      iv", location, v, 4)) |  4712     if (isContextLost() || !validateUniformParameters<WTF::Int32Array>("uniform4
      iv", location, v, 4)) | 
|  4713         return; |  4713         return; | 
|  4714  |  4714  | 
|  4715     webContext()->uniform4iv(location->location(), v.length() >> 2, v.dataMaybeO
      nStack()); |  4715     contextGL()->Uniform4iv(location->location(), v.length() >> 2, v.dataMaybeOn
      Stack()); | 
|  4716 } |  4716 } | 
|  4717  |  4717  | 
|  4718 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) |  4718 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
       Vector<GLint>& v) | 
|  4719 { |  4719 { | 
|  4720     if (isContextLost() || !validateUniformParameters("uniform4iv", location, v.
      data(), v.size(), 4)) |  4720     if (isContextLost() || !validateUniformParameters("uniform4iv", location, v.
      data(), v.size(), 4)) | 
|  4721         return; |  4721         return; | 
|  4722  |  4722  | 
|  4723     webContext()->uniform4iv(location->location(), v.size() >> 2, v.data()); |  4723     contextGL()->Uniform4iv(location->location(), v.size() >> 2, v.data()); | 
|  4724 } |  4724 } | 
|  4725  |  4725  | 
|  4726 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, DOMFloat32Array* v) |  4726 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, DOMFloat32Array* v) | 
|  4727 { |  4727 { | 
|  4728     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", 
      location, transpose, v, 4)) |  4728     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", 
      location, transpose, v, 4)) | 
|  4729         return; |  4729         return; | 
|  4730     webContext()->uniformMatrix2fv(location->location(), v->length() >> 2, trans
      pose, v->data()); |  4730     contextGL()->UniformMatrix2fv(location->location(), v->length() >> 2, transp
      ose, v->data()); | 
|  4731 } |  4731 } | 
|  4732  |  4732  | 
|  4733 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, Vector<GLfloat>& v) |  4733 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, Vector<GLfloat>& v) | 
|  4734 { |  4734 { | 
|  4735     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", 
      location, transpose, v.data(), v.size(), 4)) |  4735     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv", 
      location, transpose, v.data(), v.size(), 4)) | 
|  4736         return; |  4736         return; | 
|  4737     webContext()->uniformMatrix2fv(location->location(), v.size() >> 2, transpos
      e, v.data()); |  4737     contextGL()->UniformMatrix2fv(location->location(), v.size() >> 2, transpose
      , v.data()); | 
|  4738 } |  4738 } | 
|  4739  |  4739  | 
|  4740 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, DOMFloat32Array* v) |  4740 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, DOMFloat32Array* v) | 
|  4741 { |  4741 { | 
|  4742     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", 
      location, transpose, v, 9)) |  4742     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", 
      location, transpose, v, 9)) | 
|  4743         return; |  4743         return; | 
|  4744     webContext()->uniformMatrix3fv(location->location(), v->length() / 9, transp
      ose, v->data()); |  4744     contextGL()->UniformMatrix3fv(location->location(), v->length() / 9, transpo
      se, v->data()); | 
|  4745 } |  4745 } | 
|  4746  |  4746  | 
|  4747 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, Vector<GLfloat>& v) |  4747 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, Vector<GLfloat>& v) | 
|  4748 { |  4748 { | 
|  4749     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", 
      location, transpose, v.data(), v.size(), 9)) |  4749     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv", 
      location, transpose, v.data(), v.size(), 9)) | 
|  4750         return; |  4750         return; | 
|  4751     webContext()->uniformMatrix3fv(location->location(), v.size() / 9, transpose
      , v.data()); |  4751     contextGL()->UniformMatrix3fv(location->location(), v.size() / 9, transpose,
       v.data()); | 
|  4752 } |  4752 } | 
|  4753  |  4753  | 
|  4754 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, DOMFloat32Array* v) |  4754 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, DOMFloat32Array* v) | 
|  4755 { |  4755 { | 
|  4756     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", 
      location, transpose, v, 16)) |  4756     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", 
      location, transpose, v, 16)) | 
|  4757         return; |  4757         return; | 
|  4758     webContext()->uniformMatrix4fv(location->location(), v->length() >> 4, trans
      pose, v->data()); |  4758     contextGL()->UniformMatrix4fv(location->location(), v->length() >> 4, transp
      ose, v->data()); | 
|  4759 } |  4759 } | 
|  4760  |  4760  | 
|  4761 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, Vector<GLfloat>& v) |  4761 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
      ation, GLboolean transpose, Vector<GLfloat>& v) | 
|  4762 { |  4762 { | 
|  4763     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", 
      location, transpose, v.data(), v.size(), 16)) |  4763     if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv", 
      location, transpose, v.data(), v.size(), 16)) | 
|  4764         return; |  4764         return; | 
|  4765     webContext()->uniformMatrix4fv(location->location(), v.size() >> 4, transpos
      e, v.data()); |  4765     contextGL()->UniformMatrix4fv(location->location(), v.size() >> 4, transpose
      , v.data()); | 
|  4766 } |  4766 } | 
|  4767  |  4767  | 
|  4768 void WebGLRenderingContextBase::useProgram(ScriptState* scriptState, WebGLProgra
      m* program) |  4768 void WebGLRenderingContextBase::useProgram(ScriptState* scriptState, WebGLProgra
      m* program) | 
|  4769 { |  4769 { | 
|  4770     bool deleted; |  4770     bool deleted; | 
|  4771     if (!checkObjectToBeBound("useProgram", program, deleted)) |  4771     if (!checkObjectToBeBound("useProgram", program, deleted)) | 
|  4772         return; |  4772         return; | 
|  4773     if (deleted) |  4773     if (deleted) | 
|  4774         program = 0; |  4774         program = 0; | 
|  4775     if (program && !program->linkStatus()) { |  4775     if (program && !program->linkStatus()) { | 
|  4776         synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "program not valid
      "); |  4776         synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "program not valid
      "); | 
|  4777         return; |  4777         return; | 
|  4778     } |  4778     } | 
|  4779  |  4779  | 
|  4780     if (transformFeedbackActive() && !transformFeedbackPaused()) { |  4780     if (transformFeedbackActive() && !transformFeedbackPaused()) { | 
|  4781         synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "transform feedbac
      k is active and not paused"); |  4781         synthesizeGLError(GL_INVALID_OPERATION, "useProgram", "transform feedbac
      k is active and not paused"); | 
|  4782         return; |  4782         return; | 
|  4783     } |  4783     } | 
|  4784  |  4784  | 
|  4785     if (m_currentProgram != program) { |  4785     if (m_currentProgram != program) { | 
|  4786         if (m_currentProgram) |  4786         if (m_currentProgram) | 
|  4787             m_currentProgram->onDetached(webContext()); |  4787             m_currentProgram->onDetached(webContext(), contextGL()); | 
|  4788         m_currentProgram = program; |  4788         m_currentProgram = program; | 
|  4789         webContext()->useProgram(objectOrZero(program)); |  4789         contextGL()->UseProgram(objectOrZero(program)); | 
|  4790         if (program) |  4790         if (program) | 
|  4791             program->onAttached(); |  4791             program->onAttached(); | 
|  4792         preserveObjectWrapper(scriptState, this, "program", 0, program); |  4792         preserveObjectWrapper(scriptState, this, "program", 0, program); | 
|  4793     } |  4793     } | 
|  4794 } |  4794 } | 
|  4795  |  4795  | 
|  4796 void WebGLRenderingContextBase::validateProgram(WebGLProgram* program) |  4796 void WebGLRenderingContextBase::validateProgram(WebGLProgram* program) | 
|  4797 { |  4797 { | 
|  4798     if (isContextLost() || !validateWebGLObject("validateProgram", program)) |  4798     if (isContextLost() || !validateWebGLObject("validateProgram", program)) | 
|  4799         return; |  4799         return; | 
|  4800     webContext()->validateProgram(objectOrZero(program)); |  4800     contextGL()->ValidateProgram(objectOrZero(program)); | 
|  4801 } |  4801 } | 
|  4802  |  4802  | 
|  4803 void WebGLRenderingContextBase::setVertexAttribType(GLuint index, VertexAttribVa
      lueType type) |  4803 void WebGLRenderingContextBase::setVertexAttribType(GLuint index, VertexAttribVa
      lueType type) | 
|  4804 { |  4804 { | 
|  4805     if (index < m_maxVertexAttribs) |  4805     if (index < m_maxVertexAttribs) | 
|  4806         m_vertexAttribType[index] = type; |  4806         m_vertexAttribType[index] = type; | 
|  4807 } |  4807 } | 
|  4808  |  4808  | 
|  4809 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) |  4809 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) | 
|  4810 { |  4810 { | 
|  4811     if (isContextLost()) |  4811     if (isContextLost()) | 
|  4812         return; |  4812         return; | 
|  4813     webContext()->vertexAttrib1f(index, v0); |  4813     contextGL()->VertexAttrib1f(index, v0); | 
|  4814     setVertexAttribType(index, Float32ArrayType); |  4814     setVertexAttribType(index, Float32ArrayType); | 
|  4815 } |  4815 } | 
|  4816  |  4816  | 
|  4817 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, const DOMFloat32Ar
      ray* v) |  4817 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, const DOMFloat32Ar
      ray* v) | 
|  4818 { |  4818 { | 
|  4819     if (isContextLost()) |  4819     if (isContextLost()) | 
|  4820         return; |  4820         return; | 
|  4821     if (!v || v->length() < 1) { |  4821     if (!v || v->length() < 1) { | 
|  4822         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); |  4822         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); | 
|  4823         return; |  4823         return; | 
|  4824     } |  4824     } | 
|  4825     webContext()->vertexAttrib1fv(index, v->data()); |  4825     contextGL()->VertexAttrib1fv(index, v->data()); | 
|  4826     setVertexAttribType(index, Float32ArrayType); |  4826     setVertexAttribType(index, Float32ArrayType); | 
|  4827 } |  4827 } | 
|  4828  |  4828  | 
|  4829 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, const Vector<GLflo
      at>& v) |  4829 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, const Vector<GLflo
      at>& v) | 
|  4830 { |  4830 { | 
|  4831     if (isContextLost()) |  4831     if (isContextLost()) | 
|  4832         return; |  4832         return; | 
|  4833     if (v.size() < 1) { |  4833     if (v.size() < 1) { | 
|  4834         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); |  4834         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); | 
|  4835         return; |  4835         return; | 
|  4836     } |  4836     } | 
|  4837     webContext()->vertexAttrib1fv(index, v.data()); |  4837     contextGL()->VertexAttrib1fv(index, v.data()); | 
|  4838     setVertexAttribType(index, Float32ArrayType); |  4838     setVertexAttribType(index, Float32ArrayType); | 
|  4839 } |  4839 } | 
|  4840  |  4840  | 
|  4841 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat
       v1) |  4841 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat
       v1) | 
|  4842 { |  4842 { | 
|  4843     if (isContextLost()) |  4843     if (isContextLost()) | 
|  4844         return; |  4844         return; | 
|  4845     webContext()->vertexAttrib2f(index, v0, v1); |  4845     contextGL()->VertexAttrib2f(index, v0, v1); | 
|  4846     setVertexAttribType(index, Float32ArrayType); |  4846     setVertexAttribType(index, Float32ArrayType); | 
|  4847 } |  4847 } | 
|  4848  |  4848  | 
|  4849 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, const DOMFloat32Ar
      ray* v) |  4849 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, const DOMFloat32Ar
      ray* v) | 
|  4850 { |  4850 { | 
|  4851     if (isContextLost()) |  4851     if (isContextLost()) | 
|  4852         return; |  4852         return; | 
|  4853     if (!v || v->length() < 2) { |  4853     if (!v || v->length() < 2) { | 
|  4854         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); |  4854         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); | 
|  4855         return; |  4855         return; | 
|  4856     } |  4856     } | 
|  4857     webContext()->vertexAttrib2fv(index, v->data()); |  4857     contextGL()->VertexAttrib2fv(index, v->data()); | 
|  4858     setVertexAttribType(index, Float32ArrayType); |  4858     setVertexAttribType(index, Float32ArrayType); | 
|  4859 } |  4859 } | 
|  4860  |  4860  | 
|  4861 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, const Vector<GLflo
      at>& v) |  4861 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, const Vector<GLflo
      at>& v) | 
|  4862 { |  4862 { | 
|  4863     if (isContextLost()) |  4863     if (isContextLost()) | 
|  4864         return; |  4864         return; | 
|  4865     if (v.size() < 2) { |  4865     if (v.size() < 2) { | 
|  4866         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); |  4866         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); | 
|  4867         return; |  4867         return; | 
|  4868     } |  4868     } | 
|  4869     webContext()->vertexAttrib2fv(index, v.data()); |  4869     contextGL()->VertexAttrib2fv(index, v.data()); | 
|  4870     setVertexAttribType(index, Float32ArrayType); |  4870     setVertexAttribType(index, Float32ArrayType); | 
|  4871 } |  4871 } | 
|  4872  |  4872  | 
|  4873 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, GLfloat v0, GLfloat
       v1, GLfloat v2) |  4873 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, GLfloat v0, GLfloat
       v1, GLfloat v2) | 
|  4874 { |  4874 { | 
|  4875     if (isContextLost()) |  4875     if (isContextLost()) | 
|  4876         return; |  4876         return; | 
|  4877     webContext()->vertexAttrib3f(index, v0, v1, v2); |  4877     contextGL()->VertexAttrib3f(index, v0, v1, v2); | 
|  4878     setVertexAttribType(index, Float32ArrayType); |  4878     setVertexAttribType(index, Float32ArrayType); | 
|  4879 } |  4879 } | 
|  4880  |  4880  | 
|  4881 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, const DOMFloat32Ar
      ray* v) |  4881 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, const DOMFloat32Ar
      ray* v) | 
|  4882 { |  4882 { | 
|  4883     if (isContextLost()) |  4883     if (isContextLost()) | 
|  4884         return; |  4884         return; | 
|  4885     if (!v || v->length() < 3) { |  4885     if (!v || v->length() < 3) { | 
|  4886         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); |  4886         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); | 
|  4887         return; |  4887         return; | 
|  4888     } |  4888     } | 
|  4889     webContext()->vertexAttrib3fv(index, v->data()); |  4889     contextGL()->VertexAttrib3fv(index, v->data()); | 
|  4890     setVertexAttribType(index, Float32ArrayType); |  4890     setVertexAttribType(index, Float32ArrayType); | 
|  4891 } |  4891 } | 
|  4892  |  4892  | 
|  4893 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, const Vector<GLflo
      at>& v) |  4893 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, const Vector<GLflo
      at>& v) | 
|  4894 { |  4894 { | 
|  4895     if (isContextLost()) |  4895     if (isContextLost()) | 
|  4896         return; |  4896         return; | 
|  4897     if (v.size() < 3) { |  4897     if (v.size() < 3) { | 
|  4898         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); |  4898         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); | 
|  4899         return; |  4899         return; | 
|  4900     } |  4900     } | 
|  4901     webContext()->vertexAttrib3fv(index, v.data()); |  4901     contextGL()->VertexAttrib3fv(index, v.data()); | 
|  4902     setVertexAttribType(index, Float32ArrayType); |  4902     setVertexAttribType(index, Float32ArrayType); | 
|  4903 } |  4903 } | 
|  4904  |  4904  | 
|  4905 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, GLfloat v0, GLfloat
       v1, GLfloat v2, GLfloat v3) |  4905 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, GLfloat v0, GLfloat
       v1, GLfloat v2, GLfloat v3) | 
|  4906 { |  4906 { | 
|  4907     if (isContextLost()) |  4907     if (isContextLost()) | 
|  4908         return; |  4908         return; | 
|  4909     webContext()->vertexAttrib4f(index, v0, v1, v2, v3); |  4909     contextGL()->VertexAttrib4f(index, v0, v1, v2, v3); | 
|  4910     setVertexAttribType(index, Float32ArrayType); |  4910     setVertexAttribType(index, Float32ArrayType); | 
|  4911 } |  4911 } | 
|  4912  |  4912  | 
|  4913 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, const DOMFloat32Ar
      ray* v) |  4913 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, const DOMFloat32Ar
      ray* v) | 
|  4914 { |  4914 { | 
|  4915     if (isContextLost()) |  4915     if (isContextLost()) | 
|  4916         return; |  4916         return; | 
|  4917     if (!v || v->length() < 4) { |  4917     if (!v || v->length() < 4) { | 
|  4918         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); |  4918         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); | 
|  4919         return; |  4919         return; | 
|  4920     } |  4920     } | 
|  4921     webContext()->vertexAttrib4fv(index, v->data()); |  4921     contextGL()->VertexAttrib4fv(index, v->data()); | 
|  4922     setVertexAttribType(index, Float32ArrayType); |  4922     setVertexAttribType(index, Float32ArrayType); | 
|  4923 } |  4923 } | 
|  4924  |  4924  | 
|  4925 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, const Vector<GLflo
      at>& v) |  4925 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, const Vector<GLflo
      at>& v) | 
|  4926 { |  4926 { | 
|  4927     if (isContextLost()) |  4927     if (isContextLost()) | 
|  4928         return; |  4928         return; | 
|  4929     if (v.size() < 4) { |  4929     if (v.size() < 4) { | 
|  4930         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); |  4930         synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); | 
|  4931         return; |  4931         return; | 
|  4932     } |  4932     } | 
|  4933     webContext()->vertexAttrib4fv(index, v.data()); |  4933     contextGL()->VertexAttrib4fv(index, v.data()); | 
|  4934     setVertexAttribType(index, Float32ArrayType); |  4934     setVertexAttribType(index, Float32ArrayType); | 
|  4935 } |  4935 } | 
|  4936  |  4936  | 
|  4937 void WebGLRenderingContextBase::vertexAttribPointer(ScriptState* scriptState, GL
      uint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, long 
      long offset) |  4937 void WebGLRenderingContextBase::vertexAttribPointer(ScriptState* scriptState, GL
      uint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, long 
      long offset) | 
|  4938 { |  4938 { | 
|  4939     if (isContextLost()) |  4939     if (isContextLost()) | 
|  4940         return; |  4940         return; | 
|  4941     if (index >= m_maxVertexAttribs) { |  4941     if (index >= m_maxVertexAttribs) { | 
|  4942         synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "index out of
       range"); |  4942         synthesizeGLError(GL_INVALID_VALUE, "vertexAttribPointer", "index out of
       range"); | 
|  4943         return; |  4943         return; | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|  4958 void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GLuint index, GLuint di
      visor) |  4958 void WebGLRenderingContextBase::vertexAttribDivisorANGLE(GLuint index, GLuint di
      visor) | 
|  4959 { |  4959 { | 
|  4960     if (isContextLost()) |  4960     if (isContextLost()) | 
|  4961         return; |  4961         return; | 
|  4962  |  4962  | 
|  4963     if (index >= m_maxVertexAttribs) { |  4963     if (index >= m_maxVertexAttribs) { | 
|  4964         synthesizeGLError(GL_INVALID_VALUE, "vertexAttribDivisorANGLE", "index o
      ut of range"); |  4964         synthesizeGLError(GL_INVALID_VALUE, "vertexAttribDivisorANGLE", "index o
      ut of range"); | 
|  4965         return; |  4965         return; | 
|  4966     } |  4966     } | 
|  4967  |  4967  | 
|  4968     webContext()->vertexAttribDivisorANGLE(index, divisor); |  4968     contextGL()->VertexAttribDivisorANGLE(index, divisor); | 
|  4969 } |  4969 } | 
|  4970  |  4970  | 
|  4971 void WebGLRenderingContextBase::viewport(GLint x, GLint y, GLsizei width, GLsize
      i height) |  4971 void WebGLRenderingContextBase::viewport(GLint x, GLint y, GLsizei width, GLsize
      i height) | 
|  4972 { |  4972 { | 
|  4973     if (isContextLost()) |  4973     if (isContextLost()) | 
|  4974         return; |  4974         return; | 
|  4975     webContext()->viewport(x, y, width, height); |  4975     contextGL()->Viewport(x, y, width, height); | 
|  4976 } |  4976 } | 
|  4977  |  4977  | 
|  4978 // Added to provide a unified interface with CanvasRenderingContext2D. Prefer ca
      lling forceLostContext instead. |  4978 // Added to provide a unified interface with CanvasRenderingContext2D. Prefer ca
      lling forceLostContext instead. | 
|  4979 void WebGLRenderingContextBase::loseContext(LostContextMode mode) |  4979 void WebGLRenderingContextBase::loseContext(LostContextMode mode) | 
|  4980 { |  4980 { | 
|  4981     forceLostContext(mode, Manual); |  4981     forceLostContext(mode, Manual); | 
|  4982 } |  4982 } | 
|  4983  |  4983  | 
|  4984 void WebGLRenderingContextBase::forceLostContext(LostContextMode mode, AutoRecov
      eryMethod autoRecoveryMethod) |  4984 void WebGLRenderingContextBase::forceLostContext(LostContextMode mode, AutoRecov
      eryMethod autoRecoveryMethod) | 
|  4985 { |  4985 { | 
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6289         contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |  6289         contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 
|  6290 } |  6290 } | 
|  6291  |  6291  | 
|  6292 void WebGLRenderingContextBase::restoreUnpackParameters() |  6292 void WebGLRenderingContextBase::restoreUnpackParameters() | 
|  6293 { |  6293 { | 
|  6294     if (m_unpackAlignment != 1) |  6294     if (m_unpackAlignment != 1) | 
|  6295         contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |  6295         contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 
|  6296 } |  6296 } | 
|  6297  |  6297  | 
|  6298 } // namespace blink |  6298 } // namespace blink | 
| OLD | NEW |