Commit aa981bd7 by Jamie Madill

Refactor Uniform validation to validationES.cpp.

This patch also incidentally fixes some bugged validation in the new ES3 unsigned int uniform API entry points. BUG=angle:571 Change-Id: I89bd909467bd9418fe5ce3f246561765cf27a5e9 Reviewed-on: https://chromium-review.googlesource.com/200074Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent d7c7bb27
......@@ -946,40 +946,56 @@ bool ValidateEndQuery(gl::Context *context, GLenum target)
return true;
}
bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
GLboolean transpose)
static bool ValidateUniformCommonBase(gl::Context *context, GLint location, GLsizei count)
{
if (count < 0)
{
return gl::error(GL_INVALID_VALUE, false);
}
// Check for ES3 uniform entry points
int rows = VariableRowCount(matrixType);
int cols = VariableColumnCount(matrixType);
if (rows != cols && context->getClientVersion() < 3)
gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
if (!programBinary)
{
return gl::error(GL_INVALID_OPERATION, false);
}
if (transpose != GL_FALSE && context->getClientVersion() < 3)
if (location == -1)
{
return gl::error(GL_INVALID_VALUE, false);
// Silently ignore the uniform command
return false;
}
gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
if (!programBinary)
return true;
}
bool ValidateUniform(gl::Context *context, GLenum uniformType, GLint location, GLsizei count)
{
// Check for ES3 uniform entry points
if (UniformComponentType(uniformType) == GL_UNSIGNED_INT && context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_OPERATION, false);
}
if (location == -1)
return ValidateUniformCommonBase(context, location, count);
}
bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
GLboolean transpose)
{
// Check for ES3 uniform entry points
int rows = VariableRowCount(matrixType);
int cols = VariableColumnCount(matrixType);
if (rows != cols && context->getClientVersion() < 3)
{
// Silently ignore the uniform command
return false;
return gl::error(GL_INVALID_OPERATION, false);
}
return true;
if (transpose != GL_FALSE && context->getClientVersion() < 3)
{
return gl::error(GL_INVALID_VALUE, false);
}
return ValidateUniformCommonBase(context, location, count);
}
}
......@@ -48,6 +48,7 @@ bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsize
bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id);
bool ValidateEndQuery(gl::Context *context, GLenum target);
bool ValidateUniform(gl::Context *context, GLenum uniformType, GLint location, GLsizei count);
bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
GLboolean transpose);
......
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