Chromium Code Reviews| 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 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2459 return WebGLAny(scriptState, m_unpackPremultiplyAlpha); | 2459 return WebGLAny(scriptState, m_unpackPremultiplyAlpha); |
| 2460 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: | 2460 case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL: |
| 2461 return WebGLAny(scriptState, m_unpackColorspaceConversion); | 2461 return WebGLAny(scriptState, m_unpackColorspaceConversion); |
| 2462 case GL_VENDOR: | 2462 case GL_VENDOR: |
| 2463 return WebGLAny(scriptState, String("WebKit")); | 2463 return WebGLAny(scriptState, String("WebKit")); |
| 2464 case GL_VERSION: | 2464 case GL_VERSION: |
| 2465 return WebGLAny(scriptState, "WebGL 1.0 (" + String(webContext()->getStr ing(GL_VERSION)) + ")"); | 2465 return WebGLAny(scriptState, "WebGL 1.0 (" + String(webContext()->getStr ing(GL_VERSION)) + ")"); |
| 2466 case GL_VIEWPORT: | 2466 case GL_VIEWPORT: |
| 2467 return getWebGLIntArrayParameter(scriptState, pname); | 2467 return getWebGLIntArrayParameter(scriptState, pname); |
| 2468 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives | 2468 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives |
| 2469 if (extensionEnabled(OESStandardDerivativesName)) | 2469 if (extensionEnabled(OESStandardDerivativesName) || version() > 1) |
|
Ken Russell (switch to Gerrit)
2015/02/03 01:23:25
Could you add a private isVersion2OrHigher() helpe
| |
| 2470 return getUnsignedIntParameter(scriptState, GL_FRAGMENT_SHADER_DERIV ATIVE_HINT_OES); | 2470 return getUnsignedIntParameter(scriptState, GL_FRAGMENT_SHADER_DERIV ATIVE_HINT_OES); |
| 2471 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_standard_derivatives not enabled"); | 2471 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_standard_derivatives not enabled"); |
| 2472 return ScriptValue::createNull(scriptState); | 2472 return ScriptValue::createNull(scriptState); |
| 2473 case WebGLDebugRendererInfo::UNMASKED_RENDERER_WEBGL: | 2473 case WebGLDebugRendererInfo::UNMASKED_RENDERER_WEBGL: |
| 2474 if (extensionEnabled(WebGLDebugRendererInfoName)) | 2474 if (extensionEnabled(WebGLDebugRendererInfoName)) |
| 2475 return WebGLAny(scriptState, webContext()->getString(GL_RENDERER)); | 2475 return WebGLAny(scriptState, webContext()->getString(GL_RENDERER)); |
| 2476 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); | 2476 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); |
| 2477 return ScriptValue::createNull(scriptState); | 2477 return ScriptValue::createNull(scriptState); |
| 2478 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: | 2478 case WebGLDebugRendererInfo::UNMASKED_VENDOR_WEBGL: |
| 2479 if (extensionEnabled(WebGLDebugRendererInfoName)) | 2479 if (extensionEnabled(WebGLDebugRendererInfoName)) |
| 2480 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR)); | 2480 return WebGLAny(scriptState, webContext()->getString(GL_VENDOR)); |
| 2481 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); | 2481 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_debug_renderer_info not enabled"); |
| 2482 return ScriptValue::createNull(scriptState); | 2482 return ScriptValue::createNull(scriptState); |
| 2483 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object | 2483 case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object |
| 2484 if (extensionEnabled(OESVertexArrayObjectName)) { | 2484 if (extensionEnabled(OESVertexArrayObjectName) || version() > 1) { |
| 2485 if (!m_boundVertexArrayObject->isDefaultObject()) | 2485 if (!m_boundVertexArrayObject->isDefaultObject()) |
| 2486 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject> (m_boundVertexArrayObject.get())); | 2486 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject> (m_boundVertexArrayObject.get())); |
| 2487 return ScriptValue::createNull(scriptState); | 2487 return ScriptValue::createNull(scriptState); |
| 2488 } | 2488 } |
| 2489 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); | 2489 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, OES_vertex_array_object not enabled"); |
| 2490 return ScriptValue::createNull(scriptState); | 2490 return ScriptValue::createNull(scriptState); |
| 2491 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic | 2491 case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| 2492 if (extensionEnabled(EXTTextureFilterAnisotropicName)) | 2492 if (extensionEnabled(EXTTextureFilterAnisotropicName) || version() > 1) |
| 2493 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT); | 2493 return getUnsignedIntParameter(scriptState, GL_MAX_TEXTURE_MAX_ANISO TROPY_EXT); |
| 2494 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); | 2494 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, EXT_texture_filter_anisotropic not enabled"); |
| 2495 return ScriptValue::createNull(scriptState); | 2495 return ScriptValue::createNull(scriptState); |
| 2496 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN | 2496 case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN |
| 2497 if (extensionEnabled(WebGLDrawBuffersName)) | 2497 if (extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| 2498 return WebGLAny(scriptState, maxColorAttachments()); | 2498 return WebGLAny(scriptState, maxColorAttachments()); |
| 2499 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_draw_buffers not enabled"); | 2499 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_draw_buffers not enabled"); |
| 2500 return ScriptValue::createNull(scriptState); | 2500 return ScriptValue::createNull(scriptState); |
| 2501 case GL_MAX_DRAW_BUFFERS_EXT: | 2501 case GL_MAX_DRAW_BUFFERS_EXT: |
| 2502 if (extensionEnabled(WebGLDrawBuffersName)) | 2502 if (extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| 2503 return WebGLAny(scriptState, maxDrawBuffers()); | 2503 return WebGLAny(scriptState, maxDrawBuffers()); |
| 2504 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_draw_buffers not enabled"); | 2504 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me, WEBGL_draw_buffers not enabled"); |
| 2505 return ScriptValue::createNull(scriptState); | 2505 return ScriptValue::createNull(scriptState); |
| 2506 default: | 2506 default: |
| 2507 if (extensionEnabled(WebGLDrawBuffersName) | 2507 if ((extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| 2508 && pname >= GL_DRAW_BUFFER0_EXT | 2508 && pname >= GL_DRAW_BUFFER0_EXT |
| 2509 && pname < static_cast<GLenum>(GL_DRAW_BUFFER0_EXT + maxDrawBuffers( ))) { | 2509 && pname < static_cast<GLenum>(GL_DRAW_BUFFER0_EXT + maxDrawBuffers( ))) { |
| 2510 GLint value = GL_NONE; | 2510 GLint value = GL_NONE; |
| 2511 if (m_framebufferBinding) | 2511 if (m_framebufferBinding) |
| 2512 value = m_framebufferBinding->getDrawBuffer(pname); | 2512 value = m_framebufferBinding->getDrawBuffer(pname); |
| 2513 else // emulated backbuffer | 2513 else // emulated backbuffer |
| 2514 value = m_backDrawBuffer; | 2514 value = m_backDrawBuffer; |
| 2515 return WebGLAny(scriptState, value); | 2515 return WebGLAny(scriptState, value); |
| 2516 } | 2516 } |
| 2517 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me"); | 2517 synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter na me"); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2689 case GL_TEXTURE_MAG_FILTER: | 2689 case GL_TEXTURE_MAG_FILTER: |
| 2690 case GL_TEXTURE_MIN_FILTER: | 2690 case GL_TEXTURE_MIN_FILTER: |
| 2691 case GL_TEXTURE_WRAP_S: | 2691 case GL_TEXTURE_WRAP_S: |
| 2692 case GL_TEXTURE_WRAP_T: | 2692 case GL_TEXTURE_WRAP_T: |
| 2693 { | 2693 { |
| 2694 GLint value = 0; | 2694 GLint value = 0; |
| 2695 webContext()->getTexParameteriv(target, pname, &value); | 2695 webContext()->getTexParameteriv(target, pname, &value); |
| 2696 return WebGLAny(scriptState, static_cast<unsigned>(value)); | 2696 return WebGLAny(scriptState, static_cast<unsigned>(value)); |
| 2697 } | 2697 } |
| 2698 case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic | 2698 case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| 2699 if (extensionEnabled(EXTTextureFilterAnisotropicName)) { | 2699 if (extensionEnabled(EXTTextureFilterAnisotropicName) || version() > 1) { |
| 2700 GLfloat value = 0.f; | 2700 GLfloat value = 0.f; |
| 2701 webContext()->getTexParameterfv(target, pname, &value); | 2701 webContext()->getTexParameterfv(target, pname, &value); |
| 2702 return WebGLAny(scriptState, value); | 2702 return WebGLAny(scriptState, value); |
| 2703 } | 2703 } |
| 2704 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled"); | 2704 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name, EXT_texture_filter_anisotropic not enabled"); |
| 2705 return ScriptValue::createNull(scriptState); | 2705 return ScriptValue::createNull(scriptState); |
| 2706 default: | 2706 default: |
| 2707 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name"); | 2707 synthesizeGLError(GL_INVALID_ENUM, "getTexParameter", "invalid parameter name"); |
| 2708 return ScriptValue::createNull(scriptState); | 2708 return ScriptValue::createNull(scriptState); |
| 2709 } | 2709 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2877 ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, GLuint index, GLenum pname) | 2877 ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, GLuint index, GLenum pname) |
| 2878 { | 2878 { |
| 2879 if (isContextLost()) | 2879 if (isContextLost()) |
| 2880 return ScriptValue::createNull(scriptState); | 2880 return ScriptValue::createNull(scriptState); |
| 2881 if (index >= m_maxVertexAttribs) { | 2881 if (index >= m_maxVertexAttribs) { |
| 2882 synthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of ran ge"); | 2882 synthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of ran ge"); |
| 2883 return ScriptValue::createNull(scriptState); | 2883 return ScriptValue::createNull(scriptState); |
| 2884 } | 2884 } |
| 2885 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr ayObject->getVertexAttribState(index); | 2885 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArr ayObject->getVertexAttribState(index); |
| 2886 | 2886 |
| 2887 if (extensionEnabled(ANGLEInstancedArraysName) && pname == GL_VERTEX_ATTRIB_ ARRAY_DIVISOR_ANGLE) | 2887 if ((extensionEnabled(ANGLEInstancedArraysName) || version() > 1) |
| 2888 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) | |
| 2888 return WebGLAny(scriptState, state.divisor); | 2889 return WebGLAny(scriptState, state.divisor); |
| 2889 | 2890 |
| 2890 switch (pname) { | 2891 switch (pname) { |
| 2891 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: | 2892 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
| 2892 if (!state.bufferBinding || !state.bufferBinding->object()) | 2893 if (!state.bufferBinding || !state.bufferBinding->object()) |
| 2893 return ScriptValue::createNull(scriptState); | 2894 return ScriptValue::createNull(scriptState); |
| 2894 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state.b ufferBinding.get())); | 2895 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state.b ufferBinding.get())); |
| 2895 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: | 2896 case GL_VERTEX_ATTRIB_ARRAY_ENABLED: |
| 2896 return WebGLAny(scriptState, state.enabled); | 2897 return WebGLAny(scriptState, state.enabled); |
| 2897 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: | 2898 case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 2925 void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) | 2926 void WebGLRenderingContextBase::hint(GLenum target, GLenum mode) |
| 2926 { | 2927 { |
| 2927 if (isContextLost()) | 2928 if (isContextLost()) |
| 2928 return; | 2929 return; |
| 2929 bool isValid = false; | 2930 bool isValid = false; |
| 2930 switch (target) { | 2931 switch (target) { |
| 2931 case GL_GENERATE_MIPMAP_HINT: | 2932 case GL_GENERATE_MIPMAP_HINT: |
| 2932 isValid = true; | 2933 isValid = true; |
| 2933 break; | 2934 break; |
| 2934 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives | 2935 case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives |
| 2935 if (extensionEnabled(OESStandardDerivativesName)) | 2936 if (extensionEnabled(OESStandardDerivativesName) || version() > 1) |
| 2936 isValid = true; | 2937 isValid = true; |
| 2937 break; | 2938 break; |
| 2938 } | 2939 } |
| 2939 if (!isValid) { | 2940 if (!isValid) { |
| 2940 synthesizeGLError(GL_INVALID_ENUM, "hint", "invalid target"); | 2941 synthesizeGLError(GL_INVALID_ENUM, "hint", "invalid target"); |
| 2941 return; | 2942 return; |
| 2942 } | 2943 } |
| 2943 webContext()->hint(target, mode); | 2944 webContext()->hint(target, mode); |
| 2944 } | 2945 } |
| 2945 | 2946 |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3759 break; | 3760 break; |
| 3760 case GL_TEXTURE_WRAP_S: | 3761 case GL_TEXTURE_WRAP_S: |
| 3761 case GL_TEXTURE_WRAP_T: | 3762 case GL_TEXTURE_WRAP_T: |
| 3762 if ((isFloat && paramf != GL_CLAMP_TO_EDGE && paramf != GL_MIRRORED_REPE AT && paramf != GL_REPEAT) | 3763 if ((isFloat && paramf != GL_CLAMP_TO_EDGE && paramf != GL_MIRRORED_REPE AT && paramf != GL_REPEAT) |
| 3763 || (!isFloat && parami != GL_CLAMP_TO_EDGE && parami != GL_MIRRORED_ REPEAT && parami != GL_REPEAT)) { | 3764 || (!isFloat && parami != GL_CLAMP_TO_EDGE && parami != GL_MIRRORED_ REPEAT && parami != GL_REPEAT)) { |
| 3764 synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid paramete r"); | 3765 synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid paramete r"); |
| 3765 return; | 3766 return; |
| 3766 } | 3767 } |
| 3767 break; | 3768 break; |
| 3768 case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic | 3769 case GL_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic |
| 3769 if (!extensionEnabled(EXTTextureFilterAnisotropicName)) { | 3770 if (!extensionEnabled(EXTTextureFilterAnisotropicName) || version() > 1) { |
| 3770 synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid paramete r, EXT_texture_filter_anisotropic not enabled"); | 3771 synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid paramete r, EXT_texture_filter_anisotropic not enabled"); |
| 3771 return; | 3772 return; |
| 3772 } | 3773 } |
| 3773 break; | 3774 break; |
| 3774 default: | 3775 default: |
| 3775 synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid parameter na me"); | 3776 synthesizeGLError(GL_INVALID_ENUM, "texParameter", "invalid parameter na me"); |
| 3776 return; | 3777 return; |
| 3777 } | 3778 } |
| 3778 if (isFloat) { | 3779 if (isFloat) { |
| 3779 tex->setParameterf(pname, paramf); | 3780 tex->setParameterf(pname, paramf); |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4600 default: | 4601 default: |
| 4601 notImplemented(); | 4602 notImplemented(); |
| 4602 } | 4603 } |
| 4603 return WebGLAny(scriptState, DOMInt32Array::create(value, length)); | 4604 return WebGLAny(scriptState, DOMInt32Array::create(value, length)); |
| 4604 } | 4605 } |
| 4605 | 4606 |
| 4606 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa me, bool prepareToDraw) | 4607 void WebGLRenderingContextBase::handleTextureCompleteness(const char* functionNa me, bool prepareToDraw) |
| 4607 { | 4608 { |
| 4608 // All calling functions check isContextLost, so a duplicate check is not ne eded here. | 4609 // All calling functions check isContextLost, so a duplicate check is not ne eded here. |
| 4609 bool resetActiveUnit = false; | 4610 bool resetActiveUnit = false; |
| 4610 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE xtensionFlag>((extensionEnabled(OESTextureFloatLinearName) ? WebGLTexture::Textu reFloatLinearExtensionEnabled : 0) | 4611 WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureE xtensionFlag>(((extensionEnabled(OESTextureFloatLinearName) || version() > 1) ? WebGLTexture::TextureFloatLinearExtensionEnabled : 0) |
| 4611 | (extensionEnabled(OESTextureHalfFloatLinearName) ? WebGLTexture::Textu reHalfFloatLinearExtensionEnabled : 0)); | 4612 | ((extensionEnabled(OESTextureHalfFloatLinearName) || version() > 1) ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); |
| 4612 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { | 4613 for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { |
| 4613 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m _texture2DBinding->needToUseBlackTexture(flag)) | 4614 if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m _texture2DBinding->needToUseBlackTexture(flag)) |
| 4614 || (m_textureUnits[ii].m_textureCubeMapBinding.get() && m_textureUni ts[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))) { | 4615 || (m_textureUnits[ii].m_textureCubeMapBinding.get() && m_textureUni ts[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))) { |
| 4615 if (ii != m_activeTextureUnit) { | 4616 if (ii != m_activeTextureUnit) { |
| 4616 webContext()->activeTexture(GL_TEXTURE0 + ii); | 4617 webContext()->activeTexture(GL_TEXTURE0 + ii); |
| 4617 resetActiveUnit = true; | 4618 resetActiveUnit = true; |
| 4618 } else if (resetActiveUnit) { | 4619 } else if (resetActiveUnit) { |
| 4619 webContext()->activeTexture(GL_TEXTURE0 + ii); | 4620 webContext()->activeTexture(GL_TEXTURE0 + ii); |
| 4620 resetActiveUnit = false; | 4621 resetActiveUnit = false; |
| 4621 } | 4622 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4753 { | 4754 { |
| 4754 switch (format) { | 4755 switch (format) { |
| 4755 case GL_ALPHA: | 4756 case GL_ALPHA: |
| 4756 case GL_LUMINANCE: | 4757 case GL_LUMINANCE: |
| 4757 case GL_LUMINANCE_ALPHA: | 4758 case GL_LUMINANCE_ALPHA: |
| 4758 case GL_RGB: | 4759 case GL_RGB: |
| 4759 case GL_RGBA: | 4760 case GL_RGBA: |
| 4760 break; | 4761 break; |
| 4761 case GL_DEPTH_STENCIL_OES: | 4762 case GL_DEPTH_STENCIL_OES: |
| 4762 case GL_DEPTH_COMPONENT: | 4763 case GL_DEPTH_COMPONENT: |
| 4763 if (extensionEnabled(WebGLDepthTextureName)) | 4764 if (extensionEnabled(WebGLDepthTextureName) || version() > 1) |
| 4764 break; | 4765 break; |
| 4765 synthesizeGLError(GL_INVALID_ENUM, functionName, "depth texture formats not enabled"); | 4766 synthesizeGLError(GL_INVALID_ENUM, functionName, "depth texture formats not enabled"); |
| 4766 return false; | 4767 return false; |
| 4767 case GL_SRGB_EXT: | 4768 case GL_SRGB_EXT: |
| 4768 case GL_SRGB_ALPHA_EXT: | 4769 case GL_SRGB_ALPHA_EXT: |
| 4769 if (extensionEnabled(EXTsRGBName)) | 4770 if (extensionEnabled(EXTsRGBName)) |
| 4770 break; | 4771 break; |
| 4771 synthesizeGLError(GL_INVALID_ENUM, functionName, "sRGB texture formats n ot enabled"); | 4772 synthesizeGLError(GL_INVALID_ENUM, functionName, "sRGB texture formats n ot enabled"); |
| 4772 return false; | 4773 return false; |
| 4773 default: | 4774 default: |
| 4774 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture format "); | 4775 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture format "); |
| 4775 return false; | 4776 return false; |
| 4776 } | 4777 } |
| 4777 | 4778 |
| 4778 switch (type) { | 4779 switch (type) { |
| 4779 case GL_UNSIGNED_BYTE: | 4780 case GL_UNSIGNED_BYTE: |
| 4780 case GL_UNSIGNED_SHORT_5_6_5: | 4781 case GL_UNSIGNED_SHORT_5_6_5: |
| 4781 case GL_UNSIGNED_SHORT_4_4_4_4: | 4782 case GL_UNSIGNED_SHORT_4_4_4_4: |
| 4782 case GL_UNSIGNED_SHORT_5_5_5_1: | 4783 case GL_UNSIGNED_SHORT_5_5_5_1: |
| 4783 break; | 4784 break; |
| 4784 case GL_FLOAT: | 4785 case GL_FLOAT: |
| 4785 if (extensionEnabled(OESTextureFloatName)) | 4786 if (extensionEnabled(OESTextureFloatName) || version() > 1) |
| 4786 break; | 4787 break; |
| 4787 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; | 4788 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; |
| 4788 return false; | 4789 return false; |
| 4789 case GL_HALF_FLOAT_OES: | 4790 case GL_HALF_FLOAT_OES: |
| 4790 if (extensionEnabled(OESTextureHalfFloatName)) | 4791 if (extensionEnabled(OESTextureHalfFloatName) || version() > 1) |
| 4791 break; | 4792 break; |
| 4792 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; | 4793 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; |
| 4793 return false; | 4794 return false; |
| 4794 case GL_UNSIGNED_INT: | 4795 case GL_UNSIGNED_INT: |
| 4795 case GL_UNSIGNED_INT_24_8_OES: | 4796 case GL_UNSIGNED_INT_24_8_OES: |
| 4796 case GL_UNSIGNED_SHORT: | 4797 case GL_UNSIGNED_SHORT: |
| 4797 if (extensionEnabled(WebGLDepthTextureName)) | 4798 if (extensionEnabled(WebGLDepthTextureName) || version() > 1) |
| 4798 break; | 4799 break; |
| 4799 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; | 4800 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; |
| 4800 return false; | 4801 return false; |
| 4801 default: | 4802 default: |
| 4802 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; | 4803 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid texture type") ; |
| 4803 return false; | 4804 return false; |
| 4804 } | 4805 } |
| 4805 | 4806 |
| 4806 // Verify that the combination of format and type is supported. | 4807 // Verify that the combination of format and type is supported. |
| 4807 switch (format) { | 4808 switch (format) { |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5282 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); | 5283 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid target"); |
| 5283 return false; | 5284 return false; |
| 5284 } | 5285 } |
| 5285 switch (attachment) { | 5286 switch (attachment) { |
| 5286 case GL_COLOR_ATTACHMENT0: | 5287 case GL_COLOR_ATTACHMENT0: |
| 5287 case GL_DEPTH_ATTACHMENT: | 5288 case GL_DEPTH_ATTACHMENT: |
| 5288 case GL_STENCIL_ATTACHMENT: | 5289 case GL_STENCIL_ATTACHMENT: |
| 5289 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: | 5290 case GC3D_DEPTH_STENCIL_ATTACHMENT_WEBGL: |
| 5290 break; | 5291 break; |
| 5291 default: | 5292 default: |
| 5292 if (extensionEnabled(WebGLDrawBuffersName) | 5293 if ((extensionEnabled(WebGLDrawBuffersName) || version() > 1) |
| 5293 && attachment > GL_COLOR_ATTACHMENT0 | 5294 && attachment > GL_COLOR_ATTACHMENT0 |
| 5294 && attachment < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + maxColorA ttachments())) | 5295 && attachment < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + maxColorA ttachments())) |
| 5295 break; | 5296 break; |
| 5296 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid attachment"); | 5297 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid attachment"); |
| 5297 return false; | 5298 return false; |
| 5298 } | 5299 } |
| 5299 return true; | 5300 return true; |
| 5300 } | 5301 } |
| 5301 | 5302 |
| 5302 bool WebGLRenderingContextBase::validateBlendEquation(const char* functionName, GLenum mode) | 5303 bool WebGLRenderingContextBase::validateBlendEquation(const char* functionName, GLenum mode) |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5508 return false; | 5509 return false; |
| 5509 | 5510 |
| 5510 if (!validateStencilSettings(functionName)) | 5511 if (!validateStencilSettings(functionName)) |
| 5511 return false; | 5512 return false; |
| 5512 | 5513 |
| 5513 switch (type) { | 5514 switch (type) { |
| 5514 case GL_UNSIGNED_BYTE: | 5515 case GL_UNSIGNED_BYTE: |
| 5515 case GL_UNSIGNED_SHORT: | 5516 case GL_UNSIGNED_SHORT: |
| 5516 break; | 5517 break; |
| 5517 case GL_UNSIGNED_INT: | 5518 case GL_UNSIGNED_INT: |
| 5518 if (extensionEnabled(OESElementIndexUintName)) | 5519 if (extensionEnabled(OESElementIndexUintName) || version() > 1) |
| 5519 break; | 5520 break; |
| 5520 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid type"); | 5521 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid type"); |
| 5521 return false; | 5522 return false; |
| 5522 default: | 5523 default: |
| 5523 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid type"); | 5524 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid type"); |
| 5524 return false; | 5525 return false; |
| 5525 } | 5526 } |
| 5526 | 5527 |
| 5527 if (count < 0) { | 5528 if (count < 0) { |
| 5528 synthesizeGLError(GL_INVALID_VALUE, functionName, "count < 0"); | 5529 synthesizeGLError(GL_INVALID_VALUE, functionName, "count < 0"); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5844 } | 5845 } |
| 5845 | 5846 |
| 5846 IntSize WebGLRenderingContextBase::clampedCanvasSize() | 5847 IntSize WebGLRenderingContextBase::clampedCanvasSize() |
| 5847 { | 5848 { |
| 5848 return IntSize(clamp(canvas()->width(), 1, m_maxViewportDims[0]), | 5849 return IntSize(clamp(canvas()->width(), 1, m_maxViewportDims[0]), |
| 5849 clamp(canvas()->height(), 1, m_maxViewportDims[1])); | 5850 clamp(canvas()->height(), 1, m_maxViewportDims[1])); |
| 5850 } | 5851 } |
| 5851 | 5852 |
| 5852 GLint WebGLRenderingContextBase::maxDrawBuffers() | 5853 GLint WebGLRenderingContextBase::maxDrawBuffers() |
| 5853 { | 5854 { |
| 5854 if (isContextLost() || !extensionEnabled(WebGLDrawBuffersName)) | 5855 if (isContextLost() || !(extensionEnabled(WebGLDrawBuffersName) || version() > 1)) |
| 5855 return 0; | 5856 return 0; |
| 5856 if (!m_maxDrawBuffers) | 5857 if (!m_maxDrawBuffers) |
| 5857 webContext()->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &m_maxDrawBuffers); | 5858 webContext()->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &m_maxDrawBuffers); |
| 5858 if (!m_maxColorAttachments) | 5859 if (!m_maxColorAttachments) |
| 5859 webContext()->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttac hments); | 5860 webContext()->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttac hments); |
| 5860 // WEBGL_draw_buffers requires MAX_COLOR_ATTACHMENTS >= MAX_DRAW_BUFFERS. | 5861 // WEBGL_draw_buffers requires MAX_COLOR_ATTACHMENTS >= MAX_DRAW_BUFFERS. |
| 5861 return std::min(m_maxDrawBuffers, m_maxColorAttachments); | 5862 return std::min(m_maxDrawBuffers, m_maxColorAttachments); |
| 5862 } | 5863 } |
| 5863 | 5864 |
| 5864 GLint WebGLRenderingContextBase::maxColorAttachments() | 5865 GLint WebGLRenderingContextBase::maxColorAttachments() |
| 5865 { | 5866 { |
| 5866 if (isContextLost() || !extensionEnabled(WebGLDrawBuffersName)) | 5867 if (isContextLost() || !(extensionEnabled(WebGLDrawBuffersName) || version() > 1)) |
| 5867 return 0; | 5868 return 0; |
| 5868 if (!m_maxColorAttachments) | 5869 if (!m_maxColorAttachments) |
| 5869 webContext()->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttac hments); | 5870 webContext()->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &m_maxColorAttac hments); |
| 5870 return m_maxColorAttachments; | 5871 return m_maxColorAttachments; |
| 5871 } | 5872 } |
| 5872 | 5873 |
| 5873 void WebGLRenderingContextBase::setBackDrawBuffer(GLenum buf) | 5874 void WebGLRenderingContextBase::setBackDrawBuffer(GLenum buf) |
| 5874 { | 5875 { |
| 5875 m_backDrawBuffer = buf; | 5876 m_backDrawBuffer = buf; |
| 5876 } | 5877 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5974 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; | 5975 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; |
| 5975 } | 5976 } |
| 5976 #else | 5977 #else |
| 5977 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 5978 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 5978 { | 5979 { |
| 5979 return m_drawingBuffer.get(); | 5980 return m_drawingBuffer.get(); |
| 5980 } | 5981 } |
| 5981 #endif | 5982 #endif |
| 5982 | 5983 |
| 5983 } // namespace blink | 5984 } // namespace blink |
| OLD | NEW |