Commit afa75152 by Brandon Jones Committed by Commit Bot

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: 's avatarCorentin Wallez <cwallez@chromium.org>
parent aadc8f37
...@@ -16,27 +16,35 @@ ...@@ -16,27 +16,35 @@
namespace gl namespace gl
{ {
ERRMSG(ActiveTextureRange, "Cannot be less than 0 or greater than maximum number of textures.");
ERRMSG(BufferNotBound, "A buffer must be bound."); ERRMSG(BufferNotBound, "A buffer must be bound.");
ERRMSG(ClearInvalidMask, "Invalid mask bits."); ERRMSG(CompressedTextureDimensionsMustMatchData,
"Compressed texture dimensions must exactly match the dimensions of the data passed in.");
ERRMSG(CompressedTexturesNotAttachable, "Compressed textures cannot be attached to a framebuffer."); ERRMSG(CompressedTexturesNotAttachable, "Compressed textures cannot be attached to a framebuffer.");
ERRMSG(CubemapFacesEqualDimensions, "Each cubemap face must have equal width and height."); ERRMSG(CubemapFacesEqualDimensions, "Each cubemap face must have equal width and height.");
ERRMSG(CubemapIncomplete, ERRMSG(CubemapIncomplete,
"Texture is not cubemap complete. All cubemaps faces must be defined and be the same size."); "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size.");
ERRMSG(DefaultFramebufferInvalidAttachment,
"Invalid attachment when the default framebuffer is bound.");
ERRMSG(DefaultFramebufferTarget, "It is invalid to change default FBO's attachments"); ERRMSG(DefaultFramebufferTarget, "It is invalid to change default FBO's attachments");
ERRMSG(EnumNotSupported, "Enum is not currently supported."); ERRMSG(EnumNotSupported, "Enum is not currently supported.");
ERRMSG(EnumRequiresGLES31, "Enum requires GLES 3.1"); ERRMSG(EnumRequiresGLES31, "Enum requires GLES 3.1");
ERRMSG(ES31Required, "OpenGL ES 3.1 Required");
ERRMSG(ES3Required, "OpenGL ES 3.0 Required.");
ERRMSG(ExceedsMaxElement, "Element value exceeds maximum element index."); ERRMSG(ExceedsMaxElement, "Element value exceeds maximum element index.");
ERRMSG(ExpectedProgramName, "Expected a program name, but found a shader name."); ERRMSG(ExpectedProgramName, "Expected a program name, but found a shader name.");
ERRMSG(ExpectedShaderName, "Expected a shader name, but found a program name."); ERRMSG(ExpectedShaderName, "Expected a shader name, but found a program name.");
ERRMSG(ExtensionNotEnabled, "Extension is not enabled."); ERRMSG(ExtensionNotEnabled, "Extension is not enabled.");
ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Texture.");
ERRMSG(FramebufferIncompleteAttachment, ERRMSG(FramebufferIncompleteAttachment,
"Attachment type must be compatible with attachment object."); "Attachment type must be compatible with attachment object.");
ERRMSG(FramebufferInvalidAttachment, "Invalid Attachment Type");
ERRMSG(GenerateMipmapNotAllowed, "Compressed textures do not support mipmap generation."); ERRMSG(GenerateMipmapNotAllowed, "Compressed textures do not support mipmap generation.");
ERRMSG(IndexExceedsMax, "Index exceeds MAX_VERTEX_ATTRIBS"); ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count.");
ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS.");
ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS.");
ERRMSG(InsufficientBufferSize, "Insufficient buffer size."); ERRMSG(InsufficientBufferSize, "Insufficient buffer size.");
ERRMSG(InsufficientVertexBufferSize, "Vertex buffer is not big enough for the draw call");
ERRMSG(IntegerOverflow, "Integer overflow."); ERRMSG(IntegerOverflow, "Integer overflow.");
ERRMSG(InvalidAttachment, "Invalid Attachment Type.");
ERRMSG(InvalidBlendEquation, "Invalid blend equation."); ERRMSG(InvalidBlendEquation, "Invalid blend equation.");
ERRMSG(InvalidBlendFunction, "Invalid blend function."); ERRMSG(InvalidBlendFunction, "Invalid blend function.");
ERRMSG(InvalidBorder, "Border must be 0."); ERRMSG(InvalidBorder, "Border must be 0.");
...@@ -47,53 +55,85 @@ ERRMSG(InvalidConstantColor, ...@@ -47,53 +55,85 @@ ERRMSG(InvalidConstantColor,
"CONSTANT_COLOR (or ONE_MINUS_CONSTANT_COLOR) and CONSTANT_ALPHA (or " "CONSTANT_COLOR (or ONE_MINUS_CONSTANT_COLOR) and CONSTANT_ALPHA (or "
"ONE_MINUS_CONSTANT_ALPHA) cannot be used together as source and destination factors in the " "ONE_MINUS_CONSTANT_ALPHA) cannot be used together as source and destination factors in the "
"blend function."); "blend function.");
ERRMSG(InvalidCoverMode, "Invalid cover mode.");
ERRMSG(InvalidCullMode, "Cull mode not recognized."); ERRMSG(InvalidCullMode, "Cull mode not recognized.");
ERRMSG(InvalidDebugSeverity, "Invalid debug severity.");
ERRMSG(InvalidDebugSource, "Invalid debug source.");
ERRMSG(InvalidDebugType, "Invalid debug type.");
ERRMSG(InvalidDepthRange, "Near value cannot be greater than far."); ERRMSG(InvalidDepthRange, "Near value cannot be greater than far.");
ERRMSG(InvalidDrawMode, "Invalid draw mode."); ERRMSG(InvalidDrawMode, "Invalid draw mode.");
ERRMSG(InvalidDrawModeTransformFeedback, ERRMSG(InvalidDrawModeTransformFeedback,
"Draw mode must match current transform feedback object's draw mode."); "Draw mode must match current transform feedback object's draw mode.");
ERRMSG(InvalidFillMode, "Invalid fill mode.");
ERRMSG(InvalidFilterTexture, "Texture only supports NEAREST and LINEAR filtering.");
ERRMSG(InvalidFormat, "Invalid format."); ERRMSG(InvalidFormat, "Invalid format.");
ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target."); ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target.");
ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture."); ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture.");
ERRMSG(InvalidFramebufferTextureParameter, "Invalid parameter name for framebuffer attachment.");
ERRMSG(InvalidInternalFormat, "Invalid internal format."); ERRMSG(InvalidInternalFormat, "Invalid internal format.");
ERRMSG(InvalidMatrixMode, "Invalid matrix mode.");
ERRMSG(InvalidMipLevel, "Level of detail outside of range."); ERRMSG(InvalidMipLevel, "Level of detail outside of range.");
ERRMSG(InvalidName, "Invalid name.");
ERRMSG(InvalidNameCharacters, "Name contains invalid characters."); ERRMSG(InvalidNameCharacters, "Name contains invalid characters.");
ERRMSG(InvalidPname, "Invalid pname.");
ERRMSG(InvalidPrecision, "Invalid or unsupported precision type."); ERRMSG(InvalidPrecision, "Invalid or unsupported precision type.");
ERRMSG(InvalidProgramName, "Program object expected."); ERRMSG(InvalidProgramName, "Program object expected.");
ERRMSG(InvalidQueryId, "Invalid query Id.");
ERRMSG(InvalidQueryTarget, "Invalid query target.");
ERRMSG(InvalidQueryType, "Invalid query type.");
ERRMSG(InvalidRange, "Invalid range.");
ERRMSG(InvalidRenderbufferInternalFormat, "Invalid renderbuffer internalformat."); ERRMSG(InvalidRenderbufferInternalFormat, "Invalid renderbuffer internalformat.");
ERRMSG(InvalidRenderbufferTarget, "Invalid renderbuffer target."); ERRMSG(InvalidRenderbufferTarget, "Invalid renderbuffer target.");
ERRMSG(InvalidRenderbufferTextureParameter, "Invalid parameter name for renderbuffer attachment."); ERRMSG(InvalidRenderbufferTextureParameter, "Invalid parameter name for renderbuffer attachment.");
ERRMSG(InvalidRenderbufferWidthHeight, ERRMSG(InvalidRenderbufferWidthHeight,
"Renderbuffer width and height cannot be negative and cannot exceed maximum texture size."); "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size.");
ERRMSG(InvalidSampler, "Sampler is not valid");
ERRMSG(InvalidShaderName, "Shader object expected."); ERRMSG(InvalidShaderName, "Shader object expected.");
ERRMSG(InvalidShaderType, "Invalid shader type."); ERRMSG(InvalidShaderType, "Invalid shader type.");
ERRMSG(InvalidStencil, "Invalid stencil."); ERRMSG(InvalidStencil, "Invalid stencil.");
ERRMSG(InvalidStencilBitMask, "Invalid stencil bit mask.");
ERRMSG(InvalidTarget, "Invalid target.");
ERRMSG(InvalidTextureFilterParam, "Texture filter not recognized."); ERRMSG(InvalidTextureFilterParam, "Texture filter not recognized.");
ERRMSG(InvalidTextureRange, "Cannot be less than 0 or greater than maximum number of textures.");
ERRMSG(InvalidTextureTarget, "Invalid or unsupported texture target."); ERRMSG(InvalidTextureTarget, "Invalid or unsupported texture target.");
ERRMSG(InvalidTextureWrap, "Texture wrap mode not recognized.");
ERRMSG(InvalidType, "Invalid type."); ERRMSG(InvalidType, "Invalid type.");
ERRMSG(InvalidTypePureInt, "Invalid type, should be integer"); ERRMSG(InvalidTypePureInt, "Invalid type, should be integer");
ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8."); ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8.");
ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4."); ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4.");
ERRMSG(InvalidWidth, "Invalid width.");
ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type.");
ERRMSG(LevelNotZero, "Texture level must be zero.");
ERRMSG(MismatchedFormat, "Format must match internal format."); ERRMSG(MismatchedFormat, "Format must match internal format.");
ERRMSG(MismatchedTargetAndFormat, "Invalid texture target and format combination.");
ERRMSG(MismatchedTypeAndFormat, "Invalid format and type combination."); ERRMSG(MismatchedTypeAndFormat, "Invalid format and type combination.");
ERRMSG(MismatchedVariableProgram, "Variable is not part of the current program."); ERRMSG(MismatchedVariableProgram, "Variable is not part of the current program.");
ERRMSG(MissingReadAttachment, "Missing read attachment."); ERRMSG(MissingReadAttachment, "Missing read attachment.");
ERRMSG(MustHaveElementArrayBinding, "Must have element array buffer binding."); ERRMSG(MustHaveElementArrayBinding, "Must have element array buffer binding.");
ERRMSG(NameBeginsWithGL, "Attributes that begin with 'gl_' are not allowed."); ERRMSG(NameBeginsWithGL, "Attributes that begin with 'gl_' are not allowed.");
ERRMSG(NegativeAttachments, "Negative number of attachments.");
ERRMSG(NegativeBufferSize, "Negative buffer size."); ERRMSG(NegativeBufferSize, "Negative buffer size.");
ERRMSG(NegativeCount, "Negative count."); ERRMSG(NegativeCount, "Negative count.");
ERRMSG(NegativeLength, "Negative length."); ERRMSG(NegativeLength, "Negative length.");
ERRMSG(NegativeMaxCount, "Negative maxcount.");
ERRMSG(NegativeOffset, "Negative offset."); ERRMSG(NegativeOffset, "Negative offset.");
ERRMSG(NegativePrimcount, "Primcount must be greater than or equal to zero.");
ERRMSG(NegativeSize, "Cannot have negative height or width."); ERRMSG(NegativeSize, "Cannot have negative height or width.");
ERRMSG(NegativeStart, "Cannot have negative start."); ERRMSG(NegativeStart, "Cannot have negative start.");
ERRMSG(NegativeStride, "Cannot have negative stride."); ERRMSG(NegativeStride, "Cannot have negative stride.");
ERRMSG(NoSuchPath, "No such path object.");
ERRMSG(NoZeroDivisor, "At least one enabled attribute must have a divisor of zero.");
ERRMSG(ObjectNotGenerated, "Object cannot be used because it has not been generated."); ERRMSG(ObjectNotGenerated, "Object cannot be used because it has not been generated.");
ERRMSG(OffsetMustBeMultipleOfType, "Offset must be a multiple of the passed in datatype."); ERRMSG(OffsetMustBeMultipleOfType, "Offset must be a multiple of the passed in datatype.");
ERRMSG(OutsideOfBounds, "Parameter outside of bounds."); ERRMSG(OutsideOfBounds, "Parameter outside of bounds.");
ERRMSG(ParamOverflow, "The provided parameters overflow with the provided buffer."); ERRMSG(ParamOverflow, "The provided parameters overflow with the provided buffer.");
ERRMSG(PixelDataNotNull, "Pixel data must be null.");
ERRMSG(ProgramDoesNotExist, "Program doesn't exist."); ERRMSG(ProgramDoesNotExist, "Program doesn't exist.");
ERRMSG(ProgramNotBound, "A program must be bound."); ERRMSG(ProgramNotBound, "A program must be bound.");
ERRMSG(ProgramNotLinked, "Program not linked."); ERRMSG(ProgramNotLinked, "Program not linked.");
ERRMSG(QueryActive, "Query is active.");
ERRMSG(QueryExtensionNotEnabled, "Query extension not enabled.");
ERRMSG(ReadBufferNone, "Read buffer is GL_NONE.");
ERRMSG(RenderbufferNotBound, "A renderbuffer must be bound."); ERRMSG(RenderbufferNotBound, "A renderbuffer must be bound.");
ERRMSG(ResourceMaxTextureSize, "Desired resource size is greater than max texture size."); ERRMSG(ResourceMaxTextureSize, "Desired resource size is greater than max texture size.");
ERRMSG(ShaderAttachmentHasShader, "Shader attachment already has a shader."); ERRMSG(ShaderAttachmentHasShader, "Shader attachment already has a shader.");
...@@ -107,11 +147,14 @@ ERRMSG(StencilReferenceMaskOrMismatch, ...@@ -107,11 +147,14 @@ ERRMSG(StencilReferenceMaskOrMismatch,
ERRMSG(StrideMustBeMultipleOfType, "Stride must be a multiple of the passed in datatype."); ERRMSG(StrideMustBeMultipleOfType, "Stride must be a multiple of the passed in datatype.");
ERRMSG(TextureNotBound, "A texture must be bound."); ERRMSG(TextureNotBound, "A texture must be bound.");
ERRMSG(TextureNotPow2, "The texture is a non-power-of-two texture."); ERRMSG(TextureNotPow2, "The texture is a non-power-of-two texture.");
ERRMSG(TypeMustMatchOriginalType, ERRMSG(TypeMismatch,
"Passed in texture target and format must match the one originally used to define the " "Passed in texture target and format must match the one originally used to define the "
"texture."); "texture.");
ERRMSG(TypeNotUnsignedShortByte, "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported."); ERRMSG(TypeNotUnsignedShortByte, "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported.");
ERRMSG(UniformSizeDoesNotMatchMethod, "Uniform size does not match uniform method."); ERRMSG(UniformSizeMismatch, "Uniform size does not match uniform method.");
ERRMSG(UnknownParameter, "Unknown parameter value.");
ERRMSG(VertexArrayNoBuffer, "An enabled vertex array has no buffer.");
ERRMSG(VertexArrayNoBufferPointer, "An enabled vertex array has no buffer and no pointer.");
ERRMSG(ViewportNegativeSize, "Viewport size cannot be negative."); ERRMSG(ViewportNegativeSize, "Viewport size cannot be negative.");
ERRMSG(WebglBindAttribLocationReservedPrefix, ERRMSG(WebglBindAttribLocationReservedPrefix,
"Attributes that begin with 'webgl_', or '_webgl_' are not allowed."); "Attributes that begin with 'webgl_', or '_webgl_' are not allowed.");
......
...@@ -94,13 +94,13 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, ...@@ -94,13 +94,13 @@ static bool ValidateTexImageFormatCombination(gl::Context *context,
// The type and format are valid if any supported internal format has that type and format // The type and format are valid if any supported internal format has that type and format
if (!ValidES3Format(format)) if (!ValidES3Format(format))
{ {
context->handleError(InvalidEnum() << "Invalid format."); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFormat);
return false; return false;
} }
if (!ValidES3Type(type)) if (!ValidES3Type(type))
{ {
context->handleError(InvalidEnum() << "Invalid type."); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidType);
return false; return false;
} }
...@@ -110,7 +110,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, ...@@ -110,7 +110,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context,
// the validation codepaths for glTexImage2D/3D, we record a GL_INVALID_VALUE error. // the validation codepaths for glTexImage2D/3D, we record a GL_INVALID_VALUE error.
if (!ValidES3InternalFormat(internalFormat)) if (!ValidES3InternalFormat(internalFormat))
{ {
context->handleError(InvalidValue() << "Invalid internalFormat."); ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidInternalFormat);
return false; return false;
} }
...@@ -1125,7 +1125,7 @@ bool ValidateInvalidateFramebuffer(Context *context, ...@@ -1125,7 +1125,7 @@ bool ValidateInvalidateFramebuffer(Context *context,
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Operation only supported on ES 3.0 and above"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -1141,7 +1141,7 @@ bool ValidateInvalidateFramebuffer(Context *context, ...@@ -1141,7 +1141,7 @@ bool ValidateInvalidateFramebuffer(Context *context,
defaultFramebuffer = context->getGLState().getReadFramebuffer()->id() == 0; defaultFramebuffer = context->getGLState().getReadFramebuffer()->id() == 0;
break; break;
default: default:
context->handleError(InvalidEnum() << "Invalid framebuffer target"); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
return false; return false;
} }
...@@ -1176,7 +1176,7 @@ bool ValidateDrawRangeElements(Context *context, ...@@ -1176,7 +1176,7 @@ bool ValidateDrawRangeElements(Context *context,
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -1566,7 +1566,7 @@ bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, G ...@@ -1566,7 +1566,7 @@ bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, G
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -1777,7 +1777,7 @@ bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bu ...@@ -1777,7 +1777,7 @@ bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bu
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -2051,7 +2051,7 @@ bool ValidateGenOrDeleteCountES3(Context *context, GLint count) ...@@ -2051,7 +2051,7 @@ bool ValidateGenOrDeleteCountES3(Context *context, GLint count)
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
if (count < 0) if (count < 0)
...@@ -2066,7 +2066,7 @@ bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode) ...@@ -2066,7 +2066,7 @@ bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode)
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
switch (primitiveMode) switch (primitiveMode)
...@@ -2152,7 +2152,7 @@ bool ValidateMapBufferRange(Context *context, ...@@ -2152,7 +2152,7 @@ bool ValidateMapBufferRange(Context *context,
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -2166,7 +2166,7 @@ bool ValidateFlushMappedBufferRange(Context *context, ...@@ -2166,7 +2166,7 @@ bool ValidateFlushMappedBufferRange(Context *context,
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -2297,7 +2297,7 @@ bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint ind ...@@ -2297,7 +2297,7 @@ bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint ind
{ {
if (context->getClientVersion() < ES_3_0) if (context->getClientVersion() < ES_3_0)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.0"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
return ValidateIndexedStateQuery(context, target, index, nullptr); return ValidateIndexedStateQuery(context, target, index, nullptr);
...@@ -2312,7 +2312,7 @@ bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context, ...@@ -2312,7 +2312,7 @@ bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context,
{ {
if (context->getClientVersion() < ES_3_0) if (context->getClientVersion() < ES_3_0)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.0"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -2338,7 +2338,7 @@ bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint i ...@@ -2338,7 +2338,7 @@ bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint i
{ {
if (context->getClientVersion() < ES_3_0) if (context->getClientVersion() < ES_3_0)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.0"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
return ValidateIndexedStateQuery(context, target, index, nullptr); return ValidateIndexedStateQuery(context, target, index, nullptr);
...@@ -2353,7 +2353,7 @@ bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context, ...@@ -2353,7 +2353,7 @@ bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context,
{ {
if (context->getClientVersion() < ES_3_0) if (context->getClientVersion() < ES_3_0)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.0"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -2384,7 +2384,7 @@ bool ValidateCopyBufferSubData(ValidationContext *context, ...@@ -2384,7 +2384,7 @@ bool ValidateCopyBufferSubData(ValidationContext *context,
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "CopyBufferSubData requires ES 3 or greater"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
...@@ -2466,8 +2466,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index) ...@@ -2466,8 +2466,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index)
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
<< "glGetStringi requires OpenGL ES 3.0 or higher.");
return false; return false;
} }
...@@ -2485,7 +2484,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index) ...@@ -2485,7 +2484,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index)
case GL_REQUESTABLE_EXTENSIONS_ANGLE: case GL_REQUESTABLE_EXTENSIONS_ANGLE:
if (!context->getExtensions().requestExtension) if (!context->getExtensions().requestExtension)
{ {
context->handleError(InvalidEnum() << "Invalid name."); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
return false; return false;
} }
if (index >= context->getRequestableExtensionStringCount()) if (index >= context->getRequestableExtensionStringCount())
...@@ -2498,7 +2497,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index) ...@@ -2498,7 +2497,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index)
break; break;
default: default:
context->handleError(InvalidEnum() << "Invalid name."); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidName);
return false; return false;
} }
...@@ -2556,8 +2555,7 @@ bool ValidateVertexAttribIPointer(ValidationContext *context, ...@@ -2556,8 +2555,7 @@ bool ValidateVertexAttribIPointer(ValidationContext *context,
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
<< "VertexAttribIPointer requires OpenGL ES 3.0 or higher.");
return false; return false;
} }
...@@ -2568,7 +2566,7 @@ bool ValidateVertexAttribIPointer(ValidationContext *context, ...@@ -2568,7 +2566,7 @@ bool ValidateVertexAttribIPointer(ValidationContext *context,
if (stride < 0) if (stride < 0)
{ {
context->handleError(InvalidValue() << "stride cannot be negative."); ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeStride);
return false; return false;
} }
...@@ -2626,13 +2624,13 @@ bool ValidateGetSynciv(Context *context, ...@@ -2626,13 +2624,13 @@ bool ValidateGetSynciv(Context *context,
{ {
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->handleError(InvalidOperation() << "GetSynciv requires OpenGL ES 3.0 or higher."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false; return false;
} }
if (bufSize < 0) if (bufSize < 0)
{ {
context->handleError(InvalidValue() << "bufSize cannot be negative."); ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
return false; return false;
} }
...@@ -2652,7 +2650,7 @@ bool ValidateGetSynciv(Context *context, ...@@ -2652,7 +2650,7 @@ bool ValidateGetSynciv(Context *context,
break; break;
default: default:
context->handleError(InvalidEnum() << "Invalid pname."); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
return false; return false;
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "libANGLE/validationES31.h" #include "libANGLE/validationES31.h"
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/ErrorStrings.h"
#include "libANGLE/Framebuffer.h" #include "libANGLE/Framebuffer.h"
#include "libANGLE/VertexArray.h" #include "libANGLE/VertexArray.h"
#include "libANGLE/validationES.h" #include "libANGLE/validationES.h"
...@@ -277,7 +278,7 @@ bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLbool ...@@ -277,7 +278,7 @@ bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLbool
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -298,7 +299,7 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context, ...@@ -298,7 +299,7 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -324,7 +325,7 @@ bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirec ...@@ -324,7 +325,7 @@ bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirec
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -452,7 +453,7 @@ bool ValidateGetTexLevelParameterBase(Context *context, ...@@ -452,7 +453,7 @@ bool ValidateGetTexLevelParameterBase(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1"); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -463,7 +464,7 @@ bool ValidateGetTexLevelParameterBase(Context *context, ...@@ -463,7 +464,7 @@ bool ValidateGetTexLevelParameterBase(Context *context,
if (!ValidTexLevelDestinationTarget(context, target)) if (!ValidTexLevelDestinationTarget(context, target))
{ {
context->handleError(InvalidEnum() << "Invalid texture target"); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget);
return false; return false;
} }
...@@ -507,7 +508,7 @@ bool ValidateGetTexLevelParameterBase(Context *context, ...@@ -507,7 +508,7 @@ bool ValidateGetTexLevelParameterBase(Context *context,
case GL_TEXTURE_COMPRESSED: case GL_TEXTURE_COMPRESSED:
break; break;
default: default:
context->handleError(InvalidEnum() << "Unknown pname."); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
return false; return false;
} }
...@@ -546,7 +547,7 @@ bool ValidateTexStorage2DMultiSample(Context *context, ...@@ -546,7 +547,7 @@ bool ValidateTexStorage2DMultiSample(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -558,7 +559,7 @@ bool ValidateTexStorage2DMultiSample(Context *context, ...@@ -558,7 +559,7 @@ bool ValidateTexStorage2DMultiSample(Context *context,
if (width < 1 || height < 1) if (width < 1 || height < 1)
{ {
context->handleError(InvalidValue() << "Width and height must be positive."); ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize);
return false; return false;
} }
...@@ -627,7 +628,7 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl ...@@ -627,7 +628,7 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -651,7 +652,7 @@ bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pna ...@@ -651,7 +652,7 @@ bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pna
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -705,8 +706,7 @@ bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pna ...@@ -705,8 +706,7 @@ bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pna
} }
default: default:
{ {
context->handleError(InvalidEnum() ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
<< "Invalid pname: 0x" << std::hex << std::uppercase << pname);
return false; return false;
} }
} }
...@@ -728,13 +728,13 @@ bool ValidationGetFramebufferParameteri(Context *context, ...@@ -728,13 +728,13 @@ bool ValidationGetFramebufferParameteri(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
if (!ValidFramebufferTarget(target)) if (!ValidFramebufferTarget(target))
{ {
context->handleError(InvalidEnum() << "Invalid framebuffer target."); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget);
return false; return false;
} }
...@@ -746,8 +746,7 @@ bool ValidationGetFramebufferParameteri(Context *context, ...@@ -746,8 +746,7 @@ bool ValidationGetFramebufferParameteri(Context *context,
case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS: case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
break; break;
default: default:
context->handleError(InvalidEnum() ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
<< "Invalid pname: 0x" << std::hex << std::uppercase << pname);
return false; return false;
} }
...@@ -769,7 +768,7 @@ bool ValidateGetProgramResourceIndex(Context *context, ...@@ -769,7 +768,7 @@ bool ValidateGetProgramResourceIndex(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES 3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -797,7 +796,7 @@ bool ValidateBindVertexBuffer(ValidationContext *context, ...@@ -797,7 +796,7 @@ bool ValidateBindVertexBuffer(ValidationContext *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -817,7 +816,7 @@ bool ValidateBindVertexBuffer(ValidationContext *context, ...@@ -817,7 +816,7 @@ bool ValidateBindVertexBuffer(ValidationContext *context,
if (offset < 0) if (offset < 0)
{ {
context->handleError(InvalidValue() << "offset cannot be negative."); ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
return false; return false;
} }
...@@ -843,7 +842,7 @@ bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingInde ...@@ -843,7 +842,7 @@ bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingInde
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -875,7 +874,7 @@ bool ValidateVertexAttribFormat(ValidationContext *context, ...@@ -875,7 +874,7 @@ bool ValidateVertexAttribFormat(ValidationContext *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -905,7 +904,7 @@ bool ValidateVertexAttribBinding(ValidationContext *context, ...@@ -905,7 +904,7 @@ bool ValidateVertexAttribBinding(ValidationContext *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -920,8 +919,7 @@ bool ValidateVertexAttribBinding(ValidationContext *context, ...@@ -920,8 +919,7 @@ bool ValidateVertexAttribBinding(ValidationContext *context,
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (attribIndex >= caps.maxVertexAttributes) if (attribIndex >= caps.maxVertexAttributes)
{ {
context->handleError(InvalidValue() ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute);
<< "attribindex must be smaller than MAX_VERTEX_ATTRIBS.");
return false; return false;
} }
...@@ -945,7 +943,7 @@ bool ValidateGetProgramResourceName(Context *context, ...@@ -945,7 +943,7 @@ bool ValidateGetProgramResourceName(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -970,7 +968,7 @@ bool ValidateGetProgramResourceName(Context *context, ...@@ -970,7 +968,7 @@ bool ValidateGetProgramResourceName(Context *context,
if (bufSize < 0) if (bufSize < 0)
{ {
context->handleError(InvalidValue() << "Invalid bufSize: " << bufSize); ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize);
return false; return false;
} }
...@@ -984,7 +982,7 @@ bool ValidateDispatchCompute(Context *context, ...@@ -984,7 +982,7 @@ bool ValidateDispatchCompute(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
...@@ -1119,7 +1117,7 @@ bool ValidateGetProgramResourceLocation(Context *context, ...@@ -1119,7 +1117,7 @@ bool ValidateGetProgramResourceLocation(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->handleError(InvalidOperation() << "Context does not support GLES3.1."); ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment