Commit 4e857b83 authored by gman@chromium.org's avatar gman@chromium.org

Make attrib missing buffer message clearer.

BUG=149069
TEST=no functional changes
R=kbr@chromium.org

Review URL: https://codereview.chromium.org/135893002

git-svn-id: svn://svn.chromium.org/blink/trunk@165055 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 08010580
......@@ -1792,17 +1792,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;
......@@ -5218,8 +5222,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;
}
......@@ -5269,8 +5272,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;
}
......
......@@ -371,7 +371,7 @@ public:
unsigned sizeInBytes(GLenum type);
// Check if each enabled vertex attribute is bound to a buffer.
bool validateRenderingState();
bool validateRenderingState(const char*);
bool validateWebGLObject(const char*, WebGLObject*);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment