| 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 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2798 return getUnsignedIntParameter(scriptState, pname); | 2798 return getUnsignedIntParameter(scriptState, pname); |
| 2799 case GL_BLEND_SRC_RGB: | 2799 case GL_BLEND_SRC_RGB: |
| 2800 return getUnsignedIntParameter(scriptState, pname); | 2800 return getUnsignedIntParameter(scriptState, pname); |
| 2801 case GL_BLUE_BITS: | 2801 case GL_BLUE_BITS: |
| 2802 return getIntParameter(scriptState, pname); | 2802 return getIntParameter(scriptState, pname); |
| 2803 case GL_COLOR_CLEAR_VALUE: | 2803 case GL_COLOR_CLEAR_VALUE: |
| 2804 return getWebGLFloatArrayParameter(scriptState, pname); | 2804 return getWebGLFloatArrayParameter(scriptState, pname); |
| 2805 case GL_COLOR_WRITEMASK: | 2805 case GL_COLOR_WRITEMASK: |
| 2806 return getBooleanArrayParameter(scriptState, pname); | 2806 return getBooleanArrayParameter(scriptState, pname); |
| 2807 case GL_COMPRESSED_TEXTURE_FORMATS: | 2807 case GL_COMPRESSED_TEXTURE_FORMATS: |
| 2808 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF
ormats.data(), m_compressedTextureFormats.size())); | 2808 return WebGLAny(scriptState, DOMUint32Array::deprecatedCreateOrCrash(m_c
ompressedTextureFormats.data(), m_compressedTextureFormats.size())); |
| 2809 case GL_CULL_FACE: | 2809 case GL_CULL_FACE: |
| 2810 return getBooleanParameter(scriptState, pname); | 2810 return getBooleanParameter(scriptState, pname); |
| 2811 case GL_CULL_FACE_MODE: | 2811 case GL_CULL_FACE_MODE: |
| 2812 return getUnsignedIntParameter(scriptState, pname); | 2812 return getUnsignedIntParameter(scriptState, pname); |
| 2813 case GL_CURRENT_PROGRAM: | 2813 case GL_CURRENT_PROGRAM: |
| 2814 return WebGLAny(scriptState, m_currentProgram.get()); | 2814 return WebGLAny(scriptState, m_currentProgram.get()); |
| 2815 case GL_DEPTH_BITS: | 2815 case GL_DEPTH_BITS: |
| 2816 if (!m_framebufferBinding && !m_requestedAttributes.depth()) | 2816 if (!m_framebufferBinding && !m_requestedAttributes.depth()) |
| 2817 return WebGLAny(scriptState, intZero); | 2817 return WebGLAny(scriptState, intZero); |
| 2818 return getIntParameter(scriptState, pname); | 2818 return getIntParameter(scriptState, pname); |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unhan
dled type"); | 3385 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unhan
dled type"); |
| 3386 return ScriptValue::createNull(scriptState); | 3386 return ScriptValue::createNull(scriptState); |
| 3387 } | 3387 } |
| 3388 } | 3388 } |
| 3389 switch (baseType) { | 3389 switch (baseType) { |
| 3390 case GL_FLOAT: { | 3390 case GL_FLOAT: { |
| 3391 GLfloat value[16] = {0}; | 3391 GLfloat value[16] = {0}; |
| 3392 webContext()->getUniformfv(objectOrZero(program), location,
value); | 3392 webContext()->getUniformfv(objectOrZero(program), location,
value); |
| 3393 if (length == 1) | 3393 if (length == 1) |
| 3394 return WebGLAny(scriptState, value[0]); | 3394 return WebGLAny(scriptState, value[0]); |
| 3395 return WebGLAny(scriptState, DOMFloat32Array::create(value,
length)); | 3395 return WebGLAny(scriptState, DOMFloat32Array::deprecatedCrea
teOrCrash(value, length)); |
| 3396 } | 3396 } |
| 3397 case GL_INT: { | 3397 case GL_INT: { |
| 3398 GLint value[4] = {0}; | 3398 GLint value[4] = {0}; |
| 3399 webContext()->getUniformiv(objectOrZero(program), location,
value); | 3399 webContext()->getUniformiv(objectOrZero(program), location,
value); |
| 3400 if (length == 1) | 3400 if (length == 1) |
| 3401 return WebGLAny(scriptState, value[0]); | 3401 return WebGLAny(scriptState, value[0]); |
| 3402 return WebGLAny(scriptState, DOMInt32Array::create(value, le
ngth)); | 3402 return WebGLAny(scriptState, DOMInt32Array::deprecatedCreate
OrCrash(value, length)); |
| 3403 } | 3403 } |
| 3404 case GL_UNSIGNED_INT: { | 3404 case GL_UNSIGNED_INT: { |
| 3405 GLuint value[4] = {0}; | 3405 GLuint value[4] = {0}; |
| 3406 webContext()->getUniformuiv(objectOrZero(program), location,
value); | 3406 webContext()->getUniformuiv(objectOrZero(program), location,
value); |
| 3407 if (length == 1) | 3407 if (length == 1) |
| 3408 return WebGLAny(scriptState, value[0]); | 3408 return WebGLAny(scriptState, value[0]); |
| 3409 return WebGLAny(scriptState, DOMUint32Array::create(value, l
ength)); | 3409 return WebGLAny(scriptState, DOMUint32Array::deprecatedCreat
eOrCrash(value, length)); |
| 3410 } | 3410 } |
| 3411 case GL_BOOL: { | 3411 case GL_BOOL: { |
| 3412 GLint value[4] = {0}; | 3412 GLint value[4] = {0}; |
| 3413 webContext()->getUniformiv(objectOrZero(program), location,
value); | 3413 webContext()->getUniformiv(objectOrZero(program), location,
value); |
| 3414 if (length > 1) { | 3414 if (length > 1) { |
| 3415 bool boolValue[16] = {0}; | 3415 bool boolValue[16] = {0}; |
| 3416 for (unsigned j = 0; j < length; j++) | 3416 for (unsigned j = 0; j < length; j++) |
| 3417 boolValue[j] = static_cast<bool>(value[j]); | 3417 boolValue[j] = static_cast<bool>(value[j]); |
| 3418 return WebGLAny(scriptState, boolValue, length); | 3418 return WebGLAny(scriptState, boolValue, length); |
| 3419 } | 3419 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3477 return WebGLAny(scriptState, state->size); | 3477 return WebGLAny(scriptState, state->size); |
| 3478 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 3478 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
| 3479 return WebGLAny(scriptState, state->originalStride); | 3479 return WebGLAny(scriptState, state->originalStride); |
| 3480 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 3480 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
| 3481 return WebGLAny(scriptState, state->type); | 3481 return WebGLAny(scriptState, state->type); |
| 3482 case GL_CURRENT_VERTEX_ATTRIB: | 3482 case GL_CURRENT_VERTEX_ATTRIB: |
| 3483 { | 3483 { |
| 3484 VertexAttribValue& attribValue = m_vertexAttribValue[index]; | 3484 VertexAttribValue& attribValue = m_vertexAttribValue[index]; |
| 3485 switch (attribValue.type) { | 3485 switch (attribValue.type) { |
| 3486 case Float32ArrayType: | 3486 case Float32ArrayType: |
| 3487 return WebGLAny(scriptState, DOMFloat32Array::create(attribValue
.value.floatValue, 4)); | 3487 return WebGLAny(scriptState, DOMFloat32Array::deprecatedCreateOr
Crash(attribValue.value.floatValue, 4)); |
| 3488 case Int32ArrayType: | 3488 case Int32ArrayType: |
| 3489 return WebGLAny(scriptState, DOMInt32Array::create(attribValue.v
alue.intValue, 4)); | 3489 return WebGLAny(scriptState, DOMInt32Array::deprecatedCreateOrCr
ash(attribValue.value.intValue, 4)); |
| 3490 case Uint32ArrayType: | 3490 case Uint32ArrayType: |
| 3491 return WebGLAny(scriptState, DOMUint32Array::create(attribValue.
value.uintValue, 4)); | 3491 return WebGLAny(scriptState, DOMUint32Array::deprecatedCreateOrC
rash(attribValue.value.uintValue, 4)); |
| 3492 default: | 3492 default: |
| 3493 ASSERT_NOT_REACHED(); | 3493 ASSERT_NOT_REACHED(); |
| 3494 break; | 3494 break; |
| 3495 } | 3495 } |
| 3496 return ScriptValue::createNull(scriptState); | 3496 return ScriptValue::createNull(scriptState); |
| 3497 } | 3497 } |
| 3498 case GL_VERTEX_ATTRIB_ARRAY_INTEGER: | 3498 case GL_VERTEX_ATTRIB_ARRAY_INTEGER: |
| 3499 if (isWebGL2OrHigher()) { | 3499 if (isWebGL2OrHigher()) { |
| 3500 GLint value = 0; | 3500 GLint value = 0; |
| 3501 webContext()->getVertexAttribiv(index, pname, &value); | 3501 webContext()->getVertexAttribiv(index, pname, &value); |
| (...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5351 case GL_DEPTH_RANGE: | 5351 case GL_DEPTH_RANGE: |
| 5352 length = 2; | 5352 length = 2; |
| 5353 break; | 5353 break; |
| 5354 case GL_BLEND_COLOR: | 5354 case GL_BLEND_COLOR: |
| 5355 case GL_COLOR_CLEAR_VALUE: | 5355 case GL_COLOR_CLEAR_VALUE: |
| 5356 length = 4; | 5356 length = 4; |
| 5357 break; | 5357 break; |
| 5358 default: | 5358 default: |
| 5359 notImplemented(); | 5359 notImplemented(); |
| 5360 } | 5360 } |
| 5361 return WebGLAny(scriptState, DOMFloat32Array::create(value, length)); | 5361 return WebGLAny(scriptState, DOMFloat32Array::deprecatedCreateOrCrash(value,
length)); |
| 5362 } | 5362 } |
| 5363 | 5363 |
| 5364 ScriptValue WebGLRenderingContextBase::getWebGLIntArrayParameter(ScriptState* sc
riptState, GLenum pname) | 5364 ScriptValue WebGLRenderingContextBase::getWebGLIntArrayParameter(ScriptState* sc
riptState, GLenum pname) |
| 5365 { | 5365 { |
| 5366 GLint value[4] = {0}; | 5366 GLint value[4] = {0}; |
| 5367 if (!isContextLost()) | 5367 if (!isContextLost()) |
| 5368 webContext()->getIntegerv(pname, value); | 5368 webContext()->getIntegerv(pname, value); |
| 5369 unsigned length = 0; | 5369 unsigned length = 0; |
| 5370 switch (pname) { | 5370 switch (pname) { |
| 5371 case GL_MAX_VIEWPORT_DIMS: | 5371 case GL_MAX_VIEWPORT_DIMS: |
| 5372 length = 2; | 5372 length = 2; |
| 5373 break; | 5373 break; |
| 5374 case GL_SCISSOR_BOX: | 5374 case GL_SCISSOR_BOX: |
| 5375 case GL_VIEWPORT: | 5375 case GL_VIEWPORT: |
| 5376 length = 4; | 5376 length = 4; |
| 5377 break; | 5377 break; |
| 5378 default: | 5378 default: |
| 5379 notImplemented(); | 5379 notImplemented(); |
| 5380 } | 5380 } |
| 5381 return WebGLAny(scriptState, DOMInt32Array::create(value, length)); | 5381 return WebGLAny(scriptState, DOMInt32Array::deprecatedCreateOrCrash(value, l
ength)); |
| 5382 } | 5382 } |
| 5383 | 5383 |
| 5384 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) | 5384 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) |
| 5385 { | 5385 { |
| 5386 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. | 5386 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. |
| 5387 bool resetActiveUnit = false; | 5387 bool resetActiveUnit = false; |
| 5388 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) | 5388 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) |
| 5389 | ((extensionEnabled(OESTextureHalfFloatLinearName) || isWebGL2OrHigher(
)) ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); | 5389 | ((extensionEnabled(OESTextureHalfFloatLinearName) || isWebGL2OrHigher(
)) ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); |
| 5390 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { | 5390 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { |
| 5391 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m
_texture2DBinding->needToUseBlackTexture(flag)) | 5391 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m
_texture2DBinding->needToUseBlackTexture(flag)) |
| (...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6906 | 6906 |
| 6907 return totalBytesPerPixel; | 6907 return totalBytesPerPixel; |
| 6908 } | 6908 } |
| 6909 | 6909 |
| 6910 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6910 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6911 { | 6911 { |
| 6912 return m_drawingBuffer.get(); | 6912 return m_drawingBuffer.get(); |
| 6913 } | 6913 } |
| 6914 | 6914 |
| 6915 } // namespace blink | 6915 } // namespace blink |
| OLD | NEW |