| 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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 ScopedFramebufferRestorer restorer(this); | 1618 ScopedFramebufferRestorer restorer(this); |
| 1619 int width, height; | 1619 int width, height; |
| 1620 WTF::ArrayBufferContents contents; | 1620 WTF::ArrayBufferContents contents; |
| 1621 if (!drawingBuffer()->paintRenderingResultsToImageData( | 1621 if (!drawingBuffer()->paintRenderingResultsToImageData( |
| 1622 width, height, sourceBuffer, contents)) | 1622 width, height, sourceBuffer, contents)) |
| 1623 return nullptr; | 1623 return nullptr; |
| 1624 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents); | 1624 DOMArrayBuffer* imageDataPixels = DOMArrayBuffer::create(contents); |
| 1625 | 1625 |
| 1626 return ImageData::create( | 1626 return ImageData::create( |
| 1627 IntSize(width, height), | 1627 IntSize(width, height), |
| 1628 DOMUint8ClampedArray::create(imageDataPixels, 0, | 1628 NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::create( |
| 1629 imageDataPixels->byteLength())); | 1629 imageDataPixels, 0, imageDataPixels->byteLength()))); |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 void WebGLRenderingContextBase::reshape(int width, int height) { | 1632 void WebGLRenderingContextBase::reshape(int width, int height) { |
| 1633 if (isContextLost()) | 1633 if (isContextLost()) |
| 1634 return; | 1634 return; |
| 1635 | 1635 |
| 1636 GLint buffer = 0; | 1636 GLint buffer = 0; |
| 1637 if (isWebGL2OrHigher()) { | 1637 if (isWebGL2OrHigher()) { |
| 1638 // This query returns client side cached binding, so it's trivial. | 1638 // This query returns client side cached binding, so it's trivial. |
| 1639 // If it changes in the future, such query is heavy and should be avoided. | 1639 // If it changes in the future, such query is heavy and should be avoided. |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1959 if (isContextLost()) | 1959 if (isContextLost()) |
| 1960 return; | 1960 return; |
| 1961 if (!data) { | 1961 if (!data) { |
| 1962 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); | 1962 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); |
| 1963 return; | 1963 return; |
| 1964 } | 1964 } |
| 1965 bufferDataImpl(target, data->byteLength(), data->data(), usage); | 1965 bufferDataImpl(target, data->byteLength(), data->data(), usage); |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 void WebGLRenderingContextBase::bufferData(GLenum target, | 1968 void WebGLRenderingContextBase::bufferData(GLenum target, |
| 1969 DOMArrayBufferView* data, | 1969 NotShared<DOMArrayBufferView> data, |
| 1970 GLenum usage) { | 1970 GLenum usage) { |
| 1971 if (isContextLost()) | 1971 if (isContextLost()) |
| 1972 return; | 1972 return; |
| 1973 DCHECK(data); | 1973 DCHECK(data); |
| 1974 bufferDataImpl(target, data->byteLength(), data->baseAddress(), usage); | 1974 bufferDataImpl(target, data.view()->byteLength(), data.view()->baseAddress(), |
| 1975 usage); |
| 1975 } | 1976 } |
| 1976 | 1977 |
| 1977 void WebGLRenderingContextBase::bufferSubDataImpl(GLenum target, | 1978 void WebGLRenderingContextBase::bufferSubDataImpl(GLenum target, |
| 1978 long long offset, | 1979 long long offset, |
| 1979 GLsizeiptr size, | 1980 GLsizeiptr size, |
| 1980 const void* data) { | 1981 const void* data) { |
| 1981 WebGLBuffer* buffer = validateBufferDataTarget("bufferSubData", target); | 1982 WebGLBuffer* buffer = validateBufferDataTarget("bufferSubData", target); |
| 1982 if (!buffer) | 1983 if (!buffer) |
| 1983 return; | 1984 return; |
| 1984 if (!validateValueFitNonNegInt32("bufferSubData", "offset", offset)) | 1985 if (!validateValueFitNonNegInt32("bufferSubData", "offset", offset)) |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2131 m_colorMask[3] = alpha; | 2132 m_colorMask[3] = alpha; |
| 2132 contextGL()->ColorMask(red, green, blue, alpha); | 2133 contextGL()->ColorMask(red, green, blue, alpha); |
| 2133 } | 2134 } |
| 2134 | 2135 |
| 2135 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) { | 2136 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) { |
| 2136 if (isContextLost() || !validateWebGLObject("compileShader", shader)) | 2137 if (isContextLost() || !validateWebGLObject("compileShader", shader)) |
| 2137 return; | 2138 return; |
| 2138 contextGL()->CompileShader(objectOrZero(shader)); | 2139 contextGL()->CompileShader(objectOrZero(shader)); |
| 2139 } | 2140 } |
| 2140 | 2141 |
| 2141 void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, | 2142 void WebGLRenderingContextBase::compressedTexImage2D( |
| 2142 GLint level, | 2143 GLenum target, |
| 2143 GLenum internalformat, | 2144 GLint level, |
| 2144 GLsizei width, | 2145 GLenum internalformat, |
| 2145 GLsizei height, | 2146 GLsizei width, |
| 2146 GLint border, | 2147 GLsizei height, |
| 2147 DOMArrayBufferView* data) { | 2148 GLint border, |
| 2149 NotShared<DOMArrayBufferView> data) { |
| 2148 if (isContextLost()) | 2150 if (isContextLost()) |
| 2149 return; | 2151 return; |
| 2150 if (!validateTexture2DBinding("compressedTexImage2D", target)) | 2152 if (!validateTexture2DBinding("compressedTexImage2D", target)) |
| 2151 return; | 2153 return; |
| 2152 if (!validateCompressedTexFormat("compressedTexImage2D", internalformat)) | 2154 if (!validateCompressedTexFormat("compressedTexImage2D", internalformat)) |
| 2153 return; | 2155 return; |
| 2154 contextGL()->CompressedTexImage2D(target, level, internalformat, width, | 2156 contextGL()->CompressedTexImage2D(target, level, internalformat, width, |
| 2155 height, border, data->byteLength(), | 2157 height, border, data.view()->byteLength(), |
| 2156 data->baseAddress()); | 2158 data.view()->baseAddress()); |
| 2157 } | 2159 } |
| 2158 | 2160 |
| 2159 void WebGLRenderingContextBase::compressedTexSubImage2D( | 2161 void WebGLRenderingContextBase::compressedTexSubImage2D( |
| 2160 GLenum target, | 2162 GLenum target, |
| 2161 GLint level, | 2163 GLint level, |
| 2162 GLint xoffset, | 2164 GLint xoffset, |
| 2163 GLint yoffset, | 2165 GLint yoffset, |
| 2164 GLsizei width, | 2166 GLsizei width, |
| 2165 GLsizei height, | 2167 GLsizei height, |
| 2166 GLenum format, | 2168 GLenum format, |
| 2167 DOMArrayBufferView* data) { | 2169 NotShared<DOMArrayBufferView> data) { |
| 2168 if (isContextLost()) | 2170 if (isContextLost()) |
| 2169 return; | 2171 return; |
| 2170 if (!validateTexture2DBinding("compressedTexSubImage2D", target)) | 2172 if (!validateTexture2DBinding("compressedTexSubImage2D", target)) |
| 2171 return; | 2173 return; |
| 2172 if (!validateCompressedTexFormat("compressedTexSubImage2D", format)) | 2174 if (!validateCompressedTexFormat("compressedTexSubImage2D", format)) |
| 2173 return; | 2175 return; |
| 2174 contextGL()->CompressedTexSubImage2D(target, level, xoffset, yoffset, width, | 2176 contextGL()->CompressedTexSubImage2D( |
| 2175 height, format, data->byteLength(), | 2177 target, level, xoffset, yoffset, width, height, format, |
| 2176 data->baseAddress()); | 2178 data.view()->byteLength(), data.view()->baseAddress()); |
| 2177 } | 2179 } |
| 2178 | 2180 |
| 2179 bool WebGLRenderingContextBase::validateSettableTexFormat( | 2181 bool WebGLRenderingContextBase::validateSettableTexFormat( |
| 2180 const char* functionName, | 2182 const char* functionName, |
| 2181 GLenum format) { | 2183 GLenum format) { |
| 2182 if (isWebGL2OrHigher()) | 2184 if (isWebGL2OrHigher()) |
| 2183 return true; | 2185 return true; |
| 2184 | 2186 |
| 2185 if (WebGLImageConversion::getChannelBitsByFormat(format) & | 2187 if (WebGLImageConversion::getChannelBitsByFormat(format) & |
| 2186 WebGLImageConversion::ChannelDepthStencil) { | 2188 WebGLImageConversion::ChannelDepthStencil) { |
| (...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4150 } | 4152 } |
| 4151 if (bufferSize < | 4153 if (bufferSize < |
| 4152 static_cast<long long>(totalBytesRequired + totalSkipBytes)) { | 4154 static_cast<long long>(totalBytesRequired + totalSkipBytes)) { |
| 4153 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", | 4155 synthesizeGLError(GL_INVALID_OPERATION, "readPixels", |
| 4154 "buffer is not large enough for dimensions"); | 4156 "buffer is not large enough for dimensions"); |
| 4155 return false; | 4157 return false; |
| 4156 } | 4158 } |
| 4157 return true; | 4159 return true; |
| 4158 } | 4160 } |
| 4159 | 4161 |
| 4160 void WebGLRenderingContextBase::readPixels(GLint x, | 4162 void WebGLRenderingContextBase::readPixels( |
| 4161 GLint y, | 4163 GLint x, |
| 4162 GLsizei width, | 4164 GLint y, |
| 4163 GLsizei height, | 4165 GLsizei width, |
| 4164 GLenum format, | 4166 GLsizei height, |
| 4165 GLenum type, | 4167 GLenum format, |
| 4166 DOMArrayBufferView* pixels) { | 4168 GLenum type, |
| 4167 readPixelsHelper(x, y, width, height, format, type, pixels, 0); | 4169 NotShared<DOMArrayBufferView> pixels) { |
| 4170 readPixelsHelper(x, y, width, height, format, type, pixels.view(), 0); |
| 4168 } | 4171 } |
| 4169 | 4172 |
| 4170 void WebGLRenderingContextBase::readPixelsHelper(GLint x, | 4173 void WebGLRenderingContextBase::readPixelsHelper(GLint x, |
| 4171 GLint y, | 4174 GLint y, |
| 4172 GLsizei width, | 4175 GLsizei width, |
| 4173 GLsizei height, | 4176 GLsizei height, |
| 4174 GLenum format, | 4177 GLenum format, |
| 4175 GLenum type, | 4178 GLenum type, |
| 4176 DOMArrayBufferView* pixels, | 4179 DOMArrayBufferView* pixels, |
| 4177 GLuint offset) { | 4180 GLuint offset) { |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4762 ScopedUnpackParametersResetRestore temporaryResetUnpack( | 4765 ScopedUnpackParametersResetRestore temporaryResetUnpack( |
| 4763 this, changeUnpackAlignment); | 4766 this, changeUnpackAlignment); |
| 4764 if (functionID == TexImage2D) | 4767 if (functionID == TexImage2D) |
| 4765 texImage2DBase(target, level, internalformat, width, height, border, format, | 4768 texImage2DBase(target, level, internalformat, width, height, border, format, |
| 4766 type, data); | 4769 type, data); |
| 4767 else if (functionID == TexSubImage2D) | 4770 else if (functionID == TexSubImage2D) |
| 4768 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, | 4771 contextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, |
| 4769 format, type, data); | 4772 format, type, data); |
| 4770 } | 4773 } |
| 4771 | 4774 |
| 4772 void WebGLRenderingContextBase::texImage2D(GLenum target, | 4775 void WebGLRenderingContextBase::texImage2D( |
| 4773 GLint level, | 4776 GLenum target, |
| 4774 GLint internalformat, | 4777 GLint level, |
| 4775 GLsizei width, | 4778 GLint internalformat, |
| 4776 GLsizei height, | 4779 GLsizei width, |
| 4777 GLint border, | 4780 GLsizei height, |
| 4778 GLenum format, | 4781 GLint border, |
| 4779 GLenum type, | 4782 GLenum format, |
| 4780 DOMArrayBufferView* pixels) { | 4783 GLenum type, |
| 4784 NotShared<DOMArrayBufferView> pixels) { |
| 4781 texImageHelperDOMArrayBufferView(TexImage2D, target, level, internalformat, | 4785 texImageHelperDOMArrayBufferView(TexImage2D, target, level, internalformat, |
| 4782 width, height, 1, border, format, type, 0, 0, | 4786 width, height, 1, border, format, type, 0, 0, |
| 4783 0, pixels, NullAllowed, 0); | 4787 0, pixels.view(), NullAllowed, 0); |
| 4784 } | 4788 } |
| 4785 | 4789 |
| 4786 void WebGLRenderingContextBase::texImageHelperImageData( | 4790 void WebGLRenderingContextBase::texImageHelperImageData( |
| 4787 TexImageFunctionID functionID, | 4791 TexImageFunctionID functionID, |
| 4788 GLenum target, | 4792 GLenum target, |
| 4789 GLint level, | 4793 GLint level, |
| 4790 GLint internalformat, | 4794 GLint internalformat, |
| 4791 GLint border, | 4795 GLint border, |
| 4792 GLenum format, | 4796 GLenum format, |
| 4793 GLenum type, | 4797 GLenum type, |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5585 GLfloat param) { | 5589 GLfloat param) { |
| 5586 texParameter(target, pname, param, 0, true); | 5590 texParameter(target, pname, param, 0, true); |
| 5587 } | 5591 } |
| 5588 | 5592 |
| 5589 void WebGLRenderingContextBase::texParameteri(GLenum target, | 5593 void WebGLRenderingContextBase::texParameteri(GLenum target, |
| 5590 GLenum pname, | 5594 GLenum pname, |
| 5591 GLint param) { | 5595 GLint param) { |
| 5592 texParameter(target, pname, 0, param, false); | 5596 texParameter(target, pname, 0, param, false); |
| 5593 } | 5597 } |
| 5594 | 5598 |
| 5595 void WebGLRenderingContextBase::texSubImage2D(GLenum target, | 5599 void WebGLRenderingContextBase::texSubImage2D( |
| 5596 GLint level, | 5600 GLenum target, |
| 5597 GLint xoffset, | 5601 GLint level, |
| 5598 GLint yoffset, | 5602 GLint xoffset, |
| 5599 GLsizei width, | 5603 GLint yoffset, |
| 5600 GLsizei height, | 5604 GLsizei width, |
| 5601 GLenum format, | 5605 GLsizei height, |
| 5602 GLenum type, | 5606 GLenum format, |
| 5603 DOMArrayBufferView* pixels) { | 5607 GLenum type, |
| 5608 NotShared<DOMArrayBufferView> pixels) { |
| 5604 texImageHelperDOMArrayBufferView(TexSubImage2D, target, level, 0, width, | 5609 texImageHelperDOMArrayBufferView(TexSubImage2D, target, level, 0, width, |
| 5605 height, 1, 0, format, type, xoffset, yoffset, | 5610 height, 1, 0, format, type, xoffset, yoffset, |
| 5606 0, pixels, NullNotAllowed, 0); | 5611 0, pixels.view(), NullNotAllowed, 0); |
| 5607 } | 5612 } |
| 5608 | 5613 |
| 5609 void WebGLRenderingContextBase::texSubImage2D(GLenum target, | 5614 void WebGLRenderingContextBase::texSubImage2D(GLenum target, |
| 5610 GLint level, | 5615 GLint level, |
| 5611 GLint xoffset, | 5616 GLint xoffset, |
| 5612 GLint yoffset, | 5617 GLint yoffset, |
| 5613 GLenum format, | 5618 GLenum format, |
| 5614 GLenum type, | 5619 GLenum type, |
| 5615 ImageData* pixels) { | 5620 ImageData* pixels) { |
| 5616 texImageHelperImageData(TexSubImage2D, target, level, 0, 0, format, type, 1, | 5621 texImageHelperImageData(TexSubImage2D, target, level, 0, 0, format, type, 1, |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5958 !validateUniformParameters("uniform4iv", location, v.data(), v.size(), 4, | 5963 !validateUniformParameters("uniform4iv", location, v.data(), v.size(), 4, |
| 5959 0, v.size())) | 5964 0, v.size())) |
| 5960 return; | 5965 return; |
| 5961 | 5966 |
| 5962 contextGL()->Uniform4iv(location->location(), v.size() >> 2, v.data()); | 5967 contextGL()->Uniform4iv(location->location(), v.size() >> 2, v.data()); |
| 5963 } | 5968 } |
| 5964 | 5969 |
| 5965 void WebGLRenderingContextBase::uniformMatrix2fv( | 5970 void WebGLRenderingContextBase::uniformMatrix2fv( |
| 5966 const WebGLUniformLocation* location, | 5971 const WebGLUniformLocation* location, |
| 5967 GLboolean transpose, | 5972 GLboolean transpose, |
| 5968 DOMFloat32Array* v) { | 5973 NotShared<DOMFloat32Array> v) { |
| 5969 if (isContextLost() || | 5974 if (isContextLost() || |
| 5970 !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, | 5975 !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, |
| 5971 v, 4, 0, v->length())) | 5976 v.view(), 4, 0, v.view()->length())) |
| 5972 return; | 5977 return; |
| 5973 contextGL()->UniformMatrix2fv(location->location(), v->length() >> 2, | 5978 contextGL()->UniformMatrix2fv(location->location(), v.view()->length() >> 2, |
| 5974 transpose, v->data()); | 5979 transpose, v.view()->data()); |
| 5975 } | 5980 } |
| 5976 | 5981 |
| 5977 void WebGLRenderingContextBase::uniformMatrix2fv( | 5982 void WebGLRenderingContextBase::uniformMatrix2fv( |
| 5978 const WebGLUniformLocation* location, | 5983 const WebGLUniformLocation* location, |
| 5979 GLboolean transpose, | 5984 GLboolean transpose, |
| 5980 Vector<GLfloat>& v) { | 5985 Vector<GLfloat>& v) { |
| 5981 if (isContextLost() || | 5986 if (isContextLost() || |
| 5982 !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, | 5987 !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, |
| 5983 v.data(), v.size(), 4, 0, v.size())) | 5988 v.data(), v.size(), 4, 0, v.size())) |
| 5984 return; | 5989 return; |
| 5985 contextGL()->UniformMatrix2fv(location->location(), v.size() >> 2, transpose, | 5990 contextGL()->UniformMatrix2fv(location->location(), v.size() >> 2, transpose, |
| 5986 v.data()); | 5991 v.data()); |
| 5987 } | 5992 } |
| 5988 | 5993 |
| 5989 void WebGLRenderingContextBase::uniformMatrix3fv( | 5994 void WebGLRenderingContextBase::uniformMatrix3fv( |
| 5990 const WebGLUniformLocation* location, | 5995 const WebGLUniformLocation* location, |
| 5991 GLboolean transpose, | 5996 GLboolean transpose, |
| 5992 DOMFloat32Array* v) { | 5997 NotShared<DOMFloat32Array> v) { |
| 5993 if (isContextLost() || | 5998 if (isContextLost() || |
| 5994 !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, | 5999 !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, |
| 5995 v, 9, 0, v->length())) | 6000 v.view(), 9, 0, v.view()->length())) |
| 5996 return; | 6001 return; |
| 5997 contextGL()->UniformMatrix3fv(location->location(), v->length() / 9, | 6002 contextGL()->UniformMatrix3fv(location->location(), v.view()->length() / 9, |
| 5998 transpose, v->data()); | 6003 transpose, v.view()->data()); |
| 5999 } | 6004 } |
| 6000 | 6005 |
| 6001 void WebGLRenderingContextBase::uniformMatrix3fv( | 6006 void WebGLRenderingContextBase::uniformMatrix3fv( |
| 6002 const WebGLUniformLocation* location, | 6007 const WebGLUniformLocation* location, |
| 6003 GLboolean transpose, | 6008 GLboolean transpose, |
| 6004 Vector<GLfloat>& v) { | 6009 Vector<GLfloat>& v) { |
| 6005 if (isContextLost() || | 6010 if (isContextLost() || |
| 6006 !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, | 6011 !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, |
| 6007 v.data(), v.size(), 9, 0, v.size())) | 6012 v.data(), v.size(), 9, 0, v.size())) |
| 6008 return; | 6013 return; |
| 6009 contextGL()->UniformMatrix3fv(location->location(), v.size() / 9, transpose, | 6014 contextGL()->UniformMatrix3fv(location->location(), v.size() / 9, transpose, |
| 6010 v.data()); | 6015 v.data()); |
| 6011 } | 6016 } |
| 6012 | 6017 |
| 6013 void WebGLRenderingContextBase::uniformMatrix4fv( | 6018 void WebGLRenderingContextBase::uniformMatrix4fv( |
| 6014 const WebGLUniformLocation* location, | 6019 const WebGLUniformLocation* location, |
| 6015 GLboolean transpose, | 6020 GLboolean transpose, |
| 6016 DOMFloat32Array* v) { | 6021 NotShared<DOMFloat32Array> v) { |
| 6017 if (isContextLost() || | 6022 if (isContextLost() || |
| 6018 !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, | 6023 !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, |
| 6019 v, 16, 0, v->length())) | 6024 v.view(), 16, 0, v.view()->length())) |
| 6020 return; | 6025 return; |
| 6021 contextGL()->UniformMatrix4fv(location->location(), v->length() >> 4, | 6026 contextGL()->UniformMatrix4fv(location->location(), v.view()->length() >> 4, |
| 6022 transpose, v->data()); | 6027 transpose, v.view()->data()); |
| 6023 } | 6028 } |
| 6024 | 6029 |
| 6025 void WebGLRenderingContextBase::uniformMatrix4fv( | 6030 void WebGLRenderingContextBase::uniformMatrix4fv( |
| 6026 const WebGLUniformLocation* location, | 6031 const WebGLUniformLocation* location, |
| 6027 GLboolean transpose, | 6032 GLboolean transpose, |
| 6028 Vector<GLfloat>& v) { | 6033 Vector<GLfloat>& v) { |
| 6029 if (isContextLost() || | 6034 if (isContextLost() || |
| 6030 !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, | 6035 !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, |
| 6031 v.data(), v.size(), 16, 0, v.size())) | 6036 v.data(), v.size(), 16, 0, v.size())) |
| 6032 return; | 6037 return; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6068 m_vertexAttribType[index] = type; | 6073 m_vertexAttribType[index] = type; |
| 6069 } | 6074 } |
| 6070 | 6075 |
| 6071 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) { | 6076 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) { |
| 6072 if (isContextLost()) | 6077 if (isContextLost()) |
| 6073 return; | 6078 return; |
| 6074 contextGL()->VertexAttrib1f(index, v0); | 6079 contextGL()->VertexAttrib1f(index, v0); |
| 6075 setVertexAttribType(index, Float32ArrayType); | 6080 setVertexAttribType(index, Float32ArrayType); |
| 6076 } | 6081 } |
| 6077 | 6082 |
| 6078 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, | 6083 void WebGLRenderingContextBase::vertexAttrib1fv( |
| 6079 const DOMFloat32Array* v) { | 6084 GLuint index, |
| 6085 NotShared<const DOMFloat32Array> v) { |
| 6080 if (isContextLost()) | 6086 if (isContextLost()) |
| 6081 return; | 6087 return; |
| 6082 if (!v || v->length() < 1) { | 6088 if (!v.view() || v.view()->length() < 1) { |
| 6083 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); | 6089 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); |
| 6084 return; | 6090 return; |
| 6085 } | 6091 } |
| 6086 contextGL()->VertexAttrib1fv(index, v->data()); | 6092 contextGL()->VertexAttrib1fv(index, v.view()->data()); |
| 6087 setVertexAttribType(index, Float32ArrayType); | 6093 setVertexAttribType(index, Float32ArrayType); |
| 6088 } | 6094 } |
| 6089 | 6095 |
| 6090 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, | 6096 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, |
| 6091 const Vector<GLfloat>& v) { | 6097 const Vector<GLfloat>& v) { |
| 6092 if (isContextLost()) | 6098 if (isContextLost()) |
| 6093 return; | 6099 return; |
| 6094 if (v.size() < 1) { | 6100 if (v.size() < 1) { |
| 6095 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); | 6101 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); |
| 6096 return; | 6102 return; |
| 6097 } | 6103 } |
| 6098 contextGL()->VertexAttrib1fv(index, v.data()); | 6104 contextGL()->VertexAttrib1fv(index, v.data()); |
| 6099 setVertexAttribType(index, Float32ArrayType); | 6105 setVertexAttribType(index, Float32ArrayType); |
| 6100 } | 6106 } |
| 6101 | 6107 |
| 6102 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, | 6108 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, |
| 6103 GLfloat v0, | 6109 GLfloat v0, |
| 6104 GLfloat v1) { | 6110 GLfloat v1) { |
| 6105 if (isContextLost()) | 6111 if (isContextLost()) |
| 6106 return; | 6112 return; |
| 6107 contextGL()->VertexAttrib2f(index, v0, v1); | 6113 contextGL()->VertexAttrib2f(index, v0, v1); |
| 6108 setVertexAttribType(index, Float32ArrayType); | 6114 setVertexAttribType(index, Float32ArrayType); |
| 6109 } | 6115 } |
| 6110 | 6116 |
| 6111 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, | 6117 void WebGLRenderingContextBase::vertexAttrib2fv( |
| 6112 const DOMFloat32Array* v) { | 6118 GLuint index, |
| 6119 NotShared<const DOMFloat32Array> v) { |
| 6113 if (isContextLost()) | 6120 if (isContextLost()) |
| 6114 return; | 6121 return; |
| 6115 if (!v || v->length() < 2) { | 6122 if (!v.view() || v.view()->length() < 2) { |
| 6116 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); | 6123 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); |
| 6117 return; | 6124 return; |
| 6118 } | 6125 } |
| 6119 contextGL()->VertexAttrib2fv(index, v->data()); | 6126 contextGL()->VertexAttrib2fv(index, v.view()->data()); |
| 6120 setVertexAttribType(index, Float32ArrayType); | 6127 setVertexAttribType(index, Float32ArrayType); |
| 6121 } | 6128 } |
| 6122 | 6129 |
| 6123 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, | 6130 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, |
| 6124 const Vector<GLfloat>& v) { | 6131 const Vector<GLfloat>& v) { |
| 6125 if (isContextLost()) | 6132 if (isContextLost()) |
| 6126 return; | 6133 return; |
| 6127 if (v.size() < 2) { | 6134 if (v.size() < 2) { |
| 6128 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); | 6135 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); |
| 6129 return; | 6136 return; |
| 6130 } | 6137 } |
| 6131 contextGL()->VertexAttrib2fv(index, v.data()); | 6138 contextGL()->VertexAttrib2fv(index, v.data()); |
| 6132 setVertexAttribType(index, Float32ArrayType); | 6139 setVertexAttribType(index, Float32ArrayType); |
| 6133 } | 6140 } |
| 6134 | 6141 |
| 6135 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, | 6142 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, |
| 6136 GLfloat v0, | 6143 GLfloat v0, |
| 6137 GLfloat v1, | 6144 GLfloat v1, |
| 6138 GLfloat v2) { | 6145 GLfloat v2) { |
| 6139 if (isContextLost()) | 6146 if (isContextLost()) |
| 6140 return; | 6147 return; |
| 6141 contextGL()->VertexAttrib3f(index, v0, v1, v2); | 6148 contextGL()->VertexAttrib3f(index, v0, v1, v2); |
| 6142 setVertexAttribType(index, Float32ArrayType); | 6149 setVertexAttribType(index, Float32ArrayType); |
| 6143 } | 6150 } |
| 6144 | 6151 |
| 6145 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, | 6152 void WebGLRenderingContextBase::vertexAttrib3fv( |
| 6146 const DOMFloat32Array* v) { | 6153 GLuint index, |
| 6154 NotShared<const DOMFloat32Array> v) { |
| 6147 if (isContextLost()) | 6155 if (isContextLost()) |
| 6148 return; | 6156 return; |
| 6149 if (!v || v->length() < 3) { | 6157 if (!v.view() || v.view()->length() < 3) { |
| 6150 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); | 6158 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); |
| 6151 return; | 6159 return; |
| 6152 } | 6160 } |
| 6153 contextGL()->VertexAttrib3fv(index, v->data()); | 6161 contextGL()->VertexAttrib3fv(index, v.view()->data()); |
| 6154 setVertexAttribType(index, Float32ArrayType); | 6162 setVertexAttribType(index, Float32ArrayType); |
| 6155 } | 6163 } |
| 6156 | 6164 |
| 6157 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, | 6165 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, |
| 6158 const Vector<GLfloat>& v) { | 6166 const Vector<GLfloat>& v) { |
| 6159 if (isContextLost()) | 6167 if (isContextLost()) |
| 6160 return; | 6168 return; |
| 6161 if (v.size() < 3) { | 6169 if (v.size() < 3) { |
| 6162 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); | 6170 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); |
| 6163 return; | 6171 return; |
| 6164 } | 6172 } |
| 6165 contextGL()->VertexAttrib3fv(index, v.data()); | 6173 contextGL()->VertexAttrib3fv(index, v.data()); |
| 6166 setVertexAttribType(index, Float32ArrayType); | 6174 setVertexAttribType(index, Float32ArrayType); |
| 6167 } | 6175 } |
| 6168 | 6176 |
| 6169 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, | 6177 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, |
| 6170 GLfloat v0, | 6178 GLfloat v0, |
| 6171 GLfloat v1, | 6179 GLfloat v1, |
| 6172 GLfloat v2, | 6180 GLfloat v2, |
| 6173 GLfloat v3) { | 6181 GLfloat v3) { |
| 6174 if (isContextLost()) | 6182 if (isContextLost()) |
| 6175 return; | 6183 return; |
| 6176 contextGL()->VertexAttrib4f(index, v0, v1, v2, v3); | 6184 contextGL()->VertexAttrib4f(index, v0, v1, v2, v3); |
| 6177 setVertexAttribType(index, Float32ArrayType); | 6185 setVertexAttribType(index, Float32ArrayType); |
| 6178 } | 6186 } |
| 6179 | 6187 |
| 6180 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, | 6188 void WebGLRenderingContextBase::vertexAttrib4fv( |
| 6181 const DOMFloat32Array* v) { | 6189 GLuint index, |
| 6190 NotShared<const DOMFloat32Array> v) { |
| 6182 if (isContextLost()) | 6191 if (isContextLost()) |
| 6183 return; | 6192 return; |
| 6184 if (!v || v->length() < 4) { | 6193 if (!v.view() || v.view()->length() < 4) { |
| 6185 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); | 6194 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); |
| 6186 return; | 6195 return; |
| 6187 } | 6196 } |
| 6188 contextGL()->VertexAttrib4fv(index, v->data()); | 6197 contextGL()->VertexAttrib4fv(index, v.view()->data()); |
| 6189 setVertexAttribType(index, Float32ArrayType); | 6198 setVertexAttribType(index, Float32ArrayType); |
| 6190 } | 6199 } |
| 6191 | 6200 |
| 6192 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, | 6201 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, |
| 6193 const Vector<GLfloat>& v) { | 6202 const Vector<GLfloat>& v) { |
| 6194 if (isContextLost()) | 6203 if (isContextLost()) |
| 6195 return; | 6204 return; |
| 6196 if (v.size() < 4) { | 6205 if (v.size() < 4) { |
| 6197 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); | 6206 synthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); |
| 6198 return; | 6207 return; |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7849 | 7858 |
| 7850 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7859 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7851 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7860 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7852 if (canvas()) | 7861 if (canvas()) |
| 7853 result.setHTMLCanvasElement(canvas()); | 7862 result.setHTMLCanvasElement(canvas()); |
| 7854 else | 7863 else |
| 7855 result.setOffscreenCanvas(offscreenCanvas()); | 7864 result.setOffscreenCanvas(offscreenCanvas()); |
| 7856 } | 7865 } |
| 7857 | 7866 |
| 7858 } // namespace blink | 7867 } // namespace blink |
| OLD | NEW |