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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

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

Powered by Google App Engine
This is Rietveld 408576698