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

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

Issue 135893002: Make attrib missing buffer message clearer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/WebGLRenderingContext.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index 447cbb56c1076a1e00f5f3523516a84088e46dd1..20fa595b39da22a5e0ff80a590017e3dd1b03291 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -1793,17 +1793,21 @@ void WebGLRenderingContext::disableVertexAttribArray(GLuint index)
m_context->disableVertexAttribArray(index);
}
-bool WebGLRenderingContext::validateRenderingState()
+bool WebGLRenderingContext::validateRenderingState(const char* functionName)
{
- if (!m_currentProgram)
+ if (!m_currentProgram) {
+ synthesizeGLError(GL_INVALID_OPERATION, functionName, "no valid shader program in use");
return false;
+ }
// Look in each enabled vertex attrib and check if they've been bound to a buffer.
for (unsigned i = 0; i < m_onePlusMaxEnabledAttribIndex; ++i) {
const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(i);
if (state.enabled
- && (!state.bufferBinding || !state.bufferBinding->object()))
+ && (!state.bufferBinding || !state.bufferBinding->object())) {
+ synthesizeGLError(GL_INVALID_OPERATION, functionName, String::format("attribute %d is enabled but has no buffer bound", i).utf8().data());
return false;
+ }
}
return true;
@@ -5219,8 +5223,7 @@ bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GLenum
return false;
}
- if (!validateRenderingState()) {
- synthesizeGLError(GL_INVALID_OPERATION, functionName, "attribs not setup correctly");
+ if (!validateRenderingState(functionName)) {
return false;
}
@@ -5270,8 +5273,7 @@ bool WebGLRenderingContext::validateDrawElements(const char* functionName, GLenu
return false;
}
- if (!validateRenderingState()) {
- synthesizeGLError(GL_INVALID_OPERATION, functionName, "attribs not setup correctly");
+ if (!validateRenderingState(functionName)) {
return false;
}
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698