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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 ScopedFramebufferRestorer restorer(this); | 1555 ScopedFramebufferRestorer restorer(this); |
1556 int width, height; | 1556 int width, height; |
1557 WTF::ArrayBufferContents contents; | 1557 WTF::ArrayBufferContents contents; |
1558 if (!GetDrawingBuffer()->PaintRenderingResultsToImageData( | 1558 if (!GetDrawingBuffer()->PaintRenderingResultsToImageData( |
1559 width, height, source_buffer, contents)) | 1559 width, height, source_buffer, contents)) |
1560 return nullptr; | 1560 return nullptr; |
1561 DOMArrayBuffer* image_data_pixels = DOMArrayBuffer::Create(contents); | 1561 DOMArrayBuffer* image_data_pixels = DOMArrayBuffer::Create(contents); |
1562 | 1562 |
1563 return ImageData::Create( | 1563 return ImageData::Create( |
1564 IntSize(width, height), | 1564 IntSize(width, height), |
1565 DOMUint8ClampedArray::Create(image_data_pixels, 0, | 1565 NotShared<DOMUint8ClampedArray>(DOMUint8ClampedArray::Create( |
1566 image_data_pixels->ByteLength())); | 1566 image_data_pixels, 0, image_data_pixels->ByteLength()))); |
1567 } | 1567 } |
1568 | 1568 |
1569 void WebGLRenderingContextBase::Reshape(int width, int height) { | 1569 void WebGLRenderingContextBase::Reshape(int width, int height) { |
1570 if (isContextLost()) | 1570 if (isContextLost()) |
1571 return; | 1571 return; |
1572 | 1572 |
1573 GLint buffer = 0; | 1573 GLint buffer = 0; |
1574 if (IsWebGL2OrHigher()) { | 1574 if (IsWebGL2OrHigher()) { |
1575 // This query returns client side cached binding, so it's trivial. | 1575 // This query returns client side cached binding, so it's trivial. |
1576 // If it changes in the future, such query is heavy and should be avoided. | 1576 // 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... |
1896 if (isContextLost()) | 1896 if (isContextLost()) |
1897 return; | 1897 return; |
1898 if (!data) { | 1898 if (!data) { |
1899 SynthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); | 1899 SynthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); |
1900 return; | 1900 return; |
1901 } | 1901 } |
1902 BufferDataImpl(target, data->ByteLength(), data->Data(), usage); | 1902 BufferDataImpl(target, data->ByteLength(), data->Data(), usage); |
1903 } | 1903 } |
1904 | 1904 |
1905 void WebGLRenderingContextBase::bufferData(GLenum target, | 1905 void WebGLRenderingContextBase::bufferData(GLenum target, |
1906 DOMArrayBufferView* data, | 1906 NotShared<DOMArrayBufferView> data, |
1907 GLenum usage) { | 1907 GLenum usage) { |
1908 if (isContextLost()) | 1908 if (isContextLost()) |
1909 return; | 1909 return; |
1910 DCHECK(data); | 1910 DCHECK(data); |
1911 BufferDataImpl(target, data->byteLength(), data->BaseAddress(), usage); | 1911 BufferDataImpl(target, data.View()->byteLength(), data.View()->BaseAddress(), |
| 1912 usage); |
1912 } | 1913 } |
1913 | 1914 |
1914 void WebGLRenderingContextBase::BufferSubDataImpl(GLenum target, | 1915 void WebGLRenderingContextBase::BufferSubDataImpl(GLenum target, |
1915 long long offset, | 1916 long long offset, |
1916 GLsizeiptr size, | 1917 GLsizeiptr size, |
1917 const void* data) { | 1918 const void* data) { |
1918 WebGLBuffer* buffer = ValidateBufferDataTarget("bufferSubData", target); | 1919 WebGLBuffer* buffer = ValidateBufferDataTarget("bufferSubData", target); |
1919 if (!buffer) | 1920 if (!buffer) |
1920 return; | 1921 return; |
1921 if (!ValidateValueFitNonNegInt32("bufferSubData", "offset", offset)) | 1922 if (!ValidateValueFitNonNegInt32("bufferSubData", "offset", offset)) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2068 color_mask_[3] = alpha; | 2069 color_mask_[3] = alpha; |
2069 ContextGL()->ColorMask(red, green, blue, alpha); | 2070 ContextGL()->ColorMask(red, green, blue, alpha); |
2070 } | 2071 } |
2071 | 2072 |
2072 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) { | 2073 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) { |
2073 if (isContextLost() || !ValidateWebGLObject("compileShader", shader)) | 2074 if (isContextLost() || !ValidateWebGLObject("compileShader", shader)) |
2074 return; | 2075 return; |
2075 ContextGL()->CompileShader(ObjectOrZero(shader)); | 2076 ContextGL()->CompileShader(ObjectOrZero(shader)); |
2076 } | 2077 } |
2077 | 2078 |
2078 void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, | 2079 void WebGLRenderingContextBase::compressedTexImage2D( |
2079 GLint level, | 2080 GLenum target, |
2080 GLenum internalformat, | 2081 GLint level, |
2081 GLsizei width, | 2082 GLenum internalformat, |
2082 GLsizei height, | 2083 GLsizei width, |
2083 GLint border, | 2084 GLsizei height, |
2084 DOMArrayBufferView* data) { | 2085 GLint border, |
| 2086 NotShared<DOMArrayBufferView> data) { |
2085 if (isContextLost()) | 2087 if (isContextLost()) |
2086 return; | 2088 return; |
2087 if (!ValidateTexture2DBinding("compressedTexImage2D", target)) | 2089 if (!ValidateTexture2DBinding("compressedTexImage2D", target)) |
2088 return; | 2090 return; |
2089 if (!ValidateCompressedTexFormat("compressedTexImage2D", internalformat)) | 2091 if (!ValidateCompressedTexFormat("compressedTexImage2D", internalformat)) |
2090 return; | 2092 return; |
2091 ContextGL()->CompressedTexImage2D(target, level, internalformat, width, | 2093 ContextGL()->CompressedTexImage2D(target, level, internalformat, width, |
2092 height, border, data->byteLength(), | 2094 height, border, data.View()->byteLength(), |
2093 data->BaseAddress()); | 2095 data.View()->BaseAddress()); |
2094 } | 2096 } |
2095 | 2097 |
2096 void WebGLRenderingContextBase::compressedTexSubImage2D( | 2098 void WebGLRenderingContextBase::compressedTexSubImage2D( |
2097 GLenum target, | 2099 GLenum target, |
2098 GLint level, | 2100 GLint level, |
2099 GLint xoffset, | 2101 GLint xoffset, |
2100 GLint yoffset, | 2102 GLint yoffset, |
2101 GLsizei width, | 2103 GLsizei width, |
2102 GLsizei height, | 2104 GLsizei height, |
2103 GLenum format, | 2105 GLenum format, |
2104 DOMArrayBufferView* data) { | 2106 NotShared<DOMArrayBufferView> data) { |
2105 if (isContextLost()) | 2107 if (isContextLost()) |
2106 return; | 2108 return; |
2107 if (!ValidateTexture2DBinding("compressedTexSubImage2D", target)) | 2109 if (!ValidateTexture2DBinding("compressedTexSubImage2D", target)) |
2108 return; | 2110 return; |
2109 if (!ValidateCompressedTexFormat("compressedTexSubImage2D", format)) | 2111 if (!ValidateCompressedTexFormat("compressedTexSubImage2D", format)) |
2110 return; | 2112 return; |
2111 ContextGL()->CompressedTexSubImage2D(target, level, xoffset, yoffset, width, | 2113 ContextGL()->CompressedTexSubImage2D( |
2112 height, format, data->byteLength(), | 2114 target, level, xoffset, yoffset, width, height, format, |
2113 data->BaseAddress()); | 2115 data.View()->byteLength(), data.View()->BaseAddress()); |
2114 } | 2116 } |
2115 | 2117 |
2116 bool WebGLRenderingContextBase::ValidateSettableTexFormat( | 2118 bool WebGLRenderingContextBase::ValidateSettableTexFormat( |
2117 const char* function_name, | 2119 const char* function_name, |
2118 GLenum format) { | 2120 GLenum format) { |
2119 if (IsWebGL2OrHigher()) | 2121 if (IsWebGL2OrHigher()) |
2120 return true; | 2122 return true; |
2121 | 2123 |
2122 if (WebGLImageConversion::GetChannelBitsByFormat(format) & | 2124 if (WebGLImageConversion::GetChannelBitsByFormat(format) & |
2123 WebGLImageConversion::kChannelDepthStencil) { | 2125 WebGLImageConversion::kChannelDepthStencil) { |
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 } | 4101 } |
4100 if (buffer_size < | 4102 if (buffer_size < |
4101 static_cast<long long>(total_bytes_required + total_skip_bytes)) { | 4103 static_cast<long long>(total_bytes_required + total_skip_bytes)) { |
4102 SynthesizeGLError(GL_INVALID_OPERATION, "readPixels", | 4104 SynthesizeGLError(GL_INVALID_OPERATION, "readPixels", |
4103 "buffer is not large enough for dimensions"); | 4105 "buffer is not large enough for dimensions"); |
4104 return false; | 4106 return false; |
4105 } | 4107 } |
4106 return true; | 4108 return true; |
4107 } | 4109 } |
4108 | 4110 |
4109 void WebGLRenderingContextBase::readPixels(GLint x, | 4111 void WebGLRenderingContextBase::readPixels( |
4110 GLint y, | 4112 GLint x, |
4111 GLsizei width, | 4113 GLint y, |
4112 GLsizei height, | 4114 GLsizei width, |
4113 GLenum format, | 4115 GLsizei height, |
4114 GLenum type, | 4116 GLenum format, |
4115 DOMArrayBufferView* pixels) { | 4117 GLenum type, |
4116 ReadPixelsHelper(x, y, width, height, format, type, pixels, 0); | 4118 NotShared<DOMArrayBufferView> pixels) { |
| 4119 ReadPixelsHelper(x, y, width, height, format, type, pixels.View(), 0); |
4117 } | 4120 } |
4118 | 4121 |
4119 void WebGLRenderingContextBase::ReadPixelsHelper(GLint x, | 4122 void WebGLRenderingContextBase::ReadPixelsHelper(GLint x, |
4120 GLint y, | 4123 GLint y, |
4121 GLsizei width, | 4124 GLsizei width, |
4122 GLsizei height, | 4125 GLsizei height, |
4123 GLenum format, | 4126 GLenum format, |
4124 GLenum type, | 4127 GLenum type, |
4125 DOMArrayBufferView* pixels, | 4128 DOMArrayBufferView* pixels, |
4126 GLuint offset) { | 4129 GLuint offset) { |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4713 ScopedUnpackParametersResetRestore temporary_reset_unpack( | 4716 ScopedUnpackParametersResetRestore temporary_reset_unpack( |
4714 this, change_unpack_alignment); | 4717 this, change_unpack_alignment); |
4715 if (function_id == kTexImage2D) | 4718 if (function_id == kTexImage2D) |
4716 TexImage2DBase(target, level, internalformat, width, height, border, format, | 4719 TexImage2DBase(target, level, internalformat, width, height, border, format, |
4717 type, data); | 4720 type, data); |
4718 else if (function_id == kTexSubImage2D) | 4721 else if (function_id == kTexSubImage2D) |
4719 ContextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, | 4722 ContextGL()->TexSubImage2D(target, level, xoffset, yoffset, width, height, |
4720 format, type, data); | 4723 format, type, data); |
4721 } | 4724 } |
4722 | 4725 |
4723 void WebGLRenderingContextBase::texImage2D(GLenum target, | 4726 void WebGLRenderingContextBase::texImage2D( |
4724 GLint level, | 4727 GLenum target, |
4725 GLint internalformat, | 4728 GLint level, |
4726 GLsizei width, | 4729 GLint internalformat, |
4727 GLsizei height, | 4730 GLsizei width, |
4728 GLint border, | 4731 GLsizei height, |
4729 GLenum format, | 4732 GLint border, |
4730 GLenum type, | 4733 GLenum format, |
4731 DOMArrayBufferView* pixels) { | 4734 GLenum type, |
| 4735 NotShared<DOMArrayBufferView> pixels) { |
4732 TexImageHelperDOMArrayBufferView(kTexImage2D, target, level, internalformat, | 4736 TexImageHelperDOMArrayBufferView(kTexImage2D, target, level, internalformat, |
4733 width, height, 1, border, format, type, 0, 0, | 4737 width, height, 1, border, format, type, 0, 0, |
4734 0, pixels, kNullAllowed, 0); | 4738 0, pixels.View(), kNullAllowed, 0); |
4735 } | 4739 } |
4736 | 4740 |
4737 void WebGLRenderingContextBase::TexImageHelperImageData( | 4741 void WebGLRenderingContextBase::TexImageHelperImageData( |
4738 TexImageFunctionID function_id, | 4742 TexImageFunctionID function_id, |
4739 GLenum target, | 4743 GLenum target, |
4740 GLint level, | 4744 GLint level, |
4741 GLint internalformat, | 4745 GLint internalformat, |
4742 GLint border, | 4746 GLint border, |
4743 GLenum format, | 4747 GLenum format, |
4744 GLenum type, | 4748 GLenum type, |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5547 GLfloat param) { | 5551 GLfloat param) { |
5548 TexParameter(target, pname, param, 0, true); | 5552 TexParameter(target, pname, param, 0, true); |
5549 } | 5553 } |
5550 | 5554 |
5551 void WebGLRenderingContextBase::texParameteri(GLenum target, | 5555 void WebGLRenderingContextBase::texParameteri(GLenum target, |
5552 GLenum pname, | 5556 GLenum pname, |
5553 GLint param) { | 5557 GLint param) { |
5554 TexParameter(target, pname, 0, param, false); | 5558 TexParameter(target, pname, 0, param, false); |
5555 } | 5559 } |
5556 | 5560 |
5557 void WebGLRenderingContextBase::texSubImage2D(GLenum target, | 5561 void WebGLRenderingContextBase::texSubImage2D( |
5558 GLint level, | 5562 GLenum target, |
5559 GLint xoffset, | 5563 GLint level, |
5560 GLint yoffset, | 5564 GLint xoffset, |
5561 GLsizei width, | 5565 GLint yoffset, |
5562 GLsizei height, | 5566 GLsizei width, |
5563 GLenum format, | 5567 GLsizei height, |
5564 GLenum type, | 5568 GLenum format, |
5565 DOMArrayBufferView* pixels) { | 5569 GLenum type, |
| 5570 NotShared<DOMArrayBufferView> pixels) { |
5566 TexImageHelperDOMArrayBufferView(kTexSubImage2D, target, level, 0, width, | 5571 TexImageHelperDOMArrayBufferView(kTexSubImage2D, target, level, 0, width, |
5567 height, 1, 0, format, type, xoffset, yoffset, | 5572 height, 1, 0, format, type, xoffset, yoffset, |
5568 0, pixels, kNullNotAllowed, 0); | 5573 0, pixels.View(), kNullNotAllowed, 0); |
5569 } | 5574 } |
5570 | 5575 |
5571 void WebGLRenderingContextBase::texSubImage2D(GLenum target, | 5576 void WebGLRenderingContextBase::texSubImage2D(GLenum target, |
5572 GLint level, | 5577 GLint level, |
5573 GLint xoffset, | 5578 GLint xoffset, |
5574 GLint yoffset, | 5579 GLint yoffset, |
5575 GLenum format, | 5580 GLenum format, |
5576 GLenum type, | 5581 GLenum type, |
5577 ImageData* pixels) { | 5582 ImageData* pixels) { |
5578 TexImageHelperImageData(kTexSubImage2D, target, level, 0, 0, format, type, 1, | 5583 TexImageHelperImageData(kTexSubImage2D, target, level, 0, 0, format, type, 1, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5912 !ValidateUniformParameters("uniform4iv", location, v.Data(), v.size(), 4, | 5917 !ValidateUniformParameters("uniform4iv", location, v.Data(), v.size(), 4, |
5913 0, v.size())) | 5918 0, v.size())) |
5914 return; | 5919 return; |
5915 | 5920 |
5916 ContextGL()->Uniform4iv(location->Location(), v.size() >> 2, v.Data()); | 5921 ContextGL()->Uniform4iv(location->Location(), v.size() >> 2, v.Data()); |
5917 } | 5922 } |
5918 | 5923 |
5919 void WebGLRenderingContextBase::uniformMatrix2fv( | 5924 void WebGLRenderingContextBase::uniformMatrix2fv( |
5920 const WebGLUniformLocation* location, | 5925 const WebGLUniformLocation* location, |
5921 GLboolean transpose, | 5926 GLboolean transpose, |
5922 DOMFloat32Array* v) { | 5927 NotShared<DOMFloat32Array> v) { |
5923 if (isContextLost() || | 5928 if (isContextLost() || |
5924 !ValidateUniformMatrixParameters("uniformMatrix2fv", location, transpose, | 5929 !ValidateUniformMatrixParameters("uniformMatrix2fv", location, transpose, |
5925 v, 4, 0, v->length())) | 5930 v.View(), 4, 0, v.View()->length())) |
5926 return; | 5931 return; |
5927 ContextGL()->UniformMatrix2fv(location->Location(), v->length() >> 2, | 5932 ContextGL()->UniformMatrix2fv(location->Location(), v.View()->length() >> 2, |
5928 transpose, v->Data()); | 5933 transpose, v.View()->Data()); |
5929 } | 5934 } |
5930 | 5935 |
5931 void WebGLRenderingContextBase::uniformMatrix2fv( | 5936 void WebGLRenderingContextBase::uniformMatrix2fv( |
5932 const WebGLUniformLocation* location, | 5937 const WebGLUniformLocation* location, |
5933 GLboolean transpose, | 5938 GLboolean transpose, |
5934 Vector<GLfloat>& v) { | 5939 Vector<GLfloat>& v) { |
5935 if (isContextLost() || | 5940 if (isContextLost() || |
5936 !ValidateUniformMatrixParameters("uniformMatrix2fv", location, transpose, | 5941 !ValidateUniformMatrixParameters("uniformMatrix2fv", location, transpose, |
5937 v.Data(), v.size(), 4, 0, v.size())) | 5942 v.Data(), v.size(), 4, 0, v.size())) |
5938 return; | 5943 return; |
5939 ContextGL()->UniformMatrix2fv(location->Location(), v.size() >> 2, transpose, | 5944 ContextGL()->UniformMatrix2fv(location->Location(), v.size() >> 2, transpose, |
5940 v.Data()); | 5945 v.Data()); |
5941 } | 5946 } |
5942 | 5947 |
5943 void WebGLRenderingContextBase::uniformMatrix3fv( | 5948 void WebGLRenderingContextBase::uniformMatrix3fv( |
5944 const WebGLUniformLocation* location, | 5949 const WebGLUniformLocation* location, |
5945 GLboolean transpose, | 5950 GLboolean transpose, |
5946 DOMFloat32Array* v) { | 5951 NotShared<DOMFloat32Array> v) { |
5947 if (isContextLost() || | 5952 if (isContextLost() || |
5948 !ValidateUniformMatrixParameters("uniformMatrix3fv", location, transpose, | 5953 !ValidateUniformMatrixParameters("uniformMatrix3fv", location, transpose, |
5949 v, 9, 0, v->length())) | 5954 v.View(), 9, 0, v.View()->length())) |
5950 return; | 5955 return; |
5951 ContextGL()->UniformMatrix3fv(location->Location(), v->length() / 9, | 5956 ContextGL()->UniformMatrix3fv(location->Location(), v.View()->length() / 9, |
5952 transpose, v->Data()); | 5957 transpose, v.View()->Data()); |
5953 } | 5958 } |
5954 | 5959 |
5955 void WebGLRenderingContextBase::uniformMatrix3fv( | 5960 void WebGLRenderingContextBase::uniformMatrix3fv( |
5956 const WebGLUniformLocation* location, | 5961 const WebGLUniformLocation* location, |
5957 GLboolean transpose, | 5962 GLboolean transpose, |
5958 Vector<GLfloat>& v) { | 5963 Vector<GLfloat>& v) { |
5959 if (isContextLost() || | 5964 if (isContextLost() || |
5960 !ValidateUniformMatrixParameters("uniformMatrix3fv", location, transpose, | 5965 !ValidateUniformMatrixParameters("uniformMatrix3fv", location, transpose, |
5961 v.Data(), v.size(), 9, 0, v.size())) | 5966 v.Data(), v.size(), 9, 0, v.size())) |
5962 return; | 5967 return; |
5963 ContextGL()->UniformMatrix3fv(location->Location(), v.size() / 9, transpose, | 5968 ContextGL()->UniformMatrix3fv(location->Location(), v.size() / 9, transpose, |
5964 v.Data()); | 5969 v.Data()); |
5965 } | 5970 } |
5966 | 5971 |
5967 void WebGLRenderingContextBase::uniformMatrix4fv( | 5972 void WebGLRenderingContextBase::uniformMatrix4fv( |
5968 const WebGLUniformLocation* location, | 5973 const WebGLUniformLocation* location, |
5969 GLboolean transpose, | 5974 GLboolean transpose, |
5970 DOMFloat32Array* v) { | 5975 NotShared<DOMFloat32Array> v) { |
5971 if (isContextLost() || | 5976 if (isContextLost() || |
5972 !ValidateUniformMatrixParameters("uniformMatrix4fv", location, transpose, | 5977 !ValidateUniformMatrixParameters("uniformMatrix4fv", location, transpose, |
5973 v, 16, 0, v->length())) | 5978 v.View(), 16, 0, v.View()->length())) |
5974 return; | 5979 return; |
5975 ContextGL()->UniformMatrix4fv(location->Location(), v->length() >> 4, | 5980 ContextGL()->UniformMatrix4fv(location->Location(), v.View()->length() >> 4, |
5976 transpose, v->Data()); | 5981 transpose, v.View()->Data()); |
5977 } | 5982 } |
5978 | 5983 |
5979 void WebGLRenderingContextBase::uniformMatrix4fv( | 5984 void WebGLRenderingContextBase::uniformMatrix4fv( |
5980 const WebGLUniformLocation* location, | 5985 const WebGLUniformLocation* location, |
5981 GLboolean transpose, | 5986 GLboolean transpose, |
5982 Vector<GLfloat>& v) { | 5987 Vector<GLfloat>& v) { |
5983 if (isContextLost() || | 5988 if (isContextLost() || |
5984 !ValidateUniformMatrixParameters("uniformMatrix4fv", location, transpose, | 5989 !ValidateUniformMatrixParameters("uniformMatrix4fv", location, transpose, |
5985 v.Data(), v.size(), 16, 0, v.size())) | 5990 v.Data(), v.size(), 16, 0, v.size())) |
5986 return; | 5991 return; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6022 vertex_attrib_type_[index] = type; | 6027 vertex_attrib_type_[index] = type; |
6023 } | 6028 } |
6024 | 6029 |
6025 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) { | 6030 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) { |
6026 if (isContextLost()) | 6031 if (isContextLost()) |
6027 return; | 6032 return; |
6028 ContextGL()->VertexAttrib1f(index, v0); | 6033 ContextGL()->VertexAttrib1f(index, v0); |
6029 SetVertexAttribType(index, kFloat32ArrayType); | 6034 SetVertexAttribType(index, kFloat32ArrayType); |
6030 } | 6035 } |
6031 | 6036 |
6032 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, | 6037 void WebGLRenderingContextBase::vertexAttrib1fv( |
6033 const DOMFloat32Array* v) { | 6038 GLuint index, |
| 6039 NotShared<const DOMFloat32Array> v) { |
6034 if (isContextLost()) | 6040 if (isContextLost()) |
6035 return; | 6041 return; |
6036 if (!v || v->length() < 1) { | 6042 if (!v.View() || v.View()->length() < 1) { |
6037 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); | 6043 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); |
6038 return; | 6044 return; |
6039 } | 6045 } |
6040 ContextGL()->VertexAttrib1fv(index, v->Data()); | 6046 ContextGL()->VertexAttrib1fv(index, v.View()->Data()); |
6041 SetVertexAttribType(index, kFloat32ArrayType); | 6047 SetVertexAttribType(index, kFloat32ArrayType); |
6042 } | 6048 } |
6043 | 6049 |
6044 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, | 6050 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, |
6045 const Vector<GLfloat>& v) { | 6051 const Vector<GLfloat>& v) { |
6046 if (isContextLost()) | 6052 if (isContextLost()) |
6047 return; | 6053 return; |
6048 if (v.size() < 1) { | 6054 if (v.size() < 1) { |
6049 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); | 6055 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib1fv", "invalid array"); |
6050 return; | 6056 return; |
6051 } | 6057 } |
6052 ContextGL()->VertexAttrib1fv(index, v.Data()); | 6058 ContextGL()->VertexAttrib1fv(index, v.Data()); |
6053 SetVertexAttribType(index, kFloat32ArrayType); | 6059 SetVertexAttribType(index, kFloat32ArrayType); |
6054 } | 6060 } |
6055 | 6061 |
6056 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, | 6062 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, |
6057 GLfloat v0, | 6063 GLfloat v0, |
6058 GLfloat v1) { | 6064 GLfloat v1) { |
6059 if (isContextLost()) | 6065 if (isContextLost()) |
6060 return; | 6066 return; |
6061 ContextGL()->VertexAttrib2f(index, v0, v1); | 6067 ContextGL()->VertexAttrib2f(index, v0, v1); |
6062 SetVertexAttribType(index, kFloat32ArrayType); | 6068 SetVertexAttribType(index, kFloat32ArrayType); |
6063 } | 6069 } |
6064 | 6070 |
6065 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, | 6071 void WebGLRenderingContextBase::vertexAttrib2fv( |
6066 const DOMFloat32Array* v) { | 6072 GLuint index, |
| 6073 NotShared<const DOMFloat32Array> v) { |
6067 if (isContextLost()) | 6074 if (isContextLost()) |
6068 return; | 6075 return; |
6069 if (!v || v->length() < 2) { | 6076 if (!v.View() || v.View()->length() < 2) { |
6070 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); | 6077 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); |
6071 return; | 6078 return; |
6072 } | 6079 } |
6073 ContextGL()->VertexAttrib2fv(index, v->Data()); | 6080 ContextGL()->VertexAttrib2fv(index, v.View()->Data()); |
6074 SetVertexAttribType(index, kFloat32ArrayType); | 6081 SetVertexAttribType(index, kFloat32ArrayType); |
6075 } | 6082 } |
6076 | 6083 |
6077 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, | 6084 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, |
6078 const Vector<GLfloat>& v) { | 6085 const Vector<GLfloat>& v) { |
6079 if (isContextLost()) | 6086 if (isContextLost()) |
6080 return; | 6087 return; |
6081 if (v.size() < 2) { | 6088 if (v.size() < 2) { |
6082 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); | 6089 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib2fv", "invalid array"); |
6083 return; | 6090 return; |
6084 } | 6091 } |
6085 ContextGL()->VertexAttrib2fv(index, v.Data()); | 6092 ContextGL()->VertexAttrib2fv(index, v.Data()); |
6086 SetVertexAttribType(index, kFloat32ArrayType); | 6093 SetVertexAttribType(index, kFloat32ArrayType); |
6087 } | 6094 } |
6088 | 6095 |
6089 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, | 6096 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, |
6090 GLfloat v0, | 6097 GLfloat v0, |
6091 GLfloat v1, | 6098 GLfloat v1, |
6092 GLfloat v2) { | 6099 GLfloat v2) { |
6093 if (isContextLost()) | 6100 if (isContextLost()) |
6094 return; | 6101 return; |
6095 ContextGL()->VertexAttrib3f(index, v0, v1, v2); | 6102 ContextGL()->VertexAttrib3f(index, v0, v1, v2); |
6096 SetVertexAttribType(index, kFloat32ArrayType); | 6103 SetVertexAttribType(index, kFloat32ArrayType); |
6097 } | 6104 } |
6098 | 6105 |
6099 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, | 6106 void WebGLRenderingContextBase::vertexAttrib3fv( |
6100 const DOMFloat32Array* v) { | 6107 GLuint index, |
| 6108 NotShared<const DOMFloat32Array> v) { |
6101 if (isContextLost()) | 6109 if (isContextLost()) |
6102 return; | 6110 return; |
6103 if (!v || v->length() < 3) { | 6111 if (!v.View() || v.View()->length() < 3) { |
6104 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); | 6112 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); |
6105 return; | 6113 return; |
6106 } | 6114 } |
6107 ContextGL()->VertexAttrib3fv(index, v->Data()); | 6115 ContextGL()->VertexAttrib3fv(index, v.View()->Data()); |
6108 SetVertexAttribType(index, kFloat32ArrayType); | 6116 SetVertexAttribType(index, kFloat32ArrayType); |
6109 } | 6117 } |
6110 | 6118 |
6111 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, | 6119 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, |
6112 const Vector<GLfloat>& v) { | 6120 const Vector<GLfloat>& v) { |
6113 if (isContextLost()) | 6121 if (isContextLost()) |
6114 return; | 6122 return; |
6115 if (v.size() < 3) { | 6123 if (v.size() < 3) { |
6116 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); | 6124 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib3fv", "invalid array"); |
6117 return; | 6125 return; |
6118 } | 6126 } |
6119 ContextGL()->VertexAttrib3fv(index, v.Data()); | 6127 ContextGL()->VertexAttrib3fv(index, v.Data()); |
6120 SetVertexAttribType(index, kFloat32ArrayType); | 6128 SetVertexAttribType(index, kFloat32ArrayType); |
6121 } | 6129 } |
6122 | 6130 |
6123 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, | 6131 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, |
6124 GLfloat v0, | 6132 GLfloat v0, |
6125 GLfloat v1, | 6133 GLfloat v1, |
6126 GLfloat v2, | 6134 GLfloat v2, |
6127 GLfloat v3) { | 6135 GLfloat v3) { |
6128 if (isContextLost()) | 6136 if (isContextLost()) |
6129 return; | 6137 return; |
6130 ContextGL()->VertexAttrib4f(index, v0, v1, v2, v3); | 6138 ContextGL()->VertexAttrib4f(index, v0, v1, v2, v3); |
6131 SetVertexAttribType(index, kFloat32ArrayType); | 6139 SetVertexAttribType(index, kFloat32ArrayType); |
6132 } | 6140 } |
6133 | 6141 |
6134 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, | 6142 void WebGLRenderingContextBase::vertexAttrib4fv( |
6135 const DOMFloat32Array* v) { | 6143 GLuint index, |
| 6144 NotShared<const DOMFloat32Array> v) { |
6136 if (isContextLost()) | 6145 if (isContextLost()) |
6137 return; | 6146 return; |
6138 if (!v || v->length() < 4) { | 6147 if (!v.View() || v.View()->length() < 4) { |
6139 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); | 6148 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); |
6140 return; | 6149 return; |
6141 } | 6150 } |
6142 ContextGL()->VertexAttrib4fv(index, v->Data()); | 6151 ContextGL()->VertexAttrib4fv(index, v.View()->Data()); |
6143 SetVertexAttribType(index, kFloat32ArrayType); | 6152 SetVertexAttribType(index, kFloat32ArrayType); |
6144 } | 6153 } |
6145 | 6154 |
6146 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, | 6155 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, |
6147 const Vector<GLfloat>& v) { | 6156 const Vector<GLfloat>& v) { |
6148 if (isContextLost()) | 6157 if (isContextLost()) |
6149 return; | 6158 return; |
6150 if (v.size() < 4) { | 6159 if (v.size() < 4) { |
6151 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); | 6160 SynthesizeGLError(GL_INVALID_VALUE, "vertexAttrib4fv", "invalid array"); |
6152 return; | 6161 return; |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7807 | 7816 |
7808 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7817 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
7809 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7818 HTMLCanvasElementOrOffscreenCanvas& result) const { |
7810 if (canvas()) | 7819 if (canvas()) |
7811 result.setHTMLCanvasElement(canvas()); | 7820 result.setHTMLCanvasElement(canvas()); |
7812 else | 7821 else |
7813 result.setOffscreenCanvas(offscreenCanvas()); | 7822 result.setOffscreenCanvas(offscreenCanvas()); |
7814 } | 7823 } |
7815 | 7824 |
7816 } // namespace blink | 7825 } // namespace blink |
OLD | NEW |