Don't use gl::Error in validation.
Instead pass error code and error message directly to the Context. As
a side effect every validation error has an associated message now.
Reduces binary size by almost 100k.
Bug: angleproject:2957
Change-Id: I045e8ab57f8f9d787654a32f6f037011fe3a9f24
Reviewed-on: https://chromium-review.googlesource.com/c/1335890
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index e7975e5..cbaa515 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -37,7 +37,7 @@
{
if (!context->getExtensions().multiview)
{
- context->handleError(InvalidOperation() << "ANGLE_multiview is not available.");
+ context->validationError(GL_INVALID_OPERATION, kErrorMultiviewNotAvailable);
return false;
}
@@ -48,15 +48,14 @@
if (texture != 0 && numViews < 1)
{
- context->handleError(InvalidValue() << "numViews cannot be less than 1.");
+ context->validationError(GL_INVALID_VALUE, kErrorMultiviewViewsTooSmall);
return false;
}
const Extensions &extensions = context->getExtensions();
if (static_cast<GLuint>(numViews) > extensions.maxViews)
{
- context->handleError(InvalidValue()
- << "numViews cannot be greater than GL_MAX_VIEWS_ANGLE.");
+ context->validationError(GL_INVALID_VALUE, kErrorMultiviewViewsTooLarge);
return false;
}
@@ -70,14 +69,14 @@
TextureType type = texture->getType();
if (!ValidMipLevel(context, type, level))
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidMipLevel);
return false;
}
const auto &format = texture->getFormat(NonCubeTextureTypeToTarget(type), level);
if (format.info->compressed)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), CompressedTexturesNotAttachable);
+ context->validationError(GL_INVALID_OPERATION, kErrorCompressedTexturesNotAttachable);
return false;
}
return true;
@@ -87,7 +86,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -103,7 +102,7 @@
// Check for ES3 uniform entry points
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -114,7 +113,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
return ValidateGenOrDelete(context, n);
@@ -124,12 +123,12 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (count < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeCount);
return false;
}
return true;
@@ -146,19 +145,19 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (!context->getExtensions().copyTexture3d)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ANGLECopyTexture3DUnavailable);
+ context->validationError(GL_INVALID_OPERATION, kErrorANGLECopyTexture3DUnavailable);
return false;
}
if (!ValidTexture3DTarget(context, source->getType()))
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
@@ -180,13 +179,13 @@
case GL_DEPTH_STENCIL:
break;
default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidInternalFormat);
return false;
}
if (!ValidTexture3DTarget(context, TextureTargetToType(destTarget)))
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
@@ -250,7 +249,7 @@
case GL_RGBA32UI:
break;
default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidInternalFormat);
return false;
}
@@ -268,13 +267,13 @@
// The type and format are valid if any supported internal format has that type and format
if (!ValidES3Format(format))
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFormat);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidFormat);
return false;
}
if (!ValidES3Type(type))
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidType);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidType);
return false;
}
@@ -284,7 +283,7 @@
// the validation codepaths for glTexImage2D/3D, we record a GL_INVALID_VALUE error.
if (!ValidES3InternalFormat(internalFormat))
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidInternalFormat);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidInternalFormat);
return false;
}
@@ -295,24 +294,21 @@
// INVALID_OPERATION error.
if (target == TextureType::_3D && (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL))
{
- context->handleError(InvalidOperation() << "Format cannot be GL_DEPTH_COMPONENT or "
- "GL_DEPTH_STENCIL if target is "
- "GL_TEXTURE_3D");
+ context->validationError(GL_INVALID_OPERATION, kError3DDepthStencil);
return false;
}
// Check if this is a valid format combination to load texture data
if (!ValidES3FormatCombination(format, type, internalFormat))
{
- context->handleError(InvalidOperation()
- << "Invalid combination of format, type and internalFormat.");
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidFormatCombination);
return false;
}
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat, type);
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
- context->handleError(InvalidOperation() << "Unsupported internal format.");
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidInternalFormat);
return false;
}
@@ -342,23 +338,28 @@
// Validate image size
if (!ValidImageSizeParameters(context, texType, level, width, height, depth, isSubImage))
{
- context->handleError(InvalidValue());
+ // Error already processed.
return false;
}
// Verify zero border
if (border != 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidBorder);
return false;
}
- if (xoffset < 0 || yoffset < 0 || zoffset < 0 ||
- std::numeric_limits<GLsizei>::max() - xoffset < width ||
+ if (xoffset < 0 || yoffset < 0 || zoffset < 0)
+ {
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeOffset);
+ return false;
+ }
+
+ if (std::numeric_limits<GLsizei>::max() - xoffset < width ||
std::numeric_limits<GLsizei>::max() - yoffset < height ||
std::numeric_limits<GLsizei>::max() - zoffset < depth)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorOffsetOverflow);
return false;
}
@@ -370,7 +371,7 @@
if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
break;
@@ -380,13 +381,12 @@
if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
if (isCompressed)
{
- context->handleError(InvalidEnum()
- << "Rectangle texture cannot have a compressed format.");
+ context->validationError(GL_INVALID_ENUM, kErrorRectangleTextureCompressed);
return false;
}
break;
@@ -394,13 +394,13 @@
case TextureType::CubeMap:
if (!isSubImage && width != height)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorCubemapFacesEqualDimensions);
return false;
}
if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
break;
@@ -410,7 +410,7 @@
static_cast<GLuint>(height) > (caps.max3DTextureSize >> level) ||
static_cast<GLuint>(depth) > (caps.max3DTextureSize >> level))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
break;
@@ -420,26 +420,26 @@
static_cast<GLuint>(height) > (caps.max2DTextureSize >> level) ||
static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
gl::Texture *texture = context->getTargetTexture(texType);
if (!texture)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorMissingTexture);
return false;
}
if (texture->getImmutableFormat() && !isSubImage)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorTextureIsImmutable);
return false;
}
@@ -448,7 +448,7 @@
isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat;
if (isSubImage && actualInternalFormat == GL_NONE)
{
- context->handleError(InvalidOperation() << "Texture level does not exist.");
+ context->validationError(GL_INVALID_OPERATION, "Texture level does not exist.");
return false;
}
@@ -459,8 +459,8 @@
{
if (!actualFormatInfo.compressed)
{
- context->handleError(
- InvalidEnum() << "internalformat is not a supported compressed internal format.");
+ context->validationError(
+ GL_INVALID_ENUM, "internalformat is not a supported compressed internal format.");
return false;
}
@@ -470,20 +470,21 @@
context, actualFormatInfo.internalFormat, xoffset, yoffset, width, height,
texture->getWidth(target, level), texture->getHeight(target, level)))
{
- context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Invalid compressed format dimension.");
return false;
}
if (format != actualInternalFormat)
{
- context->handleError(InvalidOperation()
- << "Format must match the internal format of the texture.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Format must match the internal format of the texture.");
return false;
}
if (actualInternalFormat == GL_ETC1_RGB8_OES)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidInternalFormat);
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidInternalFormat);
return false;
}
}
@@ -491,20 +492,21 @@
{
if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height))
{
- context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Invalid compressed format dimension.");
return false;
}
}
if (!actualFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidFormat);
return false;
}
if (texType == TextureType::_3D)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidTextureTarget);
return false;
}
}
@@ -522,13 +524,13 @@
{
if (isCompressed != actualFormatInfo.compressed)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorCompressedMismatch);
return false;
}
if (xoffset < 0 || yoffset < 0 || zoffset < 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeOffset);
return false;
}
@@ -536,7 +538,7 @@
std::numeric_limits<GLsizei>::max() - yoffset < height ||
std::numeric_limits<GLsizei>::max() - zoffset < depth)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorOffsetOverflow);
return false;
}
@@ -544,14 +546,14 @@
static_cast<size_t>(yoffset + height) > texture->getHeight(target, level) ||
static_cast<size_t>(zoffset + depth) > texture->getDepth(target, level))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorOffsetOverflow);
return false;
}
if (width > 0 && height > 0 && depth > 0 && pixels == nullptr &&
context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack) == nullptr)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), PixelDataNull);
+ context->validationError(GL_INVALID_VALUE, kErrorPixelDataNull);
return false;
}
}
@@ -578,8 +580,8 @@
if ((offset % dataBytesPerPixel) != 0)
{
- context->handleError(InvalidOperation()
- << "Reads would overflow the pixel unpack buffer.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Reads would overflow the pixel unpack buffer.");
return false;
}
}
@@ -587,7 +589,7 @@
// ...the buffer object's data store is currently mapped.
if (pixelUnpackBuffer->isMapped())
{
- context->handleError(InvalidOperation() << "Pixel unpack buffer is mapped.");
+ context->validationError(GL_INVALID_OPERATION, "Pixel unpack buffer is mapped.");
return false;
}
}
@@ -615,7 +617,7 @@
{
if (!ValidTexture2DDestinationTarget(context, target))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
@@ -644,14 +646,14 @@
{
if (!ValidTexture3DDestinationTarget(context, target))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
if (IsETC2EACFormat(format) && target != TextureType::_2DArray)
{
// ES 3.1, Section 8.7, page 169.
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InternalFormatRequiresTexture2DArray);
+ context->validationError(GL_INVALID_OPERATION, kErrorInternalFormatRequiresTexture2DArray);
return false;
}
@@ -946,7 +948,7 @@
// is RGB9_E5 and copy to such a texture, generate INVALID_OPERATION.
if (textureFormat.info->internalFormat == GL_RGB9_E5)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidFormat);
return false;
}
@@ -955,7 +957,7 @@
if (!IsValidES3CopyTexImageCombination(*textureFormat.info, *source->getFormat().info,
readFramebufferID))
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidCopyCombination);
return false;
}
}
@@ -966,7 +968,7 @@
const InternalFormat ©Format = GetInternalFormatInfo(internalformat, GL_UNSIGNED_BYTE);
if (!IsValidES3CopyTexImageCombination(copyFormat, framebufferFormat, readFramebufferID))
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidCopyCombination);
return false;
}
}
@@ -991,7 +993,7 @@
{
if (!ValidTexture2DDestinationTarget(context, target))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
@@ -1016,7 +1018,7 @@
{
if (!ValidTexture3DDestinationTarget(context, target))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
@@ -1035,7 +1037,7 @@
{
if (width < 1 || height < 1 || depth < 1 || levels < 1)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorTextureSizeTooSmall);
return false;
}
@@ -1047,7 +1049,7 @@
if (levels > gl::log2(maxDim) + 1)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidMipLevels);
return false;
}
@@ -1060,7 +1062,7 @@
if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
static_cast<GLuint>(height) > caps.max2DTextureSize)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
}
@@ -1068,10 +1070,16 @@
case TextureType::Rectangle:
{
- if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
- static_cast<GLuint>(height) > caps.maxRectangleTextureSize || levels != 1)
+ if (levels != 1)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidMipLevels);
+ return false;
+ }
+
+ if (static_cast<GLuint>(width) > caps.maxRectangleTextureSize ||
+ static_cast<GLuint>(height) > caps.maxRectangleTextureSize)
+ {
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
}
@@ -1081,13 +1089,13 @@
{
if (width != height)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorCubemapFacesEqualDimensions);
return false;
}
if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
}
@@ -1099,7 +1107,7 @@
static_cast<GLuint>(height) > caps.max3DTextureSize ||
static_cast<GLuint>(depth) > caps.max3DTextureSize)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
}
@@ -1111,7 +1119,7 @@
static_cast<GLuint>(height) > caps.max2DTextureSize ||
static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorResourceMaxTextureSize);
return false;
}
}
@@ -1125,32 +1133,32 @@
gl::Texture *texture = context->getTargetTexture(target);
if (!texture || texture->id() == 0)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorMissingTexture);
return false;
}
if (texture->getImmutableFormat())
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorTextureIsImmutable);
return false;
}
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidFormat);
return false;
}
if (!formatInfo.sized)
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidFormat);
return false;
}
if (formatInfo.compressed && target == TextureType::Rectangle)
{
- context->handleError(InvalidEnum() << "Rectangle texture cannot have a compressed format.");
+ context->validationError(GL_INVALID_ENUM, kErrorRectangleTextureCompressed);
return false;
}
@@ -1167,7 +1175,7 @@
{
if (!ValidTexture2DTarget(context, target))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
@@ -1185,7 +1193,7 @@
{
if (!ValidTexture3DTarget(context, target))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
@@ -1197,7 +1205,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1208,7 +1216,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1219,7 +1227,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1230,7 +1238,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1246,7 +1254,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1260,7 +1268,7 @@
{
if (layer < 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeLayer);
return false;
}
@@ -1273,14 +1281,15 @@
{
if (level > gl::log2(caps.max2DTextureSize))
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(),
- FramebufferTextureInvalidMipLevel);
+ context->validationError(GL_INVALID_VALUE,
+ kErrorFramebufferTextureInvalidMipLevel);
return false;
}
if (static_cast<GLuint>(layer) >= caps.maxArrayTextureLayers)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), FramebufferTextureInvalidLayer);
+ context->validationError(GL_INVALID_VALUE,
+ kErrorFramebufferTextureInvalidLayer);
return false;
}
}
@@ -1290,14 +1299,15 @@
{
if (level > gl::log2(caps.max3DTextureSize))
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(),
- FramebufferTextureInvalidMipLevel);
+ context->validationError(GL_INVALID_VALUE,
+ kErrorFramebufferTextureInvalidMipLevel);
return false;
}
if (static_cast<GLuint>(layer) >= caps.max3DTextureSize)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), FramebufferTextureInvalidLayer);
+ context->validationError(GL_INVALID_VALUE,
+ kErrorFramebufferTextureInvalidLayer);
return false;
}
}
@@ -1307,29 +1317,30 @@
{
if (level != 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(),
- FramebufferTextureInvalidMipLevel);
+ context->validationError(GL_INVALID_VALUE,
+ kErrorFramebufferTextureInvalidMipLevel);
return false;
}
if (static_cast<GLuint>(layer) >= caps.maxArrayTextureLayers)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), FramebufferTextureInvalidLayer);
+ context->validationError(GL_INVALID_VALUE,
+ kErrorFramebufferTextureInvalidLayer);
return false;
}
}
break;
default:
- ANGLE_VALIDATION_ERR(context, InvalidOperation(),
- FramebufferTextureLayerIncorrectTextureType);
+ context->validationError(GL_INVALID_OPERATION,
+ kErrorFramebufferTextureLayerIncorrectTextureType);
return false;
}
const auto &format = tex->getFormat(NonCubeTextureTypeToTarget(tex->getType()), level);
if (format.info->compressed)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorCompressedTexturesNotAttachable);
return false;
}
}
@@ -1344,7 +1355,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1360,7 +1371,7 @@
defaultFramebuffer = context->getGLState().getReadFramebuffer()->id() == 0;
break;
default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidFramebufferTarget);
return false;
}
@@ -1379,7 +1390,7 @@
{
if (width < 0 || height < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeSize);
return false;
}
@@ -1390,7 +1401,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1412,13 +1423,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (end < start)
{
- context->handleError(InvalidValue() << "end < start");
+ context->validationError(GL_INVALID_VALUE, "end < start");
return false;
}
@@ -1441,7 +1452,7 @@
if (indexRange.end > end || indexRange.start < start)
{
// GL spec says that behavior in this case is undefined - generating an error is fine.
- context->handleError(InvalidOperation() << "Indices are out of the start, end range.");
+ context->validationError(GL_INVALID_OPERATION, "Indices are out of the start, end range.");
return false;
}
return true;
@@ -1451,7 +1462,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1462,7 +1473,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1470,7 +1481,7 @@
if (readFBO == nullptr)
{
- context->handleError(InvalidOperation() << "No active read framebuffer.");
+ context->validationError(GL_INVALID_OPERATION, "No active read framebuffer.");
return false;
}
@@ -1481,7 +1492,7 @@
if (src != GL_BACK && (src < GL_COLOR_ATTACHMENT0 || src > GL_COLOR_ATTACHMENT31))
{
- context->handleError(InvalidEnum() << "Unknown enum for 'src' in ReadBuffer");
+ context->validationError(GL_INVALID_ENUM, "Unknown enum for 'src' in ReadBuffer");
return false;
}
@@ -1489,9 +1500,9 @@
{
if (src != GL_BACK)
{
- context->handleError(
- InvalidOperation()
- << "'src' must be GL_NONE or GL_BACK when reading from the default framebuffer.");
+ context->validationError(
+ GL_INVALID_OPERATION,
+ "'src' must be GL_NONE or GL_BACK when reading from the default framebuffer.");
return false;
}
}
@@ -1501,7 +1512,8 @@
if (drawBuffer >= context->getCaps().maxDrawBuffers)
{
- context->handleError(InvalidOperation() << "'src' is greater than MAX_DRAW_BUFFERS.");
+ context->validationError(GL_INVALID_OPERATION,
+ "'src' is greater than MAX_DRAW_BUFFERS.");
return false;
}
}
@@ -1522,47 +1534,48 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (!ValidTextureTarget(context, target))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureTarget);
return false;
}
// Validate image size
if (!ValidImageSizeParameters(context, target, level, width, height, depth, false))
{
- context->handleError(InvalidValue());
+ // Error already generated.
return false;
}
const InternalFormat &formatInfo = GetSizedInternalFormatInfo(internalformat);
if (!formatInfo.compressed)
{
- context->handleError(InvalidEnum() << "Not a valid compressed texture format");
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidCompressedFormat);
return false;
}
GLuint blockSize = 0;
if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth), &blockSize))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIntegerOverflow);
return false;
}
if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidCompressedImageSize);
return false;
}
// 3D texture target validation
if (target != TextureType::_3D && target != TextureType::_2DArray)
{
- context->handleError(InvalidEnum() << "Must specify a valid 3D texture destination target");
+ context->validationError(GL_INVALID_ENUM,
+ "Must specify a valid 3D texture destination target");
return false;
}
@@ -1602,7 +1615,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1613,7 +1626,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1629,20 +1642,20 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (buffer != 0 && offset < 0)
{
- context->handleError(InvalidValue() << "buffer is non-zero and offset is negative.");
+ context->validationError(GL_INVALID_VALUE, "buffer is non-zero and offset is negative.");
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isBufferGenerated(buffer))
{
- context->handleError(InvalidOperation() << "Buffer was not generated.");
+ context->validationError(GL_INVALID_OPERATION, "Buffer was not generated.");
return false;
}
@@ -1653,14 +1666,16 @@
{
if (index >= caps.maxTransformFeedbackSeparateAttributes)
{
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of TRANSFORM_FEEDBACK_BUFFER "
- "indexed binding points.");
+ context->validationError(GL_INVALID_VALUE,
+ "index is greater than or equal to the "
+ "number of TRANSFORM_FEEDBACK_BUFFER "
+ "indexed binding points.");
return false;
}
if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0))
{
- context->handleError(InvalidValue() << "offset and size must be multiple of 4.");
+ context->validationError(GL_INVALID_VALUE,
+ "offset and size must be multiple of 4.");
return false;
}
@@ -1668,9 +1683,9 @@
context->getGLState().getCurrentTransformFeedback();
if (curTransformFeedback && curTransformFeedback->isActive())
{
- context->handleError(InvalidOperation()
- << "target is TRANSFORM_FEEDBACK_BUFFER and transform "
- "feedback is currently active.");
+ context->validationError(GL_INVALID_OPERATION,
+ "target is TRANSFORM_FEEDBACK_BUFFER and transform "
+ "feedback is currently active.");
return false;
}
break;
@@ -1679,18 +1694,19 @@
{
if (index >= caps.maxUniformBufferBindings)
{
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of UNIFORM_BUFFER indexed "
- "binding points.");
+ context->validationError(GL_INVALID_VALUE,
+ "index is greater than or equal to the "
+ "number of UNIFORM_BUFFER indexed "
+ "binding points.");
return false;
}
ASSERT(caps.uniformBufferOffsetAlignment);
if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0)
{
- context->handleError(
- InvalidValue()
- << "offset must be multiple of value of UNIFORM_BUFFER_OFFSET_ALIGNMENT.");
+ context->validationError(
+ GL_INVALID_VALUE,
+ "offset must be multiple of value of UNIFORM_BUFFER_OFFSET_ALIGNMENT.");
return false;
}
break;
@@ -1699,20 +1715,21 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidEnum()
- << "ATOMIC_COUNTER_BUFFER is not supported before GLES 3.1");
+ context->validationError(GL_INVALID_ENUM,
+ "ATOMIC_COUNTER_BUFFER is not supported before GLES 3.1");
return false;
}
if (index >= caps.maxAtomicCounterBufferBindings)
{
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of ATOMIC_COUNTER_BUFFER "
- "indexed binding points.");
+ context->validationError(GL_INVALID_VALUE,
+ "index is greater than or equal to the "
+ "number of ATOMIC_COUNTER_BUFFER "
+ "indexed binding points.");
return false;
}
if (buffer != 0 && (offset % 4) != 0)
{
- context->handleError(InvalidValue() << "offset must be a multiple of 4.");
+ context->validationError(GL_INVALID_VALUE, "offset must be a multiple of 4.");
return false;
}
break;
@@ -1721,29 +1738,31 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidEnum()
- << "SHADER_STORAGE_BUFFER is not supported in GLES3.");
+ context->validationError(GL_INVALID_ENUM,
+ "SHADER_STORAGE_BUFFER is not supported in GLES3.");
return false;
}
if (index >= caps.maxShaderStorageBufferBindings)
{
- context->handleError(InvalidValue() << "index is greater than or equal to the "
- "number of SHADER_STORAGE_BUFFER "
- "indexed binding points.");
+ context->validationError(GL_INVALID_VALUE,
+ "index is greater than or equal to the "
+ "number of SHADER_STORAGE_BUFFER "
+ "indexed binding points.");
return false;
}
ASSERT(caps.shaderStorageBufferOffsetAlignment);
if (buffer != 0 && (offset % caps.shaderStorageBufferOffsetAlignment) != 0)
{
- context->handleError(InvalidValue() << "offset must be multiple of value of "
- "SHADER_STORAGE_BUFFER_OFFSET_"
- "ALIGNMENT.");
+ context->validationError(GL_INVALID_VALUE,
+ "offset must be multiple of value of "
+ "SHADER_STORAGE_BUFFER_OFFSET_"
+ "ALIGNMENT.");
return false;
}
break;
}
default:
- context->handleError(InvalidEnum() << "the target is not supported.");
+ context->validationError(GL_INVALID_ENUM, "the target is not supported.");
return false;
}
@@ -1764,8 +1783,8 @@
{
if (buffer != 0 && size <= 0)
{
- context->handleError(InvalidValue()
- << "buffer is non-zero and size is less than or equal to zero.");
+ context->validationError(GL_INVALID_VALUE,
+ "buffer is non-zero and size is less than or equal to zero.");
return false;
}
return ValidateBindBufferCommon(context, target, index, buffer, offset, size);
@@ -1779,7 +1798,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1795,7 +1814,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1806,7 +1825,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1820,8 +1839,7 @@
case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
if (value != GL_FALSE && value != GL_TRUE)
{
- context->handleError(InvalidValue()
- << "Invalid value, expected GL_FALSE or GL_TRUE: " << value);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidBooleanValue);
return false;
}
break;
@@ -1829,22 +1847,19 @@
case GL_PROGRAM_SEPARABLE:
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidEnum()
- << "PROGRAM_SEPARABLE is not supported before GLES 3.1");
+ context->validationError(GL_INVALID_ENUM, kErrorES31Required);
return false;
}
if (value != GL_FALSE && value != GL_TRUE)
{
- context->handleError(InvalidValue()
- << "Invalid value, expected GL_FALSE or GL_TRUE: " << value);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidBooleanValue);
return false;
}
break;
default:
- context->handleError(InvalidEnum()
- << "Invalid pname: 0x" << std::hex << std::uppercase << pname);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
return false;
}
@@ -1865,7 +1880,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -1881,7 +1896,7 @@
if (drawbuffer < 0 ||
static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxDrawBuffer);
return false;
}
if (context->getExtensions().webglCompatibility)
@@ -1898,13 +1913,13 @@
case GL_STENCIL:
if (drawbuffer != 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidDepthStencilDrawBuffer);
return false;
}
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
@@ -1919,7 +1934,7 @@
if (drawbuffer < 0 ||
static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxDrawBuffer);
return false;
}
if (context->getExtensions().webglCompatibility)
@@ -1934,7 +1949,7 @@
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
@@ -1949,7 +1964,7 @@
if (drawbuffer < 0 ||
static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxDrawBuffer);
return false;
}
if (context->getExtensions().webglCompatibility)
@@ -1967,13 +1982,13 @@
case GL_DEPTH:
if (drawbuffer != 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidDepthStencilDrawBuffer);
return false;
}
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
@@ -1991,13 +2006,13 @@
case GL_DEPTH_STENCIL:
if (drawbuffer != 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidDepthStencilDrawBuffer);
return false;
}
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
@@ -2008,7 +2023,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2028,7 +2043,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2051,7 +2066,7 @@
const Texture *source = context->getTexture(sourceId);
if (source == nullptr)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSourceTexture);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidSourceTexture);
return false;
}
@@ -2063,7 +2078,7 @@
const Texture *dest = context->getTexture(destId);
if (dest == nullptr)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidDestinationTexture);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidDestinationTexture);
return false;
}
@@ -2076,7 +2091,7 @@
if (!ValidMipLevel(context, source->getType(), sourceLevel))
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSourceTextureLevel);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidSourceTextureLevel);
return false;
}
@@ -2084,13 +2099,13 @@
GLsizei sourceHeight = static_cast<GLsizei>(source->getHeight(sourceTarget, sourceLevel));
if (sourceWidth == 0 || sourceHeight == 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidSourceTextureSize);
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidSourceTextureSize);
return false;
}
if (dest->getImmutableFormat())
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), DestinationImmutable);
+ context->validationError(GL_INVALID_OPERATION, kErrorDestinationImmutable);
return false;
}
@@ -2119,7 +2134,7 @@
const Texture *source = context->getTexture(sourceId);
if (source == nullptr)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSourceTexture);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidSourceTexture);
return false;
}
@@ -2131,7 +2146,7 @@
const Texture *dest = context->getTexture(destId);
if (dest == nullptr)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidDestinationTexture);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidDestinationTexture);
return false;
}
@@ -2146,13 +2161,13 @@
if (x < 0 || y < 0 || z < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeXYZ);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeXYZ);
return false;
}
if (width < 0 || height < 0 || depth < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeHeightWidthDepth);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeHeightWidthDepth);
return false;
}
@@ -2160,19 +2175,19 @@
static_cast<size_t>(y + height) > source->getHeight(sourceTarget, sourceLevel) ||
static_cast<size_t>(z + depth) > source->getDepth(sourceTarget, sourceLevel))
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), SourceTextureTooSmall);
+ context->validationError(GL_INVALID_VALUE, kErrorSourceTextureTooSmall);
return false;
}
if (TextureTargetToType(destTarget) != dest->getType())
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidDestinationTextureType);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidDestinationTextureType);
return false;
}
if (xoffset < 0 || yoffset < 0 || zoffset < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeOffset);
return false;
}
@@ -2180,7 +2195,7 @@
static_cast<size_t>(yoffset + height) > dest->getHeight(destTarget, destLevel) ||
static_cast<size_t>(zoffset + depth) > dest->getDepth(destTarget, destLevel))
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), DestinationTextureTooSmall);
+ context->validationError(GL_INVALID_VALUE, kErrorDestinationTextureTooSmall);
return false;
}
@@ -2201,7 +2216,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2225,7 +2240,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2254,7 +2269,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2279,7 +2294,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2308,27 +2323,27 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
const InternalFormat &formatInfo = GetSizedInternalFormatInfo(format);
if (!formatInfo.compressed)
{
- context->handleError(InvalidEnum() << "Not a valid compressed texture format");
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidCompressedFormat);
return false;
}
GLuint blockSize = 0;
if (!formatInfo.computeCompressedImageSize(gl::Extents(width, height, depth), &blockSize))
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), IntegerOverflow);
+ context->validationError(GL_INVALID_OPERATION, kErrorIntegerOverflow);
return false;
}
if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSize)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidCompressedImageSize);
return false;
}
@@ -2341,7 +2356,7 @@
if (!data)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorPixelDataNull);
return false;
}
@@ -2408,8 +2423,8 @@
if (transformFeedback != nullptr && transformFeedback->isActive())
{
// ES 3.0.4 section 2.15.1 page 86
- context->handleError(InvalidOperation()
- << "Attempt to delete active transform feedback.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Attempt to delete active transform feedback.");
return false;
}
}
@@ -2430,7 +2445,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
switch (primitiveMode)
@@ -2441,7 +2456,7 @@
break;
default:
- context->handleError(InvalidEnum() << "Invalid primitive mode.");
+ context->validationError(GL_INVALID_ENUM, "Invalid primitive mode.");
return false;
}
@@ -2450,7 +2465,7 @@
if (transformFeedback->isActive())
{
- context->handleError(InvalidOperation() << "Transform feedback is already active.");
+ context->validationError(GL_INVALID_OPERATION, "Transform feedback is already active.");
return false;
}
@@ -2459,7 +2474,8 @@
const auto &buffer = transformFeedback->getIndexedBuffer(i);
if (buffer.get() && buffer->isMapped())
{
- context->handleError(InvalidOperation() << "Transform feedback has a mapped buffer.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Transform feedback has a mapped buffer.");
return false;
}
}
@@ -2468,13 +2484,13 @@
if (!program)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotBound);
+ context->validationError(GL_INVALID_OPERATION, kErrorProgramNotBound);
return false;
}
if (program->getTransformFeedbackVaryingCount() == 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoTransformFeedbackOutputVariables);
+ context->validationError(GL_INVALID_OPERATION, kErrorNoTransformFeedbackOutputVariables);
return false;
}
@@ -2519,7 +2535,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2534,7 +2550,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2548,7 +2564,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2566,7 +2582,7 @@
unsigned int numParams;
if (!context->getIndexedQueryParameterInfo(pname, &nativeType, &numParams))
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
return false;
}
@@ -2578,7 +2594,8 @@
case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
if (index >= caps.maxTransformFeedbackSeparateAttributes)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE,
+ kErrorIndexExceedsMaxTransformFeedbackAttribs);
return false;
}
break;
@@ -2588,7 +2605,8 @@
case GL_UNIFORM_BUFFER_BINDING:
if (index >= caps.maxUniformBufferBindings)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE,
+ kErrorIndexExceedsMaxUniformBufferBindings);
return false;
}
break;
@@ -2597,7 +2615,8 @@
case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
if (index >= 3u)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE,
+ kErrorIndexExceedsMaxWorkgroupDimensions);
return false;
}
break;
@@ -2607,16 +2626,13 @@
case GL_ATOMIC_COUNTER_BUFFER_BINDING:
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(
- InvalidEnum()
- << "Atomic Counter buffers are not supported in this version of GL");
+ context->validationError(GL_INVALID_ENUM, kErrorEnumRequiresGLES31);
return false;
}
if (index >= caps.maxAtomicCounterBufferBindings)
{
- context->handleError(
- InvalidValue()
- << "index is outside the valid range for GL_ATOMIC_COUNTER_BUFFER_BINDING");
+ context->validationError(GL_INVALID_VALUE,
+ kErrorIndexExceedsMaxAtomicCounterBufferBindings);
return false;
}
break;
@@ -2626,16 +2642,14 @@
case GL_SHADER_STORAGE_BUFFER_BINDING:
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(
- InvalidEnum()
- << "Shader storage buffers are not supported in this version of GL");
+ context->validationError(GL_INVALID_ENUM, kErrorEnumRequiresGLES31);
return false;
}
if (index >= caps.maxShaderStorageBufferBindings)
{
- context->handleError(
- InvalidValue()
- << "index is outside the valid range for GL_SHADER_STORAGE_BUFFER_BINDING");
+ context->validationError(
+ GL_INVALID_VALUE,
+ "index is outside the valid range for GL_SHADER_STORAGE_BUFFER_BINDING");
return false;
}
break;
@@ -2646,28 +2660,26 @@
case GL_VERTEX_BINDING_STRIDE:
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(
- InvalidEnum()
- << "Vertex Attrib Bindings are not supported in this version of GL");
+ context->validationError(GL_INVALID_ENUM, kErrorEnumRequiresGLES31);
return false;
}
if (index >= caps.maxVertexAttribBindings)
{
- context->handleError(
- InvalidValue()
- << "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
+ context->validationError(
+ GL_INVALID_VALUE,
+ "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false;
}
break;
case GL_SAMPLE_MASK_VALUE:
if (context->getClientVersion() < ES_3_1)
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumRequiresGLES31);
+ context->validationError(GL_INVALID_ENUM, kErrorEnumRequiresGLES31);
return false;
}
if (index >= caps.maxSampleMaskWords)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSampleMaskNumber);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidSampleMaskNumber);
return false;
}
break;
@@ -2679,17 +2691,17 @@
case GL_IMAGE_BINDING_FORMAT:
if (context->getClientVersion() < ES_3_1)
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumRequiresGLES31);
+ context->validationError(GL_INVALID_ENUM, kErrorEnumRequiresGLES31);
return false;
}
if (index >= caps.maxImageUnits)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidImageUnit);
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidImageUnit);
return false;
}
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
@@ -2705,7 +2717,7 @@
{
if (context->getClientVersion() < ES_3_0)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
return ValidateIndexedStateQuery(context, target, index, nullptr);
@@ -2720,7 +2732,7 @@
{
if (context->getClientVersion() < ES_3_0)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2750,7 +2762,7 @@
{
if (context->getClientVersion() < ES_3_0)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
return ValidateIndexedStateQuery(context, target, index, nullptr);
@@ -2765,7 +2777,7 @@
{
if (context->getClientVersion() < ES_3_0)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2800,13 +2812,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (!context->isValidBufferBinding(readTarget) || !context->isValidBufferBinding(writeTarget))
{
- context->handleError(InvalidEnum() << "Invalid buffer target");
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidBufferTypes);
return false;
}
@@ -2815,15 +2827,15 @@
if (!readBuffer || !writeBuffer)
{
- context->handleError(InvalidOperation() << "No buffer bound to target");
+ context->validationError(GL_INVALID_OPERATION, "No buffer bound to target");
return false;
}
// Verify that readBuffer and writeBuffer are not currently mapped
if (readBuffer->isMapped() || writeBuffer->isMapped())
{
- context->handleError(InvalidOperation()
- << "Cannot call CopyBufferSubData on a mapped buffer");
+ context->validationError(GL_INVALID_OPERATION,
+ "Cannot call CopyBufferSubData on a mapped buffer");
return false;
}
@@ -2831,7 +2843,7 @@
(readBuffer->isBoundForTransformFeedbackAndOtherUse() ||
writeBuffer->isBoundForTransformFeedbackAndOtherUse()))
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback);
+ context->validationError(GL_INVALID_OPERATION, kErrorBufferBoundForTransformFeedback);
return false;
}
@@ -2846,21 +2858,21 @@
!IsValueInRangeForNumericType<GLintptr>(readBuffer->getSize()) ||
!IsValueInRangeForNumericType<GLintptr>(writeBuffer->getSize()))
{
- context->handleError(InvalidValue() << "Integer overflow when validating copy offsets.");
+ context->validationError(GL_INVALID_VALUE, kErrorIntegerOverflow);
return false;
}
if (readOffset < 0 || writeOffset < 0 || size < 0)
{
- context->handleError(InvalidValue()
- << "readOffset, writeOffset and size must all be non-negative");
+ context->validationError(GL_INVALID_VALUE,
+ "readOffset, writeOffset and size must all be non-negative");
return false;
}
if (checkedReadSum.ValueOrDie() > readBuffer->getSize() ||
checkedWriteSum.ValueOrDie() > writeBuffer->getSize())
{
- context->handleError(InvalidValue() << "Buffer offset overflow in CopyBufferSubData");
+ context->validationError(GL_INVALID_VALUE, "Buffer offset overflow in CopyBufferSubData");
return false;
}
@@ -2871,14 +2883,13 @@
{
// This shold not be possible.
UNREACHABLE();
- context->handleError(InvalidValue()
- << "Integer overflow when validating same buffer copy.");
+ context->validationError(GL_INVALID_VALUE, kErrorIntegerOverflow);
return false;
}
if (checkedOffsetDiff.ValueOrDie() < size)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorCopyAlias);
return false;
}
}
@@ -2890,7 +2901,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2899,8 +2910,8 @@
case GL_EXTENSIONS:
if (index >= context->getExtensionStringCount())
{
- context->handleError(InvalidValue()
- << "index must be less than the number of extension strings.");
+ context->validationError(
+ GL_INVALID_VALUE, "index must be less than the number of extension strings.");
return false;
}
break;
@@ -2908,20 +2919,20 @@
case GL_REQUESTABLE_EXTENSIONS_ANGLE:
if (!context->getExtensions().requestExtension)
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidName);
return false;
}
if (index >= context->getRequestableExtensionStringCount())
{
- context->handleError(
- InvalidValue()
- << "index must be less than the number of requestable extension strings.");
+ context->validationError(
+ GL_INVALID_VALUE,
+ "index must be less than the number of requestable extension strings.");
return false;
}
break;
default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidName);
return false;
}
@@ -2937,7 +2948,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2956,7 +2967,7 @@
if ((samples > 0 && context->getClientVersion() == ES_3_0) ||
static_cast<GLuint>(samples) > context->getCaps().maxIntegerSamples)
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorSamplesOutOfRange);
return false;
}
}
@@ -2965,9 +2976,7 @@
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
{
- context->handleError(
- InvalidOperation()
- << "Samples must not be greater than maximum supported value for the format.");
+ context->validationError(GL_INVALID_OPERATION, kErrorSamplesOutOfRange);
return false;
}
@@ -2983,7 +2992,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -2994,7 +3003,7 @@
if (stride < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeStride);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeStride);
return false;
}
@@ -3003,8 +3012,8 @@
{
if (stride > caps.maxVertexAttribStride)
{
- context->handleError(InvalidValue()
- << "stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE.");
+ context->validationError(GL_INVALID_VALUE,
+ "stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE.");
return false;
}
@@ -3013,8 +3022,8 @@
// validation should be inherited.
if (index >= caps.maxVertexAttribBindings)
{
- context->handleError(InvalidValue()
- << "index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
+ context->validationError(GL_INVALID_VALUE,
+ "index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false;
}
}
@@ -3026,9 +3035,9 @@
if (context->getGLState().getVertexArrayId() != 0 &&
context->getGLState().getTargetBuffer(BufferBinding::Array) == 0 && pointer != nullptr)
{
- context
- ->handleError(InvalidOperation()
- << "Client data cannot be used with a non-default vertex array object.");
+ context->validationError(
+ GL_INVALID_OPERATION,
+ "Client data cannot be used with a non-default vertex array object.");
return false;
}
@@ -3052,20 +3061,20 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (bufSize < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeBufferSize);
return false;
}
Sync *syncObject = context->getSync(sync);
if (!syncObject)
{
- context->handleError(InvalidValue() << "Invalid sync object.");
+ context->validationError(GL_INVALID_VALUE, "Invalid sync object.");
return false;
}
@@ -3078,7 +3087,7 @@
break;
default:
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
return false;
}
@@ -3094,7 +3103,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3110,14 +3119,14 @@
{
if (!context->getExtensions().multiDraw)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
return false;
}
if (context->getClientMajorVersion() < 3)
{
if (!context->getExtensions().instancedArrays)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
return false;
}
if (!ValidateDrawInstancedANGLE(context))
@@ -3146,14 +3155,14 @@
{
if (!context->getExtensions().multiDraw)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
return false;
}
if (context->getClientMajorVersion() < 3)
{
if (!context->getExtensions().instancedArrays)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
return false;
}
if (!ValidateDrawInstancedANGLE(context))
@@ -3191,7 +3200,7 @@
{
if (baseViewIndex < 0)
{
- context->handleError(InvalidValue() << "baseViewIndex cannot be less than 0.");
+ context->validationError(GL_INVALID_VALUE, "baseViewIndex cannot be less than 0.");
return false;
}
@@ -3207,8 +3216,8 @@
{
if (!context->getExtensions().multiviewMultisample)
{
- context->handleError(InvalidOperation()
- << "Texture's target must be GL_TEXTURE_2D_ARRAY.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Texture's target must be GL_TEXTURE_2D_ARRAY.");
return false;
}
}
@@ -3216,17 +3225,18 @@
const Caps &caps = context->getCaps();
if (static_cast<GLuint>(baseViewIndex + numViews) > caps.maxArrayTextureLayers)
{
- context->handleError(InvalidValue() << "baseViewIndex+numViews cannot be "
- "greater than "
- "GL_MAX_ARRAY_TEXTURE_LAYERS.");
+ context->validationError(GL_INVALID_VALUE,
+ "baseViewIndex+numViews cannot be "
+ "greater than "
+ "GL_MAX_ARRAY_TEXTURE_LAYERS.");
return false;
}
break;
}
default:
- context->handleError(InvalidOperation()
- << "Texture's target must be GL_TEXTURE_2D_ARRAY.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Texture's target must be GL_TEXTURE_2D_ARRAY.");
return false;
}
@@ -3260,8 +3270,8 @@
{
if (viewportOffsets[i] < 0)
{
- context->handleError(InvalidValue()
- << "viewportOffsets cannot contain negative values.");
+ context->validationError(GL_INVALID_VALUE,
+ "viewportOffsets cannot contain negative values.");
return false;
}
}
@@ -3274,8 +3284,8 @@
case TextureType::_2D:
break;
default:
- context->handleError(InvalidOperation()
- << "Texture's target must be GL_TEXTURE_2D.");
+ context->validationError(GL_INVALID_OPERATION,
+ "Texture's target must be GL_TEXTURE_2D.");
return false;
}
@@ -3337,7 +3347,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3402,7 +3412,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3411,7 +3421,7 @@
if (!transformFeedback->isActive())
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorTransformFeedbackNotActive);
return false;
}
@@ -3426,13 +3436,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (count < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeCount);
return false;
}
@@ -3445,13 +3455,14 @@
const Caps &caps = context->getCaps();
if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE,
+ kErrorInvalidTransformFeedbackAttribsCount);
return false;
}
break;
}
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
@@ -3475,13 +3486,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (bufSize < 0)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeBufferSize);
return false;
}
@@ -3493,7 +3504,7 @@
if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorTransformFeedbackVaryingIndexOutOfRange);
return false;
}
@@ -3504,7 +3515,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3519,7 +3530,7 @@
if (curTransformFeedback && curTransformFeedback->isActive() &&
!curTransformFeedback->isPaused())
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorTransformFeedbackNotPaused);
return false;
}
@@ -3527,14 +3538,14 @@
// 2.14.1)
if (!context->isTransformFeedbackGenerated(id))
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), TransformFeedbackDoesNotExist);
+ context->validationError(GL_INVALID_OPERATION, kErrorTransformFeedbackDoesNotExist);
return false;
}
}
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
@@ -3545,7 +3556,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3556,7 +3567,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3564,9 +3575,15 @@
ASSERT(transformFeedback != nullptr);
// Current transform feedback must be active and not paused in order to pause (3.0.2 pg 86)
- if (!transformFeedback->isActive() || transformFeedback->isPaused())
+ if (!transformFeedback->isActive())
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorTransformFeedbackNotActive);
+ return false;
+ }
+
+ if (transformFeedback->isPaused())
+ {
+ context->validationError(GL_INVALID_OPERATION, kErrorTransformFeedbackPaused);
return false;
}
@@ -3577,7 +3594,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3585,9 +3602,15 @@
ASSERT(transformFeedback != nullptr);
// Current transform feedback must be active and paused in order to resume (3.0.2 pg 86)
- if (!transformFeedback->isActive() || !transformFeedback->isPaused())
+ if (!transformFeedback->isActive())
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorTransformFeedbackNotActive);
+ return false;
+ }
+
+ if (!transformFeedback->isPaused())
+ {
+ context->validationError(GL_INVALID_OPERATION, kErrorTransformFeedbackNotPaused);
return false;
}
@@ -3598,7 +3621,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3614,7 +3637,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3625,7 +3648,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3636,7 +3659,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3647,7 +3670,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3659,7 +3682,7 @@
if (!programObject->isLinked())
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
+ context->validationError(GL_INVALID_OPERATION, kErrorProgramNotLinked);
return false;
}
@@ -3674,13 +3697,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (uniformCount < 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeCount);
return false;
}
@@ -3702,13 +3725,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (uniformCount < 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorNegativeCount);
return false;
}
@@ -3726,7 +3749,7 @@
case GL_UNIFORM_NAME_LENGTH:
if (context->getExtensions().webglCompatibility)
{
- ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
break;
@@ -3738,13 +3761,13 @@
break;
default:
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false;
}
if (uniformCount > programObject->getActiveUniformCount())
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxActiveUniform);
return false;
}
@@ -3754,7 +3777,7 @@
if (index >= static_cast<GLuint>(programObject->getActiveUniformCount()))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxActiveUniform);
return false;
}
}
@@ -3766,7 +3789,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3797,7 +3820,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3809,7 +3832,7 @@
if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxActiveUniformBlock);
return false;
}
@@ -3823,13 +3846,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxUniformBufferBindings);
return false;
}
@@ -3842,7 +3865,7 @@
// if never linked, there won't be any uniform blocks
if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxUniformBufferBindings);
return false;
}
@@ -3857,7 +3880,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3868,19 +3891,19 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
{
- context->handleError(InvalidEnum());
+ context->validationError(GL_INVALID_ENUM, kErrorInvalidFenceCondition);
return false;
}
if (flags != 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidFlags);
return false;
}
@@ -3891,7 +3914,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3902,13 +3925,13 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (sync != static_cast<GLsync>(0) && !context->getSync(sync))
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorSyncMissing);
return false;
}
@@ -3919,20 +3942,20 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidFlags);
return false;
}
Sync *clientWaitSync = context->getSync(sync);
if (!clientWaitSync)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorSyncMissing);
return false;
}
@@ -3943,26 +3966,26 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (flags != 0)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidFlags);
return false;
}
if (timeout != GL_TIMEOUT_IGNORED)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidTimeout);
return false;
}
Sync *waitSync = context->getSync(sync);
if (!waitSync)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorSyncMissing);
return false;
}
@@ -3973,7 +3996,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -3991,7 +4014,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -4002,19 +4025,19 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (sampler != 0 && !context->isSampler(sampler))
{
- context->handleError(InvalidOperation());
+ context->validationError(GL_INVALID_OPERATION, kErrorInvalidSampler);
return false;
}
if (unit >= context->getCaps().maxCombinedTextureImageUnits)
{
- context->handleError(InvalidValue());
+ context->validationError(GL_INVALID_VALUE, kErrorInvalidCombinedImageUnit);
return false;
}
@@ -4025,7 +4048,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -4041,7 +4064,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -4064,7 +4087,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
@@ -4102,7 +4125,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
@@ -4115,7 +4138,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
@@ -4151,7 +4174,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
return ValidateSamplerParameterBase(context, sampler, pname, -1, true, params);
@@ -4164,7 +4187,7 @@
{
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
return ValidateSamplerParameterBase(context, sampler, pname, -1, true, params);
@@ -4199,12 +4222,12 @@
{
if (!context->getExtensions().blendFuncExtended)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
return false;
}
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
if (index < 0 || index > 1)
@@ -4212,15 +4235,15 @@
// This error is not explicitly specified but the spec does say that "<index> may be zero or
// one to specify that the color be used as either the first or second color input to the
// blend equation, respectively"
- ANGLE_VALIDATION_ERR(context, InvalidValue(), FragDataBindingIndexOutOfRange);
+ context->validationError(GL_INVALID_VALUE, kErrorFragDataBindingIndexOutOfRange);
return false;
}
if (index == 1)
{
if (colorNumber >= context->getExtensions().maxDualSourceDrawBuffers)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(),
- ColorNumberGreaterThanMaxDualSourceDrawBuffers);
+ context->validationError(GL_INVALID_VALUE,
+ kErrorColorNumberGreaterThanMaxDualSourceDrawBuffers);
return false;
}
}
@@ -4228,7 +4251,7 @@
{
if (colorNumber >= context->getCaps().maxDrawBuffers)
{
- ANGLE_VALIDATION_ERR(context, InvalidValue(), ColorNumberGreaterThanMaxDrawBuffers);
+ context->validationError(GL_INVALID_VALUE, kErrorColorNumberGreaterThanMaxDrawBuffers);
return false;
}
}
@@ -4252,12 +4275,12 @@
{
if (!context->getExtensions().blendFuncExtended)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
return false;
}
if (context->getClientMajorVersion() < 3)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
+ context->validationError(GL_INVALID_OPERATION, kErrorES3Required);
return false;
}
Program *programObject = GetValidProgram(context, program);
@@ -4267,7 +4290,7 @@
}
if (!programObject->isLinked())
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
+ context->validationError(GL_INVALID_OPERATION, kErrorProgramNotLinked);
return false;
}
return true;
@@ -4283,8 +4306,8 @@
{
if (!context->getExtensions().textureMultisample)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(),
- MultisampleTextureExtensionOrES31Required);
+ context->validationError(GL_INVALID_OPERATION,
+ kErrorMultisampleTextureExtensionOrES31Required);
return false;
}
@@ -4300,8 +4323,8 @@
{
if (!context->getExtensions().textureMultisample)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(),
- MultisampleTextureExtensionOrES31Required);
+ context->validationError(GL_INVALID_OPERATION,
+ kErrorMultisampleTextureExtensionOrES31Required);
return false;
}
@@ -4316,8 +4339,8 @@
{
if (!context->getExtensions().textureMultisample)
{
- ANGLE_VALIDATION_ERR(context, InvalidOperation(),
- MultisampleTextureExtensionOrES31Required);
+ context->validationError(GL_INVALID_OPERATION,
+ kErrorMultisampleTextureExtensionOrES31Required);
return false;
}