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

Unified Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 1157983002: Update WebGLVertexArrayObjectOES to WebGLVertexArrayObject for WebGL2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed bajones' comments Created 5 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
Index: Source/core/html/canvas/WebGLRenderingContextBase.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
index 81550c6b5c79f743e923a2ce6fb6608fa4b07017..b7b9a63aaa715e7e54e9ef45e79cd02c064088d0 100644
--- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
@@ -76,6 +76,7 @@
#include "core/html/canvas/WebGLSharedWebGraphicsContext3D.h"
#include "core/html/canvas/WebGLTexture.h"
#include "core/html/canvas/WebGLUniformLocation.h"
+#include "core/html/canvas/WebGLVertexArrayObjectOES.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/layout/LayoutBox.h"
@@ -704,10 +705,6 @@ void WebGLRenderingContextBase::initializeNewContext()
m_textureUnits.clear();
m_textureUnits.resize(numCombinedTextureImageUnits);
- GLint numVertexAttribs = 0;
- webContext()->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs);
- m_maxVertexAttribs = numVertexAttribs;
-
m_maxTextureSize = 0;
webContext()->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);
m_maxTextureLevel = WebGLTexture::computeLevelCount(m_maxTextureSize, m_maxTextureSize, 1);
@@ -723,9 +720,15 @@ void WebGLRenderingContextBase::initializeNewContext()
m_backDrawBuffer = GL_BACK;
- m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVertexArrayObjectOES::VaoTypeDefault);
- addContextObject(m_defaultVertexArrayObject.get());
- m_boundVertexArrayObject = m_defaultVertexArrayObject;
+ if (!m_defaultVertexArrayObject) {
+ GLint numVertexAttribs = 0;
+ webContext()->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs);
+ m_maxVertexAttribs = numVertexAttribs;
legend 2015/05/27 02:05:46 The initialization of m_maxVertexAttribs is moved
+
+ m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVertexArrayObjectBase::VaoTypeDefault);
+ addContextObject(m_defaultVertexArrayObject.get());
+ m_boundVertexArrayObject = m_defaultVertexArrayObject;
+ }
m_vertexAttribValue.resize(m_maxVertexAttribs);
@@ -1869,7 +1872,7 @@ void WebGLRenderingContextBase::disableVertexAttribArray(GLuint index)
return;
}
- WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArrayObject->getVertexAttribState(index);
+ WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexArrayObject->getVertexAttribState(index);
state->enabled = false;
webContext()->disableVertexAttribArray(index);
@@ -1981,7 +1984,7 @@ void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index)
return;
}
- WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArrayObject->getVertexAttribState(index);
+ WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexArrayObject->getVertexAttribState(index);
state->enabled = true;
webContext()->enableVertexAttribArray(index);
@@ -3052,7 +3055,7 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState,
synthesizeGLError(GL_INVALID_VALUE, "getVertexAttrib", "index out of range");
return ScriptValue::createNull(scriptState);
}
- const WebGLVertexArrayObjectOES::VertexAttribState* state = m_boundVertexArrayObject->getVertexAttribState(index);
+ const WebGLVertexArrayObjectBase::VertexAttribState* state = m_boundVertexArrayObject->getVertexAttribState(index);
if ((extensionEnabled(ANGLEInstancedArraysName) || isWebGL2OrHigher())
&& pname == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContextBase.h ('k') | Source/core/html/canvas/WebGLVertexArrayObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698