Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp

Issue 2019513004: Validate bound buffer for draw calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLVertexArrayObjectBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698