Commit ced53ae2 by He Yunchao Committed by Commit Bot

Fix the coding style issue for validation code

Change-Id: I63aa1c1b3bbc52b0b522e4a703e6d20574eb21ad Reviewed-on: https://chromium-review.googlesource.com/414588Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent e157e5a9
...@@ -24,7 +24,10 @@ using namespace angle; ...@@ -24,7 +24,10 @@ using namespace angle;
namespace gl namespace gl
{ {
static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum internalFormat, GLenum format, GLenum type) static bool ValidateTexImageFormatCombination(gl::Context *context,
GLenum internalFormat,
GLenum format,
GLenum type)
{ {
// For historical reasons, glTexImage2D and glTexImage3D pass in their internal format as a // For historical reasons, glTexImage2D and glTexImage3D pass in their internal format as a
// GLint instead of a GLenum. Therefor an invalid internal format gives a GL_INVALID_VALUE // GLint instead of a GLenum. Therefor an invalid internal format gives a GL_INVALID_VALUE
...@@ -152,7 +155,8 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -152,7 +155,8 @@ bool ValidateES3TexImageParametersBase(Context *context,
return false; return false;
} }
gl::Texture *texture = context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); gl::Texture *texture =
context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
if (!texture) if (!texture)
{ {
context->handleError(Error(GL_INVALID_OPERATION)); context->handleError(Error(GL_INVALID_OPERATION));
...@@ -263,7 +267,8 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -263,7 +267,8 @@ bool ValidateES3TexImageParametersBase(Context *context,
gl::Buffer *pixelUnpackBuffer = context->getGLState().getTargetBuffer(GL_PIXEL_UNPACK_BUFFER); gl::Buffer *pixelUnpackBuffer = context->getGLState().getTargetBuffer(GL_PIXEL_UNPACK_BUFFER);
if (pixelUnpackBuffer != nullptr) if (pixelUnpackBuffer != nullptr)
{ {
// ...data is not evenly divisible into the number of bytes needed to store in memory a datum // ...data is not evenly divisible into the number of bytes needed to store in memory a
// datum
// indicated by type. // indicated by type.
if (!isCompressed) if (!isCompressed)
{ {
...@@ -442,7 +447,8 @@ bool GetUnsizedEffectiveInternalFormatInfo(const InternalFormat &srcFormat, ...@@ -442,7 +447,8 @@ bool GetUnsizedEffectiveInternalFormatInfo(const InternalFormat &srcFormat,
outEffectiveFormat); outEffectiveFormat);
} }
static bool GetEffectiveInternalFormat(const InternalFormat &srcFormat, const InternalFormat &destFormat, static bool GetEffectiveInternalFormat(const InternalFormat &srcFormat,
const InternalFormat &destFormat,
GLenum *outEffectiveFormat) GLenum *outEffectiveFormat)
{ {
if (destFormat.pixelBytes > 0) if (destFormat.pixelBytes > 0)
...@@ -903,8 +909,12 @@ bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint ...@@ -903,8 +909,12 @@ bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint
return ValidateGetQueryObjectValueBase(context, id, pname, nullptr); return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
} }
bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum attachment, bool ValidateFramebufferTextureLayer(Context *context,
GLuint texture, GLint level, GLint layer) GLenum target,
GLenum attachment,
GLuint texture,
GLint level,
GLint layer)
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
...@@ -979,17 +989,24 @@ bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum att ...@@ -979,17 +989,24 @@ bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum att
return true; return true;
} }
bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum target, GLsizei samples, bool ValidateES3RenderbufferStorageParameters(gl::Context *context,
GLenum internalformat, GLsizei width, GLsizei height) GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height)
{ {
if (!ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width, height)) if (!ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width,
height))
{ {
return false; return false;
} }
//The ES3 spec(section 4.4.2) states that the internal format must be sized and not an integer format if samples is greater than zero. // The ES3 spec(section 4.4.2) states that the internal format must be sized and not an integer
// format if samples is greater than zero.
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT) && samples > 0) if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT) &&
samples > 0)
{ {
context->handleError(Error(GL_INVALID_OPERATION)); context->handleError(Error(GL_INVALID_OPERATION));
return false; return false;
...@@ -1008,7 +1025,9 @@ bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum targe ...@@ -1008,7 +1025,9 @@ bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum targe
return true; return true;
} }
bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numAttachments, bool ValidateInvalidateFramebuffer(Context *context,
GLenum target,
GLsizei numAttachments,
const GLenum *attachments) const GLenum *attachments)
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
...@@ -1034,7 +1053,8 @@ bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numA ...@@ -1034,7 +1053,8 @@ bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numA
return false; return false;
} }
return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments, defaultFramebuffer); return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments,
defaultFramebuffer);
} }
bool ValidateClearBuffer(ValidationContext *context) bool ValidateClearBuffer(ValidationContext *context)
...@@ -1091,7 +1111,7 @@ bool ValidateDrawRangeElements(Context *context, ...@@ -1091,7 +1111,7 @@ bool ValidateDrawRangeElements(Context *context,
return true; return true;
} }
bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint* params) bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint *params)
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
...@@ -1133,7 +1153,8 @@ bool ValidateReadBuffer(Context *context, GLenum src) ...@@ -1133,7 +1153,8 @@ bool ValidateReadBuffer(Context *context, GLenum src)
{ {
if (src != GL_BACK) if (src != GL_BACK)
{ {
const char *errorMsg = "'src' must be GL_NONE or GL_BACK when reading from the default framebuffer."; const char *errorMsg =
"'src' must be GL_NONE or GL_BACK when reading from the default framebuffer.";
context->handleError(gl::Error(GL_INVALID_OPERATION, errorMsg)); context->handleError(gl::Error(GL_INVALID_OPERATION, errorMsg));
return false; return false;
} }
......
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