| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGLVertexArrayObjectBase.h" | 5 #include "modules/webgl/WebGLVertexArrayObjectBase.h" |
| 6 | 6 |
| 7 #include "modules/webgl/WebGLRenderingContextBase.h" | 7 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ASSERT(index < context()->maxVertexAttribs()); | 83 ASSERT(index < context()->maxVertexAttribs()); |
| 84 // Lazily create the vertex attribute states. | 84 // Lazily create the vertex attribute states. |
| 85 for (size_t i = m_vertexAttribState.size(); i <= index; i++) | 85 for (size_t i = m_vertexAttribState.size(); i <= index; i++) |
| 86 m_vertexAttribState.append(new VertexAttribState); | 86 m_vertexAttribState.append(new VertexAttribState); |
| 87 return m_vertexAttribState[index].get(); | 87 return m_vertexAttribState[index].get(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void WebGLVertexArrayObjectBase::setVertexAttribState( | 90 void WebGLVertexArrayObjectBase::setVertexAttribState( |
| 91 GLuint index, GLsizei bytesPerElement, GLint size, GLenum type, GLboolean no
rmalized, GLsizei stride, GLintptr offset, WebGLBuffer* buffer) | 91 GLuint index, GLsizei bytesPerElement, GLint size, GLenum type, GLboolean no
rmalized, GLsizei stride, GLintptr offset, WebGLBuffer* buffer) |
| 92 { | 92 { |
| 93 if (index >= context()->maxVertexAttribs()) |
| 94 return; |
| 93 GLsizei validatedStride = stride ? stride : bytesPerElement; | 95 GLsizei validatedStride = stride ? stride : bytesPerElement; |
| 94 VertexAttribState* state = getVertexAttribState(index); | 96 VertexAttribState* state = getVertexAttribState(index); |
| 95 | 97 |
| 96 if (buffer) | 98 if (buffer) |
| 97 buffer->onAttached(); | 99 buffer->onAttached(); |
| 98 if (state->bufferBinding) | 100 if (state->bufferBinding) |
| 99 state->bufferBinding->onDetached(context()->webContext()); | 101 state->bufferBinding->onDetached(context()->webContext()); |
| 100 | 102 |
| 101 state->bufferBinding = buffer; | 103 state->bufferBinding = buffer; |
| 102 state->bytesPerElement = bytesPerElement; | 104 state->bytesPerElement = bytesPerElement; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 138 } |
| 137 | 139 |
| 138 DEFINE_TRACE(WebGLVertexArrayObjectBase) | 140 DEFINE_TRACE(WebGLVertexArrayObjectBase) |
| 139 { | 141 { |
| 140 visitor->trace(m_boundElementArrayBuffer); | 142 visitor->trace(m_boundElementArrayBuffer); |
| 141 visitor->trace(m_vertexAttribState); | 143 visitor->trace(m_vertexAttribState); |
| 142 WebGLContextObject::trace(visitor); | 144 WebGLContextObject::trace(visitor); |
| 143 } | 145 } |
| 144 | 146 |
| 145 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |