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 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 return getUnsignedIntParameter(scriptState, pname); | 2733 return getUnsignedIntParameter(scriptState, pname); |
2734 case GL_BLEND_SRC_RGB: | 2734 case GL_BLEND_SRC_RGB: |
2735 return getUnsignedIntParameter(scriptState, pname); | 2735 return getUnsignedIntParameter(scriptState, pname); |
2736 case GL_BLUE_BITS: | 2736 case GL_BLUE_BITS: |
2737 return getIntParameter(scriptState, pname); | 2737 return getIntParameter(scriptState, pname); |
2738 case GL_COLOR_CLEAR_VALUE: | 2738 case GL_COLOR_CLEAR_VALUE: |
2739 return getWebGLFloatArrayParameter(scriptState, pname); | 2739 return getWebGLFloatArrayParameter(scriptState, pname); |
2740 case GL_COLOR_WRITEMASK: | 2740 case GL_COLOR_WRITEMASK: |
2741 return getBooleanArrayParameter(scriptState, pname); | 2741 return getBooleanArrayParameter(scriptState, pname); |
2742 case GL_COMPRESSED_TEXTURE_FORMATS: | 2742 case GL_COMPRESSED_TEXTURE_FORMATS: |
2743 return WebGLAny(scriptState, DOMUint32Array::create(m_compressedTextureF
ormats.data(), m_compressedTextureFormats.size())); | 2743 return WebGLAny(scriptState, DOMUint32Array::deprecatedCreateOrCrash(m_c
ompressedTextureFormats.data(), m_compressedTextureFormats.size())); |
2744 case GL_CULL_FACE: | 2744 case GL_CULL_FACE: |
2745 return getBooleanParameter(scriptState, pname); | 2745 return getBooleanParameter(scriptState, pname); |
2746 case GL_CULL_FACE_MODE: | 2746 case GL_CULL_FACE_MODE: |
2747 return getUnsignedIntParameter(scriptState, pname); | 2747 return getUnsignedIntParameter(scriptState, pname); |
2748 case GL_CURRENT_PROGRAM: | 2748 case GL_CURRENT_PROGRAM: |
2749 return WebGLAny(scriptState, m_currentProgram.get()); | 2749 return WebGLAny(scriptState, m_currentProgram.get()); |
2750 case GL_DEPTH_BITS: | 2750 case GL_DEPTH_BITS: |
2751 if (!m_framebufferBinding && !m_requestedAttributes.depth()) | 2751 if (!m_framebufferBinding && !m_requestedAttributes.depth()) |
2752 return WebGLAny(scriptState, intZero); | 2752 return WebGLAny(scriptState, intZero); |
2753 return getIntParameter(scriptState, pname); | 2753 return getIntParameter(scriptState, pname); |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unhan
dled type"); | 3320 synthesizeGLError(GL_INVALID_VALUE, "getUniform", "unhan
dled type"); |
3321 return ScriptValue::createNull(scriptState); | 3321 return ScriptValue::createNull(scriptState); |
3322 } | 3322 } |
3323 } | 3323 } |
3324 switch (baseType) { | 3324 switch (baseType) { |
3325 case GL_FLOAT: { | 3325 case GL_FLOAT: { |
3326 GLfloat value[16] = {0}; | 3326 GLfloat value[16] = {0}; |
3327 webContext()->getUniformfv(objectOrZero(program), location,
value); | 3327 webContext()->getUniformfv(objectOrZero(program), location,
value); |
3328 if (length == 1) | 3328 if (length == 1) |
3329 return WebGLAny(scriptState, value[0]); | 3329 return WebGLAny(scriptState, value[0]); |
3330 return WebGLAny(scriptState, DOMFloat32Array::create(value,
length)); | 3330 return WebGLAny(scriptState, DOMFloat32Array::deprecatedCrea
teOrCrash(value, length)); |
3331 } | 3331 } |
3332 case GL_INT: { | 3332 case GL_INT: { |
3333 GLint value[4] = {0}; | 3333 GLint value[4] = {0}; |
3334 webContext()->getUniformiv(objectOrZero(program), location,
value); | 3334 webContext()->getUniformiv(objectOrZero(program), location,
value); |
3335 if (length == 1) | 3335 if (length == 1) |
3336 return WebGLAny(scriptState, value[0]); | 3336 return WebGLAny(scriptState, value[0]); |
3337 return WebGLAny(scriptState, DOMInt32Array::create(value, le
ngth)); | 3337 return WebGLAny(scriptState, DOMInt32Array::deprecatedCreate
OrCrash(value, length)); |
3338 } | 3338 } |
3339 case GL_UNSIGNED_INT: { | 3339 case GL_UNSIGNED_INT: { |
3340 GLuint value[4] = {0}; | 3340 GLuint value[4] = {0}; |
3341 webContext()->getUniformuiv(objectOrZero(program), location,
value); | 3341 webContext()->getUniformuiv(objectOrZero(program), location,
value); |
3342 if (length == 1) | 3342 if (length == 1) |
3343 return WebGLAny(scriptState, value[0]); | 3343 return WebGLAny(scriptState, value[0]); |
3344 return WebGLAny(scriptState, DOMUint32Array::create(value, l
ength)); | 3344 return WebGLAny(scriptState, DOMUint32Array::deprecatedCreat
eOrCrash(value, length)); |
3345 } | 3345 } |
3346 case GL_BOOL: { | 3346 case GL_BOOL: { |
3347 GLint value[4] = {0}; | 3347 GLint value[4] = {0}; |
3348 webContext()->getUniformiv(objectOrZero(program), location,
value); | 3348 webContext()->getUniformiv(objectOrZero(program), location,
value); |
3349 if (length > 1) { | 3349 if (length > 1) { |
3350 bool boolValue[16] = {0}; | 3350 bool boolValue[16] = {0}; |
3351 for (unsigned j = 0; j < length; j++) | 3351 for (unsigned j = 0; j < length; j++) |
3352 boolValue[j] = static_cast<bool>(value[j]); | 3352 boolValue[j] = static_cast<bool>(value[j]); |
3353 return WebGLAny(scriptState, boolValue, length); | 3353 return WebGLAny(scriptState, boolValue, length); |
3354 } | 3354 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3412 return WebGLAny(scriptState, state->size); | 3412 return WebGLAny(scriptState, state->size); |
3413 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: | 3413 case GL_VERTEX_ATTRIB_ARRAY_STRIDE: |
3414 return WebGLAny(scriptState, state->originalStride); | 3414 return WebGLAny(scriptState, state->originalStride); |
3415 case GL_VERTEX_ATTRIB_ARRAY_TYPE: | 3415 case GL_VERTEX_ATTRIB_ARRAY_TYPE: |
3416 return WebGLAny(scriptState, state->type); | 3416 return WebGLAny(scriptState, state->type); |
3417 case GL_CURRENT_VERTEX_ATTRIB: | 3417 case GL_CURRENT_VERTEX_ATTRIB: |
3418 { | 3418 { |
3419 VertexAttribValue& attribValue = m_vertexAttribValue[index]; | 3419 VertexAttribValue& attribValue = m_vertexAttribValue[index]; |
3420 switch (attribValue.type) { | 3420 switch (attribValue.type) { |
3421 case Float32ArrayType: | 3421 case Float32ArrayType: |
3422 return WebGLAny(scriptState, DOMFloat32Array::create(attribValue
.value.floatValue, 4)); | 3422 return WebGLAny(scriptState, DOMFloat32Array::deprecatedCreateOr
Crash(attribValue.value.floatValue, 4)); |
3423 case Int32ArrayType: | 3423 case Int32ArrayType: |
3424 return WebGLAny(scriptState, DOMInt32Array::create(attribValue.v
alue.intValue, 4)); | 3424 return WebGLAny(scriptState, DOMInt32Array::deprecatedCreateOrCr
ash(attribValue.value.intValue, 4)); |
3425 case Uint32ArrayType: | 3425 case Uint32ArrayType: |
3426 return WebGLAny(scriptState, DOMUint32Array::create(attribValue.
value.uintValue, 4)); | 3426 return WebGLAny(scriptState, DOMUint32Array::deprecatedCreateOrC
rash(attribValue.value.uintValue, 4)); |
3427 default: | 3427 default: |
3428 ASSERT_NOT_REACHED(); | 3428 ASSERT_NOT_REACHED(); |
3429 break; | 3429 break; |
3430 } | 3430 } |
3431 return ScriptValue::createNull(scriptState); | 3431 return ScriptValue::createNull(scriptState); |
3432 } | 3432 } |
3433 case GL_VERTEX_ATTRIB_ARRAY_INTEGER: | 3433 case GL_VERTEX_ATTRIB_ARRAY_INTEGER: |
3434 if (isWebGL2OrHigher()) { | 3434 if (isWebGL2OrHigher()) { |
3435 GLint value = 0; | 3435 GLint value = 0; |
3436 webContext()->getVertexAttribiv(index, pname, &value); | 3436 webContext()->getVertexAttribiv(index, pname, &value); |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5277 case GL_DEPTH_RANGE: | 5277 case GL_DEPTH_RANGE: |
5278 length = 2; | 5278 length = 2; |
5279 break; | 5279 break; |
5280 case GL_BLEND_COLOR: | 5280 case GL_BLEND_COLOR: |
5281 case GL_COLOR_CLEAR_VALUE: | 5281 case GL_COLOR_CLEAR_VALUE: |
5282 length = 4; | 5282 length = 4; |
5283 break; | 5283 break; |
5284 default: | 5284 default: |
5285 notImplemented(); | 5285 notImplemented(); |
5286 } | 5286 } |
5287 return WebGLAny(scriptState, DOMFloat32Array::create(value, length)); | 5287 return WebGLAny(scriptState, DOMFloat32Array::deprecatedCreateOrCrash(value,
length)); |
5288 } | 5288 } |
5289 | 5289 |
5290 ScriptValue WebGLRenderingContextBase::getWebGLIntArrayParameter(ScriptState* sc
riptState, GLenum pname) | 5290 ScriptValue WebGLRenderingContextBase::getWebGLIntArrayParameter(ScriptState* sc
riptState, GLenum pname) |
5291 { | 5291 { |
5292 GLint value[4] = {0}; | 5292 GLint value[4] = {0}; |
5293 if (!isContextLost()) | 5293 if (!isContextLost()) |
5294 webContext()->getIntegerv(pname, value); | 5294 webContext()->getIntegerv(pname, value); |
5295 unsigned length = 0; | 5295 unsigned length = 0; |
5296 switch (pname) { | 5296 switch (pname) { |
5297 case GL_MAX_VIEWPORT_DIMS: | 5297 case GL_MAX_VIEWPORT_DIMS: |
5298 length = 2; | 5298 length = 2; |
5299 break; | 5299 break; |
5300 case GL_SCISSOR_BOX: | 5300 case GL_SCISSOR_BOX: |
5301 case GL_VIEWPORT: | 5301 case GL_VIEWPORT: |
5302 length = 4; | 5302 length = 4; |
5303 break; | 5303 break; |
5304 default: | 5304 default: |
5305 notImplemented(); | 5305 notImplemented(); |
5306 } | 5306 } |
5307 return WebGLAny(scriptState, DOMInt32Array::create(value, length)); | 5307 return WebGLAny(scriptState, DOMInt32Array::deprecatedCreateOrCrash(value, l
ength)); |
5308 } | 5308 } |
5309 | 5309 |
5310 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) | 5310 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa
me, bool prepareToDraw) |
5311 { | 5311 { |
5312 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. | 5312 // All calling functions check isContextLost, so a duplicate check is not ne
eded here. |
5313 bool resetActiveUnit = false; | 5313 bool resetActiveUnit = false; |
5314 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) | 5314 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE
xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu
reFloatLinearExtensionEnabled : 0) |
5315 | ((extensionEnabled(OESTextureHalfFloatLinearName) || isWebGL2OrHigher(
)) ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); | 5315 | ((extensionEnabled(OESTextureHalfFloatLinearName) || isWebGL2OrHigher(
)) ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); |
5316 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { | 5316 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { |
5317 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m
_texture2DBinding->needToUseBlackTexture(flag)) | 5317 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... |
6832 | 6832 |
6833 return totalBytesPerPixel; | 6833 return totalBytesPerPixel; |
6834 } | 6834 } |
6835 | 6835 |
6836 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6836 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
6837 { | 6837 { |
6838 return m_drawingBuffer.get(); | 6838 return m_drawingBuffer.get(); |
6839 } | 6839 } |
6840 | 6840 |
6841 } // namespace blink | 6841 } // namespace blink |
OLD | NEW |