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