Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp |
| diff --git a/third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp |
| index 842546731cd6b336cd710b789745e3147d3fe49c..0b5ec68bc6ebe5baaa75cf6cd51ba260377bf36d 100644 |
| --- a/third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp |
| +++ b/third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp |
| @@ -18,6 +18,10 @@ WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase(WebGLRenderingContextBase |
| , m_boundElementArrayBuffer(nullptr) |
| { |
| m_arrayBufferList.resize(ctx->maxVertexAttribs()); |
| + m_attribEnabled.resize(ctx->maxVertexAttribs()); |
| + for (size_t i = 0; i < m_attribEnabled.size(); ++i) { |
| + m_attribEnabled[i] = false; |
| + } |
| switch (m_type) { |
| case VaoTypeDefault: |
| @@ -80,7 +84,7 @@ void WebGLVertexArrayObjectBase::setElementArrayBuffer(WebGLBuffer* buffer) |
| WebGLBuffer* WebGLVertexArrayObjectBase::getArrayBufferForAttrib(size_t index) |
| { |
| - ASSERT(index < context()->maxVertexAttribs()); |
| + DCHECK(index < context()->maxVertexAttribs()); |
| return m_arrayBufferList[index].get(); |
| } |
| @@ -94,6 +98,27 @@ void WebGLVertexArrayObjectBase::setArrayBufferForAttrib(GLuint index, WebGLBuff |
| m_arrayBufferList[index] = buffer; |
| } |
| +void WebGLVertexArrayObjectBase::setAttribEnabled(GLuint index, bool enabled) |
| +{ |
| + DCHECK(index < context()->maxVertexAttribs()); |
| + m_attribEnabled[index] = enabled; |
| +} |
| + |
| +bool WebGLVertexArrayObjectBase::getAttribEnabled(GLuint index) |
| +{ |
| + DCHECK(index < context()->maxVertexAttribs()); |
| + return m_attribEnabled[index]; |
| +} |
| + |
| +bool WebGLVertexArrayObjectBase::isAllEnabledAttribBufferBound() |
|
Ken Russell (switch to Gerrit)
2016/06/01 20:55:24
This function is potentially very hot -- it will b
qiankun
2016/06/06 11:28:36
Thanks for your suggestion. I updated this CL to s
|
| +{ |
| + for (size_t i = 0; i < m_attribEnabled.size(); ++i) { |
| + if (m_attribEnabled[i] && !m_arrayBufferList[i]) |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| void WebGLVertexArrayObjectBase::unbindBuffer(WebGLBuffer* buffer) |
| { |
| if (m_boundElementArrayBuffer == buffer) { |