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 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/html/canvas/WebGLRenderingContextBase.h" | 27 #include "core/html/canvas/WebGLRenderingContextBase.h" |
28 | 28 |
29 #include "bindings/core/v8/ExceptionMessages.h" | 29 #include "bindings/core/v8/ExceptionMessages.h" |
30 #include "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
| 31 #include "core/dom/DOMArrayBuffer.h" |
| 32 #include "core/dom/DOMTypedArray.h" |
31 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
32 #include "core/fetch/ImageResource.h" | 34 #include "core/fetch/ImageResource.h" |
33 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
34 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
35 #include "core/html/HTMLCanvasElement.h" | 37 #include "core/html/HTMLCanvasElement.h" |
36 #include "core/html/HTMLImageElement.h" | 38 #include "core/html/HTMLImageElement.h" |
37 #include "core/html/HTMLVideoElement.h" | 39 #include "core/html/HTMLVideoElement.h" |
38 #include "core/html/ImageData.h" | 40 #include "core/html/ImageData.h" |
39 #include "core/html/canvas/ANGLEInstancedArrays.h" | 41 #include "core/html/canvas/ANGLEInstancedArrays.h" |
40 #include "core/html/canvas/EXTBlendMinMax.h" | 42 #include "core/html/canvas/EXTBlendMinMax.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #include "core/rendering/RenderBox.h" | 79 #include "core/rendering/RenderBox.h" |
78 #include "platform/CheckedInt.h" | 80 #include "platform/CheckedInt.h" |
79 #include "platform/NotImplemented.h" | 81 #include "platform/NotImplemented.h" |
80 #include "platform/RuntimeEnabledFeatures.h" | 82 #include "platform/RuntimeEnabledFeatures.h" |
81 #include "platform/geometry/IntSize.h" | 83 #include "platform/geometry/IntSize.h" |
82 #include "platform/graphics/GraphicsContext.h" | 84 #include "platform/graphics/GraphicsContext.h" |
83 #include "platform/graphics/UnacceleratedImageBufferSurface.h" | 85 #include "platform/graphics/UnacceleratedImageBufferSurface.h" |
84 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" | 86 #include "platform/graphics/gpu/AcceleratedImageBufferSurface.h" |
85 #include "platform/graphics/gpu/DrawingBuffer.h" | 87 #include "platform/graphics/gpu/DrawingBuffer.h" |
86 #include "public/platform/Platform.h" | 88 #include "public/platform/Platform.h" |
87 | |
88 #include "wtf/PassOwnPtr.h" | 89 #include "wtf/PassOwnPtr.h" |
89 #include "wtf/Uint32Array.h" | |
90 #include "wtf/text/StringBuilder.h" | 90 #include "wtf/text/StringBuilder.h" |
91 | 91 |
92 namespace blink { | 92 namespace blink { |
93 | 93 |
94 const double secondsBetweenRestoreAttempts = 1.0; | 94 const double secondsBetweenRestoreAttempts = 1.0; |
95 const int maxGLErrorsAllowedToConsole = 256; | 95 const int maxGLErrorsAllowedToConsole = 256; |
96 const unsigned maxGLActiveContexts = 16; | 96 const unsigned maxGLActiveContexts = 16; |
97 | 97 |
98 // FIXME: Oilpan: static vectors to heap allocated WebGLRenderingContextBase obj
ects | 98 // FIXME: Oilpan: static vectors to heap allocated WebGLRenderingContextBase obj
ects |
99 // are kept here. This relies on the WebGLRenderingContextBase finalization to | 99 // are kept here. This relies on the WebGLRenderingContextBase finalization to |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 { | 1256 { |
1257 if (isContextLost()) | 1257 if (isContextLost()) |
1258 return; | 1258 return; |
1259 if (!size) { | 1259 if (!size) { |
1260 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "size == 0"); | 1260 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "size == 0"); |
1261 return; | 1261 return; |
1262 } | 1262 } |
1263 bufferDataImpl(target, size, 0, usage); | 1263 bufferDataImpl(target, size, 0, usage); |
1264 } | 1264 } |
1265 | 1265 |
1266 void WebGLRenderingContextBase::bufferData(GLenum target, ArrayBuffer* data, GLe
num usage) | 1266 void WebGLRenderingContextBase::bufferData(GLenum target, DOMArrayBuffer* data,
GLenum usage) |
1267 { | 1267 { |
1268 if (isContextLost()) | 1268 if (isContextLost()) |
1269 return; | 1269 return; |
1270 if (!data) { | 1270 if (!data) { |
1271 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); | 1271 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); |
1272 return; | 1272 return; |
1273 } | 1273 } |
1274 bufferDataImpl(target, data->byteLength(), data->data(), usage); | 1274 bufferDataImpl(target, data->byteLength(), data->data(), usage); |
1275 } | 1275 } |
1276 | 1276 |
1277 void WebGLRenderingContextBase::bufferData(GLenum target, ArrayBufferView* data,
GLenum usage) | 1277 void WebGLRenderingContextBase::bufferData(GLenum target, DOMArrayBufferView* da
ta, GLenum usage) |
1278 { | 1278 { |
1279 if (isContextLost()) | 1279 if (isContextLost()) |
1280 return; | 1280 return; |
1281 if (!data) { | 1281 if (!data) { |
1282 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); | 1282 synthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data"); |
1283 return; | 1283 return; |
1284 } | 1284 } |
1285 bufferDataImpl(target, data->byteLength(), data->baseAddress(), usage); | 1285 bufferDataImpl(target, data->byteLength(), data->baseAddress(), usage); |
1286 } | 1286 } |
1287 | 1287 |
1288 void WebGLRenderingContextBase::bufferSubDataImpl(GLenum target, long long offse
t, GLsizeiptr size, const void* data) | 1288 void WebGLRenderingContextBase::bufferSubDataImpl(GLenum target, long long offse
t, GLsizeiptr size, const void* data) |
1289 { | 1289 { |
1290 WebGLBuffer* buffer = validateBufferDataTarget("bufferSubData", target); | 1290 WebGLBuffer* buffer = validateBufferDataTarget("bufferSubData", target); |
1291 if (!buffer) | 1291 if (!buffer) |
1292 return; | 1292 return; |
1293 if (!validateValueFitNonNegInt32("bufferSubData", "offset", offset)) | 1293 if (!validateValueFitNonNegInt32("bufferSubData", "offset", offset)) |
1294 return; | 1294 return; |
1295 if (!data) | 1295 if (!data) |
1296 return; | 1296 return; |
1297 | 1297 |
1298 webContext()->bufferSubData(target, static_cast<GLintptr>(offset), size, dat
a); | 1298 webContext()->bufferSubData(target, static_cast<GLintptr>(offset), size, dat
a); |
1299 } | 1299 } |
1300 | 1300 |
1301 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, A
rrayBuffer* data) | 1301 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D
OMArrayBuffer* data) |
1302 { | 1302 { |
1303 if (isContextLost()) | 1303 if (isContextLost()) |
1304 return; | 1304 return; |
1305 if (!data) | 1305 if (!data) |
1306 return; | 1306 return; |
1307 bufferSubDataImpl(target, offset, data->byteLength(), data->data()); | 1307 bufferSubDataImpl(target, offset, data->byteLength(), data->data()); |
1308 } | 1308 } |
1309 | 1309 |
1310 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, A
rrayBufferView* data) | 1310 void WebGLRenderingContextBase::bufferSubData(GLenum target, long long offset, D
OMArrayBufferView* data) |
1311 { | 1311 { |
1312 if (isContextLost()) | 1312 if (isContextLost()) |
1313 return; | 1313 return; |
1314 if (!data) | 1314 if (!data) |
1315 return; | 1315 return; |
1316 bufferSubDataImpl(target, offset, data->byteLength(), data->baseAddress()); | 1316 bufferSubDataImpl(target, offset, data->byteLength(), data->baseAddress()); |
1317 } | 1317 } |
1318 | 1318 |
1319 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) | 1319 GLenum WebGLRenderingContextBase::checkFramebufferStatus(GLenum target) |
1320 { | 1320 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 webContext()->colorMask(red, green, blue, alpha); | 1400 webContext()->colorMask(red, green, blue, alpha); |
1401 } | 1401 } |
1402 | 1402 |
1403 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) | 1403 void WebGLRenderingContextBase::compileShader(WebGLShader* shader) |
1404 { | 1404 { |
1405 if (isContextLost() || !validateWebGLObject("compileShader", shader)) | 1405 if (isContextLost() || !validateWebGLObject("compileShader", shader)) |
1406 return; | 1406 return; |
1407 webContext()->compileShader(objectOrZero(shader)); | 1407 webContext()->compileShader(objectOrZero(shader)); |
1408 } | 1408 } |
1409 | 1409 |
1410 void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level,
GLenum internalformat, GLsizei width, GLsizei height, GLint border, ArrayBuffer
View* data) | 1410 void WebGLRenderingContextBase::compressedTexImage2D(GLenum target, GLint level,
GLenum internalformat, GLsizei width, GLsizei height, GLint border, DOMArrayBuf
ferView* data) |
1411 { | 1411 { |
1412 if (isContextLost()) | 1412 if (isContextLost()) |
1413 return; | 1413 return; |
1414 if (!validateTexFuncLevel("compressedTexImage2D", target, level)) | 1414 if (!validateTexFuncLevel("compressedTexImage2D", target, level)) |
1415 return; | 1415 return; |
1416 | 1416 |
1417 if (!validateCompressedTexFormat(internalformat)) { | 1417 if (!validateCompressedTexFormat(internalformat)) { |
1418 synthesizeGLError(GL_INVALID_ENUM, "compressedTexImage2D", "invalid inte
rnalformat"); | 1418 synthesizeGLError(GL_INVALID_ENUM, "compressedTexImage2D", "invalid inte
rnalformat"); |
1419 return; | 1419 return; |
1420 } | 1420 } |
(...skipping 13 matching lines...) Expand all Loading... |
1434 if (level && WebGLTexture::isNPOT(width, height)) { | 1434 if (level && WebGLTexture::isNPOT(width, height)) { |
1435 synthesizeGLError(GL_INVALID_VALUE, "compressedTexImage2D", "level >
0 not power of 2"); | 1435 synthesizeGLError(GL_INVALID_VALUE, "compressedTexImage2D", "level >
0 not power of 2"); |
1436 return; | 1436 return; |
1437 } | 1437 } |
1438 } | 1438 } |
1439 webContext()->compressedTexImage2D(target, level, internalformat, width, hei
ght, | 1439 webContext()->compressedTexImage2D(target, level, internalformat, width, hei
ght, |
1440 border, data->byteLength(), data->baseAddress()); | 1440 border, data->byteLength(), data->baseAddress()); |
1441 tex->setLevelInfo(target, level, internalformat, width, height, GL_UNSIGNED_
BYTE); | 1441 tex->setLevelInfo(target, level, internalformat, width, height, GL_UNSIGNED_
BYTE); |
1442 } | 1442 } |
1443 | 1443 |
1444 void WebGLRenderingContextBase::compressedTexSubImage2D(GLenum target, GLint lev
el, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format,
ArrayBufferView* data) | 1444 void WebGLRenderingContextBase::compressedTexSubImage2D(GLenum target, GLint lev
el, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format,
DOMArrayBufferView* data) |
1445 { | 1445 { |
1446 if (isContextLost()) | 1446 if (isContextLost()) |
1447 return; | 1447 return; |
1448 if (!validateTexFuncLevel("compressedTexSubImage2D", target, level)) | 1448 if (!validateTexFuncLevel("compressedTexSubImage2D", target, level)) |
1449 return; | 1449 return; |
1450 if (!validateCompressedTexFormat(format)) { | 1450 if (!validateCompressedTexFormat(format)) { |
1451 synthesizeGLError(GL_INVALID_ENUM, "compressedTexSubImage2D", "invalid f
ormat"); | 1451 synthesizeGLError(GL_INVALID_ENUM, "compressedTexSubImage2D", "invalid f
ormat"); |
1452 return; | 1452 return; |
1453 } | 1453 } |
1454 if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height,
format, data)) | 1454 if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height,
format, data)) |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 return getUnsignedIntParameter(pname); | 2288 return getUnsignedIntParameter(pname); |
2289 case GL_BLEND_SRC_RGB: | 2289 case GL_BLEND_SRC_RGB: |
2290 return getUnsignedIntParameter(pname); | 2290 return getUnsignedIntParameter(pname); |
2291 case GL_BLUE_BITS: | 2291 case GL_BLUE_BITS: |
2292 return getIntParameter(pname); | 2292 return getIntParameter(pname); |
2293 case GL_COLOR_CLEAR_VALUE: | 2293 case GL_COLOR_CLEAR_VALUE: |
2294 return getWebGLFloatArrayParameter(pname); | 2294 return getWebGLFloatArrayParameter(pname); |
2295 case GL_COLOR_WRITEMASK: | 2295 case GL_COLOR_WRITEMASK: |
2296 return getBooleanArrayParameter(pname); | 2296 return getBooleanArrayParameter(pname); |
2297 case GL_COMPRESSED_TEXTURE_FORMATS: | 2297 case GL_COMPRESSED_TEXTURE_FORMATS: |
2298 return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(
), m_compressedTextureFormats.size())); | 2298 return WebGLGetInfo(DOMUint32Array::create(m_compressedTextureFormats.da
ta(), m_compressedTextureFormats.size())); |
2299 case GL_CULL_FACE: | 2299 case GL_CULL_FACE: |
2300 return getBooleanParameter(pname); | 2300 return getBooleanParameter(pname); |
2301 case GL_CULL_FACE_MODE: | 2301 case GL_CULL_FACE_MODE: |
2302 return getUnsignedIntParameter(pname); | 2302 return getUnsignedIntParameter(pname); |
2303 case GL_CURRENT_PROGRAM: | 2303 case GL_CURRENT_PROGRAM: |
2304 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLProgram>(m_currentProgra
m.get())); | 2304 return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLProgram>(m_currentProgra
m.get())); |
2305 case GL_DEPTH_BITS: | 2305 case GL_DEPTH_BITS: |
2306 if (!m_framebufferBinding && !m_requestedAttributes->depth()) | 2306 if (!m_framebufferBinding && !m_requestedAttributes->depth()) |
2307 return WebGLGetInfo(intZero); | 2307 return WebGLGetInfo(intZero); |
2308 return getIntParameter(pname); | 2308 return getIntParameter(pname); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 // Can't handle this type | 2800 // Can't handle this type |
2801 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unhandled
type"); | 2801 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unhandled
type"); |
2802 return WebGLGetInfo(); | 2802 return WebGLGetInfo(); |
2803 } | 2803 } |
2804 switch (baseType) { | 2804 switch (baseType) { |
2805 case GL_FLOAT: { | 2805 case GL_FLOAT: { |
2806 GLfloat value[16] = {0}; | 2806 GLfloat value[16] = {0}; |
2807 webContext()->getUniformfv(objectOrZero(program), location,
value); | 2807 webContext()->getUniformfv(objectOrZero(program), location,
value); |
2808 if (length == 1) | 2808 if (length == 1) |
2809 return WebGLGetInfo(value[0]); | 2809 return WebGLGetInfo(value[0]); |
2810 return WebGLGetInfo(Float32Array::create(value, length)); | 2810 return WebGLGetInfo(DOMFloat32Array::create(value, length)); |
2811 } | 2811 } |
2812 case GL_INT: { | 2812 case GL_INT: { |
2813 GLint value[4] = {0}; | 2813 GLint value[4] = {0}; |
2814 webContext()->getUniformiv(objectOrZero(program), location,
value); | 2814 webContext()->getUniformiv(objectOrZero(program), location,
value); |
2815 if (length == 1) | 2815 if (length == 1) |
2816 return WebGLGetInfo(value[0]); | 2816 return WebGLGetInfo(value[0]); |
2817 return WebGLGetInfo(Int32Array::create(value, length)); | 2817 return WebGLGetInfo(DOMInt32Array::create(value, length)); |
2818 } | 2818 } |
2819 case GL_BOOL: { | 2819 case GL_BOOL: { |
2820 GLint value[4] = {0}; | 2820 GLint value[4] = {0}; |
2821 webContext()->getUniformiv(objectOrZero(program), location,
value); | 2821 webContext()->getUniformiv(objectOrZero(program), location,
value); |
2822 if (length > 1) { | 2822 if (length > 1) { |
2823 bool boolValue[16] = {0}; | 2823 bool boolValue[16] = {0}; |
2824 for (unsigned j = 0; j < length; j++) | 2824 for (unsigned j = 0; j < length; j++) |
2825 boolValue[j] = static_cast<bool>(value[j]); | 2825 boolValue[j] = static_cast<bool>(value[j]); |
2826 return WebGLGetInfo(boolValue, length); | 2826 return WebGLGetInfo(boolValue, length); |
2827 } | 2827 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2880 return WebGLGetInfo(state.enabled); | 2880 return WebGLGetInfo(state.enabled); |
2881 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 2881 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
2882 return WebGLGetInfo(state.normalized); | 2882 return WebGLGetInfo(state.normalized); |
2883 case GL_VERTEX_ATTRIB_ARRAY_SIZE: | 2883 case GL_VERTEX_ATTRIB_ARRAY_SIZE: |
2884 return WebGLGetInfo(state.size); | 2884 return WebGLGetInfo(state.size); |
2885 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 2885 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
2886 return WebGLGetInfo(state.originalStride); | 2886 return WebGLGetInfo(state.originalStride); |
2887 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 2887 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
2888 return WebGLGetInfo(state.type); | 2888 return WebGLGetInfo(state.type); |
2889 case GL_CURRENT_VERTEX_ATTRIB: | 2889 case GL_CURRENT_VERTEX_ATTRIB: |
2890 return WebGLGetInfo(Float32Array::create(m_vertexAttribValue[index].valu
e, 4)); | 2890 return WebGLGetInfo(DOMFloat32Array::create(m_vertexAttribValue[index].v
alue, 4)); |
2891 default: | 2891 default: |
2892 synthesizeGLError(GL_INVALID_ENUM, "getVertexAttrib", "invalid parameter
name"); | 2892 synthesizeGLError(GL_INVALID_ENUM, "getVertexAttrib", "invalid parameter
name"); |
2893 return WebGLGetInfo(); | 2893 return WebGLGetInfo(); |
2894 } | 2894 } |
2895 } | 2895 } |
2896 | 2896 |
2897 long long WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum
pname) | 2897 long long WebGLRenderingContextBase::getVertexAttribOffset(GLuint index, GLenum
pname) |
2898 { | 2898 { |
2899 if (isContextLost()) | 2899 if (isContextLost()) |
2900 return 0; | 2900 return 0; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3057 } | 3057 } |
3058 } | 3058 } |
3059 | 3059 |
3060 void WebGLRenderingContextBase::polygonOffset(GLfloat factor, GLfloat units) | 3060 void WebGLRenderingContextBase::polygonOffset(GLfloat factor, GLfloat units) |
3061 { | 3061 { |
3062 if (isContextLost()) | 3062 if (isContextLost()) |
3063 return; | 3063 return; |
3064 webContext()->polygonOffset(factor, units); | 3064 webContext()->polygonOffset(factor, units); |
3065 } | 3065 } |
3066 | 3066 |
3067 void WebGLRenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsi
zei height, GLenum format, GLenum type, ArrayBufferView* pixels) | 3067 void WebGLRenderingContextBase::readPixels(GLint x, GLint y, GLsizei width, GLsi
zei height, GLenum format, GLenum type, DOMArrayBufferView* pixels) |
3068 { | 3068 { |
3069 if (isContextLost()) | 3069 if (isContextLost()) |
3070 return; | 3070 return; |
3071 // Due to WebGL's same-origin restrictions, it is not possible to | 3071 // Due to WebGL's same-origin restrictions, it is not possible to |
3072 // taint the origin using the WebGL API. | 3072 // taint the origin using the WebGL API. |
3073 ASSERT(canvas()->originClean()); | 3073 ASSERT(canvas()->originClean()); |
3074 // Validate input parameters. | 3074 // Validate input parameters. |
3075 if (!pixels) { | 3075 if (!pixels) { |
3076 synthesizeGLError(GL_INVALID_VALUE, "readPixels", "no destination ArrayB
ufferView"); | 3076 synthesizeGLError(GL_INVALID_VALUE, "readPixels", "no destination ArrayB
ufferView"); |
3077 return; | 3077 return; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3451 } | 3451 } |
3452 | 3452 |
3453 IntRect srcRect(IntPoint(), image->size()); | 3453 IntRect srcRect(IntPoint(), image->size()); |
3454 IntRect destRect(0, 0, size.width(), size.height()); | 3454 IntRect destRect(0, 0, size.width(), size.height()); |
3455 buf->context()->drawImage(image, destRect, srcRect); | 3455 buf->context()->drawImage(image, destRect, srcRect); |
3456 return buf->copyImage(ImageBuffer::fastCopyImageMode()); | 3456 return buf->copyImage(ImageBuffer::fastCopyImageMode()); |
3457 } | 3457 } |
3458 | 3458 |
3459 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
ternalformat, | 3459 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in
ternalformat, |
3460 GLsizei width, GLsizei height, GLint border, | 3460 GLsizei width, GLsizei height, GLint border, |
3461 GLenum format, GLenum type, ArrayBufferView* pixels, ExceptionState& excepti
onState) | 3461 GLenum format, GLenum type, DOMArrayBufferView* pixels, ExceptionState& exce
ptionState) |
3462 { | 3462 { |
3463 if (isContextLost() || !validateTexFuncData("texImage2D", level, width, heig
ht, format, type, pixels, NullAllowed) | 3463 if (isContextLost() || !validateTexFuncData("texImage2D", level, width, heig
ht, format, type, pixels, NullAllowed) |
3464 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferVie
w, target, level, internalformat, width, height, border, format, type, 0, 0)) | 3464 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferVie
w, target, level, internalformat, width, height, border, format, type, 0, 0)) |
3465 return; | 3465 return; |
3466 void* data = pixels ? pixels->baseAddress() : 0; | 3466 void* data = pixels ? pixels->baseAddress() : 0; |
3467 Vector<uint8_t> tempData; | 3467 Vector<uint8_t> tempData; |
3468 bool changeUnpackAlignment = false; | 3468 bool changeUnpackAlignment = false; |
3469 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 3469 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
3470 if (!WebGLImageConversion::extractTextureData(width, height, format, typ
e, m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, tempData)) | 3470 if (!WebGLImageConversion::extractTextureData(width, height, format, typ
e, m_unpackAlignment, m_unpackFlipY, m_unpackPremultiplyAlpha, data, tempData)) |
3471 return; | 3471 return; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3708 | 3708 |
3709 if (m_unpackAlignment != 1) | 3709 if (m_unpackAlignment != 1) |
3710 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); | 3710 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, 1); |
3711 texSubImage2DBase(target, level, xoffset, yoffset, imageExtractor.imageWidth
(), imageExtractor.imageHeight(), format, type, needConversion ? data.data() :
imagePixelData, exceptionState); | 3711 texSubImage2DBase(target, level, xoffset, yoffset, imageExtractor.imageWidth
(), imageExtractor.imageHeight(), format, type, needConversion ? data.data() :
imagePixelData, exceptionState); |
3712 if (m_unpackAlignment != 1) | 3712 if (m_unpackAlignment != 1) |
3713 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 3713 webContext()->pixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
3714 } | 3714 } |
3715 | 3715 |
3716 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, | 3716 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, |
3717 GLsizei width, GLsizei height, | 3717 GLsizei width, GLsizei height, |
3718 GLenum format, GLenum type, ArrayBufferView* pixels, ExceptionState& excepti
onState) | 3718 GLenum format, GLenum type, DOMArrayBufferView* pixels, ExceptionState& exce
ptionState) |
3719 { | 3719 { |
3720 if (isContextLost() || !validateTexFuncData("texSubImage2D", level, width, h
eight, format, type, pixels, NullNotAllowed) | 3720 if (isContextLost() || !validateTexFuncData("texSubImage2D", level, width, h
eight, format, type, pixels, NullNotAllowed) |
3721 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceArrayBufferVie
w, target, level, format, width, height, 0, format, type, xoffset, yoffset)) | 3721 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceArrayBufferVie
w, target, level, format, width, height, 0, format, type, xoffset, yoffset)) |
3722 return; | 3722 return; |
3723 void* data = pixels->baseAddress(); | 3723 void* data = pixels->baseAddress(); |
3724 Vector<uint8_t> tempData; | 3724 Vector<uint8_t> tempData; |
3725 bool changeUnpackAlignment = false; | 3725 bool changeUnpackAlignment = false; |
3726 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { | 3726 if (data && (m_unpackFlipY || m_unpackPremultiplyAlpha)) { |
3727 if (!WebGLImageConversion::extractTextureData(width, height, format, typ
e, | 3727 if (!WebGLImageConversion::extractTextureData(width, height, format, typ
e, |
3728 m_unpackAlignment, | 3728 m_unpackAlignment, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3814 return; | 3814 return; |
3815 | 3815 |
3816 if (location->program() != m_currentProgram) { | 3816 if (location->program() != m_currentProgram) { |
3817 synthesizeGLError(GL_INVALID_OPERATION, "uniform1f", "location not for c
urrent program"); | 3817 synthesizeGLError(GL_INVALID_OPERATION, "uniform1f", "location not for c
urrent program"); |
3818 return; | 3818 return; |
3819 } | 3819 } |
3820 | 3820 |
3821 webContext()->uniform1f(location->location(), x); | 3821 webContext()->uniform1f(location->location(), x); |
3822 } | 3822 } |
3823 | 3823 |
3824 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
Float32Array* v) | 3824 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) |
3825 { | 3825 { |
3826 if (isContextLost() || !validateUniformParameters("uniform1fv", location, v,
1)) | 3826 if (isContextLost() || !validateUniformParameters("uniform1fv", location, v,
1)) |
3827 return; | 3827 return; |
3828 | 3828 |
3829 webContext()->uniform1fv(location->location(), v->length(), v->data()); | 3829 webContext()->uniform1fv(location->location(), v->length(), v->data()); |
3830 } | 3830 } |
3831 | 3831 |
3832 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) | 3832 void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) |
3833 { | 3833 { |
3834 if (isContextLost() || !validateUniformParameters("uniform1fv", location, v,
size, 1)) | 3834 if (isContextLost() || !validateUniformParameters("uniform1fv", location, v,
size, 1)) |
3835 return; | 3835 return; |
3836 | 3836 |
3837 webContext()->uniform1fv(location->location(), size, v); | 3837 webContext()->uniform1fv(location->location(), size, v); |
3838 } | 3838 } |
3839 | 3839 |
3840 void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location,
GLint x) | 3840 void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location,
GLint x) |
3841 { | 3841 { |
3842 if (isContextLost() || !location) | 3842 if (isContextLost() || !location) |
3843 return; | 3843 return; |
3844 | 3844 |
3845 if (location->program() != m_currentProgram) { | 3845 if (location->program() != m_currentProgram) { |
3846 synthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for c
urrent program"); | 3846 synthesizeGLError(GL_INVALID_OPERATION, "uniform1i", "location not for c
urrent program"); |
3847 return; | 3847 return; |
3848 } | 3848 } |
3849 | 3849 |
3850 webContext()->uniform1i(location->location(), x); | 3850 webContext()->uniform1i(location->location(), x); |
3851 } | 3851 } |
3852 | 3852 |
3853 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
Int32Array* v) | 3853 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
DOMInt32Array* v) |
3854 { | 3854 { |
3855 if (isContextLost() || !validateUniformParameters("uniform1iv", location, v,
1)) | 3855 if (isContextLost() || !validateUniformParameters("uniform1iv", location, v,
1)) |
3856 return; | 3856 return; |
3857 | 3857 |
3858 webContext()->uniform1iv(location->location(), v->length(), v->data()); | 3858 webContext()->uniform1iv(location->location(), v->length(), v->data()); |
3859 } | 3859 } |
3860 | 3860 |
3861 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) | 3861 void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) |
3862 { | 3862 { |
3863 if (isContextLost() || !validateUniformParameters("uniform1iv", location, v,
size, 1)) | 3863 if (isContextLost() || !validateUniformParameters("uniform1iv", location, v,
size, 1)) |
3864 return; | 3864 return; |
3865 | 3865 |
3866 webContext()->uniform1iv(location->location(), size, v); | 3866 webContext()->uniform1iv(location->location(), size, v); |
3867 } | 3867 } |
3868 | 3868 |
3869 void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y) | 3869 void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y) |
3870 { | 3870 { |
3871 if (isContextLost() || !location) | 3871 if (isContextLost() || !location) |
3872 return; | 3872 return; |
3873 | 3873 |
3874 if (location->program() != m_currentProgram) { | 3874 if (location->program() != m_currentProgram) { |
3875 synthesizeGLError(GL_INVALID_OPERATION, "uniform2f", "location not for c
urrent program"); | 3875 synthesizeGLError(GL_INVALID_OPERATION, "uniform2f", "location not for c
urrent program"); |
3876 return; | 3876 return; |
3877 } | 3877 } |
3878 | 3878 |
3879 webContext()->uniform2f(location->location(), x, y); | 3879 webContext()->uniform2f(location->location(), x, y); |
3880 } | 3880 } |
3881 | 3881 |
3882 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
Float32Array* v) | 3882 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) |
3883 { | 3883 { |
3884 if (isContextLost() || !validateUniformParameters("uniform2fv", location, v,
2)) | 3884 if (isContextLost() || !validateUniformParameters("uniform2fv", location, v,
2)) |
3885 return; | 3885 return; |
3886 | 3886 |
3887 webContext()->uniform2fv(location->location(), v->length() >> 1, v->data()); | 3887 webContext()->uniform2fv(location->location(), v->length() >> 1, v->data()); |
3888 } | 3888 } |
3889 | 3889 |
3890 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) | 3890 void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) |
3891 { | 3891 { |
3892 if (isContextLost() || !validateUniformParameters("uniform2fv", location, v,
size, 2)) | 3892 if (isContextLost() || !validateUniformParameters("uniform2fv", location, v,
size, 2)) |
3893 return; | 3893 return; |
3894 | 3894 |
3895 webContext()->uniform2fv(location->location(), size >> 1, v); | 3895 webContext()->uniform2fv(location->location(), size >> 1, v); |
3896 } | 3896 } |
3897 | 3897 |
3898 void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location,
GLint x, GLint y) | 3898 void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location,
GLint x, GLint y) |
3899 { | 3899 { |
3900 if (isContextLost() || !location) | 3900 if (isContextLost() || !location) |
3901 return; | 3901 return; |
3902 | 3902 |
3903 if (location->program() != m_currentProgram) { | 3903 if (location->program() != m_currentProgram) { |
3904 synthesizeGLError(GL_INVALID_OPERATION, "uniform2i", "location not for c
urrent program"); | 3904 synthesizeGLError(GL_INVALID_OPERATION, "uniform2i", "location not for c
urrent program"); |
3905 return; | 3905 return; |
3906 } | 3906 } |
3907 | 3907 |
3908 webContext()->uniform2i(location->location(), x, y); | 3908 webContext()->uniform2i(location->location(), x, y); |
3909 } | 3909 } |
3910 | 3910 |
3911 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
Int32Array* v) | 3911 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
DOMInt32Array* v) |
3912 { | 3912 { |
3913 if (isContextLost() || !validateUniformParameters("uniform2iv", location, v,
2)) | 3913 if (isContextLost() || !validateUniformParameters("uniform2iv", location, v,
2)) |
3914 return; | 3914 return; |
3915 | 3915 |
3916 webContext()->uniform2iv(location->location(), v->length() >> 1, v->data()); | 3916 webContext()->uniform2iv(location->location(), v->length() >> 1, v->data()); |
3917 } | 3917 } |
3918 | 3918 |
3919 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) | 3919 void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) |
3920 { | 3920 { |
3921 if (isContextLost() || !validateUniformParameters("uniform2iv", location, v,
size, 2)) | 3921 if (isContextLost() || !validateUniformParameters("uniform2iv", location, v,
size, 2)) |
3922 return; | 3922 return; |
3923 | 3923 |
3924 webContext()->uniform2iv(location->location(), size >> 1, v); | 3924 webContext()->uniform2iv(location->location(), size >> 1, v); |
3925 } | 3925 } |
3926 | 3926 |
3927 void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z) | 3927 void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z) |
3928 { | 3928 { |
3929 if (isContextLost() || !location) | 3929 if (isContextLost() || !location) |
3930 return; | 3930 return; |
3931 | 3931 |
3932 if (location->program() != m_currentProgram) { | 3932 if (location->program() != m_currentProgram) { |
3933 synthesizeGLError(GL_INVALID_OPERATION, "uniform3f", "location not for c
urrent program"); | 3933 synthesizeGLError(GL_INVALID_OPERATION, "uniform3f", "location not for c
urrent program"); |
3934 return; | 3934 return; |
3935 } | 3935 } |
3936 | 3936 |
3937 webContext()->uniform3f(location->location(), x, y, z); | 3937 webContext()->uniform3f(location->location(), x, y, z); |
3938 } | 3938 } |
3939 | 3939 |
3940 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
Float32Array* v) | 3940 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) |
3941 { | 3941 { |
3942 if (isContextLost() || !validateUniformParameters("uniform3fv", location, v,
3)) | 3942 if (isContextLost() || !validateUniformParameters("uniform3fv", location, v,
3)) |
3943 return; | 3943 return; |
3944 | 3944 |
3945 webContext()->uniform3fv(location->location(), v->length() / 3, v->data()); | 3945 webContext()->uniform3fv(location->location(), v->length() / 3, v->data()); |
3946 } | 3946 } |
3947 | 3947 |
3948 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) | 3948 void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) |
3949 { | 3949 { |
3950 if (isContextLost() || !validateUniformParameters("uniform3fv", location, v,
size, 3)) | 3950 if (isContextLost() || !validateUniformParameters("uniform3fv", location, v,
size, 3)) |
3951 return; | 3951 return; |
3952 | 3952 |
3953 webContext()->uniform3fv(location->location(), size / 3, v); | 3953 webContext()->uniform3fv(location->location(), size / 3, v); |
3954 } | 3954 } |
3955 | 3955 |
3956 void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z) | 3956 void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z) |
3957 { | 3957 { |
3958 if (isContextLost() || !location) | 3958 if (isContextLost() || !location) |
3959 return; | 3959 return; |
3960 | 3960 |
3961 if (location->program() != m_currentProgram) { | 3961 if (location->program() != m_currentProgram) { |
3962 synthesizeGLError(GL_INVALID_OPERATION, "uniform3i", "location not for c
urrent program"); | 3962 synthesizeGLError(GL_INVALID_OPERATION, "uniform3i", "location not for c
urrent program"); |
3963 return; | 3963 return; |
3964 } | 3964 } |
3965 | 3965 |
3966 webContext()->uniform3i(location->location(), x, y, z); | 3966 webContext()->uniform3i(location->location(), x, y, z); |
3967 } | 3967 } |
3968 | 3968 |
3969 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
Int32Array* v) | 3969 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
DOMInt32Array* v) |
3970 { | 3970 { |
3971 if (isContextLost() || !validateUniformParameters("uniform3iv", location, v,
3)) | 3971 if (isContextLost() || !validateUniformParameters("uniform3iv", location, v,
3)) |
3972 return; | 3972 return; |
3973 | 3973 |
3974 webContext()->uniform3iv(location->location(), v->length() / 3, v->data()); | 3974 webContext()->uniform3iv(location->location(), v->length() / 3, v->data()); |
3975 } | 3975 } |
3976 | 3976 |
3977 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) | 3977 void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) |
3978 { | 3978 { |
3979 if (isContextLost() || !validateUniformParameters("uniform3iv", location, v,
size, 3)) | 3979 if (isContextLost() || !validateUniformParameters("uniform3iv", location, v,
size, 3)) |
3980 return; | 3980 return; |
3981 | 3981 |
3982 webContext()->uniform3iv(location->location(), size / 3, v); | 3982 webContext()->uniform3iv(location->location(), size / 3, v); |
3983 } | 3983 } |
3984 | 3984 |
3985 void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z, GLfloat w) | 3985 void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location,
GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
3986 { | 3986 { |
3987 if (isContextLost() || !location) | 3987 if (isContextLost() || !location) |
3988 return; | 3988 return; |
3989 | 3989 |
3990 if (location->program() != m_currentProgram) { | 3990 if (location->program() != m_currentProgram) { |
3991 synthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for c
urrent program"); | 3991 synthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for c
urrent program"); |
3992 return; | 3992 return; |
3993 } | 3993 } |
3994 | 3994 |
3995 webContext()->uniform4f(location->location(), x, y, z, w); | 3995 webContext()->uniform4f(location->location(), x, y, z, w); |
3996 } | 3996 } |
3997 | 3997 |
3998 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
Float32Array* v) | 3998 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
DOMFloat32Array* v) |
3999 { | 3999 { |
4000 if (isContextLost() || !validateUniformParameters("uniform4fv", location, v,
4)) | 4000 if (isContextLost() || !validateUniformParameters("uniform4fv", location, v,
4)) |
4001 return; | 4001 return; |
4002 | 4002 |
4003 webContext()->uniform4fv(location->location(), v->length() >> 2, v->data()); | 4003 webContext()->uniform4fv(location->location(), v->length() >> 2, v->data()); |
4004 } | 4004 } |
4005 | 4005 |
4006 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) | 4006 void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location,
GLfloat* v, GLsizei size) |
4007 { | 4007 { |
4008 if (isContextLost() || !validateUniformParameters("uniform4fv", location, v,
size, 4)) | 4008 if (isContextLost() || !validateUniformParameters("uniform4fv", location, v,
size, 4)) |
4009 return; | 4009 return; |
4010 | 4010 |
4011 webContext()->uniform4fv(location->location(), size >> 2, v); | 4011 webContext()->uniform4fv(location->location(), size >> 2, v); |
4012 } | 4012 } |
4013 | 4013 |
4014 void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z, GLint w) | 4014 void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location,
GLint x, GLint y, GLint z, GLint w) |
4015 { | 4015 { |
4016 if (isContextLost() || !location) | 4016 if (isContextLost() || !location) |
4017 return; | 4017 return; |
4018 | 4018 |
4019 if (location->program() != m_currentProgram) { | 4019 if (location->program() != m_currentProgram) { |
4020 synthesizeGLError(GL_INVALID_OPERATION, "uniform4i", "location not for c
urrent program"); | 4020 synthesizeGLError(GL_INVALID_OPERATION, "uniform4i", "location not for c
urrent program"); |
4021 return; | 4021 return; |
4022 } | 4022 } |
4023 | 4023 |
4024 webContext()->uniform4i(location->location(), x, y, z, w); | 4024 webContext()->uniform4i(location->location(), x, y, z, w); |
4025 } | 4025 } |
4026 | 4026 |
4027 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
Int32Array* v) | 4027 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
DOMInt32Array* v) |
4028 { | 4028 { |
4029 if (isContextLost() || !validateUniformParameters("uniform4iv", location, v,
4)) | 4029 if (isContextLost() || !validateUniformParameters("uniform4iv", location, v,
4)) |
4030 return; | 4030 return; |
4031 | 4031 |
4032 webContext()->uniform4iv(location->location(), v->length() >> 2, v->data()); | 4032 webContext()->uniform4iv(location->location(), v->length() >> 2, v->data()); |
4033 } | 4033 } |
4034 | 4034 |
4035 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) | 4035 void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location,
GLint* v, GLsizei size) |
4036 { | 4036 { |
4037 if (isContextLost() || !validateUniformParameters("uniform4iv", location, v,
size, 4)) | 4037 if (isContextLost() || !validateUniformParameters("uniform4iv", location, v,
size, 4)) |
4038 return; | 4038 return; |
4039 | 4039 |
4040 webContext()->uniform4iv(location->location(), size >> 2, v); | 4040 webContext()->uniform4iv(location->location(), size >> 2, v); |
4041 } | 4041 } |
4042 | 4042 |
4043 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, Float32Array* v) | 4043 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, DOMFloat32Array* v) |
4044 { | 4044 { |
4045 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv",
location, transpose, v, 4)) | 4045 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv",
location, transpose, v, 4)) |
4046 return; | 4046 return; |
4047 webContext()->uniformMatrix2fv(location->location(), v->length() >> 2, trans
pose, v->data()); | 4047 webContext()->uniformMatrix2fv(location->location(), v->length() >> 2, trans
pose, v->data()); |
4048 } | 4048 } |
4049 | 4049 |
4050 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, GLfloat* v, GLsizei size) | 4050 void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, GLfloat* v, GLsizei size) |
4051 { | 4051 { |
4052 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv",
location, transpose, v, size, 4)) | 4052 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix2fv",
location, transpose, v, size, 4)) |
4053 return; | 4053 return; |
4054 webContext()->uniformMatrix2fv(location->location(), size >> 2, transpose, v
); | 4054 webContext()->uniformMatrix2fv(location->location(), size >> 2, transpose, v
); |
4055 } | 4055 } |
4056 | 4056 |
4057 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, Float32Array* v) | 4057 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, DOMFloat32Array* v) |
4058 { | 4058 { |
4059 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv",
location, transpose, v, 9)) | 4059 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv",
location, transpose, v, 9)) |
4060 return; | 4060 return; |
4061 webContext()->uniformMatrix3fv(location->location(), v->length() / 9, transp
ose, v->data()); | 4061 webContext()->uniformMatrix3fv(location->location(), v->length() / 9, transp
ose, v->data()); |
4062 } | 4062 } |
4063 | 4063 |
4064 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, GLfloat* v, GLsizei size) | 4064 void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, GLfloat* v, GLsizei size) |
4065 { | 4065 { |
4066 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv",
location, transpose, v, size, 9)) | 4066 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix3fv",
location, transpose, v, size, 9)) |
4067 return; | 4067 return; |
4068 webContext()->uniformMatrix3fv(location->location(), size / 9, transpose, v)
; | 4068 webContext()->uniformMatrix3fv(location->location(), size / 9, transpose, v)
; |
4069 } | 4069 } |
4070 | 4070 |
4071 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, Float32Array* v) | 4071 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, DOMFloat32Array* v) |
4072 { | 4072 { |
4073 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv",
location, transpose, v, 16)) | 4073 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv",
location, transpose, v, 16)) |
4074 return; | 4074 return; |
4075 webContext()->uniformMatrix4fv(location->location(), v->length() >> 4, trans
pose, v->data()); | 4075 webContext()->uniformMatrix4fv(location->location(), v->length() >> 4, trans
pose, v->data()); |
4076 } | 4076 } |
4077 | 4077 |
4078 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, GLfloat* v, GLsizei size) | 4078 void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* loc
ation, GLboolean transpose, GLfloat* v, GLsizei size) |
4079 { | 4079 { |
4080 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv",
location, transpose, v, size, 16)) | 4080 if (isContextLost() || !validateUniformMatrixParameters("uniformMatrix4fv",
location, transpose, v, size, 16)) |
4081 return; | 4081 return; |
(...skipping 26 matching lines...) Expand all Loading... |
4108 if (isContextLost() || !validateWebGLObject("validateProgram", program)) | 4108 if (isContextLost() || !validateWebGLObject("validateProgram", program)) |
4109 return; | 4109 return; |
4110 webContext()->validateProgram(objectOrZero(program)); | 4110 webContext()->validateProgram(objectOrZero(program)); |
4111 } | 4111 } |
4112 | 4112 |
4113 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) | 4113 void WebGLRenderingContextBase::vertexAttrib1f(GLuint index, GLfloat v0) |
4114 { | 4114 { |
4115 vertexAttribfImpl("vertexAttrib1f", index, 1, v0, 0.0f, 0.0f, 1.0f); | 4115 vertexAttribfImpl("vertexAttrib1f", index, 1, v0, 0.0f, 0.0f, 1.0f); |
4116 } | 4116 } |
4117 | 4117 |
4118 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, Float32Array* v) | 4118 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, DOMFloat32Array* v
) |
4119 { | 4119 { |
4120 vertexAttribfvImpl("vertexAttrib1fv", index, v, 1); | 4120 vertexAttribfvImpl("vertexAttrib1fv", index, v, 1); |
4121 } | 4121 } |
4122 | 4122 |
4123 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, GLfloat* v, GLsize
i size) | 4123 void WebGLRenderingContextBase::vertexAttrib1fv(GLuint index, GLfloat* v, GLsize
i size) |
4124 { | 4124 { |
4125 vertexAttribfvImpl("vertexAttrib1fv", index, v, size, 1); | 4125 vertexAttribfvImpl("vertexAttrib1fv", index, v, size, 1); |
4126 } | 4126 } |
4127 | 4127 |
4128 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat
v1) | 4128 void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat
v1) |
4129 { | 4129 { |
4130 vertexAttribfImpl("vertexAttrib2f", index, 2, v0, v1, 0.0f, 1.0f); | 4130 vertexAttribfImpl("vertexAttrib2f", index, 2, v0, v1, 0.0f, 1.0f); |
4131 } | 4131 } |
4132 | 4132 |
4133 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, Float32Array* v) | 4133 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, DOMFloat32Array* v
) |
4134 { | 4134 { |
4135 vertexAttribfvImpl("vertexAttrib2fv", index, v, 2); | 4135 vertexAttribfvImpl("vertexAttrib2fv", index, v, 2); |
4136 } | 4136 } |
4137 | 4137 |
4138 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, GLfloat* v, GLsize
i size) | 4138 void WebGLRenderingContextBase::vertexAttrib2fv(GLuint index, GLfloat* v, GLsize
i size) |
4139 { | 4139 { |
4140 vertexAttribfvImpl("vertexAttrib2fv", index, v, size, 2); | 4140 vertexAttribfvImpl("vertexAttrib2fv", index, v, size, 2); |
4141 } | 4141 } |
4142 | 4142 |
4143 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, GLfloat v0, GLfloat
v1, GLfloat v2) | 4143 void WebGLRenderingContextBase::vertexAttrib3f(GLuint index, GLfloat v0, GLfloat
v1, GLfloat v2) |
4144 { | 4144 { |
4145 vertexAttribfImpl("vertexAttrib3f", index, 3, v0, v1, v2, 1.0f); | 4145 vertexAttribfImpl("vertexAttrib3f", index, 3, v0, v1, v2, 1.0f); |
4146 } | 4146 } |
4147 | 4147 |
4148 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, Float32Array* v) | 4148 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, DOMFloat32Array* v
) |
4149 { | 4149 { |
4150 vertexAttribfvImpl("vertexAttrib3fv", index, v, 3); | 4150 vertexAttribfvImpl("vertexAttrib3fv", index, v, 3); |
4151 } | 4151 } |
4152 | 4152 |
4153 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, GLfloat* v, GLsize
i size) | 4153 void WebGLRenderingContextBase::vertexAttrib3fv(GLuint index, GLfloat* v, GLsize
i size) |
4154 { | 4154 { |
4155 vertexAttribfvImpl("vertexAttrib3fv", index, v, size, 3); | 4155 vertexAttribfvImpl("vertexAttrib3fv", index, v, size, 3); |
4156 } | 4156 } |
4157 | 4157 |
4158 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, GLfloat v0, GLfloat
v1, GLfloat v2, GLfloat v3) | 4158 void WebGLRenderingContextBase::vertexAttrib4f(GLuint index, GLfloat v0, GLfloat
v1, GLfloat v2, GLfloat v3) |
4159 { | 4159 { |
4160 vertexAttribfImpl("vertexAttrib4f", index, 4, v0, v1, v2, v3); | 4160 vertexAttribfImpl("vertexAttrib4f", index, 4, v0, v1, v2, v3); |
4161 } | 4161 } |
4162 | 4162 |
4163 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, Float32Array* v) | 4163 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, DOMFloat32Array* v
) |
4164 { | 4164 { |
4165 vertexAttribfvImpl("vertexAttrib4fv", index, v, 4); | 4165 vertexAttribfvImpl("vertexAttrib4fv", index, v, 4); |
4166 } | 4166 } |
4167 | 4167 |
4168 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, GLfloat* v, GLsize
i size) | 4168 void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, GLfloat* v, GLsize
i size) |
4169 { | 4169 { |
4170 vertexAttribfvImpl("vertexAttrib4fv", index, v, size, 4); | 4170 vertexAttribfvImpl("vertexAttrib4fv", index, v, size, 4); |
4171 } | 4171 } |
4172 | 4172 |
4173 void WebGLRenderingContextBase::vertexAttribPointer(GLuint index, GLint size, GL
enum type, GLboolean normalized, GLsizei stride, long long offset) | 4173 void WebGLRenderingContextBase::vertexAttribPointer(GLuint index, GLint size, GL
enum type, GLboolean normalized, GLsizei stride, long long offset) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4427 case GL_DEPTH_RANGE: | 4427 case GL_DEPTH_RANGE: |
4428 length = 2; | 4428 length = 2; |
4429 break; | 4429 break; |
4430 case GL_BLEND_COLOR: | 4430 case GL_BLEND_COLOR: |
4431 case GL_COLOR_CLEAR_VALUE: | 4431 case GL_COLOR_CLEAR_VALUE: |
4432 length = 4; | 4432 length = 4; |
4433 break; | 4433 break; |
4434 default: | 4434 default: |
4435 notImplemented(); | 4435 notImplemented(); |
4436 } | 4436 } |
4437 return WebGLGetInfo(Float32Array::create(value, length)); | 4437 return WebGLGetInfo(DOMFloat32Array::create(value, length)); |
4438 } | 4438 } |
4439 | 4439 |
4440 WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GLenum pname) | 4440 WebGLGetInfo WebGLRenderingContextBase::getWebGLIntArrayParameter(GLenum pname) |
4441 { | 4441 { |
4442 GLint value[4] = {0}; | 4442 GLint value[4] = {0}; |
4443 if (!isContextLost()) | 4443 if (!isContextLost()) |
4444 webContext()->getIntegerv(pname, value); | 4444 webContext()->getIntegerv(pname, value); |
4445 unsigned length = 0; | 4445 unsigned length = 0; |
4446 switch (pname) { | 4446 switch (pname) { |
4447 case GL_MAX_VIEWPORT_DIMS: | 4447 case GL_MAX_VIEWPORT_DIMS: |
4448 length = 2; | 4448 length = 2; |
4449 break; | 4449 break; |
4450 case GL_SCISSOR_BOX: | 4450 case GL_SCISSOR_BOX: |
4451 case GL_VIEWPORT: | 4451 case GL_VIEWPORT: |
4452 length = 4; | 4452 length = 4; |
4453 break; | 4453 break; |
4454 default: | 4454 default: |
4455 notImplemented(); | 4455 notImplemented(); |
4456 } | 4456 } |
4457 return WebGLGetInfo(Int32Array::create(value, length)); | 4457 return WebGLGetInfo(DOMInt32Array::create(value, length)); |
4458 } | 4458 } |
4459 | 4459 |
4460 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) | 4460 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) |
4461 { | 4461 { |
4462 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. | 4462 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. |
4463 bool resetActiveUnit = false; | 4463 bool resetActiveUnit = false; |
4464 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) | 4464 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) |
4465 | (extensionEnabled(OESTextureHalfFloatLinearName) ? WebGLTexture::Textu
reHalfFloatLinearExtensionEnabled : 0)); | 4465 | (extensionEnabled(OESTextureHalfFloatLinearName) ? WebGLTexture::Textu
reHalfFloatLinearExtensionEnabled : 0)); |
4466 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { | 4466 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { |
4467 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m
_texture2DBinding->needToUseBlackTexture(flag)) | 4467 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m
_texture2DBinding->needToUseBlackTexture(flag)) |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4805 } | 4805 } |
4806 | 4806 |
4807 if (border) { | 4807 if (border) { |
4808 synthesizeGLError(GL_INVALID_VALUE, functionName, "border != 0"); | 4808 synthesizeGLError(GL_INVALID_VALUE, functionName, "border != 0"); |
4809 return false; | 4809 return false; |
4810 } | 4810 } |
4811 | 4811 |
4812 return true; | 4812 return true; |
4813 } | 4813 } |
4814 | 4814 |
4815 bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GL
int level, GLsizei width, GLsizei height, GLenum format, GLenum type, ArrayBuffe
rView* pixels, NullDisposition disposition) | 4815 bool WebGLRenderingContextBase::validateTexFuncData(const char* functionName, GL
int level, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBu
fferView* pixels, NullDisposition disposition) |
4816 { | 4816 { |
4817 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. | 4817 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. |
4818 if (!pixels) { | 4818 if (!pixels) { |
4819 if (disposition == NullAllowed) | 4819 if (disposition == NullAllowed) |
4820 return true; | 4820 return true; |
4821 synthesizeGLError(GL_INVALID_VALUE, functionName, "no pixels"); | 4821 synthesizeGLError(GL_INVALID_VALUE, functionName, "no pixels"); |
4822 return false; | 4822 return false; |
4823 } | 4823 } |
4824 | 4824 |
4825 if (!validateTexFuncFormatAndType(functionName, format, type, level)) | 4825 if (!validateTexFuncFormatAndType(functionName, format, type, level)) |
(...skipping 18 matching lines...) Expand all Loading... |
4844 break; | 4844 break; |
4845 case GL_FLOAT: // OES_texture_float | 4845 case GL_FLOAT: // OES_texture_float |
4846 if (pixels->type() != ArrayBufferView::TypeFloat32) { | 4846 if (pixels->type() != ArrayBufferView::TypeFloat32) { |
4847 synthesizeGLError(GL_INVALID_OPERATION, functionName, "type FLOAT bu
t ArrayBufferView not Float32Array"); | 4847 synthesizeGLError(GL_INVALID_OPERATION, functionName, "type FLOAT bu
t ArrayBufferView not Float32Array"); |
4848 return false; | 4848 return false; |
4849 } | 4849 } |
4850 break; | 4850 break; |
4851 case GL_HALF_FLOAT_OES: // OES_texture_half_float | 4851 case GL_HALF_FLOAT_OES: // OES_texture_half_float |
4852 // As per the specification, ArrayBufferView should be null or a Uint16A
rray when | 4852 // As per the specification, ArrayBufferView should be null or a Uint16A
rray when |
4853 // OES_texture_half_float is enabled. | 4853 // OES_texture_half_float is enabled. |
4854 if (pixels && pixels->type() != ArrayBufferView::TypeUint16) { | 4854 if (pixels->type() != ArrayBufferView::TypeUint16) { |
4855 synthesizeGLError(GL_INVALID_OPERATION, functionName, "type HALF_FLO
AT_OES but ArrayBufferView is not NULL and not Uint16Array"); | 4855 synthesizeGLError(GL_INVALID_OPERATION, functionName, "type HALF_FLO
AT_OES but ArrayBufferView is not NULL and not Uint16Array"); |
4856 return false; | 4856 return false; |
4857 } | 4857 } |
4858 break; | 4858 break; |
4859 default: | 4859 default: |
4860 ASSERT_NOT_REACHED(); | 4860 ASSERT_NOT_REACHED(); |
4861 } | 4861 } |
4862 | 4862 |
4863 unsigned totalBytesRequired; | 4863 unsigned totalBytesRequired; |
4864 GLenum error = WebGLImageConversion::computeImageSizeInBytes(format, type, w
idth, height, m_unpackAlignment, &totalBytesRequired, 0); | 4864 GLenum error = WebGLImageConversion::computeImageSizeInBytes(format, type, w
idth, height, m_unpackAlignment, &totalBytesRequired, 0); |
(...skipping 13 matching lines...) Expand all Loading... |
4878 return false; | 4878 return false; |
4879 } | 4879 } |
4880 return true; | 4880 return true; |
4881 } | 4881 } |
4882 | 4882 |
4883 bool WebGLRenderingContextBase::validateCompressedTexFormat(GLenum format) | 4883 bool WebGLRenderingContextBase::validateCompressedTexFormat(GLenum format) |
4884 { | 4884 { |
4885 return m_compressedTextureFormats.contains(format); | 4885 return m_compressedTextureFormats.contains(format); |
4886 } | 4886 } |
4887 | 4887 |
4888 bool WebGLRenderingContextBase::validateCompressedTexFuncData(const char* functi
onName, GLsizei width, GLsizei height, GLenum format, ArrayBufferView* pixels) | 4888 bool WebGLRenderingContextBase::validateCompressedTexFuncData(const char* functi
onName, GLsizei width, GLsizei height, GLenum format, DOMArrayBufferView* pixels
) |
4889 { | 4889 { |
4890 if (!pixels) { | 4890 if (!pixels) { |
4891 synthesizeGLError(GL_INVALID_VALUE, functionName, "no pixels"); | 4891 synthesizeGLError(GL_INVALID_VALUE, functionName, "no pixels"); |
4892 return false; | 4892 return false; |
4893 } | 4893 } |
4894 if (width < 0 || height < 0) { | 4894 if (width < 0 || height < 0) { |
4895 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0")
; | 4895 synthesizeGLError(GL_INVALID_VALUE, functionName, "width or height < 0")
; |
4896 return false; | 4896 return false; |
4897 } | 4897 } |
4898 | 4898 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5191 case GL_SAMPLE_COVERAGE: | 5191 case GL_SAMPLE_COVERAGE: |
5192 case GL_SCISSOR_TEST: | 5192 case GL_SCISSOR_TEST: |
5193 case GL_STENCIL_TEST: | 5193 case GL_STENCIL_TEST: |
5194 return true; | 5194 return true; |
5195 default: | 5195 default: |
5196 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid capability"); | 5196 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid capability"); |
5197 return false; | 5197 return false; |
5198 } | 5198 } |
5199 } | 5199 } |
5200 | 5200 |
5201 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, Float32Array* v, GLsizei requiredMinSi
ze) | 5201 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, DOMFloat32Array* v, GLsizei requiredMi
nSize) |
5202 { | 5202 { |
5203 if (!v) { | 5203 if (!v) { |
5204 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); | 5204 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
5205 return false; | 5205 return false; |
5206 } | 5206 } |
5207 return validateUniformMatrixParameters(functionName, location, false, v->dat
a(), v->length(), requiredMinSize); | 5207 return validateUniformMatrixParameters(functionName, location, false, v->dat
a(), v->length(), requiredMinSize); |
5208 } | 5208 } |
5209 | 5209 |
5210 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, Int32Array* v, GLsizei requiredMinSize
) | 5210 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, DOMInt32Array* v, GLsizei requiredMinS
ize) |
5211 { | 5211 { |
5212 if (!v) { | 5212 if (!v) { |
5213 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); | 5213 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
5214 return false; | 5214 return false; |
5215 } | 5215 } |
5216 return validateUniformMatrixParameters(functionName, location, false, v->dat
a(), v->length(), requiredMinSize); | 5216 return validateUniformMatrixParameters(functionName, location, false, v->dat
a(), v->length(), requiredMinSize); |
5217 } | 5217 } |
5218 | 5218 |
5219 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, void* v, GLsizei size, GLsizei require
dMinSize) | 5219 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionNa
me, const WebGLUniformLocation* location, void* v, GLsizei size, GLsizei require
dMinSize) |
5220 { | 5220 { |
5221 return validateUniformMatrixParameters(functionName, location, false, v, siz
e, requiredMinSize); | 5221 return validateUniformMatrixParameters(functionName, location, false, v, siz
e, requiredMinSize); |
5222 } | 5222 } |
5223 | 5223 |
5224 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* func
tionName, const WebGLUniformLocation* location, GLboolean transpose, Float32Arra
y* v, GLsizei requiredMinSize) | 5224 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* func
tionName, const WebGLUniformLocation* location, GLboolean transpose, DOMFloat32A
rray* v, GLsizei requiredMinSize) |
5225 { | 5225 { |
5226 if (!v) { | 5226 if (!v) { |
5227 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); | 5227 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
5228 return false; | 5228 return false; |
5229 } | 5229 } |
5230 return validateUniformMatrixParameters(functionName, location, transpose, v-
>data(), v->length(), requiredMinSize); | 5230 return validateUniformMatrixParameters(functionName, location, transpose, v-
>data(), v->length(), requiredMinSize); |
5231 } | 5231 } |
5232 | 5232 |
5233 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* func
tionName, const WebGLUniformLocation* location, GLboolean transpose, void* v, GL
sizei size, GLsizei requiredMinSize) | 5233 bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* func
tionName, const WebGLUniformLocation* location, GLboolean transpose, void* v, GL
sizei size, GLsizei requiredMinSize) |
5234 { | 5234 { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5437 webContext()->vertexAttrib4f(index, v0, v1, v2, v3); | 5437 webContext()->vertexAttrib4f(index, v0, v1, v2, v3); |
5438 break; | 5438 break; |
5439 } | 5439 } |
5440 VertexAttribValue& attribValue = m_vertexAttribValue[index]; | 5440 VertexAttribValue& attribValue = m_vertexAttribValue[index]; |
5441 attribValue.value[0] = v0; | 5441 attribValue.value[0] = v0; |
5442 attribValue.value[1] = v1; | 5442 attribValue.value[1] = v1; |
5443 attribValue.value[2] = v2; | 5443 attribValue.value[2] = v2; |
5444 attribValue.value[3] = v3; | 5444 attribValue.value[3] = v3; |
5445 } | 5445 } |
5446 | 5446 |
5447 void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GLu
int index, Float32Array* v, GLsizei expectedSize) | 5447 void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GLu
int index, DOMFloat32Array* v, GLsizei expectedSize) |
5448 { | 5448 { |
5449 if (isContextLost()) | 5449 if (isContextLost()) |
5450 return; | 5450 return; |
5451 if (!v) { | 5451 if (!v) { |
5452 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); | 5452 synthesizeGLError(GL_INVALID_VALUE, functionName, "no array"); |
5453 return; | 5453 return; |
5454 } | 5454 } |
5455 vertexAttribfvImpl(functionName, index, v->data(), v->length(), expectedSize
); | 5455 vertexAttribfvImpl(functionName, index, v->data(), v->length(), expectedSize
); |
5456 } | 5456 } |
5457 | 5457 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5794 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; | 5794 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; |
5795 } | 5795 } |
5796 #else | 5796 #else |
5797 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 5797 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
5798 { | 5798 { |
5799 return m_drawingBuffer.get(); | 5799 return m_drawingBuffer.get(); |
5800 } | 5800 } |
5801 #endif | 5801 #endif |
5802 | 5802 |
5803 } // namespace blink | 5803 } // namespace blink |
OLD | NEW |