Slight refactor to ErrorStrings.h.
Allows for better readability. Also sort the error strings by ID.
Bug: angleproject:2957
Change-Id: Ib3900a4c90507ac84496fd5ff916417eb768667b
Reviewed-on: https://chromium-review.googlesource.com/c/1337461
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/src/libANGLE/validationES31.cpp b/src/libANGLE/validationES31.cpp
index 258f153..8ae760b 100644
--- a/src/libANGLE/validationES31.cpp
+++ b/src/libANGLE/validationES31.cpp
@@ -22,6 +22,7 @@
namespace gl
{
+using namespace err;
namespace
{
@@ -304,7 +305,7 @@
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -324,7 +325,7 @@
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -343,14 +344,14 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
const Caps &caps = context->getCaps();
if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset))
{
- context->validationError(GL_INVALID_VALUE, kErrorRelativeOffsetTooLarge);
+ context->validationError(GL_INVALID_VALUE, kRelativeOffsetTooLarge);
return false;
}
@@ -358,7 +359,7 @@
// An INVALID_OPERATION error is generated if the default vertex array object is bound.
if (context->getGLState().getVertexArrayId() == 0)
{
- context->validationError(GL_INVALID_OPERATION, kErrorDefaultVertexArray);
+ context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
return false;
}
@@ -371,7 +372,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -392,7 +393,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -421,7 +422,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -437,14 +438,14 @@
// DRAW_INDIRECT_BUFFER or to any enabled vertex array.
if (!state.getVertexArrayId())
{
- context->validationError(GL_INVALID_OPERATION, kErrorDefaultVertexArray);
+ context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
return false;
}
Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
if (!drawIndirectBuffer)
{
- context->validationError(GL_INVALID_OPERATION, kErrorDrawIndirectBufferNotBound);
+ context->validationError(GL_INVALID_OPERATION, kDrawIndirectBufferNotBound);
return false;
}
@@ -453,7 +454,7 @@
GLint64 offset = reinterpret_cast<GLint64>(indirect);
if ((static_cast<GLuint>(offset) % sizeof(GLuint)) != 0)
{
- context->validationError(GL_INVALID_VALUE, kErrorInvalidIndirectOffset);
+ context->validationError(GL_INVALID_VALUE, kInvalidIndirectOffset);
return false;
}
@@ -464,7 +465,7 @@
ASSERT(drawFramebuffer != nullptr);
if (drawFramebuffer->getNumViews() > 1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorMultiviewActive);
+ context->validationError(GL_INVALID_OPERATION, kMultiviewActive);
return false;
}
@@ -485,8 +486,7 @@
if (!ValidateTransformFeedbackPrimitiveMode(
context, curTransformFeedback->getPrimitiveMode(), mode))
{
- context->validationError(GL_INVALID_OPERATION,
- kErrorInvalidDrawModeTransformFeedback);
+ context->validationError(GL_INVALID_OPERATION, kInvalidDrawModeTransformFeedback);
return false;
}
}
@@ -495,7 +495,7 @@
// An INVALID_OPERATION error is generated if transform feedback is active and not
// paused.
context->validationError(GL_INVALID_OPERATION,
- kErrorUnsupportedDrawModeForTransformFeedback);
+ kUnsupportedDrawModeForTransformFeedback);
return false;
}
}
@@ -511,7 +511,7 @@
if (!checkedSum.IsValid() ||
checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize()))
{
- context->validationError(GL_INVALID_OPERATION, kErrorParamOverflow);
+ context->validationError(GL_INVALID_OPERATION, kParamOverflow);
return false;
}
@@ -533,7 +533,7 @@
Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
if (!elementArrayBuffer)
{
- context->validationError(GL_INVALID_OPERATION, kErrorMustHaveElementArrayBinding);
+ context->validationError(GL_INVALID_OPERATION, kMustHaveElementArrayBinding);
return false;
}
@@ -676,7 +676,7 @@
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -892,7 +892,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -919,7 +919,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -948,7 +948,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -960,13 +960,13 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
if (pname != GL_SAMPLE_POSITION)
{
- context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
return false;
}
@@ -975,7 +975,7 @@
if (index >= static_cast<GLuint>(samples))
{
- context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsSamples);
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsSamples);
return false;
}
@@ -997,13 +997,13 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
if (!ValidFramebufferTarget(context, target))
{
- context->validationError(GL_INVALID_ENUM, kErrorInvalidFramebufferTarget);
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
return false;
}
@@ -1053,20 +1053,20 @@
{
if (!context->getExtensions().geometryShader)
{
- context->validationError(GL_INVALID_ENUM, kErrorGeometryShaderExtensionNotEnabled);
+ context->validationError(GL_INVALID_ENUM, kGeometryShaderExtensionNotEnabled);
return false;
}
GLint maxLayers = context->getCaps().maxFramebufferLayers;
if (param < 0 || param > maxLayers)
{
- context->validationError(GL_INVALID_VALUE, kErrorInvalidFramebufferLayer);
+ context->validationError(GL_INVALID_VALUE, kInvalidFramebufferLayer);
return false;
}
break;
}
default:
{
- context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
return false;
}
}
@@ -1085,13 +1085,13 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
if (!ValidFramebufferTarget(context, target))
{
- context->validationError(GL_INVALID_ENUM, kErrorInvalidFramebufferTarget);
+ context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget);
return false;
}
@@ -1105,12 +1105,12 @@
case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
if (!context->getExtensions().geometryShader)
{
- context->validationError(GL_INVALID_ENUM, kErrorGeometryShaderExtensionNotEnabled);
+ context->validationError(GL_INVALID_ENUM, kGeometryShaderExtensionNotEnabled);
return false;
}
break;
default:
- context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
+ context->validationError(GL_INVALID_ENUM, kInvalidPname);
return false;
}
@@ -1143,7 +1143,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1170,7 +1170,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1190,7 +1190,7 @@
if (offset < 0)
{
- context->validationError(GL_INVALID_VALUE, kErrorNegativeOffset);
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
return false;
}
@@ -1216,7 +1216,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1263,7 +1263,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1278,7 +1278,7 @@
const Caps &caps = context->getCaps();
if (attribIndex >= caps.maxVertexAttributes)
{
- context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxVertexAttribute);
+ context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute);
return false;
}
@@ -1302,7 +1302,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1326,7 +1326,7 @@
if (bufSize < 0)
{
- context->validationError(GL_INVALID_VALUE, kErrorNegativeBufferSize);
+ context->validationError(GL_INVALID_VALUE, kNegativeBufferSize);
return false;
}
@@ -1340,7 +1340,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1349,7 +1349,7 @@
if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
{
- context->validationError(GL_INVALID_OPERATION, kErrorNoActiveProgramWithComputeShader);
+ context->validationError(GL_INVALID_OPERATION, kNoActiveProgramWithComputeShader);
return false;
}
@@ -1383,7 +1383,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1392,26 +1392,26 @@
if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
{
- context->validationError(GL_INVALID_OPERATION, kErrorNoActiveProgramWithComputeShader);
+ context->validationError(GL_INVALID_OPERATION, kNoActiveProgramWithComputeShader);
return false;
}
if (indirect < 0)
{
- context->validationError(GL_INVALID_VALUE, kErrorNegativeOffset);
+ context->validationError(GL_INVALID_VALUE, kNegativeOffset);
return false;
}
if ((indirect & (sizeof(GLuint) - 1)) != 0)
{
- context->validationError(GL_INVALID_VALUE, kErrorOffsetMustBeMultipleOfUint);
+ context->validationError(GL_INVALID_VALUE, kOffsetMustBeMultipleOfUint);
return false;
}
Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect);
if (!dispatchIndirectBuffer)
{
- context->validationError(GL_INVALID_OPERATION, kErrorDispatchIndirectBufferNotBound);
+ context->validationError(GL_INVALID_OPERATION, kDispatchIndirectBufferNotBound);
return false;
}
@@ -1420,7 +1420,7 @@
if (!checkedSum.IsValid() ||
checkedSum.ValueOrDie() > static_cast<GLuint64>(dispatchIndirectBuffer->getSize()))
{
- context->validationError(GL_INVALID_OPERATION, kErrorInsufficientBufferSize);
+ context->validationError(GL_INVALID_OPERATION, kInsufficientBufferSize);
return false;
}
@@ -1513,7 +1513,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1549,7 +1549,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1602,7 +1602,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1673,7 +1673,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1694,13 +1694,13 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
if (!context->isProgramPipelineGenerated(pipeline))
{
- context->validationError(GL_INVALID_OPERATION, kErrorObjectNotGenerated);
+ context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
return false;
}
@@ -1711,7 +1711,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1765,7 +1765,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1782,7 +1782,7 @@
GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT;
if ((barriers & ~supported_barrier_bits) != 0)
{
- context->validationError(GL_INVALID_VALUE, kErrorInvalidMemoryBarrierBit);
+ context->validationError(GL_INVALID_VALUE, kInvalidMemoryBarrierBit);
return false;
}
@@ -1793,7 +1793,7 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
@@ -1808,7 +1808,7 @@
GL_TEXTURE_FETCH_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT;
if ((barriers & ~supported_barrier_bits) != 0)
{
- context->validationError(GL_INVALID_VALUE, kErrorInvalidMemoryBarrierBit);
+ context->validationError(GL_INVALID_VALUE, kInvalidMemoryBarrierBit);
return false;
}
@@ -1819,13 +1819,13 @@
{
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
if (maskNumber >= context->getCaps().maxSampleMaskWords)
{
- context->validationError(GL_INVALID_VALUE, kErrorInvalidSampleMaskNumber);
+ context->validationError(GL_INVALID_VALUE, kInvalidSampleMaskNumber);
return false;
}
@@ -1840,7 +1840,7 @@
{
if (!context->getExtensions().geometryShader)
{
- context->validationError(GL_INVALID_OPERATION, kErrorGeometryShaderExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kGeometryShaderExtensionNotEnabled);
return false;
}
@@ -1860,13 +1860,13 @@
// three-dimensional or two-dimensional array texture.
if (tex == nullptr)
{
- context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureName);
+ context->validationError(GL_INVALID_VALUE, kInvalidTextureName);
return false;
}
if (!ValidMipLevel(context, tex->getType(), level))
{
- context->validationError(GL_INVALID_VALUE, kErrorInvalidMipLevel);
+ context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
return false;
}
}
@@ -1891,19 +1891,19 @@
{
if (!context->getExtensions().textureStorageMultisample2DArray)
{
- context->validationError(GL_INVALID_ENUM, kErrorMultisampleArrayExtensionRequired);
+ context->validationError(GL_INVALID_ENUM, kMultisampleArrayExtensionRequired);
return false;
}
if (target != TextureType::_2DMultisampleArray)
{
- context->validationError(GL_INVALID_ENUM, kErrorTargetMustBeTexture2DMultisampleArrayOES);
+ context->validationError(GL_INVALID_ENUM, kTargetMustBeTexture2DMultisampleArrayOES);
return false;
}
if (width < 1 || height < 1 || depth < 1)
{
- context->validationError(GL_INVALID_VALUE, kErrorNegativeSize);
+ context->validationError(GL_INVALID_VALUE, kNegativeSize);
return false;
}
@@ -1918,17 +1918,17 @@
{
if (!context->getExtensions().blendFuncExtended)
{
- context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
+ context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
if (context->getClientVersion() < ES_3_1)
{
- context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
+ context->validationError(GL_INVALID_OPERATION, kES31Required);
return false;
}
if (programInterface != GL_PROGRAM_OUTPUT)
{
- context->validationError(GL_INVALID_ENUM, kErrorProgramInterfaceMustBeProgramOutput);
+ context->validationError(GL_INVALID_ENUM, kProgramInterfaceMustBeProgramOutput);
return false;
}
Program *programObject = GetValidProgram(context, program);
@@ -1938,7 +1938,7 @@
}
if (!programObject->isLinked())
{
- context->validationError(GL_INVALID_OPERATION, kErrorProgramNotLinked);
+ context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
return false;
}
return true;