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