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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 #include "core/html/canvas/WebGLDrawBuffers.h" | 69 #include "core/html/canvas/WebGLDrawBuffers.h" |
| 70 #include "core/html/canvas/WebGLFramebuffer.h" | 70 #include "core/html/canvas/WebGLFramebuffer.h" |
| 71 #include "core/html/canvas/WebGLLoseContext.h" | 71 #include "core/html/canvas/WebGLLoseContext.h" |
| 72 #include "core/html/canvas/WebGLProgram.h" | 72 #include "core/html/canvas/WebGLProgram.h" |
| 73 #include "core/html/canvas/WebGLRenderbuffer.h" | 73 #include "core/html/canvas/WebGLRenderbuffer.h" |
| 74 #include "core/html/canvas/WebGLShader.h" | 74 #include "core/html/canvas/WebGLShader.h" |
| 75 #include "core/html/canvas/WebGLShaderPrecisionFormat.h" | 75 #include "core/html/canvas/WebGLShaderPrecisionFormat.h" |
| 76 #include "core/html/canvas/WebGLSharedWebGraphicsContext3D.h" | 76 #include "core/html/canvas/WebGLSharedWebGraphicsContext3D.h" |
| 77 #include "core/html/canvas/WebGLTexture.h" | 77 #include "core/html/canvas/WebGLTexture.h" |
| 78 #include "core/html/canvas/WebGLUniformLocation.h" | 78 #include "core/html/canvas/WebGLUniformLocation.h" |
| 79 #include "core/html/canvas/WebGLVertexArrayObject.h" | |
| 80 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" | |
| 79 #include "core/inspector/ConsoleMessage.h" | 81 #include "core/inspector/ConsoleMessage.h" |
| 80 #include "core/inspector/InspectorInstrumentation.h" | 82 #include "core/inspector/InspectorInstrumentation.h" |
| 81 #include "core/layout/LayoutBox.h" | 83 #include "core/layout/LayoutBox.h" |
| 82 #include "core/loader/FrameLoader.h" | 84 #include "core/loader/FrameLoader.h" |
| 83 #include "core/loader/FrameLoaderClient.h" | 85 #include "core/loader/FrameLoaderClient.h" |
| 84 #include "platform/CheckedInt.h" | 86 #include "platform/CheckedInt.h" |
| 85 #include "platform/NotImplemented.h" | 87 #include "platform/NotImplemented.h" |
| 86 #include "platform/RuntimeEnabledFeatures.h" | 88 #include "platform/RuntimeEnabledFeatures.h" |
| 87 #include "platform/geometry/IntSize.h" | 89 #include "platform/geometry/IntSize.h" |
| 88 #include "platform/graphics/GraphicsContext.h" | 90 #include "platform/graphics/GraphicsContext.h" |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextu reSize, m_maxCubeMapTextureSize, 1); | 718 m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextu reSize, m_maxCubeMapTextureSize, 1); |
| 717 m_maxRenderbufferSize = 0; | 719 m_maxRenderbufferSize = 0; |
| 718 webContext()->getIntegerv(GL_MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize); | 720 webContext()->getIntegerv(GL_MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize); |
| 719 | 721 |
| 720 // These two values from EXT_draw_buffers are lazily queried. | 722 // These two values from EXT_draw_buffers are lazily queried. |
| 721 m_maxDrawBuffers = 0; | 723 m_maxDrawBuffers = 0; |
| 722 m_maxColorAttachments = 0; | 724 m_maxColorAttachments = 0; |
| 723 | 725 |
| 724 m_backDrawBuffer = GL_BACK; | 726 m_backDrawBuffer = GL_BACK; |
| 725 | 727 |
| 726 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVe rtexArrayObjectOES::VaoTypeDefault); | 728 if (isWebGL2OrHigher()) { |
|
legend
2015/05/27 09:20:05
@bajones, since `if (!m_defaultVertexArrayObject)`
| |
| 729 m_defaultVertexArrayObject = WebGLVertexArrayObject::create(this, WebGLV ertexArrayObjectBase::VaoTypeDefault); | |
| 730 } else { | |
| 731 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, Web GLVertexArrayObjectBase::VaoTypeDefault); | |
| 732 } | |
| 727 addContextObject(m_defaultVertexArrayObject.get()); | 733 addContextObject(m_defaultVertexArrayObject.get()); |
| 728 m_boundVertexArrayObject = m_defaultVertexArrayObject; | 734 m_boundVertexArrayObject = m_defaultVertexArrayObject; |
| 729 | 735 |
| 730 m_vertexAttribValue.resize(m_maxVertexAttribs); | 736 m_vertexAttribValue.resize(m_maxVertexAttribs); |
| 731 | 737 |
| 732 createFallbackBlackTextures1x1(); | 738 createFallbackBlackTextures1x1(); |
| 733 | 739 |
| 734 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 740 webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
| 735 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); | 741 webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight()); |
| 736 | 742 |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1862 | 1868 |
| 1863 void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) | 1869 void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index) |
| 1864 { | 1870 { |
| 1865 if (isContextLost()) | 1871 if (isContextLost()) |
| 1866 return; | 1872 return; |
| 1867 if (index >= m_maxVertexAttribs) { | 1873 if (index >= m_maxVertexAttribs) { |
| 1868 synthesizeGLError(GL_INVALID_VALUE, "disableVertexAttribArray", "index o ut of range"); | 1874 synthesizeGLError(GL_INVALID_VALUE, "disableVertexAttribArray", "index o ut of range"); |
| 1869 return; | 1875 return; |
| 1870 } | 1876 } |
| 1871 | 1877 |
| 1872 WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArrayObje ct->getVertexAttribState(index); | 1878 WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexArrayObj ect->getVertexAttribState(index); |
| 1873 state->enabled = false; | 1879 state->enabled = false; |
| 1874 | 1880 |
| 1875 webContext()->disableVertexAttribArray(index); | 1881 webContext()->disableVertexAttribArray(index); |
| 1876 } | 1882 } |
| 1877 | 1883 |
| 1878 bool WebGLRenderingContextBase::validateRenderingState(const char* functionName) | 1884 bool WebGLRenderingContextBase::validateRenderingState(const char* functionName) |
| 1879 { | 1885 { |
| 1880 if (!m_currentProgram) { | 1886 if (!m_currentProgram) { |
| 1881 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no valid shader p rogram in use"); | 1887 synthesizeGLError(GL_INVALID_OPERATION, functionName, "no valid shader p rogram in use"); |
| 1882 return false; | 1888 return false; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1974 | 1980 |
| 1975 void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) | 1981 void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) |
| 1976 { | 1982 { |
| 1977 if (isContextLost()) | 1983 if (isContextLost()) |
| 1978 return; | 1984 return; |
| 1979 if (index >= m_maxVertexAttribs) { | 1985 if (index >= m_maxVertexAttribs) { |
| 1980 synthesizeGLError(GL_INVALID_VALUE, "enableVertexAttribArray", "index ou t of range"); | 1986 synthesizeGLError(GL_INVALID_VALUE, "enableVertexAttribArray", "index ou t of range"); |
| 1981 return; | 1987 return; |
| 1982 } | 1988 } |
| 1983 | 1989 |
| 1984 WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArrayObje ct->getVertexAttribState(index); | 1990 WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexArrayObj ect->getVertexAttribState(index); |
| 1985 state->enabled = true; | 1991 state->enabled = true; |
| 1986 | 1992 |
| 1987 webContext()->enableVertexAttribArray(index); | 1993 webContext()->enableVertexAttribArray(index); |
| 1988 } | 1994 } |
| 1989 | 1995 |
| 1990 void WebGLRenderingContextBase::finish() | 1996 void WebGLRenderingContextBase::finish() |
| 1991 { | 1997 { |
| 1992 if (isContextLost()) | 1998 if (isContextLost()) |
| 1993 return; | 1999 return; |
| 1994 webContext()->flush(); // Intentionally a flush, not a finish. | 2000 webContext()->flush(); // Intentionally a flush, not a finish. |
| (...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3045 } | 3051 } |
| 3046 | 3052 |
| 3047 ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, GLuint index, GLenum pname) | 3053 ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, GLuint index, GLenum pname) |
| 3048 { | 3054 { |
| 3049 if (isContextLost()) | 3055 if (isContextLost()) |
| 3050 return ScriptValue::createNull(scriptState); | 3056 return ScriptValue::createNull(scriptState); |
| 3051 if (index >= m_maxVertexAttribs) { | 3057 if (index >= m_maxVertexAttribs) { |
| 3052 synthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of ran ge"); | 3058 synthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of ran ge"); |
| 3053 return ScriptValue::createNull(scriptState); | 3059 return ScriptValue::createNull(scriptState); |
| 3054 } | 3060 } |
| 3055 const WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArr ayObject->getVertexAttribState(index); | 3061 const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexAr rayObject->getVertexAttribState(index); |
| 3056 | 3062 |
| 3057 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher()) | 3063 if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher()) |
| 3058 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) | 3064 && pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) |
| 3059 return WebGLAny(scriptState, state->divisor); | 3065 return WebGLAny(scriptState, state->divisor); |
| 3060 | 3066 |
| 3061 switch (pname) { | 3067 switch (pname) { |
| 3062 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: | 3068 case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
| 3063 if (!state->bufferBinding || !state->bufferBinding->object()) | 3069 if (!state->bufferBinding || !state->bufferBinding->object()) |
| 3064 return ScriptValue::createNull(scriptState); | 3070 return ScriptValue::createNull(scriptState); |
| 3065 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state-> bufferBinding.get())); | 3071 return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state-> bufferBinding.get())); |
| (...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6224 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; | 6230 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; |
| 6225 } | 6231 } |
| 6226 #else | 6232 #else |
| 6227 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6233 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6228 { | 6234 { |
| 6229 return m_drawingBuffer.get(); | 6235 return m_drawingBuffer.get(); |
| 6230 } | 6236 } |
| 6231 #endif | 6237 #endif |
| 6232 | 6238 |
| 6233 } // namespace blink | 6239 } // namespace blink |
| OLD | NEW |