Use ErrorStream everywhere
Eliminates one more usage of FormatString and its static initializer.
Add more ErrorStream types
and replace gl::Error and egl::Error with them.
BUG=angleproject:1644
Change-Id: Ib498d0ae4b81a332ec71aed7cf709993b154e6bb
Reviewed-on: https://chromium-review.googlesource.com/505429
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 10bc9ae..dc3b49b 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -75,7 +75,7 @@
const GLuint pathName = array[i] + pathBase;
if (context->hasPath(pathName) && !context->hasPathData(pathName))
{
- context->handleError(gl::Error(GL_INVALID_OPERATION, "No such path object."));
+ context->handleError(InvalidOperation() << "No such path object.");
return false;
}
}
@@ -92,26 +92,25 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- gl::Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (paths == nullptr)
{
- context->handleError(gl::Error(GL_INVALID_VALUE, "No path name array."));
+ context->handleError(InvalidValue() << "No path name array.");
return false;
}
if (numPaths < 0)
{
- context->handleError(gl::Error(GL_INVALID_VALUE, "Invalid (negative) numPaths."));
+ context->handleError(InvalidValue() << "Invalid (negative) numPaths.");
return false;
}
if (!angle::IsValueInRangeForNumericType<std::uint32_t>(numPaths))
{
- context->handleError(gl::Error(GL_INVALID_OPERATION, "Overflow in numPaths."));
+ context->handleError(InvalidOperation() << "Overflow in numPaths.");
return false;
}
@@ -157,7 +156,7 @@
break;
default:
- context->handleError(gl::Error(GL_INVALID_ENUM, "Invalid path name type."));
+ context->handleError(InvalidEnum() << "Invalid path name type.");
return false;
}
@@ -185,12 +184,12 @@
componentCount = 12;
break;
default:
- context->handleError(gl::Error(GL_INVALID_ENUM, "Invalid transformation."));
+ context->handleError(InvalidEnum() << "Invalid transformation.");
return false;
}
if (componentCount != 0 && transformValues == nullptr)
{
- context->handleError(gl::Error(GL_INVALID_VALUE, "No transform array given."));
+ context->handleError(InvalidValue() << "No transform array given.");
return false;
}
@@ -199,7 +198,7 @@
checkedSize += (numPaths * sizeof(GLfloat) * componentCount);
if (!checkedSize.IsValid())
{
- context->handleError(gl::Error(GL_INVALID_OPERATION, "Overflow in num paths."));
+ context->handleError(InvalidOperation() << "Overflow in num paths.");
return false;
}
@@ -455,13 +454,13 @@
{
if (!ValidTexture2DDestinationTarget(context, target))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid texture target"));
+ context->handleError(InvalidEnum() << "Invalid texture target");
return false;
}
if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage))
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid texture dimensions."));
+ context->handleError(InvalidValue() << "Invalid texture dimensions.");
return false;
}
@@ -488,7 +487,7 @@
colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -499,7 +498,7 @@
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -512,7 +511,7 @@
colorbufferFormat != GL_RGBA32F && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -524,7 +523,7 @@
colorbufferFormat != GL_RGBA32F && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -535,7 +534,7 @@
colorbufferFormat != GL_RGBA32F && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -545,7 +544,7 @@
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_RGBA32F &&
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -559,20 +558,20 @@
case GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE:
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
case GL_DEPTH_COMPONENT:
case GL_DEPTH_STENCIL_OES:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
if (formatInfo.type == GL_FLOAT && !context->getExtensions().textureFloat)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -585,7 +584,7 @@
colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -596,7 +595,7 @@
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -607,7 +606,7 @@
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -617,7 +616,7 @@
colorbufferFormat != GL_RGB5_A1 && colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES && colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -627,7 +626,7 @@
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -637,7 +636,7 @@
colorbufferFormat != GL_BGRA8_EXT && colorbufferFormat != GL_RGBA8_OES &&
colorbufferFormat != GL_BGR5_A1_ANGLEX)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -645,48 +644,48 @@
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
if (context->getExtensions().textureCompressionDXT1)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
if (context->getExtensions().textureCompressionDXT3)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
if (context->getExtensions().textureCompressionDXT5)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_ETC1_RGB8_OES:
if (context->getExtensions().compressedETC1RGB8Texture)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -697,14 +696,14 @@
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
if (context->getExtensions().lossyETCDecode)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "ETC lossy decode formats can't be copied to."));
+ context->handleError(InvalidOperation()
+ << "ETC lossy decode formats can't be copied to.");
return false;
}
else
{
- context->handleError(Error(
- GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
+ context->handleError(InvalidEnum()
+ << "ANGLE_lossy_etc_decode extension is not supported.");
return false;
}
break;
@@ -715,16 +714,16 @@
case GL_DEPTH24_STENCIL8_OES:
if (context->getExtensions().depthTextures)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
default:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
}
@@ -826,20 +825,20 @@
{
if (!ValidTexture2DDestinationTarget(context, target))
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage))
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
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));
+ context->handleError(InvalidValue());
return false;
}
@@ -854,7 +853,7 @@
if (!isSubImage && !isCompressed && internalformat != format && !nonEqualFormatsAllowed)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -865,7 +864,7 @@
if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
}
@@ -873,20 +872,20 @@
{
if (!isSubImage && width != height)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level) ||
static_cast<GLuint>(height) > (caps.maxCubeMapTextureSize >> level))
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -894,7 +893,7 @@
context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
if (!texture)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -903,7 +902,7 @@
const InternalFormat &textureInternalFormat = *texture->getFormat(target, level).info;
if (textureInternalFormat.internalFormat == GL_NONE)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Texture level does not exist."));
+ context->handleError(InvalidOperation() << "Texture level does not exist.");
return false;
}
@@ -912,7 +911,7 @@
if (GetInternalFormatInfo(format, type).sizedInternalFormat !=
textureInternalFormat.sizedInternalFormat)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -920,7 +919,7 @@
if (static_cast<size_t>(xoffset + width) > texture->getWidth(target, level) ||
static_cast<size_t>(yoffset + height) > texture->getHeight(target, level))
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
}
@@ -928,7 +927,7 @@
{
if (texture->getImmutableFormat())
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -936,7 +935,7 @@
// Verify zero border
if (border != 0)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -951,21 +950,21 @@
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
if (!context->getExtensions().textureCompressionDXT1)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
if (!context->getExtensions().textureCompressionDXT1)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
if (!context->getExtensions().textureCompressionDXT5)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -975,14 +974,14 @@
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
if (!context->getExtensions().textureCompressionS3TCsRGB)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_ETC1_RGB8_OES:
if (!context->getExtensions().compressedETC1RGB8Texture)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -993,15 +992,15 @@
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
if (!context->getExtensions().lossyETCDecode)
{
- context->handleError(Error(
- GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported"));
+ context->handleError(InvalidEnum()
+ << "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"));
+ InvalidEnum()
+ << "internalformat is not a supported compressed internal format");
return false;
}
@@ -1011,15 +1010,14 @@
height, texture->getWidth(target, level),
texture->getHeight(target, level)))
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Invalid compressed format dimension."));
+ context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
return false;
}
if (format != actualInternalFormat)
{
- context->handleError(Error(
- GL_INVALID_OPERATION, "Format must match the internal format of the texture."));
+ context->handleError(InvalidOperation()
+ << "Format must match the internal format of the texture.");
return false;
}
}
@@ -1027,8 +1025,7 @@
{
if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height))
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Invalid compressed format dimension."));
+ context->handleError(InvalidOperation() << "Invalid compressed format dimension.");
return false;
}
}
@@ -1049,7 +1046,7 @@
case GL_FLOAT:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -1068,7 +1065,7 @@
case GL_HALF_FLOAT_OES:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1076,7 +1073,7 @@
case GL_RG:
if (!context->getExtensions().textureRG)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
switch (type)
@@ -1086,7 +1083,7 @@
case GL_HALF_FLOAT_OES:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1099,7 +1096,7 @@
case GL_HALF_FLOAT_OES:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1113,7 +1110,7 @@
case GL_HALF_FLOAT_OES:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1123,7 +1120,7 @@
case GL_UNSIGNED_BYTE:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1131,7 +1128,7 @@
case GL_SRGB_ALPHA_EXT:
if (!context->getExtensions().sRGB)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
switch (type)
@@ -1139,7 +1136,7 @@
case GL_UNSIGNED_BYTE:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1156,7 +1153,7 @@
case GL_UNSIGNED_INT:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1166,12 +1163,12 @@
case GL_UNSIGNED_INT_24_8_OES:
break;
default:
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -1181,48 +1178,48 @@
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
if (context->getExtensions().textureCompressionDXT1)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
if (context->getExtensions().textureCompressionDXT3)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
if (context->getExtensions().textureCompressionDXT5)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_ETC1_RGB8_OES:
if (context->getExtensions().compressedETC1RGB8Texture)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
else
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -1233,15 +1230,14 @@
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
if (context->getExtensions().lossyETCDecode)
{
- context->handleError(
- Error(GL_INVALID_OPERATION,
- "ETC lossy decode formats can't work with this type."));
+ context->handleError(InvalidOperation()
+ << "ETC lossy decode formats can't work with this type.");
return false;
}
else
{
- context->handleError(Error(
- GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
+ context->handleError(InvalidEnum()
+ << "ANGLE_lossy_etc_decode extension is not supported.");
return false;
}
break;
@@ -1249,19 +1245,19 @@
case GL_DEPTH_STENCIL_OES:
if (!context->getExtensions().depthTextures)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
if (target != GL_TEXTURE_2D)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
// OES_depth_texture supports loading depth data and multiple levels,
// but ANGLE_depth_texture does not
if (pixels != nullptr || level != 0)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1276,21 +1272,21 @@
case GL_RGBA32F:
if (!context->getExtensions().colorBufferFloatRGBA)
{
- context->handleError(Error(GL_INVALID_VALUE,
- "Sized GL_RGBA32F internal format requires "
- "GL_CHROMIUM_color_buffer_float_rgba"));
+ context->handleError(InvalidValue()
+ << "Sized GL_RGBA32F internal format requires "
+ "GL_CHROMIUM_color_buffer_float_rgba");
return false;
}
if (type != GL_FLOAT)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Invalid internal format/type combination"));
+ context->handleError(InvalidOperation()
+ << "Invalid internal format/type combination");
return false;
}
if (format != GL_RGBA)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Invalid internal format/format combination"));
+ context->handleError(InvalidOperation()
+ << "Invalid internal format/format combination");
return false;
}
break;
@@ -1298,21 +1294,21 @@
case GL_RGB32F:
if (!context->getExtensions().colorBufferFloatRGB)
{
- context->handleError(Error(GL_INVALID_VALUE,
- "Sized GL_RGB32F internal format requires "
- "GL_CHROMIUM_color_buffer_float_rgb"));
+ context->handleError(InvalidValue()
+ << "Sized GL_RGB32F internal format requires "
+ "GL_CHROMIUM_color_buffer_float_rgb");
return false;
}
if (type != GL_FLOAT)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Invalid internal format/type combination"));
+ context->handleError(InvalidOperation()
+ << "Invalid internal format/type combination");
return false;
}
if (format != GL_RGB)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Invalid internal format/format combination"));
+ context->handleError(InvalidOperation()
+ << "Invalid internal format/format combination");
return false;
}
break;
@@ -1326,7 +1322,7 @@
{
if (!context->getExtensions().textureFloat)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
}
@@ -1334,7 +1330,7 @@
{
if (!context->getExtensions().textureHalfFloat)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
}
@@ -1358,32 +1354,32 @@
{
if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
if (width < 1 || height < 1 || levels < 1)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
if (target == GL_TEXTURE_CUBE_MAP && width != height)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
if (levels != 1 && levels != gl::log2(std::max(width, height)) + 1)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalformat);
if (formatInfo.format == GL_NONE || formatInfo.type == GL_NONE)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -1395,7 +1391,7 @@
if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
static_cast<GLuint>(height) > caps.max2DTextureSize)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
break;
@@ -1403,12 +1399,12 @@
if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize ||
static_cast<GLuint>(height) > caps.maxCubeMapTextureSize)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -1416,7 +1412,7 @@
{
if (!gl::isPow2(width) || !gl::isPow2(height))
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -1427,28 +1423,28 @@
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
if (!context->getExtensions().textureCompressionDXT1)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
if (!context->getExtensions().textureCompressionDXT3)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
if (!context->getExtensions().textureCompressionDXT5)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
case GL_ETC1_RGB8_OES:
if (!context->getExtensions().compressedETC1RGB8Texture)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -1459,8 +1455,8 @@
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
if (!context->getExtensions().lossyETCDecode)
{
- context->handleError(
- Error(GL_INVALID_ENUM, "ANGLE_lossy_etc_decode extension is not supported."));
+ context->handleError(InvalidEnum()
+ << "ANGLE_lossy_etc_decode extension is not supported.");
return false;
}
break;
@@ -1471,7 +1467,7 @@
case GL_LUMINANCE_ALPHA32F_EXT:
if (!context->getExtensions().textureFloat)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -1482,7 +1478,7 @@
case GL_LUMINANCE_ALPHA16F_EXT:
if (!context->getExtensions().textureHalfFloat)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -1490,7 +1486,7 @@
case GL_RG8_EXT:
if (!context->getExtensions().textureRG)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -1498,7 +1494,7 @@
case GL_RG16F_EXT:
if (!context->getExtensions().textureRG || !context->getExtensions().textureHalfFloat)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -1506,7 +1502,7 @@
case GL_RG32F_EXT:
if (!context->getExtensions().textureRG || !context->getExtensions().textureFloat)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -1515,18 +1511,18 @@
case GL_DEPTH24_STENCIL8_OES:
if (!context->getExtensions().depthTextures)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
if (target != GL_TEXTURE_2D)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
// ANGLE_depth_texture only supports 1-level textures
if (levels != 1)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -1537,13 +1533,13 @@
gl::Texture *texture = context->getTargetTexture(target);
if (!texture || texture->id() == 0)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
if (texture->getImmutableFormat())
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -1557,7 +1553,7 @@
{
if (!context->getExtensions().discardFramebuffer)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1570,7 +1566,7 @@
(context->getGLState().getTargetFramebuffer(GL_FRAMEBUFFER)->id() == 0);
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid framebuffer target"));
+ context->handleError(InvalidEnum() << "Invalid framebuffer target");
return false;
}
@@ -1582,7 +1578,7 @@
{
if (!context->getExtensions().vertexArrayObject)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1593,7 +1589,7 @@
{
if (!context->getExtensions().vertexArrayObject)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1604,7 +1600,7 @@
{
if (!context->getExtensions().vertexArrayObject)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1615,7 +1611,7 @@
{
if (!context->getExtensions().vertexArrayObject)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1630,7 +1626,7 @@
{
if (!context->getExtensions().getProgramBinary)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1646,7 +1642,7 @@
{
if (!context->getExtensions().getProgramBinary)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1718,25 +1714,25 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
if (!ValidDebugSource(source, false) && source != GL_DONT_CARE)
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid debug source."));
+ context->handleError(InvalidEnum() << "Invalid debug source.");
return false;
}
if (!ValidDebugType(type) && type != GL_DONT_CARE)
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid debug type."));
+ context->handleError(InvalidEnum() << "Invalid debug type.");
return false;
}
if (!ValidDebugSeverity(severity) && severity != GL_DONT_CARE)
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid debug severity."));
+ context->handleError(InvalidEnum() << "Invalid debug severity.");
return false;
}
@@ -1744,17 +1740,17 @@
{
if (source == GL_DONT_CARE || type == GL_DONT_CARE)
{
- context->handleError(Error(
- GL_INVALID_OPERATION,
- "If count is greater than zero, source and severity cannot be GL_DONT_CARE."));
+ context->handleError(
+ InvalidOperation()
+ << "If count is greater than zero, source and severity cannot be GL_DONT_CARE.");
return false;
}
if (severity != GL_DONT_CARE)
{
context->handleError(
- Error(GL_INVALID_OPERATION,
- "If count is greater than zero, severity must be GL_DONT_CARE."));
+ InvalidOperation()
+ << "If count is greater than zero, severity must be GL_DONT_CARE.");
return false;
}
}
@@ -1772,7 +1768,7 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1785,27 +1781,27 @@
if (!ValidDebugSeverity(severity))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid debug severity."));
+ context->handleError(InvalidEnum() << "Invalid debug severity.");
return false;
}
if (!ValidDebugType(type))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid debug type."));
+ context->handleError(InvalidEnum() << "Invalid debug type.");
return false;
}
if (!ValidDebugSource(source, true))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid debug source."));
+ context->handleError(InvalidEnum() << "Invalid debug source.");
return false;
}
size_t messageLength = (length < 0) ? strlen(buf) : length;
if (messageLength > context->getExtensions().maxDebugMessageLength)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH."));
+ context->handleError(InvalidValue()
+ << "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.");
return false;
}
@@ -1818,7 +1814,7 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -1837,14 +1833,14 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
if (bufSize < 0 && messageLog != nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "bufSize must be positive if messageLog is not null."));
+ context->handleError(InvalidValue()
+ << "bufSize must be positive if messageLog is not null.");
return false;
}
@@ -1859,30 +1855,30 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
if (!ValidDebugSource(source, true))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid debug source."));
+ context->handleError(InvalidEnum() << "Invalid debug source.");
return false;
}
size_t messageLength = (length < 0) ? strlen(message) : length;
if (messageLength > context->getExtensions().maxDebugMessageLength)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH."));
+ context->handleError(InvalidValue()
+ << "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.");
return false;
}
size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth();
if (currentStackSize >= context->getExtensions().maxDebugGroupStackDepth)
{
- context->handleError(
- Error(GL_STACK_OVERFLOW,
- "Cannot push more than GL_MAX_DEBUG_GROUP_STACK_DEPTH debug groups."));
+ context
+ ->handleError(StackOverflow()
+ << "Cannot push more than GL_MAX_DEBUG_GROUP_STACK_DEPTH debug groups.");
return false;
}
@@ -1893,14 +1889,14 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth();
if (currentStackSize <= 1)
{
- context->handleError(Error(GL_STACK_UNDERFLOW, "Cannot pop the default debug group."));
+ context->handleError(StackUnderflow() << "Cannot pop the default debug group.");
return false;
}
@@ -1914,7 +1910,7 @@
case GL_BUFFER:
if (context->getBuffer(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid buffer."));
+ context->handleError(InvalidValue() << "name is not a valid buffer.");
return false;
}
return true;
@@ -1922,7 +1918,7 @@
case GL_SHADER:
if (context->getShader(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid shader."));
+ context->handleError(InvalidValue() << "name is not a valid shader.");
return false;
}
return true;
@@ -1930,7 +1926,7 @@
case GL_PROGRAM:
if (context->getProgram(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid program."));
+ context->handleError(InvalidValue() << "name is not a valid program.");
return false;
}
return true;
@@ -1938,7 +1934,7 @@
case GL_VERTEX_ARRAY:
if (context->getVertexArray(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid vertex array."));
+ context->handleError(InvalidValue() << "name is not a valid vertex array.");
return false;
}
return true;
@@ -1946,7 +1942,7 @@
case GL_QUERY:
if (context->getQuery(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid query."));
+ context->handleError(InvalidValue() << "name is not a valid query.");
return false;
}
return true;
@@ -1954,8 +1950,7 @@
case GL_TRANSFORM_FEEDBACK:
if (context->getTransformFeedback(name) == nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "name is not a valid transform feedback."));
+ context->handleError(InvalidValue() << "name is not a valid transform feedback.");
return false;
}
return true;
@@ -1963,7 +1958,7 @@
case GL_SAMPLER:
if (context->getSampler(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid sampler."));
+ context->handleError(InvalidValue() << "name is not a valid sampler.");
return false;
}
return true;
@@ -1971,7 +1966,7 @@
case GL_TEXTURE:
if (context->getTexture(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid texture."));
+ context->handleError(InvalidValue() << "name is not a valid texture.");
return false;
}
return true;
@@ -1979,7 +1974,7 @@
case GL_RENDERBUFFER:
if (context->getRenderbuffer(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid renderbuffer."));
+ context->handleError(InvalidValue() << "name is not a valid renderbuffer.");
return false;
}
return true;
@@ -1987,13 +1982,13 @@
case GL_FRAMEBUFFER:
if (context->getFramebuffer(name) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid framebuffer."));
+ context->handleError(InvalidValue() << "name is not a valid framebuffer.");
return false;
}
return true;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid identifier."));
+ context->handleError(InvalidEnum() << "Invalid identifier.");
return false;
}
}
@@ -2016,8 +2011,7 @@
if (labelLength > context->getExtensions().maxLabelLength)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Label length is larger than GL_MAX_LABEL_LENGTH."));
+ context->handleError(InvalidValue() << "Label length is larger than GL_MAX_LABEL_LENGTH.");
return false;
}
@@ -2032,7 +2026,7 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -2058,13 +2052,13 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
if (bufSize < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "bufSize cannot be negative."));
+ context->handleError(InvalidValue() << "bufSize cannot be negative.");
return false;
}
@@ -2080,7 +2074,7 @@
{
if (context->getFenceSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr))) == nullptr)
{
- context->handleError(Error(GL_INVALID_VALUE, "name is not a valid sync."));
+ context->handleError(InvalidValue() << "name is not a valid sync.");
return false;
}
@@ -2094,7 +2088,7 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -2119,13 +2113,13 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
if (bufSize < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "bufSize cannot be negative."));
+ context->handleError(InvalidValue() << "bufSize cannot be negative.");
return false;
}
@@ -2141,7 +2135,7 @@
{
if (!context->getExtensions().debug)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
+ context->handleError(InvalidOperation() << "Extension not enabled");
return false;
}
@@ -2153,7 +2147,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid pname."));
+ context->handleError(InvalidEnum() << "Invalid pname.");
return false;
}
@@ -2174,22 +2168,22 @@
{
if (!context->getExtensions().framebufferBlit)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Blit extension not available."));
+ context->handleError(InvalidOperation() << "Blit extension not available.");
return false;
}
if (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
{
// TODO(jmadill): Determine if this should be available on other implementations.
- context->handleError(Error(
- GL_INVALID_OPERATION,
- "Scaling and flipping in BlitFramebufferANGLE not supported by this implementation."));
+ context->handleError(InvalidOperation() << "Scaling and flipping in "
+ "BlitFramebufferANGLE not supported by this "
+ "implementation.");
return false;
}
if (filter == GL_LINEAR)
{
- context->handleError(Error(GL_INVALID_ENUM, "Linear blit not supported in this extension"));
+ context->handleError(InvalidEnum() << "Linear blit not supported in this extension");
return false;
}
@@ -2208,7 +2202,7 @@
readColorAttachment->type() != GL_RENDERBUFFER &&
readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -2224,7 +2218,7 @@
attachment->type() != GL_RENDERBUFFER &&
attachment->type() != GL_FRAMEBUFFER_DEFAULT)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -2232,7 +2226,7 @@
if (!Format::SameSized(attachment->getFormat(),
readColorAttachment->getFormat()))
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -2242,7 +2236,7 @@
IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0,
srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -2265,15 +2259,15 @@
dstX0, dstY0, dstX1, dstY1))
{
// only whole-buffer copies are permitted
- context->handleError(Error(GL_INVALID_OPERATION,
- "Only whole-buffer depth and stencil blits are "
- "supported by this extension."));
+ context->handleError(InvalidOperation() << "Only whole-buffer depth and "
+ "stencil blits are supported by "
+ "this extension.");
return false;
}
if (readBuffer->getSamples() != 0 || drawBuffer->getSamples() != 0)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -2289,13 +2283,13 @@
auto fbo = context->getGLState().getDrawFramebuffer();
if (fbo->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE)
{
- context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+ context->handleError(InvalidFramebufferOperation());
return false;
}
if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -2322,7 +2316,7 @@
{
if (!context->getExtensions().drawBuffers)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension not supported."));
+ context->handleError(InvalidOperation() << "Extension not supported.");
return false;
}
@@ -2476,7 +2470,7 @@
if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -2564,7 +2558,7 @@
if (imageSize < 0 || static_cast<GLuint>(imageSize) != blockSizeOrErr.getResult())
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -2580,13 +2574,13 @@
{
if (!context->getExtensions().mapBuffer)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
+ context->handleError(InvalidOperation() << "Map buffer extension not available.");
return false;
}
if (!ValidBufferTarget(context, target))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid buffer target."));
+ context->handleError(InvalidEnum() << "Invalid buffer target.");
return false;
}
@@ -2594,19 +2588,19 @@
if (buffer == nullptr)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Attempted to map buffer object zero."));
+ context->handleError(InvalidOperation() << "Attempted to map buffer object zero.");
return false;
}
if (access != GL_WRITE_ONLY_OES)
{
- context->handleError(Error(GL_INVALID_ENUM, "Non-write buffer mapping not supported."));
+ context->handleError(InvalidEnum() << "Non-write buffer mapping not supported.");
return false;
}
if (buffer->isMapped())
{
- context->handleError(Error(GL_INVALID_OPERATION, "Buffer is already mapped."));
+ context->handleError(InvalidOperation() << "Buffer is already mapped.");
return false;
}
@@ -2617,7 +2611,7 @@
{
if (!context->getExtensions().mapBuffer)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Map buffer extension not available."));
+ context->handleError(InvalidOperation() << "Map buffer extension not available.");
return false;
}
@@ -2632,8 +2626,7 @@
{
if (!context->getExtensions().mapBufferRange)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Map buffer range extension not available."));
+ context->handleError(InvalidOperation() << "Map buffer range extension not available.");
return false;
}
@@ -2647,8 +2640,7 @@
{
if (!context->getExtensions().mapBufferRange)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Map buffer range extension not available."));
+ context->handleError(InvalidOperation() << "Map buffer range extension not available.");
return false;
}
@@ -2660,14 +2652,14 @@
Texture *textureObject = context->getTexture(texture);
if (textureObject && textureObject->getTarget() != target && texture != 0)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Invalid texture"));
+ context->handleError(InvalidOperation() << "Invalid texture");
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isTextureGenerated(texture))
{
- context->handleError(Error(GL_INVALID_OPERATION, "Texture was not generated"));
+ context->handleError(InvalidOperation() << "Texture was not generated");
return false;
}
@@ -2681,7 +2673,7 @@
case GL_TEXTURE_2D_ARRAY:
if (context->getClientMajorVersion() < 3)
{
- context->handleError(Error(GL_INVALID_ENUM, "GLES 3.0 disabled"));
+ context->handleError(InvalidEnum() << "GLES 3.0 disabled");
return false;
}
break;
@@ -2689,7 +2681,7 @@
case GL_TEXTURE_2D_MULTISAMPLE:
if (context->getClientVersion() < Version(3, 1))
{
- context->handleError(Error(GL_INVALID_ENUM, "Context does not support GLES3.1"));
+ context->handleError(InvalidEnum() << "Context does not support GLES3.1");
return false;
}
break;
@@ -2698,13 +2690,12 @@
if (!context->getExtensions().eglImageExternal &&
!context->getExtensions().eglStreamConsumerExternal)
{
- context->handleError(
- Error(GL_INVALID_ENUM, "External texture extension not enabled"));
+ context->handleError(InvalidEnum() << "External texture extension not enabled");
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid target"));
+ context->handleError(InvalidEnum() << "Invalid target");
return false;
}
@@ -2718,8 +2709,8 @@
{
if (!context->getExtensions().bindUniformLocation)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_bind_uniform_location is not available."));
+ context->handleError(InvalidOperation()
+ << "GL_CHROMIUM_bind_uniform_location is not available.");
return false;
}
@@ -2731,7 +2722,7 @@
if (location < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Location cannot be less than 0."));
+ context->handleError(InvalidValue() << "Location cannot be less than 0.");
return false;
}
@@ -2739,9 +2730,9 @@
if (static_cast<size_t>(location) >=
(caps.maxVertexUniformVectors + caps.maxFragmentUniformVectors) * 4)
{
- context->handleError(Error(GL_INVALID_VALUE,
- "Location must be less than (MAX_VERTEX_UNIFORM_VECTORS + "
- "MAX_FRAGMENT_UNIFORM_VECTORS) * 4"));
+ context->handleError(InvalidValue() << "Location must be less than "
+ "(MAX_VERTEX_UNIFORM_VECTORS + "
+ "MAX_FRAGMENT_UNIFORM_VECTORS) * 4");
return false;
}
@@ -2749,14 +2740,14 @@
// shader-related entry points
if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name)))
{
- context->handleError(Error(GL_INVALID_VALUE, "Uniform name contains invalid characters"));
+ context->handleError(InvalidValue() << "Uniform name contains invalid characters");
return false;
}
if (strncmp(name, "gl_", 3) == 0)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Name cannot start with the reserved \"gl_\" prefix."));
+ context->handleError(InvalidOperation()
+ << "Name cannot start with the reserved \"gl_\" prefix.");
return false;
}
@@ -2767,8 +2758,8 @@
{
if (!context->getExtensions().framebufferMixedSamples)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_framebuffer_mixed_samples is not available."));
+ context->handleError(InvalidOperation()
+ << "GL_CHROMIUM_framebuffer_mixed_samples is not available.");
return false;
}
switch (components)
@@ -2780,8 +2771,8 @@
break;
default:
context->handleError(
- Error(GL_INVALID_ENUM,
- "GLenum components is not one of GL_RGB, GL_RGBA, GL_ALPHA or GL_NONE."));
+ InvalidEnum()
+ << "GLenum components is not one of GL_RGB, GL_RGBA, GL_ALPHA or GL_NONE.");
return false;
}
@@ -2794,18 +2785,17 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (matrixMode != GL_PATH_MODELVIEW_CHROMIUM && matrixMode != GL_PATH_PROJECTION_CHROMIUM)
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid matrix mode."));
+ context->handleError(InvalidEnum() << "Invalid matrix mode.");
return false;
}
if (matrix == nullptr)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Invalid matrix."));
+ context->handleError(InvalidOperation() << "Invalid matrix.");
return false;
}
return true;
@@ -2815,13 +2805,12 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (matrixMode != GL_PATH_MODELVIEW_CHROMIUM && matrixMode != GL_PATH_PROJECTION_CHROMIUM)
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid matrix mode."));
+ context->handleError(InvalidEnum() << "Invalid matrix mode.");
return false;
}
return true;
@@ -2831,8 +2820,7 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
@@ -2840,13 +2828,13 @@
// we add stricter semantic check here and require a non zero positive range.
if (range <= 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid range."));
+ context->handleError(InvalidValue() << "Invalid range.");
return false;
}
if (!angle::IsValueInRangeForNumericType<std::uint32_t>(range))
{
- context->handleError(Error(GL_INVALID_OPERATION, "Range overflow."));
+ context->handleError(InvalidOperation() << "Range overflow.");
return false;
}
@@ -2857,8 +2845,7 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
@@ -2866,7 +2853,7 @@
// we add stricter semantic check here and require a non zero positive range.
if (range <= 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid range."));
+ context->handleError(InvalidValue() << "Invalid range.");
return false;
}
@@ -2875,7 +2862,7 @@
if (!angle::IsValueInRangeForNumericType<std::uint32_t>(range) || !checkedRange.IsValid())
{
- context->handleError(Error(GL_INVALID_OPERATION, "Range overflow."));
+ context->handleError(InvalidOperation() << "Range overflow.");
return false;
}
return true;
@@ -2891,40 +2878,39 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (!context->hasPath(path))
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such path object."));
+ context->handleError(InvalidOperation() << "No such path object.");
return false;
}
if (numCommands < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid number of commands."));
+ context->handleError(InvalidValue() << "Invalid number of commands.");
return false;
}
else if (numCommands > 0)
{
if (!commands)
{
- context->handleError(Error(GL_INVALID_VALUE, "No commands array given."));
+ context->handleError(InvalidValue() << "No commands array given.");
return false;
}
}
if (numCoords < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid number of coordinates."));
+ context->handleError(InvalidValue() << "Invalid number of coordinates.");
return false;
}
else if (numCoords > 0)
{
if (!coords)
{
- context->handleError(Error(GL_INVALID_VALUE, "No coordinate array given."));
+ context->handleError(InvalidValue() << "No coordinate array given.");
return false;
}
}
@@ -2953,7 +2939,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid coordinate type."));
+ context->handleError(InvalidEnum() << "Invalid coordinate type.");
return false;
}
@@ -2961,7 +2947,7 @@
checkedSize += (coordTypeSize * numCoords);
if (!checkedSize.IsValid())
{
- context->handleError(Error(GL_INVALID_OPERATION, "Coord size overflow."));
+ context->handleError(InvalidOperation() << "Coord size overflow.");
return false;
}
@@ -2990,13 +2976,13 @@
expectedNumCoords += 5;
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid command."));
+ context->handleError(InvalidEnum() << "Invalid command.");
return false;
}
}
if (expectedNumCoords != numCoords)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid number of coordinates."));
+ context->handleError(InvalidValue() << "Invalid number of coordinates.");
return false;
}
@@ -3007,13 +2993,12 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (!context->hasPath(path))
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such path object."));
+ context->handleError(InvalidOperation() << "No such path object.");
return false;
}
@@ -3022,7 +3007,7 @@
case GL_PATH_STROKE_WIDTH_CHROMIUM:
if (value < 0.0f)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid stroke width."));
+ context->handleError(InvalidValue() << "Invalid stroke width.");
return false;
}
break;
@@ -3034,7 +3019,7 @@
case GL_ROUND_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid end caps."));
+ context->handleError(InvalidEnum() << "Invalid end caps.");
return false;
}
break;
@@ -3046,13 +3031,13 @@
case GL_ROUND_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid join style."));
+ context->handleError(InvalidEnum() << "Invalid join style.");
return false;
}
case GL_PATH_MITER_LIMIT_CHROMIUM:
if (value < 0.0f)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid miter limit."));
+ context->handleError(InvalidValue() << "Invalid miter limit.");
return false;
}
break;
@@ -3062,7 +3047,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid path parameter."));
+ context->handleError(InvalidEnum() << "Invalid path parameter.");
return false;
}
return true;
@@ -3072,19 +3057,18 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (!context->hasPath(path))
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such path object."));
+ context->handleError(InvalidOperation() << "No such path object.");
return false;
}
if (!value)
{
- context->handleError(Error(GL_INVALID_VALUE, "No value array."));
+ context->handleError(InvalidValue() << "No value array.");
return false;
}
@@ -3098,7 +3082,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid path parameter."));
+ context->handleError(InvalidEnum() << "Invalid path parameter.");
return false;
}
@@ -3109,8 +3093,7 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
@@ -3126,7 +3109,7 @@
case GL_NOTEQUAL:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil function."));
+ context->handleError(InvalidEnum() << "Invalid stencil function.");
return false;
}
@@ -3143,13 +3126,12 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (context->hasPath(path) && !context->hasPathData(path))
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such path object."));
+ context->handleError(InvalidOperation() << "No such path object.");
return false;
}
@@ -3159,13 +3141,13 @@
case GL_COUNT_DOWN_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid fill mode."));
+ context->handleError(InvalidEnum() << "Invalid fill mode.");
return false;
}
if (!isPow2(mask + 1))
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid stencil bit mask."));
+ context->handleError(InvalidValue() << "Invalid stencil bit mask.");
return false;
}
@@ -3176,13 +3158,12 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (context->hasPath(path) && !context->hasPathData(path))
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such path or path has no data."));
+ context->handleError(InvalidOperation() << "No such path or path has no data.");
return false;
}
@@ -3193,13 +3174,12 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
if (context->hasPath(path) && !context->hasPathData(path))
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such path object."));
+ context->handleError(InvalidOperation() << "No such path object.");
return false;
}
@@ -3209,7 +3189,7 @@
case GL_BOUNDING_BOX_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
+ context->handleError(InvalidEnum() << "Invalid cover mode.");
return false;
}
return true;
@@ -3239,8 +3219,7 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
return true;
@@ -3266,7 +3245,7 @@
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
+ context->handleError(InvalidEnum() << "Invalid cover mode.");
return false;
}
@@ -3293,7 +3272,7 @@
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
+ context->handleError(InvalidEnum() << "Invalid cover mode.");
return false;
}
@@ -3321,12 +3300,12 @@
case GL_COUNT_DOWN_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid fill mode."));
+ context->handleError(InvalidEnum() << "Invalid fill mode.");
return false;
}
if (!isPow2(mask + 1))
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid stencil bit mask."));
+ context->handleError(InvalidValue() << "Invalid stencil bit mask.");
return false;
}
return true;
@@ -3373,7 +3352,7 @@
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
+ context->handleError(InvalidEnum() << "Invalid cover mode.");
return false;
}
@@ -3383,12 +3362,12 @@
case GL_COUNT_DOWN_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid fill mode."));
+ context->handleError(InvalidEnum() << "Invalid fill mode.");
return false;
}
if (!isPow2(mask + 1))
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid stencil bit mask."));
+ context->handleError(InvalidValue() << "Invalid stencil bit mask.");
return false;
}
@@ -3417,7 +3396,7 @@
case GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cover mode."));
+ context->handleError(InvalidEnum() << "Invalid cover mode.");
return false;
}
@@ -3431,34 +3410,33 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
const GLint MaxLocation = context->getCaps().maxVaryingVectors * 4;
if (location >= MaxLocation)
{
- context->handleError(Error(GL_INVALID_VALUE, "Location exceeds max varying."));
+ context->handleError(InvalidValue() << "Location exceeds max varying.");
return false;
}
const auto *programObject = context->getProgram(program);
if (!programObject)
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such program."));
+ context->handleError(InvalidOperation() << "No such program.");
return false;
}
if (!name)
{
- context->handleError(Error(GL_INVALID_VALUE, "No name given."));
+ context->handleError(InvalidValue() << "No name given.");
return false;
}
if (angle::BeginsWith(name, "gl_"))
{
- context->handleError(Error(GL_INVALID_OPERATION, "Cannot bind a built-in variable."));
+ context->handleError(InvalidOperation() << "Cannot bind a built-in variable.");
return false;
}
@@ -3474,21 +3452,20 @@
{
if (!context->getExtensions().pathRendering)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_path_rendering is not available."));
+ context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available.");
return false;
}
const auto *programObject = context->getProgram(program);
if (!programObject || programObject->isFlaggedForDeletion())
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such program."));
+ context->handleError(InvalidOperation() << "No such program.");
return false;
}
if (!programObject->isLinked())
{
- context->handleError(Error(GL_INVALID_OPERATION, "Program is not linked."));
+ context->handleError(InvalidOperation() << "Program is not linked.");
return false;
}
@@ -3497,7 +3474,7 @@
case GL_NONE:
if (components != 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid components."));
+ context->handleError(InvalidValue() << "Invalid components.");
return false;
}
break;
@@ -3507,18 +3484,18 @@
case GL_CONSTANT_CHROMIUM:
if (components < 1 || components > 4)
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid components."));
+ context->handleError(InvalidValue() << "Invalid components.");
return false;
}
if (!coeffs)
{
- context->handleError(Error(GL_INVALID_VALUE, "No coefficients array given."));
+ context->handleError(InvalidValue() << "No coefficients array given.");
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid gen mode."));
+ context->handleError(InvalidEnum() << "Invalid gen mode.");
return false;
}
@@ -3531,7 +3508,7 @@
if (!binding.valid)
{
- context->handleError(Error(GL_INVALID_OPERATION, "No such binding."));
+ context->handleError(InvalidOperation() << "No such binding.");
return false;
}
@@ -3554,13 +3531,13 @@
break;
default:
context->handleError(
- Error(GL_INVALID_OPERATION,
- "Fragment input type is not a floating point scalar or vector."));
+ InvalidOperation()
+ << "Fragment input type is not a floating point scalar or vector.");
return false;
}
if (expectedComponents != components && genMode != GL_NONE)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Unexpected number of components"));
+ context->handleError(InvalidOperation() << "Unexpected number of components");
return false;
}
}
@@ -3581,22 +3558,21 @@
{
if (!context->getExtensions().copyTexture)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_copy_texture extension not available."));
+ context->handleError(InvalidOperation()
+ << "GL_CHROMIUM_copy_texture extension not available.");
return false;
}
const Texture *source = context->getTexture(sourceId);
if (source == nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Source texture is not a valid texture object."));
+ context->handleError(InvalidValue() << "Source texture is not a valid texture object.");
return false;
}
if (!IsValidCopyTextureSourceTarget(context, source->getTarget()))
{
- context->handleError(Error(GL_INVALID_VALUE, "Source texture a valid texture type."));
+ context->handleError(InvalidValue() << "Source texture a valid texture type.");
return false;
}
@@ -3605,7 +3581,7 @@
if (!IsValidCopyTextureSourceLevel(context, source->getTarget(), sourceLevel))
{
- context->handleError(Error(GL_INVALID_VALUE, "Source texture level is not valid."));
+ context->handleError(InvalidValue() << "Source texture level is not valid.");
return false;
}
@@ -3613,58 +3589,56 @@
GLsizei sourceHeight = static_cast<GLsizei>(source->getHeight(sourceTarget, sourceLevel));
if (sourceWidth == 0 || sourceHeight == 0)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "The source level of the source texture must be defined."));
+ context->handleError(InvalidValue()
+ << "The source level of the source texture must be defined.");
return false;
}
const InternalFormat &sourceFormat = *source->getFormat(sourceTarget, sourceLevel).info;
if (!IsValidCopyTextureSourceInternalFormatEnum(sourceFormat.internalFormat))
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Source texture internal format is invalid."));
+ context->handleError(InvalidOperation() << "Source texture internal format is invalid.");
return false;
}
const Texture *dest = context->getTexture(destId);
if (dest == nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Destination texture is not a valid texture object."));
+ context->handleError(InvalidValue()
+ << "Destination texture is not a valid texture object.");
return false;
}
if (!IsValidCopyTextureDestinationTarget(context, dest->getTarget(), destTarget))
{
- context->handleError(Error(GL_INVALID_VALUE, "Destination texture a valid texture type."));
+ context->handleError(InvalidValue() << "Destination texture a valid texture type.");
return false;
}
if (!IsValidCopyTextureDestinationLevel(context, destTarget, destLevel, sourceWidth,
sourceHeight))
{
- context->handleError(Error(GL_INVALID_VALUE, "Destination texture level is not valid."));
+ context->handleError(InvalidValue() << "Destination texture level is not valid.");
return false;
}
if (!IsValidCopyTextureDestinationFormatType(context, internalFormat, destType))
{
- context->handleError(
- Error(GL_INVALID_OPERATION,
- "Destination internal format and type combination is not valid."));
+ context->handleError(InvalidOperation()
+ << "Destination internal format and type combination is not valid.");
return false;
}
if (IsCubeMapTextureTarget(destTarget) && sourceWidth != sourceHeight)
{
- context->handleError(Error(
- GL_INVALID_VALUE, "Destination width and height must be equal for cube map textures."));
+ context->handleError(
+ InvalidValue() << "Destination width and height must be equal for cube map textures.");
return false;
}
if (dest->getImmutableFormat())
{
- context->handleError(Error(GL_INVALID_OPERATION, "Destination texture is immutable."));
+ context->handleError(InvalidOperation() << "Destination texture is immutable.");
return false;
}
@@ -3689,22 +3663,21 @@
{
if (!context->getExtensions().copyTexture)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_CHROMIUM_copy_texture extension not available."));
+ context->handleError(InvalidOperation()
+ << "GL_CHROMIUM_copy_texture extension not available.");
return false;
}
const Texture *source = context->getTexture(sourceId);
if (source == nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Source texture is not a valid texture object."));
+ context->handleError(InvalidValue() << "Source texture is not a valid texture object.");
return false;
}
if (!IsValidCopyTextureSourceTarget(context, source->getTarget()))
{
- context->handleError(Error(GL_INVALID_VALUE, "Source texture a valid texture type."));
+ context->handleError(InvalidValue() << "Source texture a valid texture type.");
return false;
}
@@ -3713,93 +3686,89 @@
if (!IsValidCopyTextureSourceLevel(context, source->getTarget(), sourceLevel))
{
- context->handleError(Error(GL_INVALID_VALUE, "Source texture level is not valid."));
+ context->handleError(InvalidValue() << "Source texture level is not valid.");
return false;
}
if (source->getWidth(sourceTarget, sourceLevel) == 0 ||
source->getHeight(sourceTarget, sourceLevel) == 0)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "The source level of the source texture must be defined."));
+ context->handleError(InvalidValue()
+ << "The source level of the source texture must be defined.");
return false;
}
if (x < 0 || y < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "x and y cannot be negative."));
+ context->handleError(InvalidValue() << "x and y cannot be negative.");
return false;
}
if (width < 0 || height < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "width and height cannot be negative."));
+ context->handleError(InvalidValue() << "width and height cannot be negative.");
return false;
}
if (static_cast<size_t>(x + width) > source->getWidth(sourceTarget, sourceLevel) ||
static_cast<size_t>(y + height) > source->getHeight(sourceTarget, sourceLevel))
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Source texture not large enough to copy from."));
+ context->handleError(InvalidValue() << "Source texture not large enough to copy from.");
return false;
}
const Format &sourceFormat = source->getFormat(sourceTarget, sourceLevel);
if (!IsValidCopySubTextureSourceInternalFormat(sourceFormat.info->internalFormat))
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Source texture internal format is invalid."));
+ context->handleError(InvalidOperation() << "Source texture internal format is invalid.");
return false;
}
const Texture *dest = context->getTexture(destId);
if (dest == nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Destination texture is not a valid texture object."));
+ context->handleError(InvalidValue()
+ << "Destination texture is not a valid texture object.");
return false;
}
if (!IsValidCopyTextureDestinationTarget(context, dest->getTarget(), destTarget))
{
- context->handleError(Error(GL_INVALID_VALUE, "Destination texture a valid texture type."));
+ context->handleError(InvalidValue() << "Destination texture a valid texture type.");
return false;
}
if (!IsValidCopyTextureDestinationLevel(context, destTarget, destLevel, width, height))
{
- context->handleError(Error(GL_INVALID_VALUE, "Destination texture level is not valid."));
+ context->handleError(InvalidValue() << "Destination texture level is not valid.");
return false;
}
if (dest->getWidth(destTarget, destLevel) == 0 || dest->getHeight(destTarget, destLevel) == 0)
{
- context->handleError(Error(
- GL_INVALID_VALUE, "The destination level of the destination texture must be defined."));
+ context->handleError(
+ InvalidValue() << "The destination level of the destination texture must be defined.");
return false;
}
const InternalFormat &destFormat = *dest->getFormat(destTarget, destLevel).info;
if (!IsValidCopySubTextureDestionationInternalFormat(destFormat.internalFormat))
{
- context->handleError(
- Error(GL_INVALID_OPERATION,
- "Destination internal format and type combination is not valid."));
+ context->handleError(InvalidOperation()
+ << "Destination internal format and type combination is not valid.");
return false;
}
if (xoffset < 0 || yoffset < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "xoffset and yoffset cannot be negative."));
+ context->handleError(InvalidValue() << "xoffset and yoffset cannot be negative.");
return false;
}
if (static_cast<size_t>(xoffset + width) > dest->getWidth(destTarget, destLevel) ||
static_cast<size_t>(yoffset + height) > dest->getHeight(destTarget, destLevel))
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Destination texture not large enough to copy to."));
+ context->handleError(InvalidValue() << "Destination texture not large enough to copy to.");
return false;
}
@@ -3810,58 +3779,56 @@
{
if (!context->getExtensions().copyCompressedTexture)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "GL_CHROMIUM_copy_compressed_texture extension not available."));
+ context->handleError(InvalidOperation()
+ << "GL_CHROMIUM_copy_compressed_texture extension not available.");
return false;
}
const gl::Texture *source = context->getTexture(sourceId);
if (source == nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Source texture is not a valid texture object."));
+ context->handleError(InvalidValue() << "Source texture is not a valid texture object.");
return false;
}
if (source->getTarget() != GL_TEXTURE_2D)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Source texture must be of type GL_TEXTURE_2D."));
+ context->handleError(InvalidValue() << "Source texture must be of type GL_TEXTURE_2D.");
return false;
}
if (source->getWidth(GL_TEXTURE_2D, 0) == 0 || source->getHeight(GL_TEXTURE_2D, 0) == 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Source texture must level 0 defined."));
+ context->handleError(InvalidValue() << "Source texture must level 0 defined.");
return false;
}
const gl::Format &sourceFormat = source->getFormat(GL_TEXTURE_2D, 0);
if (!sourceFormat.info->compressed)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Source texture must have a compressed internal format."));
+ context->handleError(InvalidOperation()
+ << "Source texture must have a compressed internal format.");
return false;
}
const gl::Texture *dest = context->getTexture(destId);
if (dest == nullptr)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Destination texture is not a valid texture object."));
+ context->handleError(InvalidValue()
+ << "Destination texture is not a valid texture object.");
return false;
}
if (dest->getTarget() != GL_TEXTURE_2D)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Destination texture must be of type GL_TEXTURE_2D."));
+ context->handleError(InvalidValue()
+ << "Destination texture must be of type GL_TEXTURE_2D.");
return false;
}
if (dest->getImmutableFormat())
{
- context->handleError(Error(GL_INVALID_OPERATION, "Destination cannot be immutable."));
+ context->handleError(InvalidOperation() << "Destination cannot be immutable.");
return false;
}
@@ -3879,14 +3846,13 @@
case GL_COMPUTE_SHADER:
if (context->getClientVersion() < Version(3, 1))
{
- context->handleError(
- Error(GL_INVALID_ENUM, "GL_COMPUTE_SHADER requires OpenGL ES 3.1."));
+ context->handleError(InvalidEnum() << "GL_COMPUTE_SHADER requires OpenGL ES 3.1.");
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Unknown shader type."));
+ context->handleError(InvalidEnum() << "Unknown shader type.");
return false;
}
@@ -3901,7 +3867,7 @@
{
if (size < 0)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -3920,19 +3886,19 @@
case GL_DYNAMIC_COPY:
if (context->getClientMajorVersion() < 3)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
if (!ValidBufferTarget(context, target))
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -3940,7 +3906,7 @@
if (!buffer)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -3955,13 +3921,13 @@
{
if (size < 0 || offset < 0)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
if (!ValidBufferTarget(context, target))
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -3969,13 +3935,13 @@
if (!buffer)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
if (buffer->isMapped())
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -3984,13 +3950,13 @@
checkedSize += offset;
if (!checkedSize.IsValid())
{
- context->handleError(Error(GL_OUT_OF_MEMORY));
+ context->handleError(OutOfMemory());
return false;
}
if (size + offset > buffer->getSize())
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -4001,8 +3967,7 @@
{
if (!context->getExtensions().requestExtension)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_ANGLE_request_extension is not available."));
+ context->handleError(InvalidOperation() << "GL_ANGLE_request_extension is not available.");
return false;
}
@@ -4010,7 +3975,7 @@
auto extension = extensionInfos.find(name);
if (extension == extensionInfos.end() || !extension->second.Requestable)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Extension %s is not requestable.", name));
+ context->handleError(InvalidOperation() << "Extension " << name << " is not requestable.");
return false;
}
@@ -4022,7 +3987,7 @@
if (texture < GL_TEXTURE0 ||
texture > GL_TEXTURE0 + context->getCaps().maxCombinedTextureImageUnits - 1)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -4049,7 +4014,7 @@
{
if (programObject->getAttachedVertexShader())
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -4058,7 +4023,7 @@
{
if (programObject->getAttachedFragmentShader())
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -4067,7 +4032,7 @@
{
if (programObject->getAttachedComputeShader())
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
break;
@@ -4087,13 +4052,13 @@
{
if (index >= MAX_VERTEX_ATTRIBS)
{
- context->handleError(Error(GL_INVALID_VALUE, "Index exceeds MAX_VERTEX_ATTRIBS"));
+ context->handleError(InvalidValue() << "Index exceeds MAX_VERTEX_ATTRIBS");
return false;
}
if (strncmp(name, "gl_", 3) == 0)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Cannot Bind built-in attributes"));
+ context->handleError(InvalidOperation() << "Cannot Bind built-in attributes");
return false;
}
@@ -4101,7 +4066,7 @@
// shader-related entry points
if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name)))
{
- context->handleError(Error(GL_INVALID_VALUE, "Attribute name contains invalid characters"));
+ context->handleError(InvalidValue() << "Attribute name contains invalid characters");
return false;
}
@@ -4112,14 +4077,14 @@
{
if (!ValidBufferTarget(context, target))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid Buffer target"));
+ context->handleError(InvalidEnum() << "Invalid Buffer target");
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isBufferGenerated(buffer))
{
- context->handleError(Error(GL_INVALID_OPERATION, "Buffer was not generated"));
+ context->handleError(InvalidOperation() << "Buffer was not generated");
return false;
}
@@ -4130,14 +4095,14 @@
{
if (!ValidFramebufferTarget(target))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid Framebuffer target"));
+ context->handleError(InvalidEnum() << "Invalid Framebuffer target");
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isFramebufferGenerated(framebuffer))
{
- context->handleError(Error(GL_INVALID_OPERATION, "Framebuffer was not generated"));
+ context->handleError(InvalidOperation() << "Framebuffer was not generated");
return false;
}
@@ -4148,14 +4113,14 @@
{
if (target != GL_RENDERBUFFER)
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid Renderbuffer target"));
+ context->handleError(InvalidEnum() << "Invalid Renderbuffer target");
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isRenderbufferGenerated(renderbuffer))
{
- context->handleError(Error(GL_INVALID_OPERATION, "Renderbuffer was not generated"));
+ context->handleError(InvalidOperation() << "Renderbuffer was not generated");
return false;
}
@@ -4191,7 +4156,7 @@
{
if (!ValidBlendEquationMode(mode))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid blend equation"));
+ context->handleError(InvalidEnum() << "Invalid blend equation");
return false;
}
@@ -4202,13 +4167,13 @@
{
if (!ValidBlendEquationMode(modeRGB))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid RGB blend equation"));
+ context->handleError(InvalidEnum() << "Invalid RGB blend equation");
return false;
}
if (!ValidBlendEquationMode(modeAlpha))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid alpha blend equation"));
+ context->handleError(InvalidEnum() << "Invalid alpha blend equation");
return false;
}
@@ -4282,25 +4247,25 @@
{
if (!ValidSrcBlendFunc(srcRGB))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid blend function"));
+ context->handleError(InvalidEnum() << "Invalid blend function");
return false;
}
if (!ValidDstBlendFunc(dstRGB, context->getClientMajorVersion()))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid blend function"));
+ context->handleError(InvalidEnum() << "Invalid blend function");
return false;
}
if (!ValidSrcBlendFunc(srcAlpha))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid blend function"));
+ context->handleError(InvalidEnum() << "Invalid blend function");
return false;
}
if (!ValidDstBlendFunc(dstAlpha, context->getClientMajorVersion()))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid blend function"));
+ context->handleError(InvalidEnum() << "Invalid blend function");
return false;
}
@@ -4332,7 +4297,7 @@
"implementation.";
ERR() << msg;
}
- context->handleError(Error(GL_INVALID_OPERATION, msg));
+ context->handleError(InvalidOperation() << msg);
return false;
}
}
@@ -4354,13 +4319,13 @@
case GL_REQUESTABLE_EXTENSIONS_ANGLE:
if (!context->getExtensions().requestExtension)
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid name."));
+ context->handleError(InvalidEnum() << "Invalid name.");
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid name."));
+ context->handleError(InvalidEnum() << "Invalid name.");
return false;
}
@@ -4371,7 +4336,7 @@
{
if (width <= 0.0f || isNaN(width))
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid width value."));
+ context->handleError(InvalidValue() << "Invalid width value.");
return false;
}
@@ -4393,7 +4358,7 @@
if (stride < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "stride cannot be negative."));
+ context->handleError(InvalidValue() << "stride cannot be negative.");
return false;
}
@@ -4402,15 +4367,15 @@
{
if (stride > caps.maxVertexAttribStride)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE."));
+ context->handleError(InvalidValue()
+ << "stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE.");
return false;
}
if (index >= caps.maxVertexAttribBindings)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS."));
+ context->handleError(InvalidValue()
+ << "index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false;
}
}
@@ -4423,9 +4388,9 @@
context->getGLState().getVertexArray()->id() == 0;
if (!nullBufferAllowed && context->getGLState().getArrayBufferId() == 0 && ptr != nullptr)
{
- context->handleError(
- Error(GL_INVALID_OPERATION,
- "Client data cannot be used with a non-default vertex array object."));
+ context
+ ->handleError(InvalidOperation()
+ << "Client data cannot be used with a non-default vertex array object.");
return false;
}
@@ -4435,7 +4400,7 @@
// The WebGL API does not support the GL_FIXED data type.
if (type == GL_FIXED)
{
- context->handleError(Error(GL_INVALID_ENUM, "GL_FIXED is not supported in WebGL."));
+ context->handleError(InvalidEnum() << "GL_FIXED is not supported in WebGL.");
return false;
}
@@ -4452,7 +4417,7 @@
{
if (context->getExtensions().webglCompatibility && zNear > zFar)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Depth near > far."));
+ context->handleError(InvalidOperation() << "Depth near > far.");
return false;
}
@@ -4478,8 +4443,8 @@
{
if (!context->getExtensions().framebufferMultisample)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "GL_ANGLE_framebuffer_multisample not available"));
+ context->handleError(InvalidOperation()
+ << "GL_ANGLE_framebuffer_multisample not available");
return false;
}
@@ -4488,7 +4453,7 @@
// generated.
if (static_cast<GLuint>(samples) > context->getCaps().maxSamples)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -4501,7 +4466,7 @@
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
{
- context->handleError(Error(GL_OUT_OF_MEMORY));
+ context->handleError(OutOfMemory());
return false;
}
}
@@ -4514,7 +4479,7 @@
{
if (!ValidFramebufferTarget(target))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid Framebuffer target"));
+ context->handleError(InvalidEnum() << "Invalid Framebuffer target");
return false;
}
@@ -4569,7 +4534,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cull face parameter"));
+ context->handleError(InvalidEnum() << "Invalid cull face parameter");
return false;
}
@@ -4587,13 +4552,12 @@
{
if (context->getShader(program))
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Shader handle passed to DeleteProgram"));
+ context->handleError(InvalidOperation() << "Shader handle passed to DeleteProgram");
return false;
}
else
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid program handle"));
+ context->handleError(InvalidValue() << "Invalid program handle");
return false;
}
}
@@ -4612,13 +4576,12 @@
{
if (context->getProgram(shader))
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Program handle passed to DeleteShader"));
+ context->handleError(InvalidOperation() << "Program handle passed to DeleteShader");
return false;
}
else
{
- context->handleError(Error(GL_INVALID_VALUE, "Invalid shader handle"));
+ context->handleError(InvalidValue() << "Invalid shader handle");
return false;
}
}
@@ -4641,7 +4604,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid depth function"));
+ context->handleError(InvalidEnum() << "Invalid depth function");
return false;
}
@@ -4693,7 +4656,7 @@
if (attachedShader != shaderObject)
{
- context->handleError(Error(GL_INVALID_OPERATION, "Cannot detach non-attached shader."));
+ context->handleError(InvalidOperation() << "Cannot detach non-attached shader.");
return false;
}
@@ -4704,7 +4667,7 @@
{
if (index >= MAX_VERTEX_ATTRIBS)
{
- context->handleError(Error(GL_INVALID_VALUE, "Attrib array index out of range"));
+ context->handleError(InvalidValue() << "Attrib array index out of range");
return false;
}
@@ -4715,7 +4678,7 @@
{
if (index >= MAX_VERTEX_ATTRIBS)
{
- context->handleError(Error(GL_INVALID_VALUE, "Attrib array index out of range"));
+ context->handleError(InvalidValue() << "Attrib array index out of range");
return false;
}
@@ -4740,7 +4703,7 @@
case GL_CCW:
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "Invalid mode for FrontFace"));
+ context->handleError(InvalidEnum() << "Invalid mode for FrontFace");
return false;
}
@@ -4758,7 +4721,7 @@
{
if (bufsize < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "bufsize must be non-negative."));
+ context->handleError(InvalidValue() << "bufsize must be non-negative.");
return false;
}
@@ -4771,8 +4734,7 @@
if (index >= static_cast<GLuint>(programObject->getActiveAttributeCount()))
{
- context->handleError(
- Error(GL_INVALID_VALUE, "index exeeds program active attribute count."));
+ context->handleError(InvalidValue() << "index exeeds program active attribute count.");
return false;
}
@@ -4790,7 +4752,7 @@
{
if (bufsize < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "bufsize must be non-negative."));
+ context->handleError(InvalidValue() << "bufsize must be non-negative.");
return false;
}
@@ -4803,8 +4765,7 @@
if (index >= static_cast<GLuint>(programObject->getActiveUniformCount()))
{
- context->handleError(
- Error(GL_INVALID_VALUE, "index exceeds program active uniform count."));
+ context->handleError(InvalidValue() << "index exceeds program active uniform count.");
return false;
}
@@ -4819,7 +4780,7 @@
{
if (maxcount < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "max count must be non-negative."));
+ context->handleError(InvalidValue() << "max count must be non-negative.");
return false;
}
@@ -4839,7 +4800,7 @@
// shader-related entry points
if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name)))
{
- context->handleError(Error(GL_INVALID_VALUE, "Attribute name contains invalid characters"));
+ context->handleError(InvalidValue() << "Attribute name contains invalid characters");
return false;
}
@@ -4852,7 +4813,7 @@
if (!programObject->isLinked())
{
- context->handleError(Error(GL_INVALID_OPERATION, "program not linked."));
+ context->handleError(InvalidOperation() << "program not linked.");
return false;
}
@@ -4893,7 +4854,7 @@
{
if (bufsize < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "bufsize must be non-negative."));
+ context->handleError(InvalidValue() << "bufsize must be non-negative.");
return false;
}
@@ -4914,7 +4875,7 @@
{
if (bufsize < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "bufsize must be non-negative."));
+ context->handleError(InvalidValue() << "bufsize must be non-negative.");
return false;
}
@@ -4939,11 +4900,11 @@
case GL_FRAGMENT_SHADER:
break;
case GL_COMPUTE_SHADER:
- context->handleError(
- Error(GL_INVALID_OPERATION, "compute shader precision not yet implemented."));
+ context->handleError(InvalidOperation()
+ << "compute shader precision not yet implemented.");
return false;
default:
- context->handleError(Error(GL_INVALID_ENUM, "invalid shader type."));
+ context->handleError(InvalidEnum() << "invalid shader type.");
return false;
}
@@ -4958,7 +4919,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "invalid precision type."));
+ context->handleError(InvalidEnum() << "invalid precision type.");
return false;
}
@@ -4973,7 +4934,7 @@
{
if (bufsize < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "bufsize must be non-negative."));
+ context->handleError(InvalidValue() << "bufsize must be non-negative.");
return false;
}
@@ -4997,7 +4958,7 @@
// shader-related entry points
if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name)))
{
- context->handleError(Error(GL_INVALID_VALUE, "Uniform name contains invalid characters"));
+ context->handleError(InvalidValue() << "Uniform name contains invalid characters");
return false;
}
@@ -5010,7 +4971,7 @@
if (!programObject->isLinked())
{
- context->handleError(Error(GL_INVALID_OPERATION, "program is not linked."));
+ context->handleError(InvalidOperation() << "program is not linked.");
return false;
}
@@ -5027,7 +4988,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "invalid hint mode."));
+ context->handleError(InvalidEnum() << "invalid hint mode.");
return false;
}
@@ -5039,14 +5000,14 @@
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
if (!context->getExtensions().standardDerivatives)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "hint requires OES_standard_derivatives."));
+ context->handleError(InvalidOperation()
+ << "hint requires OES_standard_derivatives.");
return false;
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM, "invalid hint target."));
+ context->handleError(InvalidEnum() << "invalid hint target.");
return false;
}
@@ -5091,7 +5052,7 @@
{
case GL_UNPACK_IMAGE_HEIGHT:
case GL_UNPACK_SKIP_IMAGES:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
case GL_UNPACK_ROW_LENGTH:
@@ -5099,7 +5060,7 @@
case GL_UNPACK_SKIP_PIXELS:
if (!context->getExtensions().unpackSubimage)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -5109,7 +5070,7 @@
case GL_PACK_SKIP_PIXELS:
if (!context->getExtensions().packSubimage)
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
break;
@@ -5118,7 +5079,7 @@
if (param < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Cannot use negative values in PixelStorei"));
+ context->handleError(InvalidValue() << "Cannot use negative values in PixelStorei");
return false;
}
@@ -5127,7 +5088,7 @@
case GL_UNPACK_ALIGNMENT:
if (param != 1 && param != 2 && param != 4 && param != 8)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
break;
@@ -5135,7 +5096,7 @@
case GL_PACK_ALIGNMENT:
if (param != 1 && param != 2 && param != 4 && param != 8)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
break;
@@ -5152,7 +5113,7 @@
break;
default:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -5178,8 +5139,7 @@
{
if (width < 0 || height < 0)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Scissor width and height must be non-negative."));
+ context->handleError(InvalidValue() << "Scissor width and height must be non-negative.");
return false;
}
@@ -5197,7 +5157,7 @@
if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) ==
shaderBinaryFormats.end())
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid shader binary format."));
+ context->handleError(InvalidEnum() << "Invalid shader binary format.");
return false;
}
@@ -5212,7 +5172,7 @@
{
if (count < 0)
{
- context->handleError(Error(GL_INVALID_VALUE, "Count must be non-negative."));
+ context->handleError(InvalidValue() << "Count must be non-negative.");
return false;
}
@@ -5225,8 +5185,7 @@
size_t len = length ? static_cast<size_t>(length[i]) : strlen(string[i]);
if (!IsValidESSLString(string[i], len))
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Shader source contains invalid characters"));
+ context->handleError(InvalidValue() << "Shader source contains invalid characters");
return false;
}
}
@@ -5245,7 +5204,7 @@
{
if (!IsValidStencilFunc(func))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil function."));
+ context->handleError(InvalidEnum() << "Invalid stencil function.");
return false;
}
@@ -5260,13 +5219,13 @@
{
if (!IsValidStencilFace(face))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil face."));
+ context->handleError(InvalidEnum() << "Invalid stencil face.");
return false;
}
if (!IsValidStencilFunc(func))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil function."));
+ context->handleError(InvalidEnum() << "Invalid stencil function.");
return false;
}
@@ -5282,7 +5241,7 @@
{
if (!IsValidStencilFace(face))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil face."));
+ context->handleError(InvalidEnum() << "Invalid stencil face.");
return false;
}
@@ -5293,19 +5252,19 @@
{
if (!IsValidStencilOp(fail))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil fail op."));
+ context->handleError(InvalidEnum() << "Invalid stencil fail op.");
return false;
}
if (!IsValidStencilOp(zfail))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil z fail op."));
+ context->handleError(InvalidEnum() << "Invalid stencil z fail op.");
return false;
}
if (!IsValidStencilOp(zpass))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil z pass op."));
+ context->handleError(InvalidEnum() << "Invalid stencil z pass op.");
return false;
}
@@ -5320,7 +5279,7 @@
{
if (!IsValidStencilFace(face))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid stencil face."));
+ context->handleError(InvalidEnum() << "Invalid stencil face.");
return false;
}
@@ -5455,7 +5414,7 @@
{
if (index >= MAX_VERTEX_ATTRIBS)
{
- context->handleError(Error(GL_INVALID_VALUE, "Vertex attrib index out of range."));
+ context->handleError(InvalidValue() << "Vertex attrib index out of range.");
return false;
}
@@ -5515,8 +5474,7 @@
{
if (width < 0 || height < 0)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Viewport width and height must be non-negative."));
+ context->handleError(InvalidValue() << "Viewport width and height must be non-negative.");
return false;
}
@@ -5617,7 +5575,7 @@
{
if (!ValidCap(context, cap, false))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cap."));
+ context->handleError(InvalidEnum() << "Invalid cap.");
return false;
}
@@ -5628,7 +5586,7 @@
{
if (!ValidCap(context, cap, false))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cap."));
+ context->handleError(InvalidEnum() << "Invalid cap.");
return false;
}
@@ -5636,7 +5594,7 @@
cap == GL_SAMPLE_ALPHA_TO_COVERAGE)
{
const char *errorMessage = "Current renderer doesn't support alpha-to-coverage";
- context->handleError(Error(GL_INVALID_OPERATION, errorMessage));
+ context->handleError(InvalidOperation() << errorMessage);
// We also output an error message to the debugger window if tracing is active, so that
// developers can see the error message.
@@ -5656,7 +5614,7 @@
if (!ValidFramebufferTarget(target) ||
(renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -5676,7 +5634,7 @@
if (context->getClientMajorVersion() < 3 && !context->getExtensions().fboRenderMipmap &&
level != 0)
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
@@ -5698,13 +5656,13 @@
{
if (level > gl::log2(caps.max2DTextureSize))
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
if (tex->getTarget() != GL_TEXTURE_2D)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Textarget must match the texture target type."));
+ context->handleError(InvalidOperation()
+ << "Textarget must match the texture target type.");
return false;
}
}
@@ -5719,13 +5677,13 @@
{
if (level > gl::log2(caps.maxCubeMapTextureSize))
{
- context->handleError(Error(GL_INVALID_VALUE));
+ context->handleError(InvalidValue());
return false;
}
if (tex->getTarget() != GL_TEXTURE_CUBE_MAP)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Textarget must match the texture target type."));
+ context->handleError(InvalidOperation()
+ << "Textarget must match the texture target type.");
return false;
}
}
@@ -5735,35 +5693,35 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Texture target requires at least OpenGL ES 3.1."));
+ context->handleError(InvalidOperation()
+ << "Texture target requires at least OpenGL ES 3.1.");
return false;
}
if (level != 0)
{
- context->handleError(
- Error(GL_INVALID_VALUE, "Level must be 0 for TEXTURE_2D_MULTISAMPLE."));
+ context->handleError(InvalidValue()
+ << "Level must be 0 for TEXTURE_2D_MULTISAMPLE.");
return false;
}
if (tex->getTarget() != GL_TEXTURE_2D_MULTISAMPLE)
{
- context->handleError(Error(GL_INVALID_OPERATION,
- "Textarget must match the texture target type."));
+ context->handleError(InvalidOperation()
+ << "Textarget must match the texture target type.");
return false;
}
}
break;
default:
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
const Format &format = tex->getFormat(textarget, level);
if (format.info->compressed)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
}
@@ -5795,7 +5753,7 @@
{
if (!ValidTextureTarget(context, target))
{
- context->handleError(Error(GL_INVALID_ENUM));
+ context->handleError(InvalidEnum());
return false;
}
@@ -5803,7 +5761,7 @@
if (texture == nullptr)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -5813,7 +5771,7 @@
// that out-of-range base level has a non-color-renderable / non-texture-filterable format.
if (effectiveBaseLevel >= gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -5832,7 +5790,7 @@
if (format.info->depthBits > 0 || format.info->stencilBits > 0 || !formatCaps.filterable ||
(!formatCaps.renderable && !format.info->isLUMA()) || format.info->compressed)
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -5841,8 +5799,8 @@
context->getClientVersion() >= ES_3_0 || context->getExtensions().webglCompatibility;
if (!supportsSRGBMipmapGeneration && format.info->colorEncoding == GL_SRGB)
{
- context->handleError(
- Error(GL_INVALID_OPERATION, "Mipmap generation of sRGB textures is not allowed."));
+ context->handleError(InvalidOperation()
+ << "Mipmap generation of sRGB textures is not allowed.");
return false;
}
@@ -5852,14 +5810,14 @@
!isPow2(static_cast<int>(texture->getHeight(baseTarget, 0)))))
{
ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP);
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
// Cube completeness check
if (target == GL_TEXTURE_CUBE_MAP && !texture->getTextureState().isCubeComplete())
{
- context->handleError(Error(GL_INVALID_OPERATION));
+ context->handleError(InvalidOperation());
return false;
}
@@ -5926,7 +5884,7 @@
{
if (!ValidCap(context, cap, true))
{
- context->handleError(Error(GL_INVALID_ENUM, "Invalid cap."));
+ context->handleError(InvalidEnum() << "Invalid cap.");
return false;
}
@@ -5938,9 +5896,9 @@
if (context->hasActiveTransformFeedback(program))
{
// ES 3.0.4 section 2.15 page 91
- context->handleError(Error(GL_INVALID_OPERATION,
- "Cannot link program while program is associated with an active "
- "transform feedback object."));
+ context->handleError(InvalidOperation() << "Cannot link program while program is "
+ "associated with an active transform "
+ "feedback object.");
return false;
}
@@ -5997,28 +5955,28 @@
if (context->getShader(program))
{
context->handleError(
- Error(GL_INVALID_OPERATION,
- "Attempted to use a single shader instead of a shader program."));
+ InvalidOperation()
+ << "Attempted to use a single shader instead of a shader program.");
return false;
}
else
{
- context->handleError(Error(GL_INVALID_VALUE, "Program invalid."));
+ context->handleError(InvalidValue() << "Program invalid.");
return false;
}
}
if (!programObject->isLinked())
{
- context->handleError(Error(GL_INVALID_OPERATION, "Program not linked."));
+ context->handleError(InvalidOperation() << "Program not linked.");
return false;
}
}
if (context->getGLState().isTransformFeedbackActiveUnpaused())
{
// ES 3.0.4 section 2.15 page 91
- context->handleError(
- Error(GL_INVALID_OPERATION,
- "Cannot change active program while transform feedback is unpaused."));
+ context
+ ->handleError(InvalidOperation()
+ << "Cannot change active program while transform feedback is unpaused.");
return false;
}