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
......@@ -1387,15 +1387,20 @@ bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum ta
bool ValidFramebufferTarget(GLenum target)
{
static_assert(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER && GL_READ_FRAMEBUFFER_ANGLE == GL_READ_FRAMEBUFFER,
static_assert(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER &&
GL_READ_FRAMEBUFFER_ANGLE == GL_READ_FRAMEBUFFER,
"ANGLE framebuffer enums must equal the ES3 framebuffer enums.");
switch (target)
{
case GL_FRAMEBUFFER: return true;
case GL_READ_FRAMEBUFFER: return true;
case GL_DRAW_FRAMEBUFFER: return true;
default: return false;
case GL_FRAMEBUFFER:
return true;
case GL_READ_FRAMEBUFFER:
return true;
case GL_DRAW_FRAMEBUFFER:
return true;
default:
return false;
}
}
......@@ -1454,7 +1459,8 @@ bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level)
case GL_TEXTURE_2D_ARRAY:
maxDimension = caps.max2DTextureSize;
break;
default: UNREACHABLE();
default:
UNREACHABLE();
}
return level <= gl::log2(static_cast<int>(maxDimension));
......@@ -1608,8 +1614,10 @@ bool ValidImageDataSize(ValidationContext *context,
bool ValidQueryType(const Context *context, GLenum queryType)
{
static_assert(GL_ANY_SAMPLES_PASSED == GL_ANY_SAMPLES_PASSED_EXT, "GL extension enums not equal.");
static_assert(GL_ANY_SAMPLES_PASSED_CONSERVATIVE == GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, "GL extension enums not equal.");
static_assert(GL_ANY_SAMPLES_PASSED == GL_ANY_SAMPLES_PASSED_EXT,
"GL extension enums not equal.");
static_assert(GL_ANY_SAMPLES_PASSED_CONSERVATIVE == GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
"GL extension enums not equal.");
switch (queryType)
{
......@@ -1629,9 +1637,10 @@ bool ValidQueryType(const Context *context, GLenum queryType)
Program *GetValidProgram(ValidationContext *context, GLuint id)
{
// ES3 spec (section 2.11.1) -- "Commands that accept shader or program object names will generate the
// error INVALID_VALUE if the provided name is not the name of either a shader or program object and
// INVALID_OPERATION if the provided name identifies an object that is not the expected type."
// ES3 spec (section 2.11.1) -- "Commands that accept shader or program object names will
// generate the error INVALID_VALUE if the provided name is not the name of either a shader
// or program object and INVALID_OPERATION if the provided name identifies an object
// that is not the expected type."
Program *validProgram = context->getProgram(id);
......@@ -1711,8 +1720,12 @@ bool ValidateAttachmentTarget(gl::Context *context, GLenum attachment)
return true;
}
bool ValidateRenderbufferStorageParametersBase(gl::Context *context, GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width, GLsizei height)
bool ValidateRenderbufferStorageParametersBase(gl::Context *context,
GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height)
{
switch (target)
{
......@@ -1762,8 +1775,12 @@ bool ValidateRenderbufferStorageParametersBase(gl::Context *context, GLenum targ
return true;
}
bool ValidateRenderbufferStorageParametersANGLE(gl::Context *context, GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width, GLsizei height)
bool ValidateRenderbufferStorageParametersANGLE(gl::Context *context,
GLenum target,
GLsizei samples,
GLenum internalformat,
GLsizei width,
GLsizei height)
{
ASSERT(samples == 0 || context->getExtensions().framebufferMultisample);
......@@ -1790,11 +1807,15 @@ bool ValidateRenderbufferStorageParametersANGLE(gl::Context *context, GLenum tar
}
}
return ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width, height);
return ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat,
width, height);
}
bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum target, GLenum attachment,
GLenum renderbuffertarget, GLuint renderbuffer)
bool ValidateFramebufferRenderbufferParameters(gl::Context *context,
GLenum target,
GLenum attachment,
GLenum renderbuffertarget,
GLuint renderbuffer)
{
if (!ValidFramebufferTarget(target))
{
......@@ -1934,8 +1955,10 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context,
// The GL ES 3.0.2 spec (pg 193) states that:
// 1) If the read buffer is fixed point format, the draw buffer must be as well
// 2) If the read buffer is an unsigned integer format, the draw buffer must be as well
// 3) If the read buffer is a signed integer format, the draw buffer must be as well
// 2) If the read buffer is an unsigned integer format, the draw buffer must be
// as well
// 3) If the read buffer is a signed integer format, the draw buffer must be as
// well
// Changes with EXT_color_buffer_float:
// Case 1) is changed to fixed point OR floating point
GLenum readComponentType = readFormat.info->componentType;
......@@ -2005,8 +2028,10 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context,
{
if (mask & masks[i])
{
const gl::FramebufferAttachment *readBuffer = readFramebuffer->getAttachment(attachments[i]);
const gl::FramebufferAttachment *drawBuffer = drawFramebuffer->getAttachment(attachments[i]);
const gl::FramebufferAttachment *readBuffer =
readFramebuffer->getAttachment(attachments[i]);
const gl::FramebufferAttachment *drawBuffer =
drawFramebuffer->getAttachment(attachments[i]);
if (readBuffer && drawBuffer)
{
......@@ -2693,7 +2718,10 @@ bool ValidateUniform(gl::Context *context, GLenum uniformType, GLint location, G
return true;
}
bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
bool ValidateUniformMatrix(gl::Context *context,
GLenum matrixType,
GLint location,
GLsizei count,
GLboolean transpose)
{
// Check for ES3 uniform entry points
......@@ -2855,7 +2883,8 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
return false;
}
if (std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
if (std::numeric_limits<GLsizei>::max() - xoffset < width ||
std::numeric_limits<GLsizei>::max() - yoffset < height)
{
context->handleError(Error(GL_INVALID_VALUE));
return false;
......@@ -2977,7 +3006,8 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
}
int maxLevelDimension = (maxDimension >> level);
if (static_cast<int>(width) > maxLevelDimension || static_cast<int>(height) > maxLevelDimension)
if (static_cast<int>(width) > maxLevelDimension ||
static_cast<int>(height) > maxLevelDimension)
{
context->handleError(Error(GL_INVALID_VALUE));
return false;
......@@ -3041,8 +3071,7 @@ static bool ValidateDrawBase(ValidationContext *context,
{
// Note: these separate values are not supported in WebGL, due to D3D's limitations. See
// Section 6.10 of the WebGL 1.0 spec
ERR(
"This ANGLE implementation does not support separate front/back stencil "
ERR("This ANGLE implementation does not support separate front/back stencil "
"writemasks, reference values, or stencil mask values.");
context->handleError(Error(GL_INVALID_OPERATION));
return false;
......@@ -3069,7 +3098,8 @@ static bool ValidateDrawBase(ValidationContext *context,
}
// Uniform buffer validation
for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++)
for (unsigned int uniformBlockIndex = 0;
uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++)
{
const gl::UniformBlock &uniformBlock = program->getUniformBlockByIndex(uniformBlockIndex);
GLuint blockBinding = program->getUniformBlockBinding(uniformBlockIndex);
......@@ -3120,11 +3150,12 @@ bool ValidateDrawArrays(ValidationContext *context,
const State &state = context->getGLState();
gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
if (curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused() &&
curTransformFeedback->getPrimitiveMode() != mode)
if (curTransformFeedback && curTransformFeedback->isActive() &&
!curTransformFeedback->isPaused() && curTransformFeedback->getPrimitiveMode() != mode)
{
// It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode
// that does not match the current transform feedback object's draw mode (if transform feedback
// that does not match the current transform feedback object's draw mode (if transform
// feedback
// is active), (3.0.2, section 2.14, pg 86)
context->handleError(Error(GL_INVALID_OPERATION));
return false;
......@@ -3143,7 +3174,11 @@ bool ValidateDrawArrays(ValidationContext *context,
return true;
}
bool ValidateDrawArraysInstanced(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount)
bool ValidateDrawArraysInstanced(Context *context,
GLenum mode,
GLint first,
GLsizei count,
GLsizei primcount)
{
if (primcount < 0)
{
......@@ -3183,7 +3218,11 @@ static bool ValidateDrawInstancedANGLE(Context *context)
return false;
}
bool ValidateDrawArraysInstancedANGLE(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount)
bool ValidateDrawArraysInstancedANGLE(Context *context,
GLenum mode,
GLint first,
GLsizei count,
GLsizei primcount)
{
if (!ValidateDrawInstancedANGLE(context))
{
......@@ -3221,9 +3260,11 @@ bool ValidateDrawElements(ValidationContext *context,
const State &state = context->getGLState();
gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
if (curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused())
if (curTransformFeedback && curTransformFeedback->isActive() &&
!curTransformFeedback->isPaused())
{
// It is an invalid operation to call DrawElements, DrawRangeElements or DrawElementsInstanced
// It is an invalid operation to call DrawElements, DrawRangeElements or
// DrawElementsInstanced
// while transform feedback is active, (3.0.2, section 2.14, pg 86)
context->handleError(Error(GL_INVALID_OPERATION));
return false;
......@@ -3249,7 +3290,8 @@ bool ValidateDrawElements(ValidationContext *context,
const gl::Type &typeInfo = gl::GetTypeInfo(type);
GLint64 offset = reinterpret_cast<GLint64>(indices);
GLint64 byteCount = static_cast<GLint64>(typeInfo.bytes) * static_cast<GLint64>(count)+offset;
GLint64 byteCount =
static_cast<GLint64>(typeInfo.bytes) * static_cast<GLint64>(count) + offset;
// check for integer overflows
if (static_cast<GLuint>(count) > (std::numeric_limits<GLuint>::max() / typeInfo.bytes) ||
......@@ -3352,11 +3394,15 @@ bool ValidateDrawElementsInstancedANGLE(Context *context,
return false;
}
return ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount, indexRangeOut);
return ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount,
indexRangeOut);
}
bool ValidateFramebufferTextureBase(Context *context, GLenum target, GLenum attachment,
GLuint texture, GLint level)
bool ValidateFramebufferTextureBase(Context *context,
GLenum target,
GLenum attachment,
GLuint texture,
GLint level)
{
if (!ValidFramebufferTarget(target))
{
......@@ -3399,10 +3445,15 @@ bool ValidateFramebufferTextureBase(Context *context, GLenum target, GLenum atta
return true;
}
bool ValidateFramebufferTexture2D(Context *context, GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level)
bool ValidateFramebufferTexture2D(Context *context,
GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level)
{
// Attachments are required to be bound to level 0 without ES3 or the GL_OES_fbo_render_mipmap extension
// Attachments are required to be bound to level 0 without ES3 or the GL_OES_fbo_render_mipmap
// extension
if (context->getClientMajorVersion() < 3 && !context->getExtensions().fboRenderMipmap &&
level != 0)
{
......@@ -3504,12 +3555,12 @@ bool ValidateGetUniformBase(Context *context, GLuint program, GLint location)
return true;
}
bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat* params)
bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat *params)
{
return ValidateGetUniformBase(context, program, location);
}
bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint* params)
bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint *params)
{
return ValidateGetUniformBase(context, program, location);
}
......@@ -3557,12 +3608,20 @@ static bool ValidateSizedGetUniform(Context *context,
return true;
}
bool ValidateGetnUniformfvEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
bool ValidateGetnUniformfvEXT(Context *context,
GLuint program,
GLint location,
GLsizei bufSize,
GLfloat *params)
{
return ValidateSizedGetUniform(context, program, location, bufSize, nullptr);
}
bool ValidateGetnUniformivEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLint* params)
bool ValidateGetnUniformivEXT(Context *context,
GLuint program,
GLint location,
GLsizei bufSize,
GLint *params)
{
return ValidateSizedGetUniform(context, program, location, bufSize, nullptr);
}
......@@ -3622,8 +3681,11 @@ bool ValidateGetUniformuivRobustANGLE(Context *context,
return ValidateSizedGetUniform(context, program, location, bufSize, length);
}
bool ValidateDiscardFramebufferBase(Context *context, GLenum target, GLsizei numAttachments,
const GLenum *attachments, bool defaultFramebuffer)
bool ValidateDiscardFramebufferBase(Context *context,
GLenum target,
GLsizei numAttachments,
const GLenum *attachments,
bool defaultFramebuffer)
{
if (numAttachments < 0)
{
......
......@@ -313,8 +313,7 @@ bool ValidateES2TexImageParameters(Context *context,
return false;
}
if (level < 0 || xoffset < 0 ||
std::numeric_limits<GLsizei>::max() - xoffset < width ||
if (level < 0 || xoffset < 0 || std::numeric_limits<GLsizei>::max() - xoffset < width ||
std::numeric_limits<GLsizei>::max() - yoffset < height)
{
context->handleError(Error(GL_INVALID_VALUE));
......@@ -359,7 +358,8 @@ bool ValidateES2TexImageParameters(Context *context,
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)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -445,14 +445,15 @@ bool ValidateES2TexImageParameters(Context *context,
case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
if (!context->getExtensions().lossyETCDecode)
{
context->handleError(
Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported"));
context->handleError(Error(
GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported"));
return false;
}
break;
default:
context->handleError(Error(
GL_INVALID_ENUM, "internalformat is not a supported compressed internal format"));
context->handleError(
Error(GL_INVALID_ENUM,
"internalformat is not a supported compressed internal format"));
return false;
}
if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
......@@ -571,7 +572,8 @@ bool ValidateES2TexImageParameters(Context *context,
return false;
}
break;
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // error cases for compressed textures are handled below
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: // error cases for compressed textures are
// handled below
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
......@@ -663,8 +665,8 @@ bool ValidateES2TexImageParameters(Context *context,
}
else
{
context->handleError(
Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
context->handleError(Error(
GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
return false;
}
break;
......@@ -756,22 +758,17 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
switch (formatInfo.format)
{
case GL_ALPHA:
if (colorbufferFormat != GL_ALPHA8_EXT &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES)
if (colorbufferFormat != GL_ALPHA8_EXT && colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_RGBA8_OES)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
break;
case GL_LUMINANCE:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -779,16 +776,11 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
}
break;
case GL_RED_EXT:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_R32F &&
colorbufferFormat != GL_RG32F &&
colorbufferFormat != GL_RGB32F &&
if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_R32F &&
colorbufferFormat != GL_RG32F && colorbufferFormat != GL_RGB32F &&
colorbufferFormat != GL_RGBA32F)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -796,14 +788,10 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
}
break;
case GL_RG_EXT:
if (colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_RG32F &&
colorbufferFormat != GL_RGB32F &&
if (colorbufferFormat != GL_RG8_EXT && colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES && colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_RG32F && colorbufferFormat != GL_RGB32F &&
colorbufferFormat != GL_RGBA32F)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -811,12 +799,9 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
}
break;
case GL_RGB:
if (colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_RGB32F &&
if (colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_RGB32F &&
colorbufferFormat != GL_RGBA32F)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -825,10 +810,8 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
break;
case GL_LUMINANCE_ALPHA:
case GL_RGBA:
if (colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_RGBA32F)
if (colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_RGBA32F)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
......@@ -862,26 +845,19 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
switch (internalformat)
{
case GL_ALPHA:
if (colorbufferFormat != GL_ALPHA8_EXT &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
if (colorbufferFormat != GL_ALPHA8_EXT && colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
break;
case GL_LUMINANCE:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES &&
if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -889,14 +865,10 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
}
break;
case GL_RED_EXT:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES &&
if (colorbufferFormat != GL_R8_EXT && colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -904,26 +876,19 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
}
break;
case GL_RG_EXT:
if (colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
if (colorbufferFormat != GL_RG8_EXT && colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES && colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
break;
case GL_RGB:
if (colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES &&
if (colorbufferFormat != GL_RGB565 && colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -932,10 +897,8 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
break;
case GL_LUMINANCE_ALPHA:
case GL_RGBA:
if (colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES &&
if (colorbufferFormat != GL_RGBA4 && colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -1000,8 +963,8 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
}
else
{
context->handleError(
Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
context->handleError(Error(
GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
return false;
}
break;
......@@ -1030,8 +993,12 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context,
return (width > 0 && height > 0);
}
bool ValidateES2TexStorageParameters(Context *context, GLenum target, GLsizei levels, GLenum internalformat,
GLsizei width, GLsizei height)
bool ValidateES2TexStorageParameters(Context *context,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height)
{
if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP)
{
......@@ -1211,7 +1178,9 @@ bool ValidateES2TexStorageParameters(Context *context, GLenum target, GLsizei le
return true;
}
bool ValidateDiscardFramebufferEXT(Context *context, GLenum target, GLsizei numAttachments,
bool ValidateDiscardFramebufferEXT(Context *context,
GLenum target,
GLsizei numAttachments,
const GLenum *attachments)
{
if (!context->getExtensions().discardFramebuffer)
......@@ -1233,7 +1202,8 @@ bool ValidateDiscardFramebufferEXT(Context *context, GLenum target, GLsizei numA
return false;
}
return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments, defaultFramebuffer);
return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments,
defaultFramebuffer);
}
bool ValidateBindVertexArrayOES(Context *context, GLuint array)
......@@ -1923,8 +1893,7 @@ bool ValidateBlitFramebufferANGLE(Context *context,
dstX0, dstY0, dstX1, dstY1))
{
// only whole-buffer copies are permitted
ERR(
"Only whole-buffer depth and stencil blits are supported by this "
ERR("Only whole-buffer depth and stencil blits are supported by this "
"implementation.");
context->handleError(Error(GL_INVALID_OPERATION));
return false;
......@@ -3149,7 +3118,8 @@ bool ValidateProgramPathFragmentInputGen(Context *context,
expectedComponents = 4;
break;
default:
context->handleError(Error(GL_INVALID_OPERATION,
context->handleError(
Error(GL_INVALID_OPERATION,
"Fragment input type is not a floating point scalar or vector."));
return false;
}
......
......@@ -24,7 +24,10 @@ using namespace angle;
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
// GLint instead of a GLenum. Therefor an invalid internal format gives a GL_INVALID_VALUE
......@@ -152,7 +155,8 @@ bool ValidateES3TexImageParametersBase(Context *context,
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)
{
context->handleError(Error(GL_INVALID_OPERATION));
......@@ -263,7 +267,8 @@ bool ValidateES3TexImageParametersBase(Context *context,
gl::Buffer *pixelUnpackBuffer = context->getGLState().getTargetBuffer(GL_PIXEL_UNPACK_BUFFER);
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.
if (!isCompressed)
{
......@@ -442,7 +447,8 @@ bool GetUnsizedEffectiveInternalFormatInfo(const InternalFormat &srcFormat,
outEffectiveFormat);
}
static bool GetEffectiveInternalFormat(const InternalFormat &srcFormat, const InternalFormat &destFormat,
static bool GetEffectiveInternalFormat(const InternalFormat &srcFormat,
const InternalFormat &destFormat,
GLenum *outEffectiveFormat)
{
if (destFormat.pixelBytes > 0)
......@@ -903,8 +909,12 @@ bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint
return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
}
bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum attachment,
GLuint texture, GLint level, GLint layer)
bool ValidateFramebufferTextureLayer(Context *context,
GLenum target,
GLenum attachment,
GLuint texture,
GLint level,
GLint layer)
{
if (context->getClientMajorVersion() < 3)
{
......@@ -979,17 +989,24 @@ bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum att
return true;
}
bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width, GLsizei height)
bool ValidateES3RenderbufferStorageParameters(gl::Context *context,
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;
}
//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);
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));
return false;
......@@ -1008,7 +1025,9 @@ bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum targe
return true;
}
bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numAttachments,
bool ValidateInvalidateFramebuffer(Context *context,
GLenum target,
GLsizei numAttachments,
const GLenum *attachments)
{
if (context->getClientMajorVersion() < 3)
......@@ -1034,7 +1053,8 @@ bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numA
return false;
}
return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments, defaultFramebuffer);
return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments,
defaultFramebuffer);
}
bool ValidateClearBuffer(ValidationContext *context)
......@@ -1091,7 +1111,7 @@ bool ValidateDrawRangeElements(Context *context,
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)
{
......@@ -1133,7 +1153,8 @@ bool ValidateReadBuffer(Context *context, GLenum src)
{
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));
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