Refactor More Validation Error Messages
Replace many error string literals with variables existing in
ErrorStrings.h
BUG=:angleproject:1644
Change-Id: If5665a6787a1fa8d789811d774711c3705dfb0ab
Reviewed-on: https://chromium-review.googlesource.com/598588
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/validationES31.cpp b/src/libANGLE/validationES31.cpp
index 54b7351..09719ce 100644
--- a/src/libANGLE/validationES31.cpp
+++ b/src/libANGLE/validationES31.cpp
@@ -9,6 +9,7 @@
#include "libANGLE/validationES31.h"
#include "libANGLE/Context.h"
+#include "libANGLE/ErrorStrings.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/validationES.h"
@@ -277,7 +278,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -298,7 +299,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -324,7 +325,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -452,7 +453,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -463,7 +464,7 @@
if (!ValidTexLevelDestinationTarget(context, target))
{
- context->handleError(InvalidEnum() << "Invalid texture target");
+ ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
return false;
}
@@ -507,7 +508,7 @@
case GL_TEXTURE_COMPRESSED:
break;
default:
- context->handleError(InvalidEnum() << "Unknown pname.");
+ ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
return false;
}
@@ -546,7 +547,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -558,7 +559,7 @@
if (width < 1 || height < 1)
{
- context->handleError(InvalidValue() << "Width and height must be positive.");
+ ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
return false;
}
@@ -627,7 +628,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -651,7 +652,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -705,8 +706,7 @@
}
default:
{
- context->handleError(InvalidEnum()
- << "Invalid pname: 0x" << std::hex << std::uppercase << pname);
+ ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
return false;
}
}
@@ -728,13 +728,13 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
if (!ValidFramebufferTarget(target))
{
- context->handleError(InvalidEnum() << "Invalid framebuffer target.");
+ ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
return false;
}
@@ -746,8 +746,7 @@
case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
break;
default:
- context->handleError(InvalidEnum()
- << "Invalid pname: 0x" << std::hex << std::uppercase << pname);
+ ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
return false;
}
@@ -769,7 +768,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES 3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -797,7 +796,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -817,7 +816,7 @@
if (offset < 0)
{
- context->handleError(InvalidValue() << "offset cannot be negative.");
+ ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
return false;
}
@@ -843,7 +842,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -875,7 +874,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -905,7 +904,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -920,8 +919,7 @@
const Caps &caps = context->getCaps();
if (attribIndex >= caps.maxVertexAttributes)
{
- context->handleError(InvalidValue()
- << "attribindex must be smaller than MAX_VERTEX_ATTRIBS.");
+ ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
return false;
}
@@ -945,7 +943,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -970,7 +968,7 @@
if (bufSize < 0)
{
- context->handleError(InvalidValue() << "Invalid bufSize: " << bufSize);
+ ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
return false;
}
@@ -984,7 +982,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
@@ -1119,7 +1117,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->handleError(InvalidOperation() << "Context does not support GLES3.1.");
+ ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}