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) ...@@ -946,40 +946,56 @@ bool ValidateEndQuery(gl::Context *context, GLenum target)
return true; return true;
} }
bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count, static bool ValidateUniformCommonBase(gl::Context *context, GLint location, GLsizei count)
GLboolean transpose)
{ {
if (count < 0) if (count < 0)
{ {
return gl::error(GL_INVALID_VALUE, false); return gl::error(GL_INVALID_VALUE, false);
} }
// Check for ES3 uniform entry points gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
int rows = VariableRowCount(matrixType); if (!programBinary)
int cols = VariableColumnCount(matrixType);
if (rows != cols && context->getClientVersion() < 3)
{ {
return gl::error(GL_INVALID_OPERATION, false); 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(); return true;
if (!programBinary) }
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); 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 gl::error(GL_INVALID_OPERATION, false);
return 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 ...@@ -48,6 +48,7 @@ bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsize
bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id); bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id);
bool ValidateEndQuery(gl::Context *context, GLenum target); 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, bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
GLboolean transpose); 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