Commit 610640fa by Jamie Madill Committed by Commit Bot

Don't use gl::Error in validation.

Instead pass error code and error message directly to the Context. As a side effect every validation error has an associated message now. Reduces binary size by almost 100k. Bug: angleproject:2957 Change-Id: I045e8ab57f8f9d787654a32f6f037011fe3a9f24 Reviewed-on: https://chromium-review.googlesource.com/c/1335890 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent dc65c5bd
...@@ -98,14 +98,6 @@ using ErrorStream = angle::ErrorStreamBase<Error, GLenum, GL_NO_ERROR, GLenum, E ...@@ -98,14 +98,6 @@ using ErrorStream = angle::ErrorStreamBase<Error, GLenum, GL_NO_ERROR, GLenum, E
} // namespace priv } // namespace priv
using InvalidEnum = priv::ErrorStream<GL_INVALID_ENUM>;
using InvalidValue = priv::ErrorStream<GL_INVALID_VALUE>;
using InvalidOperation = priv::ErrorStream<GL_INVALID_OPERATION>;
using StackOverflow = priv::ErrorStream<GL_STACK_OVERFLOW>;
using StackUnderflow = priv::ErrorStream<GL_STACK_UNDERFLOW>;
using OutOfMemory = priv::ErrorStream<GL_OUT_OF_MEMORY>;
using InvalidFramebufferOperation = priv::ErrorStream<GL_INVALID_FRAMEBUFFER_OPERATION>;
inline Error NoError() inline Error NoError()
{ {
return Error::NoError(); return Error::NoError();
......
...@@ -9,366 +9,485 @@ ...@@ -9,366 +9,485 @@
#ifndef LIBANGLE_ERRORSTRINGS_H_ #ifndef LIBANGLE_ERRORSTRINGS_H_
#define LIBANGLE_ERRORSTRINGS_H_ #define LIBANGLE_ERRORSTRINGS_H_
#define ERRMSG(name, message) \
static const constexpr char *kError##name = static_cast<const char *>(message);
#define ANGLE_VALIDATION_ERR(context, error, errorName) \
context->handleError(error << kError##errorName)
namespace gl namespace gl
{ {
ERRMSG(ANGLECopyTexture3DUnavailable, "GL_ANGLE_copy_texture_3d extension not available."); constexpr const char *kError3DDepthStencil =
ERRMSG(BlitDimensionsOutOfRange, "BlitFramebuffer dimensions out of 32-bit integer range."); "Format cannot be GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL if target is GL_TEXTURE_3D";
ERRMSG(BlitExtensionDepthStencilWholeBufferBlit, constexpr const char *kErrorANGLECopyTexture3DUnavailable =
"Only whole-buffer depth and stencil blits are supported by this extension."); "GL_ANGLE_copy_texture_3d extension not available.";
ERRMSG(BlitExtensionFormatMismatch, constexpr const char *kErrorBaseLevelOutOfRange = "Texture base level out of range";
"Attempting to blit and the read and draw buffer formats don't match."); constexpr const char *kErrorBlitDimensionsOutOfRange =
ERRMSG(BlitExtensionFromInvalidAttachmentType, "BlitFramebuffer dimensions out of 32-bit integer range.";
"Blits are only supported from 2D texture, renderbuffer or default framebuffer attachments " constexpr const char *kErrorBlitExtensionDepthStencilWholeBufferBlit =
"in this extension."); "Only whole-buffer depth and stencil blits are supported by this extension.";
ERRMSG(BlitExtensionLinear, "Linear blit not supported in this extension."); constexpr const char *kErrorBlitExtensionFormatMismatch =
ERRMSG(BlitExtensionMultisampledDepthOrStencil, "Attempting to blit and the read and draw buffer formats don't match.";
"Multisampled depth/stencil blit is not supported by this extension."); constexpr const char *kErrorBlitExtensionFromInvalidAttachmentType =
ERRMSG(BlitExtensionMultisampledWholeBufferBlit, "Blits are only supported from 2D texture = renderbuffer or default framebuffer attachments "
"Only whole-buffer blit is supported from a multisampled read buffer in this extension."); "in this extension.";
ERRMSG(BlitExtensionNotAvailable, "Blit extension not available."); constexpr const char *kErrorBlitExtensionLinear = "Linear blit not supported in this extension.";
ERRMSG(BlitExtensionScaleOrFlip, constexpr const char *kErrorBlitExtensionMultisampledDepthOrStencil =
"Scaling and flipping in BlitFramebufferANGLE not supported by this implementation."); "Multisampled depth/stencil blit is not supported by this extension.";
ERRMSG(BlitExtensionToInvalidAttachmentType, constexpr const char *kErrorBlitExtensionMultisampledWholeBufferBlit =
"Blits are only supported to 2D texture, renderbuffer or default framebuffer attachments in " "Only whole-buffer blit is supported from a multisampled read buffer in this extension.";
"this extension."); constexpr const char *kErrorBlitExtensionNotAvailable = "Blit extension not available.";
ERRMSG(BlitFeedbackLoop, "Blit feedback loop: the read and draw framebuffers are the same."); constexpr const char *kErrorBlitExtensionScaleOrFlip =
ERRMSG(BlitFramebufferMissing, "Read and draw framebuffers must both exist for a blit to succeed."); "Scaling and flipping in BlitFramebufferANGLE not supported by this implementation.";
ERRMSG(BlitFromMultiview, "Attempt to read from a multi-view framebuffer."); constexpr const char *kErrorBlitExtensionToInvalidAttachmentType =
ERRMSG(BlitDepthOrStencilFormatMismatch, "Blits are only supported to 2D texture = renderbuffer or default framebuffer attachments in "
"Depth/stencil buffer format combination not allowed for blit."); "this extension.";
ERRMSG(BlitIntegerWithLinearFilter, constexpr const char *kErrorBlitFeedbackLoop =
"Cannot use GL_LINEAR filter when blitting a integer framebuffer."); "Blit feedback loop: the read and draw framebuffers are the same.";
ERRMSG(BlitInvalidFilter, "Invalid blit filter."); constexpr const char *kErrorBlitFramebufferMissing =
ERRMSG(BlitInvalidMask, "Invalid blit mask."); "Read and draw framebuffers must both exist for a blit to succeed.";
ERRMSG(BlitMissingColor, constexpr const char *kErrorBlitFromMultiview = "Attempt to read from a multi-view framebuffer.";
"Attempt to read from a missing color attachment of a complete framebuffer."); constexpr const char *kErrorBlitDepthOrStencilFormatMismatch =
ERRMSG(BlitMissingDepthOrStencil, "Depth/stencil buffer format combination not allowed for blit.";
"Attempt to read from a missing depth/stencil attachment of a complete framebuffer."); constexpr const char *kErrorBlitIntegerWithLinearFilter =
ERRMSG(BlitOnlyNearestForNonColor, "Cannot use GL_LINEAR filter when blitting a integer framebuffer.";
"Only nearest filtering can be used when blitting buffers other than the color buffer."); constexpr const char *kErrorBlitInvalidFilter = "Invalid blit filter.";
ERRMSG(BlitToMultiview, "Attempt to write to a multi-view framebuffer."); constexpr const char *kErrorBlitInvalidMask = "Invalid blit mask.";
ERRMSG(BlitTypeMismatchFixedOrFloat, constexpr const char *kErrorBlitMissingColor =
"If the read buffer contains fixed-point or floating-point values, the draw buffer must as " "Attempt to read from a missing color attachment of a complete framebuffer.";
"well."); constexpr const char *kErrorBlitMissingDepthOrStencil =
ERRMSG(BlitTypeMismatchFixedPoint, "Attempt to read from a missing depth/stencil attachment of a complete framebuffer.";
"If the read buffer contains fixed-point values, the draw buffer must as well."); constexpr const char *kErrorBlitOnlyNearestForNonColor =
ERRMSG(BlitTypeMismatchSignedInteger, "Only nearest filtering can be used when blitting buffers other than the color buffer.";
"If the read buffer contains signed integer values the draw buffer must as well."); constexpr const char *kErrorBlitToMultiview = "Attempt to write to a multi-view framebuffer.";
ERRMSG(BlitTypeMismatchUnsignedInteger, constexpr const char *kErrorBlitTypeMismatchFixedOrFloat =
"If the read buffer contains unsigned integer values the draw buffer must as well."); "If the read buffer contains fixed-point or floating-point values = the draw buffer must as "
ERRMSG(BlitMultisampledBoundsMismatch, "well.";
constexpr const char *kErrorBlitTypeMismatchFixedPoint =
"If the read buffer contains fixed-point values = the draw buffer must as well.";
constexpr const char *kErrorBlitTypeMismatchSignedInteger =
"If the read buffer contains signed integer values the draw buffer must as well.";
constexpr const char *kErrorBlitTypeMismatchUnsignedInteger =
"If the read buffer contains unsigned integer values the draw buffer must as well.";
constexpr const char *kErrorBlitMultisampledBoundsMismatch =
"Attempt to blit from a multisampled framebuffer and the bounds don't match with the draw " "Attempt to blit from a multisampled framebuffer and the bounds don't match with the draw "
"framebuffer."); "framebuffer.";
ERRMSG(BlitMultisampledFormatOrBoundsMismatch, constexpr const char *kErrorBlitMultisampledFormatOrBoundsMismatch =
"Attempt to blit from a multisampled framebuffer and the bounds or format of the color " "Attempt to blit from a multisampled framebuffer and the bounds or format of the color "
"buffer don't match with the draw framebuffer."); "buffer don't match with the draw framebuffer.";
ERRMSG(BlitSameImageColor, "Read and write color attachments cannot be the same image."); constexpr const char *kErrorBlitSameImageColor =
ERRMSG(BlitSameImageDepthOrStencil, "Read and write color attachments cannot be the same image.";
"Read and write depth stencil attachments cannot be the same image."); constexpr const char *kErrorBlitSameImageDepthOrStencil =
ERRMSG(BufferBoundForTransformFeedback, "Buffer is bound for transform feedback."); "Read and write depth stencil attachments cannot be the same image.";
ERRMSG(BufferNotBound, "A buffer must be bound."); constexpr const char *kErrorBufferBoundForTransformFeedback =
ERRMSG(BufferMapped, "An active buffer is mapped"); "Buffer is bound for transform feedback.";
ERRMSG(ColorNumberGreaterThanMaxDualSourceDrawBuffers, constexpr const char *kErrorBufferNotBound = "A buffer must be bound.";
"Color number for secondary color greater than or equal to MAX_DUAL_SOURCE_DRAW_BUFFERS"); constexpr const char *kErrorBufferMapped = "An active buffer is mapped";
ERRMSG(ColorNumberGreaterThanMaxDrawBuffers, constexpr const char *kErrorColorNumberGreaterThanMaxDualSourceDrawBuffers =
"Color number for primary color greater than or equal to MAX_DRAW_BUFFERS"); "Color number for secondary color greater than or equal to MAX_DUAL_SOURCE_DRAW_BUFFERS";
ERRMSG(CompressedTextureDimensionsMustMatchData, constexpr const char *kErrorColorNumberGreaterThanMaxDrawBuffers =
"Compressed texture dimensions must exactly match the dimensions of the data passed in."); "Color number for primary color greater than or equal to MAX_DRAW_BUFFERS";
ERRMSG(CompressedTexturesNotAttachable, "Compressed textures cannot be attached to a framebuffer."); constexpr const char *kErrorCompressedMismatch =
ERRMSG(CubemapFacesEqualDimensions, "Each cubemap face must have equal width and height."); "Compressed data is valid if-and-only-if the texture is compressed.";
ERRMSG(CubemapIncomplete, constexpr const char *kErrorCompressedTextureDimensionsMustMatchData =
"Texture is not cubemap complete. All cubemaps faces must be defined and be the same size."); "Compressed texture dimensions must exactly match the dimensions of the data passed in.";
ERRMSG(DefaultFramebufferInvalidAttachment, constexpr const char *kErrorCompressedTexturesNotAttachable =
"Invalid attachment when the default framebuffer is bound."); "Compressed textures cannot be attached to a framebuffer.";
ERRMSG(DefaultFramebufferTarget, "It is invalid to change default FBO's attachments"); constexpr const char *kErrorCopyAlias = "The read and write copy regions alias memory.";
ERRMSG(DestinationImmutable, "Destination texture cannot be immutable."); constexpr const char *kErrorCubemapFacesEqualDimensions =
ERRMSG(DestinationLevelNotDefined, "Each cubemap face must have equal width and height.";
"The destination level of the destination texture must be defined."); constexpr const char *kErrorCubemapIncomplete =
ERRMSG(DestinationTextureTooSmall, "Destination texture too small."); "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size.";
ERRMSG(DispatchIndirectBufferNotBound, "Dispatch indirect buffer must be bound."); constexpr const char *kErrorDefaultFramebufferInvalidAttachment =
ERRMSG(DrawBufferTypeMismatch, "Invalid attachment when the default framebuffer is bound.";
"Fragment shader output type does not match the bound framebuffer attachment type."); constexpr const char *kErrorDefaultFramebufferTarget =
ERRMSG(DrawFramebufferIncomplete, "Draw framebuffer is incomplete"); "It is invalid to change default FBO's attachments";
ERRMSG(ElementArrayBufferBoundForTransformFeedback, constexpr const char *kErrorDefaultVertexArray = "Default vertex array object is bound.";
constexpr const char *kErrorDestinationImmutable = "Destination texture cannot be immutable.";
constexpr const char *kErrorDestinationLevelNotDefined =
"The destination level of the destination texture must be defined.";
constexpr const char *kErrorDestinationTextureTooSmall = "Destination texture too small.";
constexpr const char *kErrorDimensionsMustBePow2 = "Texture dimensions must be power-of-two.";
constexpr const char *kErrorDispatchIndirectBufferNotBound =
"Dispatch indirect buffer must be bound.";
constexpr const char *kErrorDrawIndirectBufferNotBound = "Draw indirect buffer must be bound.";
constexpr const char *kErrorDrawBufferTypeMismatch =
"Fragment shader output type does not match the bound framebuffer attachment type.";
constexpr const char *kErrorDrawFramebufferIncomplete = "Draw framebuffer is incomplete";
constexpr const char *kErrorElementArrayBufferBoundForTransformFeedback =
"It is undefined behavior to use an element array buffer that is bound for transform " "It is undefined behavior to use an element array buffer that is bound for transform "
"feedback."); "feedback.";
ERRMSG(EnumNotSupported, "Enum is not currently supported."); constexpr const char *kErrorEnumNotSupported = "Enum is not currently supported.";
ERRMSG(EnumRequiresGLES31, "Enum requires GLES 3.1"); constexpr const char *kErrorEnumRequiresGLES31 = "Enum requires GLES 3.1";
ERRMSG(ES31Required, "OpenGL ES 3.1 Required"); constexpr const char *kErrorES31Required = "OpenGL ES 3.1 Required";
ERRMSG(ES3Required, "OpenGL ES 3.0 Required."); constexpr const char *kErrorES3Required = "OpenGL ES 3.0 Required.";
ERRMSG(ExceedsMaxElement, "Element value exceeds maximum element index."); constexpr const char *kErrorExceedsMaxElement = "Element value exceeds maximum element index.";
ERRMSG(ExpectedProgramName, "Expected a program name, but found a shader name."); constexpr const char *kErrorExpectedProgramName =
ERRMSG(ExpectedShaderName, "Expected a shader name, but found a program name."); "Expected a program name = but found a shader name.";
ERRMSG(ExtensionNotEnabled, "Extension is not enabled."); constexpr const char *kErrorExpectedShaderName =
ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Texture."); "Expected a shader name = but found a program name.";
ERRMSG(FragDataBindingIndexOutOfRange, "Fragment output color index must be zero or one."); constexpr const char *kErrorExtensionNotEnabled = "Extension is not enabled.";
ERRMSG(FramebufferIncompleteAttachment, constexpr const char *kErrorFeedbackLoop =
"Attachment type must be compatible with attachment object."); "Feedback loop formed between Framebuffer and active Texture.";
ERRMSG(FramebufferTextureInvalidLayer, "Layer invalid for framebuffer texture attachment."); constexpr const char *kErrorFragDataBindingIndexOutOfRange =
ERRMSG(FramebufferTextureInvalidMipLevel, "Mip level invalid for framebuffer texture attachment."); "Fragment output color index must be zero or one.";
ERRMSG(FramebufferTextureLayerIncorrectTextureType, constexpr const char *kErrorFramebufferIncomplete = "Framebuffer is incomplete.";
"Texture is not a three-dimensional or two-dimensionsal array texture."); constexpr const char *kErrorFramebufferIncompleteAttachment =
ERRMSG(GenerateMipmapNotAllowed, "Texture format does not support mipmap generation."); "Attachment type must be compatible with attachment object.";
ERRMSG(GeometryShaderExtensionNotEnabled, "GL_EXT_geometry_shader extension not enabled."); constexpr const char *kErrorFramebufferTextureInvalidLayer =
ERRMSG(GLES1Only, "GLES1-only function."); "Layer invalid for framebuffer texture attachment.";
ERRMSG(ImmutableTextureBound, constexpr const char *kErrorFramebufferTextureInvalidMipLevel =
"Mip level invalid for framebuffer texture attachment.";
constexpr const char *kErrorFramebufferTextureLayerIncorrectTextureType =
"Texture is not a three-dimensional or two-dimensionsal array texture.";
constexpr const char *kErrorGenerateMipmapNotAllowed =
"Texture format does not support mipmap generation.";
constexpr const char *kErrorGeometryShaderExtensionNotEnabled =
"GL_EXT_geometry_shader extension not enabled.";
constexpr const char *kErrorGLES1Only = "GLES1-only function.";
constexpr const char *kErrorImmutableTextureBound =
"The value of TEXTURE_IMMUTABLE_FORMAT for the texture currently bound to target on the " "The value of TEXTURE_IMMUTABLE_FORMAT for the texture currently bound to target on the "
"active texture unit is true."); "active texture unit is true.";
ERRMSG(IncompatibleDrawModeAgainstGeometryShader, constexpr const char *kErrorIncompatibleDrawModeAgainstGeometryShader =
"Primitive mode is incompatible with the input primitive type of the geometry shader."); "Primitive mode is incompatible with the input primitive type of the geometry shader.";
ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count."); constexpr const char *kErrorIndexExceedsMaxActiveUniform =
ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS."); "Index must be less than program active uniform count.";
ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS."); constexpr const char *kErrorIndexExceedsMaxActiveUniformBlock =
ERRMSG(InsufficientBufferSize, "Insufficient buffer size."); "Index must be less than program active uniform block count.";
ERRMSG(InsufficientVertexBufferSize, "Vertex buffer is not big enough for the draw call"); constexpr const char *kErrorIndexExceedsMaxAtomicCounterBufferBindings =
ERRMSG(IntegerOverflow, "Integer overflow."); "Index must be less than MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.";
ERRMSG(InternalFormatRequiresTexture2DArray, constexpr const char *kErrorIndexExceedsMaxDrawBuffer = "Index must be less than MAX_DRAW_BUFFERS.";
"internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY."); constexpr const char *kErrorIndexExceedsMaxTransformFeedbackAttribs =
ERRMSG(InvalidAttachment, "Invalid Attachment Type."); "Index must be less than MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.";
ERRMSG(InvalidBlendEquation, "Invalid blend equation."); constexpr const char *kErrorIndexExceedsMaxUniformBufferBindings =
ERRMSG(InvalidBlendFunction, "Invalid blend function."); "Index must be less than MAX_UNIFORM_BUFFER_BINDINGS.";
ERRMSG(InvalidBorder, "Border must be 0."); constexpr const char *kErrorIndexExceedsMaxVertexAttribute =
ERRMSG(InvalidBufferTypes, "Invalid buffer target enum."); "Index must be less than MAX_VERTEX_ATTRIBS.";
ERRMSG(InvalidBufferUsage, "Invalid buffer usage enum."); constexpr const char *kErrorIndexExceedsMaxWorkgroupDimensions =
ERRMSG(InvalidClearMask, "Invalid mask bits."); "Index must be less than the number of workgroup dimensions (3).";
ERRMSG(InvalidClientState, "Invalid client vertex array type."); constexpr const char *kErrorIndexExceedsSamples = "Index must be less than the value of SAMPLES.";
ERRMSG(InvalidClipPlane, "Invalid clip plane."); constexpr const char *kErrorInsufficientBufferSize = "Insufficient buffer size.";
ERRMSG(InvalidCombinedImageUnit, constexpr const char *kErrorInsufficientVertexBufferSize =
"Specified unit must be in [GL_TEXTURE0, GL_TEXTURE0 + GL_MAX_COMBINED_IMAGE_UNITS)"); "Vertex buffer is not big enough for the draw call";
ERRMSG(InvalidConstantColor, constexpr const char *kErrorIntegerOverflow = "Integer overflow.";
constexpr const char *kErrorInternalFormatRequiresTexture2DArray =
"internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY.";
constexpr const char *kErrorInvalidAttachment = "Invalid Attachment Type.";
constexpr const char *kErrorInvalidBlendEquation = "Invalid blend equation.";
constexpr const char *kErrorInvalidBlendFunction = "Invalid blend function.";
constexpr const char *kErrorInvalidBooleanValue =
"Invalid boolean value. Must be GL_FALSE or GL_TRUE.";
constexpr const char *kErrorInvalidBorder = "Border must be 0.";
constexpr const char *kErrorInvalidBufferTypes = "Invalid buffer target.";
constexpr const char *kErrorInvalidBufferUsage = "Invalid buffer usage enum.";
constexpr const char *kErrorInvalidClearMask = "Invalid mask bits.";
constexpr const char *kErrorInvalidClientState = "Invalid client vertex array type.";
constexpr const char *kErrorInvalidClipPlane = "Invalid clip plane.";
constexpr const char *kErrorInvalidCombinedImageUnit =
"Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_COMBINED_IMAGE_UNITS)";
constexpr const char *kErrorInvalidCompressedFormat = "Not a valid compressed texture format.";
constexpr const char *kErrorInvalidCompressedImageSize = "Invalid compressed image size.";
constexpr const char *kErrorInvalidConstantColor =
"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."); constexpr const char *kErrorInvalidCopyCombination = "Invalid copy texture format combination.";
ERRMSG(InvalidCullMode, "Cull mode not recognized."); constexpr const char *kErrorInvalidCoverMode = "Invalid cover mode.";
ERRMSG(InvalidDebugSeverity, "Invalid debug severity."); constexpr const char *kErrorInvalidCullMode = "Cull mode not recognized.";
ERRMSG(InvalidDebugSource, "Invalid debug source."); constexpr const char *kErrorInvalidDebugSeverity = "Invalid debug severity.";
ERRMSG(InvalidDebugType, "Invalid debug type."); constexpr const char *kErrorInvalidDebugSource = "Invalid debug source.";
ERRMSG(InvalidDepthRange, "Near value cannot be greater than far."); constexpr const char *kErrorInvalidDebugType = "Invalid debug type.";
ERRMSG(InvalidDestinationTexture, "Destination texture is not a valid texture object."); constexpr const char *kErrorInvalidDepthRange = "Near value cannot be greater than far.";
ERRMSG(InvalidDestinationTextureType, "Invalid destination texture type."); constexpr const char *kErrorInvalidDepthStencilDrawBuffer =
ERRMSG(InvalidDrawMode, "Invalid draw mode."); "Draw buffer must be zero when using depth or stencil.";
ERRMSG(InvalidDrawModeTransformFeedback, constexpr const char *kErrorInvalidDestinationTexture =
"Draw mode must match current transform feedback object's draw mode."); "Destination texture is not a valid texture object.";
ERRMSG(InvalidFence, "Invalid fence object."); constexpr const char *kErrorInvalidDestinationTextureType = "Invalid destination texture type.";
ERRMSG(InvalidFenceState, "Fence must be set."); constexpr const char *kErrorInvalidDrawMode = "Invalid draw mode.";
ERRMSG(InvalidFillMode, "Invalid fill mode."); constexpr const char *kErrorInvalidDrawModeTransformFeedback =
ERRMSG(InvalidFilterTexture, "Texture only supports NEAREST and LINEAR filtering."); "Draw mode must match current transform feedback object's draw mode.";
ERRMSG(InvalidFogDensity, "Invalid fog density (must be nonnegative)."); constexpr const char *kErrorInvalidFence = "Invalid fence object.";
ERRMSG(InvalidFogMode, "Invalid fog mode."); constexpr const char *kErrorInvalidFenceCondition = "Invalid value for condition.";
ERRMSG(InvalidFogParameter, "Invalid fog parameter."); constexpr const char *kErrorInvalidFenceState = "Fence must be set.";
ERRMSG(InvalidFormat, "Invalid format."); constexpr const char *kErrorInvalidFillMode = "Invalid fill mode.";
ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target."); constexpr const char *kErrorInvalidFilterTexture =
ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture."); "Texture only supports NEAREST and LINEAR filtering.";
ERRMSG(InvalidFramebufferAttachmentParameter, "Invalid parameter name for framebuffer attachment."); constexpr const char *kErrorInvalidFlags = "Invalid value for flags.";
ERRMSG(InvalidFramebufferLayer, constexpr const char *kErrorInvalidFogDensity = "Invalid fog density (must be nonnegative).";
"Framebuffer layer cannot be less than 0 or greater than GL_MAX_FRAMEBUFFER_LAYERS_EXT."); constexpr const char *kErrorInvalidFogMode = "Invalid fog mode.";
ERRMSG(InvalidImageUnit, constexpr const char *kErrorInvalidFogParameter = "Invalid fog parameter.";
"Image unit cannot be greater than or equal to the value of MAX_IMAGE_UNITS."); constexpr const char *kErrorInvalidFormat = "Invalid format.";
ERRMSG(InvalidInternalFormat, "Invalid internal format."); constexpr const char *kErrorInvalidFormatCombination =
ERRMSG(InvalidLight, "Invalid light."); "Invalid combination of format = type and internalFormat.";
ERRMSG(InvalidLightModelParameter, "Invalid light model parameter."); constexpr const char *kErrorInvalidFramebufferTarget = "Invalid framebuffer target.";
ERRMSG(InvalidLightParameter, "Invalid light parameter."); constexpr const char *kErrorInvalidFramebufferTextureLevel =
ERRMSG(InvalidLogicOp, "Invalid logical operation."); "Mipmap level must be 0 when attaching a texture.";
ERRMSG(InvalidMaterialFace, "Invalid material face."); constexpr const char *kErrorInvalidFramebufferAttachmentParameter =
ERRMSG(InvalidMaterialParameter, "Invalid material parameter."); "Invalid parameter name for framebuffer attachment.";
ERRMSG(InvalidMatrixMode, "Invalid matrix mode."); constexpr const char *kErrorInvalidFramebufferLayer =
ERRMSG(InvalidMemoryBarrierBit, "Invalid memory barrier bit."); "Framebuffer layer cannot be less than 0 or greater than GL_MAX_FRAMEBUFFER_LAYERS_EXT.";
ERRMSG(InvalidMipLevel, "Level of detail outside of range."); constexpr const char *kErrorInvalidIndirectOffset =
ERRMSG(InvalidMultitextureUnit, "indirect must be a multiple of the size of uint in basic machine units.";
"Specified unit must be in [GL_TEXTURE0, GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)"); constexpr const char *kErrorInvalidImageUnit =
ERRMSG(InvalidMultisampledFramebufferOperation, "Invalid operation on multisampled framebuffer"); "Image unit cannot be greater than or equal to the value of MAX_IMAGE_UNITS.";
ERRMSG(InvalidName, "Invalid name."); constexpr const char *kErrorInvalidInternalFormat = "Invalid internal format.";
ERRMSG(InvalidNameCharacters, "Name contains invalid characters."); constexpr const char *kErrorInvalidLight = "Invalid light.";
ERRMSG(InvalidPname, "Invalid pname."); constexpr const char *kErrorInvalidLightModelParameter = "Invalid light model parameter.";
ERRMSG(InvalidPointerQuery, "Invalid pointer query."); constexpr const char *kErrorInvalidLightParameter = "Invalid light parameter.";
ERRMSG(InvalidPointParameter, "Invalid point parameter."); constexpr const char *kErrorInvalidLogicOp = "Invalid logical operation.";
ERRMSG(InvalidPointParameterValue, "Invalid point parameter value (must be non-negative)."); constexpr const char *kErrorInvalidMaterialFace = "Invalid material face.";
ERRMSG(InvalidPointSizeValue, "Invalid point size (must be positive)."); constexpr const char *kErrorInvalidMaterialParameter = "Invalid material parameter.";
ERRMSG(InvalidPrecision, "Invalid or unsupported precision type."); constexpr const char *kErrorInvalidMatrixMode = "Invalid matrix mode.";
ERRMSG(InvalidProgramName, "Program object expected."); constexpr const char *kErrorInvalidMemoryBarrierBit = "Invalid memory barrier bit.";
ERRMSG(InvalidProjectionMatrix, constexpr const char *kErrorInvalidMipLevel = "Level of detail outside of range.";
"Invalid projection matrix. Left/right, top/bottom, near/far intervals cannot be zero, and " constexpr const char *kErrorInvalidMipLevels = "Invalid level count.";
"near/far cannot be less than zero."); constexpr const char *kErrorInvalidMultitextureUnit =
ERRMSG(InvalidQueryId, "Invalid query Id."); "Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)";
ERRMSG(InvalidQueryTarget, "Invalid query target."); constexpr const char *kErrorInvalidMultisampledFramebufferOperation =
ERRMSG(InvalidQueryType, "Invalid query type."); "Invalid operation on multisampled framebuffer";
ERRMSG(InvalidRange, "Invalid range."); constexpr const char *kErrorInvalidName = "Invalid name.";
ERRMSG(InvalidRenderbufferInternalFormat, "Invalid renderbuffer internalformat."); constexpr const char *kErrorInvalidNameCharacters = "Name contains invalid characters.";
ERRMSG(InvalidRenderbufferTarget, "Invalid renderbuffer target."); constexpr const char *kErrorInvalidPname = "Invalid pname.";
ERRMSG(InvalidRenderbufferTextureParameter, "Invalid parameter name for renderbuffer attachment."); constexpr const char *kErrorInvalidPointerQuery = "Invalid pointer query.";
ERRMSG(InvalidRenderbufferWidthHeight, constexpr const char *kErrorInvalidPointParameter = "Invalid point parameter.";
"Renderbuffer width and height cannot be negative and cannot exceed maximum texture size."); constexpr const char *kErrorInvalidPointParameterValue =
ERRMSG(InvalidSampleMaskNumber, "Invalid point parameter value (must be non-negative).";
"MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS."); constexpr const char *kErrorInvalidPointSizeValue = "Invalid point size (must be positive).";
ERRMSG(InvalidSampler, "Sampler is not valid"); constexpr const char *kErrorInvalidPrecision = "Invalid or unsupported precision type.";
ERRMSG(InvalidShaderName, "Shader object expected."); constexpr const char *kErrorInvalidProgramName = "Program object expected.";
ERRMSG(InvalidShaderType, "Invalid shader type."); constexpr const char *kErrorInvalidProjectionMatrix =
ERRMSG(InvalidShadingModel, "Invalid shading model."); "Invalid projection matrix. Left/right = top/bottom = near/far intervals cannot be zero = and "
ERRMSG(InvalidSourceTexture, "Source texture is not a valid texture object."); "near/far cannot be less than zero.";
ERRMSG(InvalidSourceTextureLevel, "Invalid source texture level."); constexpr const char *kErrorInvalidQueryId = "Invalid query Id.";
ERRMSG(InvalidSourceTextureSize, "Invalid source texture height or width."); constexpr const char *kErrorInvalidQueryTarget = "Invalid query target.";
ERRMSG(InvalidStencil, "Invalid stencil."); constexpr const char *kErrorInvalidQueryType = "Invalid query type.";
ERRMSG(InvalidStencilBitMask, "Invalid stencil bit mask."); constexpr const char *kErrorInvalidRange = "Invalid range.";
ERRMSG(InvalidTarget, "Invalid target."); constexpr const char *kErrorInvalidRenderbufferInternalFormat =
ERRMSG(InvalidTextureCombine, "Invalid texture combine mode."); "Invalid renderbuffer internalformat.";
ERRMSG(InvalidTextureCombineSrc, "Invalid texture combine source."); constexpr const char *kErrorInvalidRenderbufferTarget = "Invalid renderbuffer target.";
ERRMSG(InvalidTextureCombineOp, "Invalid texture combine operand."); constexpr const char *kErrorInvalidRenderbufferTextureParameter =
ERRMSG(InvalidTextureEnvMode, "Invalid texture environment mode."); "Invalid parameter name for renderbuffer attachment.";
ERRMSG(InvalidTextureEnvParameter, "Invalid texture environment parameter."); constexpr const char *kErrorInvalidRenderbufferWidthHeight =
ERRMSG(InvalidTextureEnvScale, "Invalid texture environment scale."); "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size.";
ERRMSG(InvalidTextureEnvTarget, "Invalid texture environment target."); constexpr const char *kErrorInvalidSampleMaskNumber =
ERRMSG(InvalidTextureFilterParam, "Texture filter not recognized."); "MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS.";
ERRMSG(InvalidTextureName, "Not a valid texture object name."); constexpr const char *kErrorInvalidSampler = "Sampler is not valid";
ERRMSG(InvalidTextureRange, "Cannot be less than 0 or greater than maximum number of textures."); constexpr const char *kErrorInvalidShaderName = "Shader object expected.";
ERRMSG(InvalidTextureTarget, "Invalid or unsupported texture target."); constexpr const char *kErrorInvalidShaderType = "Invalid shader type.";
ERRMSG(InvalidTextureWrap, "Texture wrap mode not recognized."); constexpr const char *kErrorInvalidShadingModel = "Invalid shading model.";
ERRMSG(InvalidType, "Invalid type."); constexpr const char *kErrorInvalidSourceTexture = "Source texture is not a valid texture object.";
ERRMSG(InvalidTypePureInt, "Invalid type, should be integer"); constexpr const char *kErrorInvalidSourceTextureLevel = "Invalid source texture level.";
ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8."); constexpr const char *kErrorInvalidSourceTextureSize = "Invalid source texture height or width.";
ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4."); constexpr const char *kErrorInvalidStencil = "Invalid stencil.";
ERRMSG(InvalidVertexPointerSize, "Size for built-in vertex attribute is outside allowed range."); constexpr const char *kErrorInvalidStencilBitMask = "Invalid stencil bit mask.";
ERRMSG(InvalidVertexPointerStride, "Invalid stride for built-in vertex attribute."); constexpr const char *kErrorInvalidTarget = "Invalid target.";
ERRMSG(InvalidVertexPointerType, "Invalid type for built-in vertex attribute."); constexpr const char *kErrorInvalidTextureCombine = "Invalid texture combine mode.";
ERRMSG(InvalidWidth, "Invalid width."); constexpr const char *kErrorInvalidTextureCombineSrc = "Invalid texture combine source.";
ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type."); constexpr const char *kErrorInvalidTextureCombineOp = "Invalid texture combine operand.";
ERRMSG(LevelNotZero, "Texture level must be zero."); constexpr const char *kErrorInvalidTextureEnvMode = "Invalid texture environment mode.";
ERRMSG(LightParameterOutOfRange, "Light parameter out of range."); constexpr const char *kErrorInvalidTextureEnvParameter = "Invalid texture environment parameter.";
ERRMSG(MaterialParameterOutOfRange, "Material parameter out of range."); constexpr const char *kErrorInvalidTextureEnvScale = "Invalid texture environment scale.";
ERRMSG(MatrixStackOverflow, "Current matrix stack is full."); constexpr const char *kErrorInvalidTextureEnvTarget = "Invalid texture environment target.";
ERRMSG(MatrixStackUnderflow, "Current matrix stack has only a single matrix."); constexpr const char *kErrorInvalidTextureFilterParam = "Texture filter not recognized.";
ERRMSG(MismatchedByteCountType, "Buffer size does not align with data type."); constexpr const char *kErrorInvalidTextureName = "Not a valid texture object name.";
ERRMSG(MismatchedFormat, "Format must match internal format."); constexpr const char *kErrorInvalidTextureRange =
ERRMSG(MismatchedTargetAndFormat, "Invalid texture target and format combination."); "Cannot be less than 0 or greater than maximum number of textures.";
ERRMSG(MismatchedTypeAndFormat, "Invalid format and type combination."); constexpr const char *kErrorInvalidTextureTarget = "Invalid or unsupported texture target.";
ERRMSG(MismatchedVariableProgram, "Variable is not part of the current program."); constexpr const char *kErrorInvalidTextureWrap = "Texture wrap mode not recognized.";
ERRMSG(MissingReadAttachment, "Missing read attachment."); constexpr const char *kErrorInvalidTimeout = "Invalid value for timeout.";
ERRMSG(MustHaveElementArrayBinding, "Must have element array buffer binding."); constexpr const char *kErrorInvalidTransformFeedbackAttribsCount =
ERRMSG(MultiviewMismatch, "Count exeeds MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.";
constexpr const char *kErrorInvalidType = "Invalid type.";
constexpr const char *kErrorInvalidTypePureInt = "Invalid type = should be integer";
constexpr const char *kErrorInvalidUniformCount = "Only array uniforms may have count > 1.";
constexpr const char *kErrorInvalidUniformLocation = "Invalid uniform location";
constexpr const char *kErrorInvalidUnpackAlignment = "Unpack alignment must be 1 = 2 = 4 = or 8.";
constexpr const char *kErrorInvalidVertexArray = "Vertex array does not exist.";
constexpr const char *kErrorInvalidVertexAttrSize =
"Vertex attribute size must be 1 = 2 = 3 = or 4.";
constexpr const char *kErrorInvalidVertexPointerSize =
"Size for built-in vertex attribute is outside allowed range.";
constexpr const char *kErrorInvalidVertexPointerStride =
"Invalid stride for built-in vertex attribute.";
constexpr const char *kErrorInvalidVertexPointerType =
"Invalid type for built-in vertex attribute.";
constexpr const char *kErrorInvalidWidth = "Invalid width.";
constexpr const char *kErrorInvalidWrapModeTexture = "Invalid wrap mode for texture type.";
constexpr const char *kErrorLevelNotZero = "Texture level must be zero.";
constexpr const char *kErrorLightParameterOutOfRange = "Light parameter out of range.";
constexpr const char *kErrorMaterialParameterOutOfRange = "Material parameter out of range.";
constexpr const char *kErrorMatrixStackOverflow = "Current matrix stack is full.";
constexpr const char *kErrorMatrixStackUnderflow = "Current matrix stack has only a single matrix.";
constexpr const char *kErrorMismatchedByteCountType = "Buffer size does not align with data type.";
constexpr const char *kErrorMismatchedFormat = "Format must match internal format.";
constexpr const char *kErrorMismatchedTargetAndFormat =
"Invalid texture target and format combination.";
constexpr const char *kErrorMismatchedTypeAndFormat = "Invalid format and type combination.";
constexpr const char *kErrorMismatchedVariableProgram =
"Variable is not part of the current program.";
constexpr const char *kErrorMissingReadAttachment = "Missing read attachment.";
constexpr const char *kErrorMissingTexture = "No Texture is bound to the specified target.";
constexpr const char *kErrorMustHaveElementArrayBinding = "Must have element array buffer bound.";
constexpr const char *kErrorMultiviewActive =
"The number of views in the active draw framebuffer is greater than 1.";
constexpr const char *kErrorMultiviewViewsTooLarge =
"numViews cannot be greater than GL_MAX_VIEWS_ANGLE.";
constexpr const char *kErrorMultiviewViewsTooSmall = "numViews cannot be less than 1.";
constexpr const char *kErrorMultiviewNotAvailable = "ANGLE_multiview is not available.";
constexpr const char *kErrorMultiviewMismatch =
"The number of views in the active program and draw " "The number of views in the active program and draw "
"framebuffer does not match."); "framebuffer does not match.";
ERRMSG(MultiviewTransformFeedback, constexpr const char *kErrorMultiviewTransformFeedback =
"There is an active transform feedback object when " "There is an active transform feedback object when "
"the number of views in the active draw framebuffer " "the number of views in the active draw framebuffer "
"is greater than 1."); "is greater than 1.";
ERRMSG(MultiviewTimerQuery, constexpr const char *kErrorMultiviewTimerQuery =
"There is an active query for target " "There is an active query for target "
"GL_TIME_ELAPSED_EXT when the number of views in the " "GL_TIME_ELAPSED_EXT when the number of views in the "
"active draw framebuffer is greater than 1."); "active draw framebuffer is greater than 1.";
ERRMSG(MultisampleArrayExtensionRequired, "GL_ANGLE_texture_multisample_array not enabled."); constexpr const char *kErrorMultisampleArrayExtensionRequired =
ERRMSG(MultisampleTextureExtensionOrES31Required, "GL_ANGLE_texture_multisample_array not enabled.";
"GL_ANGLE_texture_multisample or GLES 3.1 required."); constexpr const char *kErrorMultisampleTextureExtensionOrES31Required =
ERRMSG(NameBeginsWithGL, "Attributes that begin with 'gl_' are not allowed."); "GL_ANGLE_texture_multisample or GLES 3.1 required.";
ERRMSG(NegativeAttachments, "Negative number of attachments."); constexpr const char *kErrorNameBeginsWithGL = "Attributes that begin with 'gl_' are not allowed.";
ERRMSG(NegativeBufferSize, "Negative buffer size."); constexpr const char *kErrorNegativeAttachments = "Negative number of attachments.";
ERRMSG(NegativeCount, "Negative count."); constexpr const char *kErrorNegativeBufferSize = "Negative buffer size.";
ERRMSG(NegativeHeightWidthDepth, "Cannot have negative height, width, or depth."); constexpr const char *kErrorNegativeCount = "Negative count.";
ERRMSG(NegativeLength, "Negative length."); constexpr const char *kErrorNegativeHeightWidthDepth =
ERRMSG(NegativeMaxCount, "Negative maxcount."); "Cannot have negative height = width = or depth.";
ERRMSG(NegativeOffset, "Negative offset."); constexpr const char *kErrorNegativeLayer = "Negative layer.";
ERRMSG(NegativePrimcount, "Primcount must be greater than or equal to zero."); constexpr const char *kErrorNegativeLength = "Negative length.";
ERRMSG(NegativeSize, "Cannot have negative height or width."); constexpr const char *kErrorNegativeMaxCount = "Negative maxcount.";
ERRMSG(NegativeStart, "Cannot have negative start."); constexpr const char *kErrorNegativeOffset = "Negative offset.";
ERRMSG(NegativeStride, "Cannot have negative stride."); constexpr const char *kErrorNegativePrimcount = "Primcount must be greater than or equal to zero.";
ERRMSG(NegativeXYZ, "x, y, or z cannot be negative."); constexpr const char *kErrorNegativeSize = "Cannot have negative height or width.";
ERRMSG(NoActiveComputeShaderStage, "No active compute shader stage in this program."); constexpr const char *kErrorNegativeStart = "Cannot have negative start.";
ERRMSG(NoActiveGeometryShaderStage, "No active geometry shader stage in this program."); constexpr const char *kErrorNegativeStride = "Cannot have negative stride.";
ERRMSG( constexpr const char *kErrorNegativeXYZ = "x = y = or z cannot be negative.";
NoActiveGraphicsShaderStage, constexpr const char *kErrorNoActiveComputeShaderStage =
"It is a undefined behaviour to render without vertex shader stage or fragment shader stage."); "No active compute shader stage in this program.";
ERRMSG(NoActiveProgramWithComputeShader, "No active program for the compute shader stage."); constexpr const char *kErrorNoActiveGeometryShaderStage =
ERRMSG(NonPositiveDrawTextureDimension, "No active geometry shader stage in this program.";
"Both width and height argument of drawn texture must be positive."); constexpr const char *kErrorNoActiveGraphicsShaderStage =
ERRMSG(NoSuchPath, "No such path object."); "It is a undefined behaviour to render without vertex shader stage or fragment shader stage.";
ERRMSG(NoTransformFeedbackOutputVariables, constexpr const char *kErrorNoActiveProgramWithComputeShader =
"The active program has specified no output variables to record."); "No active program for the compute shader stage.";
ERRMSG(NoZeroDivisor, "At least one enabled attribute must have a divisor of zero."); constexpr const char *kErrorNonPositiveDrawTextureDimension =
ERRMSG(NVFenceNotSupported, "GL_NV_fence is not supported"); "Both width and height argument of drawn texture must be positive.";
ERRMSG(ObjectNotGenerated, "Object cannot be used because it has not been generated."); constexpr const char *kErrorNoSuchPath = "No such path object.";
ERRMSG(OffsetMustBeMultipleOfType, "Offset must be a multiple of the passed in datatype."); constexpr const char *kErrorNoTransformFeedbackOutputVariables =
ERRMSG(OffsetMustBeMultipleOfUint, "The active program has specified no output variables to record.";
"Offset must be a multiple of the size, in basic machine units, of uint"); constexpr const char *kErrorNoZeroDivisor =
ERRMSG(OutsideOfBounds, "Parameter outside of bounds."); "At least one enabled attribute must have a divisor of zero.";
ERRMSG(ParamOverflow, "The provided parameters overflow with the provided buffer."); constexpr const char *kErrorNVFenceNotSupported = "GL_NV_fence is not supported";
ERRMSG(PixelDataNotNull, "Pixel data must be null."); constexpr const char *kErrorObjectNotGenerated =
ERRMSG(PixelDataNull, "Pixel data cannot be null."); "Object cannot be used because it has not been generated.";
ERRMSG(PixelPackBufferBoundForTransformFeedback, constexpr const char *kErrorOffsetMustBeMultipleOfType =
"It is undefined behavior to use a pixel pack buffer that is bound for transform feedback."); "Offset must be a multiple of the passed in datatype.";
ERRMSG( constexpr const char *kErrorOffsetMustBeMultipleOfUint =
PixelUnpackBufferBoundForTransformFeedback, "Offset must be a multiple of the size = in basic machine units = of uint";
"It is undefined behavior to use a pixel unpack buffer that is bound for transform feedback."); constexpr const char *kErrorOffsetOverflow = "Offset overflows texture dimensions.";
ERRMSG(PointSizeArrayExtensionNotEnabled, "GL_OES_point_size_array not enabled."); constexpr const char *kErrorOutsideOfBounds = "Parameter outside of bounds.";
ERRMSG(ProgramDoesNotExist, "Program doesn't exist."); constexpr const char *kErrorParamOverflow =
ERRMSG(ProgramInterfaceMustBeProgramOutput, "programInterface must be set to GL_PROGRAM_OUTPUT."); "The provided parameters overflow with the provided buffer.";
ERRMSG(ProgramNotBound, "A program must be bound."); constexpr const char *kErrorPixelDataNotNull = "Pixel data must be null.";
ERRMSG(ProgramNotLinked, "Program not linked."); constexpr const char *kErrorPixelDataNull = "Pixel data cannot be null.";
ERRMSG(QueryActive, "Query is active."); constexpr const char *kErrorPixelPackBufferBoundForTransformFeedback =
ERRMSG(QueryExtensionNotEnabled, "Query extension not enabled."); "It is undefined behavior to use a pixel pack buffer that is bound for transform feedback.";
ERRMSG(ReadBufferNone, "Read buffer is GL_NONE."); constexpr const char *kErrorPixelUnpackBufferBoundForTransformFeedback =
ERRMSG(RenderableInternalFormat, "It is undefined behavior to use a pixel unpack buffer that is bound for transform feedback.";
"SizedInternalformat must be color-renderable, depth-renderable, or stencil-renderable."); constexpr const char *kErrorPointSizeArrayExtensionNotEnabled =
ERRMSG(RenderbufferNotBound, "A renderbuffer must be bound."); "GL_OES_point_size_array not enabled.";
ERRMSG(ResourceMaxTextureSize, "Desired resource size is greater than max texture size."); constexpr const char *kErrorProgramDoesNotExist = "Program doesn't exist.";
ERRMSG(SamplesZero, "Samples may not be zero."); constexpr const char *kErrorProgramInterfaceMustBeProgramOutput =
ERRMSG(SamplesOutOfRange, "programInterface must be set to GL_PROGRAM_OUTPUT.";
"Samples must not be greater than maximum supported value for the format."); constexpr const char *kErrorProgramNotBound = "A program must be bound.";
ERRMSG(ShaderAttachmentHasShader, "Shader attachment already has a shader."); constexpr const char *kErrorProgramNotLinked = "Program not linked.";
ERRMSG(ShaderSourceInvalidCharacters, "Shader source contains invalid characters."); constexpr const char *kErrorQueryActive = "Query is active.";
ERRMSG(ShaderToDetachMustBeAttached, constexpr const char *kErrorQueryExtensionNotEnabled = "Query extension not enabled.";
"Shader to be detached must be currently attached to the program."); constexpr const char *kErrorReadBufferNone = "Read buffer is GL_NONE.";
ERRMSG(SourceLevelNotDefined, "The source level of the source texture must be defined."); constexpr const char *kErrorReadBufferNotAttached = "Read buffer has no attachment.";
ERRMSG(SourceTextureTooSmall, "The specified dimensions are outside of the bounds of the texture."); constexpr const char *kErrorRectangleTextureCompressed =
ERRMSG(StencilReferenceMaskOrMismatch, "Rectangle texture cannot have a compressed format.";
constexpr const char *kErrorRelativeOffsetTooLarge =
"relativeOffset cannot be greater than MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.";
constexpr const char *kErrorRenderableInternalFormat =
"SizedInternalformat must be color-renderable = depth-renderable = or stencil-renderable.";
constexpr const char *kErrorRenderbufferNotBound = "A renderbuffer must be bound.";
constexpr const char *kErrorResourceMaxRenderbufferSize =
"Desired resource size is greater than max renderbuffer size.";
constexpr const char *kErrorResourceMaxTextureSize =
"Desired resource size is greater than max texture size.";
constexpr const char *kErrorSamplesZero = "Samples may not be zero.";
constexpr const char *kErrorSamplesOutOfRange =
"Samples must not be greater than maximum supported value for the format.";
constexpr const char *kErrorShaderAttachmentHasShader = "Shader attachment already has a shader.";
constexpr const char *kErrorShaderSourceInvalidCharacters =
"Shader source contains invalid characters.";
constexpr const char *kErrorShaderToDetachMustBeAttached =
"Shader to be detached must be currently attached to the program.";
constexpr const char *kErrorSourceLevelNotDefined =
"The source level of the source texture must be defined.";
constexpr const char *kErrorSourceTextureTooSmall =
"The specified dimensions are outside of the bounds of the texture.";
constexpr const char *kErrorStencilReferenceMaskOrMismatch =
"Stencil reference and mask values must be the same for front facing and back facing " "Stencil reference and mask values must be the same for front facing and back facing "
"triangles."); "triangles.";
ERRMSG(StrideMustBeMultipleOfType, "Stride must be a multiple of the passed in datatype."); constexpr const char *kErrorStrideMustBeMultipleOfType =
ERRMSG(TargetMustBeTexture2DMultisampleArrayOES, "Stride must be a multiple of the passed in datatype.";
"Target must be TEXTURE_2D_MULTISAMPLE_ARRAY_OES."); constexpr const char *kErrorSyncMissing = "Sync object does not exist.";
ERRMSG(TextureNotBound, "A texture must be bound."); constexpr const char *kErrorTargetMustBeTexture2DMultisampleArrayOES =
ERRMSG(TextureNotPow2, "The texture is a non-power-of-two texture."); "Target must be TEXTURE_2D_MULTISAMPLE_ARRAY_OES.";
ERRMSG(TextureTargetRequiresES31, "Texture target requires at least OpenGL ES 3.1."); constexpr const char *kErrorTextureIsImmutable = "Texture is immutable.";
ERRMSG(TextureTypeConflict, "Two textures of different types use the same sampler location."); constexpr const char *kErrorTextureNotBound = "A texture must be bound.";
ERRMSG(TextureWidthOrHeightOutOfRange, constexpr const char *kErrorTextureNotPow2 = "The texture is a non-power-of-two texture.";
"Width and height must be less than or equal to GL_MAX_TEXTURE_SIZE."); constexpr const char *kErrorTextureSizeTooSmall =
ERRMSG(TransformFeedbackBufferDoubleBound, "Texture dimensions must all be greater than zero.";
constexpr const char *kErrorTextureTargetRequiresES31 =
"Texture target requires at least OpenGL ES 3.1.";
constexpr const char *kErrorTextureTypeConflict =
"Two textures of different types use the same sampler location.";
constexpr const char *kErrorTextureWidthOrHeightOutOfRange =
"Width and height must be less than or equal to GL_MAX_TEXTURE_SIZE.";
constexpr const char *kErrorTransformFeedbackBufferDoubleBound =
"A transform feedback buffer that would be written to is also bound to a " "A transform feedback buffer that would be written to is also bound to a "
"non-transform-feedback target, which would cause undefined behavior."); "non-transform-feedback target = which would cause undefined behavior.";
ERRMSG(TransformFeedbackBufferTooSmall, "Not enough space in bound transform feedback buffers."); constexpr const char *kErrorTransformFeedbackBufferTooSmall =
ERRMSG(TransformFeedbackDoesNotExist, "Transform feedback object that does not exist."); "Not enough space in bound transform feedback buffers.";
ERRMSG(TypeMismatch, constexpr const char *kErrorTransformFeedbackDoesNotExist =
"Transform feedback object that does not exist.";
constexpr const char *kErrorTransformFeedbackNotActive = "No Transform Feedback object is active.";
constexpr const char *kErrorTransformFeedbackNotPaused =
"The active Transform Feedback object is not paused.";
constexpr const char *kErrorTransformFeedbackPaused =
"The active Transform Feedback object is paused.";
constexpr const char *kErrorTransformFeedbackVaryingIndexOutOfRange =
"Index must be less than the transform feedback varying count in the program.";
constexpr const char *kErrorTypeMismatch =
"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."); constexpr const char *kErrorTypeNotUnsignedShortByte =
ERRMSG(UniformBufferBoundForTransformFeedback, "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported.";
"It is undefined behavior to use an uniform buffer that is bound for transform feedback."); constexpr const char *kErrorUniformBufferBoundForTransformFeedback =
ERRMSG(UniformBufferTooSmall, "It is undefined behavior to use an uniform buffer that is bound for transform feedback.";
"It is undefined behaviour to use a uniform buffer that is too small."); constexpr const char *kErrorUniformBufferTooSmall =
ERRMSG(UniformBufferUnbound, "It is undefined behaviour to use a uniform buffer that is too small.";
"It is undefined behaviour to have a used but unbound uniform buffer."); constexpr const char *kErrorUniformBufferUnbound =
ERRMSG(UniformSizeMismatch, "Uniform size does not match uniform method."); "It is undefined behaviour to have a used but unbound uniform buffer.";
ERRMSG(UnknownParameter, "Unknown parameter value."); constexpr const char *kErrorUniformSizeMismatch = "Uniform size does not match uniform method.";
ERRMSG(UnsizedInternalFormatUnsupported, constexpr const char *kErrorUnknownParameter = "Unknown parameter value.";
"Internalformat is one of the unsupported unsized base internalformats."); constexpr const char *kErrorUnsizedInternalFormatUnsupported =
ERRMSG(UnsupportedDrawModeForTransformFeedback, "Internalformat is one of the unsupported unsized base internalformats.";
"The draw command is unsupported when transform feedback is active and not paused."); constexpr const char *kErrorUnsupportedDrawModeForTransformFeedback =
ERRMSG(VertexArrayNoBuffer, "An enabled vertex array has no buffer."); "The draw command is unsupported when transform feedback is active and not paused.";
ERRMSG(VertexArrayNoBufferPointer, "An enabled vertex array has no buffer and no pointer."); constexpr const char *kErrorVertexArrayNoBuffer = "An enabled vertex array has no buffer.";
ERRMSG(VertexBufferBoundForTransformFeedback, constexpr const char *kErrorVertexArrayNoBufferPointer =
"It is undefined behavior to use a vertex buffer that is bound for transform feedback."); "An enabled vertex array has no buffer and no pointer.";
ERRMSG(VertexShaderTypeMismatch, constexpr const char *kErrorVertexBufferBoundForTransformFeedback =
"Vertex shader input type does not match the type of the bound vertex attribute.") "It is undefined behavior to use a vertex buffer that is bound for transform feedback.";
ERRMSG(ViewportNegativeSize, "Viewport size cannot be negative."); constexpr const char *kErrorVertexShaderTypeMismatch =
ERRMSG(Webgl2NameLengthLimitExceeded, "Location lengths must not be greater than 1024 characters."); "Vertex shader input type does not match the type of the bound vertex attribute.";
ERRMSG(WebglBindAttribLocationReservedPrefix, constexpr const char *kErrorViewportNegativeSize = "Viewport size cannot be negative.";
"Attributes that begin with 'webgl_', or '_webgl_' are not allowed."); constexpr const char *kErrorWebgl2NameLengthLimitExceeded =
ERRMSG(WebglNameLengthLimitExceeded, "Location lengths must not be greater than 1024 characters.";
"Location name lengths must not be greater than 256 characters."); constexpr const char *kErrorWebglBindAttribLocationReservedPrefix =
ERRMSG(ZeroBoundToTarget, "Zero is bound to target."); "Attributes that begin with 'webgl_' = or '_webgl_' are not allowed.";
} constexpr const char *kErrorWebglNameLengthLimitExceeded =
#undef ERRMSG "Location name lengths must not be greater than 256 characters.";
constexpr const char *kErrorZeroBoundToTarget = "Zero is bound to target.";
} // namespace gl
#endif // LIBANGLE_ERRORSTRINGS_H_ #endif // LIBANGLE_ERRORSTRINGS_H_
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -600,12 +600,12 @@ bool ValidateES3TexStorage3DParameters(Context *context, ...@@ -600,12 +600,12 @@ bool ValidateES3TexStorage3DParameters(Context *context,
// implementation format info for incomplete framebuffers. It seems like these queries are // implementation format info for incomplete framebuffers. It seems like these queries are
// incongruent with the other errors. // incongruent with the other errors.
// Inlined for speed. // Inlined for speed.
template <typename ErrorStream = InvalidFramebufferOperation> template <GLenum ErrorCode = GL_INVALID_FRAMEBUFFER_OPERATION>
ANGLE_INLINE bool ValidateFramebufferComplete(Context *context, Framebuffer *framebuffer) ANGLE_INLINE bool ValidateFramebufferComplete(Context *context, Framebuffer *framebuffer)
{ {
if (!framebuffer->isComplete(context)) if (!framebuffer->isComplete(context))
{ {
context->handleError(ErrorStream()); context->validationError(ErrorCode, kErrorFramebufferIncomplete);
return false; return false;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define ANGLE_VALIDATE_IS_GLES1(context) \ #define ANGLE_VALIDATE_IS_GLES1(context) \
if (context->getClientMajorVersion() > 1) \ if (context->getClientMajorVersion() > 1) \
{ \ { \
ANGLE_VALIDATION_ERR(context, InvalidOperation(), GLES1Only); \ context->validationError(GL_INVALID_OPERATION, kErrorGLES1Only); \
return false; \ return false; \
} }
...@@ -40,7 +40,7 @@ bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func) ...@@ -40,7 +40,7 @@ bool ValidateAlphaFuncCommon(Context *context, AlphaTestFunc func)
case AlphaTestFunc::NotEqual: case AlphaTestFunc::NotEqual:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported); context->validationError(GL_INVALID_ENUM, kErrorEnumNotSupported);
return false; return false;
} }
} }
...@@ -58,12 +58,12 @@ bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType ...@@ -58,12 +58,12 @@ bool ValidateClientStateCommon(Context *context, ClientVertexArrayType arrayType
case ClientVertexArrayType::PointSize: case ClientVertexArrayType::PointSize:
if (!context->getExtensions().pointSizeArray) if (!context->getExtensions().pointSizeArray)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled); context->validationError(GL_INVALID_ENUM, kErrorPointSizeArrayExtensionNotEnabled);
return false; return false;
} }
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidClientState); context->validationError(GL_INVALID_ENUM, kErrorInvalidClientState);
return false; return false;
} }
} }
...@@ -79,7 +79,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context, ...@@ -79,7 +79,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context,
if (stride < 0) if (stride < 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerStride); context->validationError(GL_INVALID_VALUE, kErrorInvalidVertexPointerStride);
return false; return false;
} }
...@@ -104,7 +104,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context, ...@@ -104,7 +104,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context,
case ClientVertexArrayType::PointSize: case ClientVertexArrayType::PointSize:
if (!context->getExtensions().pointSizeArray) if (!context->getExtensions().pointSizeArray)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), PointSizeArrayExtensionNotEnabled); context->validationError(GL_INVALID_ENUM, kErrorPointSizeArrayExtensionNotEnabled);
return false; return false;
} }
...@@ -118,7 +118,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context, ...@@ -118,7 +118,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context,
if (size < minSize || size > maxSize) if (size < minSize || size > maxSize)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidVertexPointerSize); context->validationError(GL_INVALID_VALUE, kErrorInvalidVertexPointerSize);
return false; return false;
} }
...@@ -127,7 +127,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context, ...@@ -127,7 +127,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context,
case GL_BYTE: case GL_BYTE:
if (arrayType == ClientVertexArrayType::PointSize) if (arrayType == ClientVertexArrayType::PointSize)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType); context->validationError(GL_INVALID_ENUM, kErrorInvalidVertexPointerType);
return false; return false;
} }
break; break;
...@@ -135,7 +135,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context, ...@@ -135,7 +135,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context,
if (arrayType == ClientVertexArrayType::PointSize || if (arrayType == ClientVertexArrayType::PointSize ||
arrayType == ClientVertexArrayType::Color) arrayType == ClientVertexArrayType::Color)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType); context->validationError(GL_INVALID_ENUM, kErrorInvalidVertexPointerType);
return false; return false;
} }
break; break;
...@@ -143,7 +143,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context, ...@@ -143,7 +143,7 @@ bool ValidateBuiltinVertexAttributeCommon(Context *context,
case GL_FLOAT: case GL_FLOAT:
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidVertexPointerType); context->validationError(GL_INVALID_ENUM, kErrorInvalidVertexPointerType);
return false; return false;
} }
...@@ -154,7 +154,7 @@ bool ValidateLightCaps(Context *context, GLenum light) ...@@ -154,7 +154,7 @@ bool ValidateLightCaps(Context *context, GLenum light)
{ {
if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights) if (light < GL_LIGHT0 || light >= GL_LIGHT0 + context->getCaps().maxLights)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLight); context->validationError(GL_INVALID_ENUM, kErrorInvalidLight);
return false; return false;
} }
...@@ -185,7 +185,7 @@ bool ValidateLightCommon(Context *context, ...@@ -185,7 +185,7 @@ bool ValidateLightCommon(Context *context,
case LightParameter::SpotExponent: case LightParameter::SpotExponent:
if (params[0] < 0.0f || params[0] > 128.0f) if (params[0] < 0.0f || params[0] > 128.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange); context->validationError(GL_INVALID_VALUE, kErrorLightParameterOutOfRange);
return false; return false;
} }
return true; return true;
...@@ -196,7 +196,7 @@ bool ValidateLightCommon(Context *context, ...@@ -196,7 +196,7 @@ bool ValidateLightCommon(Context *context,
} }
if (params[0] < 0.0f || params[0] > 90.0f) if (params[0] < 0.0f || params[0] > 90.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange); context->validationError(GL_INVALID_VALUE, kErrorLightParameterOutOfRange);
return false; return false;
} }
return true; return true;
...@@ -205,12 +205,12 @@ bool ValidateLightCommon(Context *context, ...@@ -205,12 +205,12 @@ bool ValidateLightCommon(Context *context,
case LightParameter::QuadraticAttenuation: case LightParameter::QuadraticAttenuation:
if (params[0] < 0.0f) if (params[0] < 0.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), LightParameterOutOfRange); context->validationError(GL_INVALID_VALUE, kErrorLightParameterOutOfRange);
return false; return false;
} }
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidLightParameter);
return false; return false;
} }
} }
...@@ -227,7 +227,7 @@ bool ValidateLightSingleComponent(Context *context, ...@@ -227,7 +227,7 @@ bool ValidateLightSingleComponent(Context *context,
if (GetLightParameterCount(pname) > 1) if (GetLightParameterCount(pname) > 1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidLightParameter);
return false; return false;
} }
...@@ -249,12 +249,12 @@ bool ValidateMaterialCommon(Context *context, ...@@ -249,12 +249,12 @@ bool ValidateMaterialCommon(Context *context,
case MaterialParameter::Shininess: case MaterialParameter::Shininess:
if (params[0] < 0.0f || params[0] > 128.0f) if (params[0] < 0.0f || params[0] > 128.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), MaterialParameterOutOfRange); context->validationError(GL_INVALID_VALUE, kErrorMaterialParameterOutOfRange);
return false; return false;
} }
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialParameter);
return false; return false;
} }
} }
...@@ -268,7 +268,7 @@ bool ValidateMaterialSetting(Context *context, ...@@ -268,7 +268,7 @@ bool ValidateMaterialSetting(Context *context,
if (face != GL_FRONT_AND_BACK) if (face != GL_FRONT_AND_BACK)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialFace); context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialFace);
return false; return false;
} }
...@@ -281,7 +281,7 @@ bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pnam ...@@ -281,7 +281,7 @@ bool ValidateMaterialQuery(Context *context, GLenum face, MaterialParameter pnam
if (face != GL_FRONT && face != GL_BACK) if (face != GL_FRONT && face != GL_BACK)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialFace); context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialFace);
return false; return false;
} }
...@@ -302,7 +302,7 @@ bool ValidateMaterialSingleComponent(Context *context, ...@@ -302,7 +302,7 @@ bool ValidateMaterialSingleComponent(Context *context,
if (GetMaterialParameterCount(pname) > 1) if (GetMaterialParameterCount(pname) > 1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMaterialParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidMaterialParameter);
return false; return false;
} }
...@@ -318,7 +318,7 @@ bool ValidateLightModelCommon(Context *context, GLenum pname) ...@@ -318,7 +318,7 @@ bool ValidateLightModelCommon(Context *context, GLenum pname)
case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_TWO_SIDE:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidLightModelParameter);
return false; return false;
} }
} }
...@@ -335,7 +335,7 @@ bool ValidateLightModelSingleComponent(Context *context, GLenum pname) ...@@ -335,7 +335,7 @@ bool ValidateLightModelSingleComponent(Context *context, GLenum pname)
case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_TWO_SIDE:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLightModelParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidLightModelParameter);
return false; return false;
} }
} }
...@@ -346,7 +346,7 @@ bool ValidateClipPlaneCommon(Context *context, GLenum plane) ...@@ -346,7 +346,7 @@ bool ValidateClipPlaneCommon(Context *context, GLenum plane)
if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes) if (plane < GL_CLIP_PLANE0 || plane >= GL_CLIP_PLANE0 + context->getCaps().maxClipPlanes)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidClipPlane); context->validationError(GL_INVALID_ENUM, kErrorInvalidClipPlane);
return false; return false;
} }
...@@ -369,7 +369,7 @@ bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params) ...@@ -369,7 +369,7 @@ bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
case GL_LINEAR: case GL_LINEAR:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFogMode); context->validationError(GL_INVALID_VALUE, kErrorInvalidFogMode);
return false; return false;
} }
} }
...@@ -381,12 +381,12 @@ bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params) ...@@ -381,12 +381,12 @@ bool ValidateFogCommon(Context *context, GLenum pname, const GLfloat *params)
case GL_FOG_DENSITY: case GL_FOG_DENSITY:
if (params[0] < 0.0f) if (params[0] < 0.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFogDensity); context->validationError(GL_INVALID_VALUE, kErrorInvalidFogDensity);
return false; return false;
} }
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFogParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidFogParameter);
return false; return false;
} }
return true; return true;
...@@ -417,7 +417,7 @@ bool ValidateTexEnvCommon(Context *context, ...@@ -417,7 +417,7 @@ bool ValidateTexEnvCommon(Context *context,
case TextureEnvMode::Replace: case TextureEnvMode::Replace:
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureEnvMode); context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureEnvMode);
return false; return false;
} }
break; break;
...@@ -439,13 +439,13 @@ bool ValidateTexEnvCommon(Context *context, ...@@ -439,13 +439,13 @@ bool ValidateTexEnvCommon(Context *context,
case TextureCombine::Dot3Rgba: case TextureCombine::Dot3Rgba:
if (pname == TextureEnvParameter::CombineAlpha) if (pname == TextureEnvParameter::CombineAlpha)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), context->validationError(GL_INVALID_VALUE,
InvalidTextureCombine); kErrorInvalidTextureCombine);
return false; return false;
} }
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureCombine); context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureCombine);
return false; return false;
} }
break; break;
...@@ -466,7 +466,8 @@ bool ValidateTexEnvCommon(Context *context, ...@@ -466,7 +466,8 @@ bool ValidateTexEnvCommon(Context *context,
case TextureSrc::Texture: case TextureSrc::Texture:
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureCombineSrc); context->validationError(GL_INVALID_VALUE,
kErrorInvalidTextureCombineSrc);
return false; return false;
} }
break; break;
...@@ -490,13 +491,14 @@ bool ValidateTexEnvCommon(Context *context, ...@@ -490,13 +491,14 @@ bool ValidateTexEnvCommon(Context *context,
pname == TextureEnvParameter::Op1Alpha || pname == TextureEnvParameter::Op1Alpha ||
pname == TextureEnvParameter::Op2Alpha) pname == TextureEnvParameter::Op2Alpha)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), context->validationError(GL_INVALID_VALUE,
InvalidTextureCombine); kErrorInvalidTextureCombine);
return false; return false;
} }
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureCombineOp); context->validationError(GL_INVALID_VALUE,
kErrorInvalidTextureCombineOp);
return false; return false;
} }
break; break;
...@@ -505,21 +507,21 @@ bool ValidateTexEnvCommon(Context *context, ...@@ -505,21 +507,21 @@ bool ValidateTexEnvCommon(Context *context,
case TextureEnvParameter::AlphaScale: case TextureEnvParameter::AlphaScale:
if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f) if (params[0] != 1.0f && params[0] != 2.0f && params[0] != 4.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureEnvScale); context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureEnvScale);
return false; return false;
} }
break; break;
case TextureEnvParameter::Color: case TextureEnvParameter::Color:
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvParameter);
return false; return false;
} }
break; break;
case TextureEnvTarget::PointSprite: case TextureEnvTarget::PointSprite:
if (!context->getExtensions().pointSprite) if (!context->getExtensions().pointSprite)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvTarget); context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvTarget);
return false; return false;
} }
switch (pname) switch (pname)
...@@ -527,12 +529,12 @@ bool ValidateTexEnvCommon(Context *context, ...@@ -527,12 +529,12 @@ bool ValidateTexEnvCommon(Context *context,
case TextureEnvParameter::PointCoordReplace: case TextureEnvParameter::PointCoordReplace:
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvParameter);
return false; return false;
} }
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureEnvTarget); context->validationError(GL_INVALID_ENUM, kErrorInvalidTextureEnvTarget);
return false; return false;
} }
return true; return true;
...@@ -592,13 +594,13 @@ bool ValidatePointParameterCommon(Context *context, PointParameter pname, const ...@@ -592,13 +594,13 @@ bool ValidatePointParameterCommon(Context *context, PointParameter pname, const
{ {
if (params[i] < 0.0f) if (params[i] < 0.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidPointParameterValue); context->validationError(GL_INVALID_VALUE, kErrorInvalidPointParameterValue);
return false; return false;
} }
} }
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidPointParameter);
return false; return false;
} }
...@@ -611,7 +613,7 @@ bool ValidatePointSizeCommon(Context *context, GLfloat size) ...@@ -611,7 +613,7 @@ bool ValidatePointSizeCommon(Context *context, GLfloat size)
if (size <= 0.0f) if (size <= 0.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidPointSizeValue); context->validationError(GL_INVALID_VALUE, kErrorInvalidPointSizeValue);
return false; return false;
} }
...@@ -624,7 +626,7 @@ bool ValidateDrawTexCommon(Context *context, float width, float height) ...@@ -624,7 +626,7 @@ bool ValidateDrawTexCommon(Context *context, float width, float height)
if (width <= 0.0f || height <= 0.0f) if (width <= 0.0f || height <= 0.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), NonPositiveDrawTextureDimension); context->validationError(GL_INVALID_VALUE, kErrorNonPositiveDrawTextureDimension);
return false; return false;
} }
...@@ -766,7 +768,7 @@ bool ValidateFrustumf(Context *context, ...@@ -766,7 +768,7 @@ bool ValidateFrustumf(Context *context,
ANGLE_VALIDATE_IS_GLES1(context); ANGLE_VALIDATE_IS_GLES1(context);
if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f) if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
} }
return true; return true;
} }
...@@ -782,7 +784,7 @@ bool ValidateFrustumx(Context *context, ...@@ -782,7 +784,7 @@ bool ValidateFrustumx(Context *context,
ANGLE_VALIDATE_IS_GLES1(context); ANGLE_VALIDATE_IS_GLES1(context);
if (l == r || b == t || n == f || n <= 0 || f <= 0) if (l == r || b == t || n == f || n <= 0 || f <= 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
} }
return true; return true;
} }
...@@ -843,7 +845,7 @@ bool ValidateGetPointerv(Context *context, GLenum pname, void **params) ...@@ -843,7 +845,7 @@ bool ValidateGetPointerv(Context *context, GLenum pname, void **params)
case GL_POINT_SIZE_ARRAY_POINTER_OES: case GL_POINT_SIZE_ARRAY_POINTER_OES:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointerQuery); context->validationError(GL_INVALID_ENUM, kErrorInvalidPointerQuery);
return false; return false;
} }
} }
...@@ -977,7 +979,7 @@ bool ValidateLogicOp(Context *context, LogicalOperation opcode) ...@@ -977,7 +979,7 @@ bool ValidateLogicOp(Context *context, LogicalOperation opcode)
case LogicalOperation::Xor: case LogicalOperation::Xor:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidLogicOp); context->validationError(GL_INVALID_ENUM, kErrorInvalidLogicOp);
return false; return false;
} }
} }
...@@ -1025,7 +1027,7 @@ bool ValidateMatrixMode(Context *context, MatrixType mode) ...@@ -1025,7 +1027,7 @@ bool ValidateMatrixMode(Context *context, MatrixType mode)
case MatrixType::Texture: case MatrixType::Texture:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMatrixMode); context->validationError(GL_INVALID_ENUM, kErrorInvalidMatrixMode);
return false; return false;
} }
} }
...@@ -1093,7 +1095,7 @@ bool ValidateOrthof(Context *context, ...@@ -1093,7 +1095,7 @@ bool ValidateOrthof(Context *context,
ANGLE_VALIDATE_IS_GLES1(context); ANGLE_VALIDATE_IS_GLES1(context);
if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f) if (l == r || b == t || n == f || n <= 0.0f || f <= 0.0f)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
} }
return true; return true;
} }
...@@ -1109,7 +1111,7 @@ bool ValidateOrthox(Context *context, ...@@ -1109,7 +1111,7 @@ bool ValidateOrthox(Context *context,
ANGLE_VALIDATE_IS_GLES1(context); ANGLE_VALIDATE_IS_GLES1(context);
if (l == r || b == t || n == f || n <= 0 || f <= 0) if (l == r || b == t || n == f || n <= 0 || f <= 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidProjectionMatrix); context->validationError(GL_INVALID_VALUE, kErrorInvalidProjectionMatrix);
} }
return true; return true;
} }
...@@ -1119,7 +1121,7 @@ bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat par ...@@ -1119,7 +1121,7 @@ bool ValidatePointParameterf(Context *context, PointParameter pname, GLfloat par
unsigned int paramCount = GetPointParameterCount(pname); unsigned int paramCount = GetPointParameterCount(pname);
if (paramCount != 1) if (paramCount != 1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidPointParameter);
return false; return false;
} }
...@@ -1136,7 +1138,7 @@ bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed par ...@@ -1136,7 +1138,7 @@ bool ValidatePointParameterx(Context *context, PointParameter pname, GLfixed par
unsigned int paramCount = GetPointParameterCount(pname); unsigned int paramCount = GetPointParameterCount(pname);
if (paramCount != 1) if (paramCount != 1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPointParameter); context->validationError(GL_INVALID_ENUM, kErrorInvalidPointParameter);
return false; return false;
} }
...@@ -1176,7 +1178,7 @@ bool ValidatePopMatrix(Context *context) ...@@ -1176,7 +1178,7 @@ bool ValidatePopMatrix(Context *context)
const auto &stack = context->getGLState().gles1().currentMatrixStack(); const auto &stack = context->getGLState().gles1().currentMatrixStack();
if (stack.size() == 1) if (stack.size() == 1)
{ {
ANGLE_VALIDATION_ERR(context, StackUnderflow(), MatrixStackUnderflow); context->validationError(GL_STACK_UNDERFLOW, kErrorMatrixStackUnderflow);
return false; return false;
} }
return true; return true;
...@@ -1188,7 +1190,7 @@ bool ValidatePushMatrix(Context *context) ...@@ -1188,7 +1190,7 @@ bool ValidatePushMatrix(Context *context)
const auto &stack = context->getGLState().gles1().currentMatrixStack(); const auto &stack = context->getGLState().gles1().currentMatrixStack();
if (stack.size() == stack.max_size()) if (stack.size() == stack.max_size())
{ {
ANGLE_VALIDATION_ERR(context, StackOverflow(), MatrixStackOverflow); context->validationError(GL_STACK_OVERFLOW, kErrorMatrixStackOverflow);
return false; return false;
} }
return true; return true;
...@@ -1233,7 +1235,7 @@ bool ValidateShadeModel(Context *context, ShadingModel mode) ...@@ -1233,7 +1235,7 @@ bool ValidateShadeModel(Context *context, ShadingModel mode)
case ShadingModel::Smooth: case ShadingModel::Smooth:
return true; return true;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShadingModel); context->validationError(GL_INVALID_ENUM, kErrorInvalidShadingModel);
return false; return false;
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -304,7 +304,7 @@ bool ValidateProgramUniform(Context *context, ...@@ -304,7 +304,7 @@ bool ValidateProgramUniform(Context *context,
// Check for ES31 program uniform entry points // Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1)) if (context->getClientVersion() < Version(3, 1))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -324,7 +324,7 @@ bool ValidateProgramUniformMatrix(Context *context, ...@@ -324,7 +324,7 @@ bool ValidateProgramUniformMatrix(Context *context,
// Check for ES31 program uniform entry points // Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1)) if (context->getClientVersion() < Version(3, 1))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -343,16 +343,14 @@ bool ValidateVertexAttribFormatCommon(Context *context, ...@@ -343,16 +343,14 @@ bool ValidateVertexAttribFormatCommon(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset)) if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset))
{ {
context->handleError( context->validationError(GL_INVALID_VALUE, kErrorRelativeOffsetTooLarge);
InvalidValue()
<< "relativeOffset cannot be greater than MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.");
return false; return false;
} }
...@@ -360,7 +358,7 @@ bool ValidateVertexAttribFormatCommon(Context *context, ...@@ -360,7 +358,7 @@ bool ValidateVertexAttribFormatCommon(Context *context,
// An INVALID_OPERATION error is generated if the default vertex array object is bound. // An INVALID_OPERATION error is generated if the default vertex array object is bound.
if (context->getGLState().getVertexArrayId() == 0) if (context->getGLState().getVertexArrayId() == 0)
{ {
context->handleError(InvalidOperation() << "Default vertex array object is bound."); context->validationError(GL_INVALID_OPERATION, kErrorDefaultVertexArray);
return false; return false;
} }
...@@ -373,7 +371,7 @@ bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLbool ...@@ -373,7 +371,7 @@ bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLbool
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -394,7 +392,7 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context, ...@@ -394,7 +392,7 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -423,7 +421,7 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void * ...@@ -423,7 +421,7 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void *
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -439,14 +437,14 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void * ...@@ -439,14 +437,14 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void *
// DRAW_INDIRECT_BUFFER or to any enabled vertex array. // DRAW_INDIRECT_BUFFER or to any enabled vertex array.
if (!state.getVertexArrayId()) if (!state.getVertexArrayId())
{ {
context->handleError(InvalidOperation() << "zero is bound to VERTEX_ARRAY_BINDING"); context->validationError(GL_INVALID_OPERATION, kErrorDefaultVertexArray);
return false; return false;
} }
Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect); Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect);
if (!drawIndirectBuffer) if (!drawIndirectBuffer)
{ {
context->handleError(InvalidOperation() << "zero is bound to DRAW_INDIRECT_BUFFER"); context->validationError(GL_INVALID_OPERATION, kErrorDrawIndirectBufferNotBound);
return false; return false;
} }
...@@ -455,9 +453,7 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void * ...@@ -455,9 +453,7 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void *
GLint64 offset = reinterpret_cast<GLint64>(indirect); GLint64 offset = reinterpret_cast<GLint64>(indirect);
if ((static_cast<GLuint>(offset) % sizeof(GLuint)) != 0) if ((static_cast<GLuint>(offset) % sizeof(GLuint)) != 0)
{ {
context->handleError( context->validationError(GL_INVALID_VALUE, kErrorInvalidIndirectOffset);
InvalidValue()
<< "indirect is not a multiple of the size, in basic machine units, of uint");
return false; return false;
} }
...@@ -468,9 +464,7 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void * ...@@ -468,9 +464,7 @@ bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void *
ASSERT(drawFramebuffer != nullptr); ASSERT(drawFramebuffer != nullptr);
if (drawFramebuffer->getNumViews() > 1) if (drawFramebuffer->getNumViews() > 1)
{ {
context->handleError( context->validationError(GL_INVALID_OPERATION, kErrorMultiviewActive);
InvalidOperation()
<< "The number of views in the active draw framebuffer is greater than 1.");
return false; return false;
} }
...@@ -491,7 +485,8 @@ bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void ...@@ -491,7 +485,8 @@ bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void
if (!ValidateTransformFeedbackPrimitiveMode( if (!ValidateTransformFeedbackPrimitiveMode(
context, curTransformFeedback->getPrimitiveMode(), mode)) context, curTransformFeedback->getPrimitiveMode(), mode))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidDrawModeTransformFeedback); context->validationError(GL_INVALID_OPERATION,
kErrorInvalidDrawModeTransformFeedback);
return false; return false;
} }
} }
...@@ -499,8 +494,8 @@ bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void ...@@ -499,8 +494,8 @@ bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void
{ {
// An INVALID_OPERATION error is generated if transform feedback is active and not // An INVALID_OPERATION error is generated if transform feedback is active and not
// paused. // paused.
ANGLE_VALIDATION_ERR(context, InvalidOperation(), context->validationError(GL_INVALID_OPERATION,
UnsupportedDrawModeForTransformFeedback); kErrorUnsupportedDrawModeForTransformFeedback);
return false; return false;
} }
} }
...@@ -516,9 +511,7 @@ bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void ...@@ -516,9 +511,7 @@ bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void
if (!checkedSum.IsValid() || if (!checkedSum.IsValid() ||
checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize())) checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize()))
{ {
context->handleError( context->validationError(GL_INVALID_OPERATION, kErrorParamOverflow);
InvalidOperation()
<< "the command would source data beyond the end of the buffer object.");
return false; return false;
} }
...@@ -540,7 +533,7 @@ bool ValidateDrawElementsIndirect(Context *context, ...@@ -540,7 +533,7 @@ bool ValidateDrawElementsIndirect(Context *context,
Buffer *elementArrayBuffer = vao->getElementArrayBuffer(); Buffer *elementArrayBuffer = vao->getElementArrayBuffer();
if (!elementArrayBuffer) if (!elementArrayBuffer)
{ {
context->handleError(InvalidOperation() << "zero is bound to ELEMENT_ARRAY_BUFFER"); context->validationError(GL_INVALID_OPERATION, kErrorMustHaveElementArrayBinding);
return false; return false;
} }
...@@ -555,9 +548,9 @@ bool ValidateDrawElementsIndirect(Context *context, ...@@ -555,9 +548,9 @@ bool ValidateDrawElementsIndirect(Context *context,
if (!checkedSum.IsValid() || if (!checkedSum.IsValid() ||
checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize())) checkedSum.ValueOrDie() > static_cast<size_t>(drawIndirectBuffer->getSize()))
{ {
context->handleError( context->validationError(
InvalidOperation() GL_INVALID_OPERATION,
<< "the command would source data beyond the end of the buffer object."); "the command would source data beyond the end of the buffer object.");
return false; return false;
} }
...@@ -683,7 +676,7 @@ bool ValidateProgramUniform1iv(Context *context, ...@@ -683,7 +676,7 @@ bool ValidateProgramUniform1iv(Context *context,
// Check for ES31 program uniform entry points // Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1)) if (context->getClientVersion() < Version(3, 1))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -899,7 +892,7 @@ bool ValidateGetTexLevelParameterfv(Context *context, ...@@ -899,7 +892,7 @@ bool ValidateGetTexLevelParameterfv(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -926,7 +919,7 @@ bool ValidateGetTexLevelParameteriv(Context *context, ...@@ -926,7 +919,7 @@ bool ValidateGetTexLevelParameteriv(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -955,7 +948,7 @@ bool ValidateTexStorage2DMultisample(Context *context, ...@@ -955,7 +948,7 @@ bool ValidateTexStorage2DMultisample(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -967,13 +960,13 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl ...@@ -967,13 +960,13 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
if (pname != GL_SAMPLE_POSITION) if (pname != GL_SAMPLE_POSITION)
{ {
context->handleError(InvalidEnum() << "Pname must be SAMPLE_POSITION."); context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
return false; return false;
} }
...@@ -982,7 +975,7 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl ...@@ -982,7 +975,7 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl
if (index >= static_cast<GLuint>(samples)) if (index >= static_cast<GLuint>(samples))
{ {
context->handleError(InvalidValue() << "Index must be less than the value of SAMPLES."); context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsSamples);
return false; return false;
} }
...@@ -1004,13 +997,13 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1004,13 +997,13 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
if (!ValidFramebufferTarget(context, target)) if (!ValidFramebufferTarget(context, target))
{ {
context->handleError(InvalidEnum() << "Invalid framebuffer target."); context->validationError(GL_INVALID_ENUM, kErrorInvalidFramebufferTarget);
return false; return false;
} }
...@@ -1021,9 +1014,9 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1021,9 +1014,9 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
GLint maxWidth = context->getCaps().maxFramebufferWidth; GLint maxWidth = context->getCaps().maxFramebufferWidth;
if (param < 0 || param > maxWidth) if (param < 0 || param > maxWidth)
{ {
context->handleError( context->validationError(
InvalidValue() GL_INVALID_VALUE,
<< "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_WIDTH."); "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_WIDTH.");
return false; return false;
} }
break; break;
...@@ -1033,9 +1026,9 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1033,9 +1026,9 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
GLint maxHeight = context->getCaps().maxFramebufferHeight; GLint maxHeight = context->getCaps().maxFramebufferHeight;
if (param < 0 || param > maxHeight) if (param < 0 || param > maxHeight)
{ {
context->handleError( context->validationError(
InvalidValue() GL_INVALID_VALUE,
<< "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_HEIGHT."); "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_HEIGHT.");
return false; return false;
} }
break; break;
...@@ -1045,9 +1038,9 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1045,9 +1038,9 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
GLint maxSamples = context->getCaps().maxFramebufferSamples; GLint maxSamples = context->getCaps().maxFramebufferSamples;
if (param < 0 || param > maxSamples) if (param < 0 || param > maxSamples)
{ {
context->handleError( context->validationError(
InvalidValue() GL_INVALID_VALUE,
<< "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_SAMPLES."); "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_SAMPLES.");
return false; return false;
} }
break; break;
...@@ -1060,20 +1053,20 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1060,20 +1053,20 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
{ {
if (!context->getExtensions().geometryShader) if (!context->getExtensions().geometryShader)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled); context->validationError(GL_INVALID_ENUM, kErrorGeometryShaderExtensionNotEnabled);
return false; return false;
} }
GLint maxLayers = context->getCaps().maxFramebufferLayers; GLint maxLayers = context->getCaps().maxFramebufferLayers;
if (param < 0 || param > maxLayers) if (param < 0 || param > maxLayers)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFramebufferLayer); context->validationError(GL_INVALID_VALUE, kErrorInvalidFramebufferLayer);
return false; return false;
} }
break; break;
} }
default: default:
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname); context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
return false; return false;
} }
} }
...@@ -1082,7 +1075,7 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1082,7 +1075,7 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
ASSERT(framebuffer); ASSERT(framebuffer);
if (framebuffer->id() == 0) if (framebuffer->id() == 0)
{ {
context->handleError(InvalidOperation() << "Default framebuffer is bound to target."); context->validationError(GL_INVALID_OPERATION, "Default framebuffer is bound to target.");
return false; return false;
} }
return true; return true;
...@@ -1092,13 +1085,13 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p ...@@ -1092,13 +1085,13 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
if (!ValidFramebufferTarget(context, target)) if (!ValidFramebufferTarget(context, target))
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidFramebufferTarget); context->validationError(GL_INVALID_ENUM, kErrorInvalidFramebufferTarget);
return false; return false;
} }
...@@ -1112,12 +1105,12 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p ...@@ -1112,12 +1105,12 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p
case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT: case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
if (!context->getExtensions().geometryShader) if (!context->getExtensions().geometryShader)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled); context->validationError(GL_INVALID_ENUM, kErrorGeometryShaderExtensionNotEnabled);
return false; return false;
} }
break; break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname); context->validationError(GL_INVALID_ENUM, kErrorInvalidPname);
return false; return false;
} }
...@@ -1126,7 +1119,7 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p ...@@ -1126,7 +1119,7 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p
if (framebuffer->id() == 0) if (framebuffer->id() == 0)
{ {
context->handleError(InvalidOperation() << "Default framebuffer is bound to target."); context->validationError(GL_INVALID_OPERATION, "Default framebuffer is bound to target.");
return false; return false;
} }
return true; return true;
...@@ -1150,7 +1143,7 @@ bool ValidateGetProgramResourceIndex(Context *context, ...@@ -1150,7 +1143,7 @@ bool ValidateGetProgramResourceIndex(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1162,8 +1155,7 @@ bool ValidateGetProgramResourceIndex(Context *context, ...@@ -1162,8 +1155,7 @@ bool ValidateGetProgramResourceIndex(Context *context,
if (!ValidateNamedProgramInterface(programInterface)) if (!ValidateNamedProgramInterface(programInterface))
{ {
context->handleError(InvalidEnum() << "Invalid program interface: 0x" << std::hex context->validationError(GL_INVALID_ENUM, "Invalid program interface");
<< std::uppercase << programInterface);
return false; return false;
} }
...@@ -1178,34 +1170,34 @@ bool ValidateBindVertexBuffer(Context *context, ...@@ -1178,34 +1170,34 @@ bool ValidateBindVertexBuffer(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
if (!context->isBufferGenerated(buffer)) if (!context->isBufferGenerated(buffer))
{ {
context->handleError(InvalidOperation() << "Buffer is not generated."); context->validationError(GL_INVALID_OPERATION, "Buffer is not generated.");
return false; return false;
} }
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (bindingIndex >= caps.maxVertexAttribBindings) if (bindingIndex >= caps.maxVertexAttribBindings)
{ {
context->handleError(InvalidValue() context->validationError(GL_INVALID_VALUE,
<< "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS."); "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false; return false;
} }
if (offset < 0) if (offset < 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset); context->validationError(GL_INVALID_VALUE, kErrorNegativeOffset);
return false; return false;
} }
if (stride < 0 || stride > caps.maxVertexAttribStride) if (stride < 0 || stride > caps.maxVertexAttribStride)
{ {
context->handleError(InvalidValue() context->validationError(GL_INVALID_VALUE,
<< "stride must be between 0 and MAX_VERTEX_ATTRIB_STRIDE."); "stride must be between 0 and MAX_VERTEX_ATTRIB_STRIDE.");
return false; return false;
} }
...@@ -1213,7 +1205,7 @@ bool ValidateBindVertexBuffer(Context *context, ...@@ -1213,7 +1205,7 @@ bool ValidateBindVertexBuffer(Context *context,
// An INVALID_OPERATION error is generated if the default vertex array object is bound. // An INVALID_OPERATION error is generated if the default vertex array object is bound.
if (context->getGLState().getVertexArrayId() == 0) if (context->getGLState().getVertexArrayId() == 0)
{ {
context->handleError(InvalidOperation() << "Default vertex array buffer is bound."); context->validationError(GL_INVALID_OPERATION, "Default vertex array buffer is bound.");
return false; return false;
} }
...@@ -1224,15 +1216,15 @@ bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint ...@@ -1224,15 +1216,15 @@ bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (bindingIndex >= caps.maxVertexAttribBindings) if (bindingIndex >= caps.maxVertexAttribBindings)
{ {
context->handleError(InvalidValue() context->validationError(GL_INVALID_VALUE,
<< "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS."); "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false; return false;
} }
...@@ -1240,7 +1232,7 @@ bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint ...@@ -1240,7 +1232,7 @@ bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint
// An INVALID_OPERATION error is generated if the default vertex array object is bound. // An INVALID_OPERATION error is generated if the default vertex array object is bound.
if (context->getGLState().getVertexArrayId() == 0) if (context->getGLState().getVertexArrayId() == 0)
{ {
context->handleError(InvalidOperation() << "Default vertex array object is bound."); context->validationError(GL_INVALID_OPERATION, "Default vertex array object is bound.");
return false; return false;
} }
...@@ -1271,7 +1263,7 @@ bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bi ...@@ -1271,7 +1263,7 @@ bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bi
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1279,21 +1271,21 @@ bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bi ...@@ -1279,21 +1271,21 @@ bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bi
// An INVALID_OPERATION error is generated if the default vertex array object is bound. // An INVALID_OPERATION error is generated if the default vertex array object is bound.
if (context->getGLState().getVertexArrayId() == 0) if (context->getGLState().getVertexArrayId() == 0)
{ {
context->handleError(InvalidOperation() << "Default vertex array object is bound."); context->validationError(GL_INVALID_OPERATION, "Default vertex array object is bound.");
return false; return false;
} }
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (attribIndex >= caps.maxVertexAttributes) if (attribIndex >= caps.maxVertexAttributes)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), IndexExceedsMaxVertexAttribute); context->validationError(GL_INVALID_VALUE, kErrorIndexExceedsMaxVertexAttribute);
return false; return false;
} }
if (bindingIndex >= caps.maxVertexAttribBindings) if (bindingIndex >= caps.maxVertexAttribBindings)
{ {
context->handleError(InvalidValue() context->validationError(GL_INVALID_VALUE,
<< "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS"); "bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS");
return false; return false;
} }
...@@ -1310,7 +1302,7 @@ bool ValidateGetProgramResourceName(Context *context, ...@@ -1310,7 +1302,7 @@ bool ValidateGetProgramResourceName(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1322,20 +1314,19 @@ bool ValidateGetProgramResourceName(Context *context, ...@@ -1322,20 +1314,19 @@ bool ValidateGetProgramResourceName(Context *context,
if (!ValidateNamedProgramInterface(programInterface)) if (!ValidateNamedProgramInterface(programInterface))
{ {
context->handleError(InvalidEnum() << "Invalid program interface: 0x" << std::hex context->validationError(GL_INVALID_ENUM, "Invalid program interface");
<< std::uppercase << programInterface);
return false; return false;
} }
if (!ValidateProgramResourceIndex(programObject, programInterface, index)) if (!ValidateProgramResourceIndex(programObject, programInterface, index))
{ {
context->handleError(InvalidValue() << "Invalid index: " << index); context->validationError(GL_INVALID_VALUE, "Invalid index");
return false; return false;
} }
if (bufSize < 0) if (bufSize < 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeBufferSize); context->validationError(GL_INVALID_VALUE, kErrorNegativeBufferSize);
return false; return false;
} }
...@@ -1349,7 +1340,7 @@ bool ValidateDispatchCompute(Context *context, ...@@ -1349,7 +1340,7 @@ bool ValidateDispatchCompute(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1358,30 +1349,30 @@ bool ValidateDispatchCompute(Context *context, ...@@ -1358,30 +1349,30 @@ bool ValidateDispatchCompute(Context *context,
if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute)) if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoActiveProgramWithComputeShader); context->validationError(GL_INVALID_OPERATION, kErrorNoActiveProgramWithComputeShader);
return false; return false;
} }
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (numGroupsX > caps.maxComputeWorkGroupCount[0]) if (numGroupsX > caps.maxComputeWorkGroupCount[0])
{ {
context->handleError( context->validationError(
InvalidValue() << "num_groups_x cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[0]=" GL_INVALID_VALUE,
<< caps.maxComputeWorkGroupCount[0]); "num_groups_x cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[0]");
return false; return false;
} }
if (numGroupsY > caps.maxComputeWorkGroupCount[1]) if (numGroupsY > caps.maxComputeWorkGroupCount[1])
{ {
context->handleError( context->validationError(
InvalidValue() << "num_groups_y cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[1]=" GL_INVALID_VALUE,
<< caps.maxComputeWorkGroupCount[1]); "num_groups_y cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[1]");
return false; return false;
} }
if (numGroupsZ > caps.maxComputeWorkGroupCount[2]) if (numGroupsZ > caps.maxComputeWorkGroupCount[2])
{ {
context->handleError( context->validationError(
InvalidValue() << "num_groups_z cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[2]=" GL_INVALID_VALUE,
<< caps.maxComputeWorkGroupCount[2]); "num_groups_z cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[2]");
return false; return false;
} }
...@@ -1392,7 +1383,7 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect) ...@@ -1392,7 +1383,7 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect)
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1401,26 +1392,26 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect) ...@@ -1401,26 +1392,26 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect)
if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute)) if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoActiveProgramWithComputeShader); context->validationError(GL_INVALID_OPERATION, kErrorNoActiveProgramWithComputeShader);
return false; return false;
} }
if (indirect < 0) if (indirect < 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset); context->validationError(GL_INVALID_VALUE, kErrorNegativeOffset);
return false; return false;
} }
if ((indirect & (sizeof(GLuint) - 1)) != 0) if ((indirect & (sizeof(GLuint) - 1)) != 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), OffsetMustBeMultipleOfUint); context->validationError(GL_INVALID_VALUE, kErrorOffsetMustBeMultipleOfUint);
return false; return false;
} }
Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect); Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect);
if (!dispatchIndirectBuffer) if (!dispatchIndirectBuffer)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), DispatchIndirectBufferNotBound); context->validationError(GL_INVALID_OPERATION, kErrorDispatchIndirectBufferNotBound);
return false; return false;
} }
...@@ -1429,7 +1420,7 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect) ...@@ -1429,7 +1420,7 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect)
if (!checkedSum.IsValid() || if (!checkedSum.IsValid() ||
checkedSum.ValueOrDie() > static_cast<GLuint64>(dispatchIndirectBuffer->getSize())) checkedSum.ValueOrDie() > static_cast<GLuint64>(dispatchIndirectBuffer->getSize()))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize); context->validationError(GL_INVALID_OPERATION, kErrorInsufficientBufferSize);
return false; return false;
} }
...@@ -1448,27 +1439,26 @@ bool ValidateBindImageTexture(Context *context, ...@@ -1448,27 +1439,26 @@ bool ValidateBindImageTexture(Context *context,
GLuint maxImageUnits = context->getCaps().maxImageUnits; GLuint maxImageUnits = context->getCaps().maxImageUnits;
if (unit >= maxImageUnits) if (unit >= maxImageUnits)
{ {
context->handleError(InvalidValue() context->validationError(GL_INVALID_VALUE,
<< "unit cannot be greater than or equal than MAX_IMAGE_UNITS = " "unit cannot be greater than or equal than MAX_IMAGE_UNITS");
<< maxImageUnits);
return false; return false;
} }
if (level < 0) if (level < 0)
{ {
context->handleError(InvalidValue() << "level is negative."); context->validationError(GL_INVALID_VALUE, "level is negative.");
return false; return false;
} }
if (layer < 0) if (layer < 0)
{ {
context->handleError(InvalidValue() << "layer is negative."); context->validationError(GL_INVALID_VALUE, "layer is negative.");
return false; return false;
} }
if (access != GL_READ_ONLY && access != GL_WRITE_ONLY && access != GL_READ_WRITE) if (access != GL_READ_ONLY && access != GL_WRITE_ONLY && access != GL_READ_WRITE)
{ {
context->handleError(InvalidEnum() << "access is not one of the supported tokens."); context->validationError(GL_INVALID_ENUM, "access is not one of the supported tokens.");
return false; return false;
} }
...@@ -1489,8 +1479,8 @@ bool ValidateBindImageTexture(Context *context, ...@@ -1489,8 +1479,8 @@ bool ValidateBindImageTexture(Context *context,
case GL_RGBA8_SNORM: case GL_RGBA8_SNORM:
break; break;
default: default:
context->handleError(InvalidValue() context->validationError(GL_INVALID_VALUE,
<< "format is not one of supported image unit formats."); "format is not one of supported image unit formats.");
return false; return false;
} }
...@@ -1500,15 +1490,15 @@ bool ValidateBindImageTexture(Context *context, ...@@ -1500,15 +1490,15 @@ bool ValidateBindImageTexture(Context *context,
if (tex == nullptr) if (tex == nullptr)
{ {
context->handleError(InvalidValue() context->validationError(GL_INVALID_VALUE,
<< "texture is not the name of an existing texture object."); "texture is not the name of an existing texture object.");
return false; return false;
} }
if (!tex->getImmutableFormat()) if (!tex->getImmutableFormat())
{ {
context->handleError(InvalidOperation() context->validationError(GL_INVALID_OPERATION,
<< "texture is not the name of an immutable texture object."); "texture is not the name of an immutable texture object.");
return false; return false;
} }
} }
...@@ -1523,7 +1513,7 @@ bool ValidateGetProgramResourceLocation(Context *context, ...@@ -1523,7 +1513,7 @@ bool ValidateGetProgramResourceLocation(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1535,13 +1525,13 @@ bool ValidateGetProgramResourceLocation(Context *context, ...@@ -1535,13 +1525,13 @@ bool ValidateGetProgramResourceLocation(Context *context,
if (!programObject->isLinked()) if (!programObject->isLinked())
{ {
context->handleError(InvalidOperation() << "Program is not successfully linked."); context->validationError(GL_INVALID_OPERATION, "Program is not successfully linked.");
return false; return false;
} }
if (!ValidateLocationProgramInterface(programInterface)) if (!ValidateLocationProgramInterface(programInterface))
{ {
context->handleError(InvalidEnum() << "Invalid program interface."); context->validationError(GL_INVALID_ENUM, "Invalid program interface.");
return false; return false;
} }
return true; return true;
...@@ -1559,7 +1549,7 @@ bool ValidateGetProgramResourceiv(Context *context, ...@@ -1559,7 +1549,7 @@ bool ValidateGetProgramResourceiv(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1570,34 +1560,34 @@ bool ValidateGetProgramResourceiv(Context *context, ...@@ -1570,34 +1560,34 @@ bool ValidateGetProgramResourceiv(Context *context,
} }
if (!ValidateProgramInterface(programInterface)) if (!ValidateProgramInterface(programInterface))
{ {
context->handleError(InvalidEnum() << "Invalid program interface."); context->validationError(GL_INVALID_ENUM, "Invalid program interface.");
return false; return false;
} }
if (propCount <= 0) if (propCount <= 0)
{ {
context->handleError(InvalidValue() << "Invalid propCount."); context->validationError(GL_INVALID_VALUE, "Invalid propCount.");
return false; return false;
} }
if (bufSize < 0) if (bufSize < 0)
{ {
context->handleError(InvalidValue() << "Invalid bufSize."); context->validationError(GL_INVALID_VALUE, "Invalid bufSize.");
return false; return false;
} }
if (!ValidateProgramResourceIndex(programObject, programInterface, index)) if (!ValidateProgramResourceIndex(programObject, programInterface, index))
{ {
context->handleError(InvalidValue() << "Invalid index: " << index); context->validationError(GL_INVALID_VALUE, "Invalid index");
return false; return false;
} }
for (GLsizei i = 0; i < propCount; i++) for (GLsizei i = 0; i < propCount; i++)
{ {
if (!ValidateProgramResourceProperty(context, props[i])) if (!ValidateProgramResourceProperty(context, props[i]))
{ {
context->handleError(InvalidEnum() << "Invalid prop."); context->validationError(GL_INVALID_ENUM, "Invalid prop.");
return false; return false;
} }
if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface)) if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface))
{ {
context->handleError(InvalidOperation() << "Not an allowed prop for interface"); context->validationError(GL_INVALID_OPERATION, "Not an allowed prop for interface");
return false; return false;
} }
} }
...@@ -1612,7 +1602,7 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1612,7 +1602,7 @@ bool ValidateGetProgramInterfaceiv(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1624,7 +1614,7 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1624,7 +1614,7 @@ bool ValidateGetProgramInterfaceiv(Context *context,
if (!ValidateProgramInterface(programInterface)) if (!ValidateProgramInterface(programInterface))
{ {
context->handleError(InvalidEnum() << "Invalid program interface."); context->validationError(GL_INVALID_ENUM, "Invalid program interface.");
return false; return false;
} }
...@@ -1636,14 +1626,14 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1636,14 +1626,14 @@ bool ValidateGetProgramInterfaceiv(Context *context,
break; break;
default: default:
context->handleError(InvalidEnum() << "Unknown property of program interface."); context->validationError(GL_INVALID_ENUM, "Unknown property of program interface.");
return false; return false;
} }
if (pname == GL_MAX_NAME_LENGTH && programInterface == GL_ATOMIC_COUNTER_BUFFER) if (pname == GL_MAX_NAME_LENGTH && programInterface == GL_ATOMIC_COUNTER_BUFFER)
{ {
context->handleError(InvalidOperation() context->validationError(GL_INVALID_OPERATION,
<< "Active atomic counter resources are not assigned name strings."); "Active atomic counter resources are not assigned name strings.");
return false; return false;
} }
...@@ -1657,9 +1647,9 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1657,9 +1647,9 @@ bool ValidateGetProgramInterfaceiv(Context *context,
break; break;
default: default:
context->handleError( context->validationError(
InvalidOperation() GL_INVALID_OPERATION,
<< "MAX_NUM_ACTIVE_VARIABLES requires a buffer or block interface."); "MAX_NUM_ACTIVE_VARIABLES requires a buffer or block interface.");
return false; return false;
} }
} }
...@@ -1683,7 +1673,7 @@ static bool ValidateGenOrDeleteES31(Context *context, GLint n) ...@@ -1683,7 +1673,7 @@ static bool ValidateGenOrDeleteES31(Context *context, GLint n)
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1704,13 +1694,13 @@ bool ValidateBindProgramPipeline(Context *context, GLuint pipeline) ...@@ -1704,13 +1694,13 @@ bool ValidateBindProgramPipeline(Context *context, GLuint pipeline)
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
if (!context->isProgramPipelineGenerated(pipeline)) if (!context->isProgramPipelineGenerated(pipeline))
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ObjectNotGenerated); context->validationError(GL_INVALID_OPERATION, kErrorObjectNotGenerated);
return false; return false;
} }
...@@ -1721,7 +1711,7 @@ bool ValidateIsProgramPipeline(Context *context, GLuint pipeline) ...@@ -1721,7 +1711,7 @@ bool ValidateIsProgramPipeline(Context *context, GLuint pipeline)
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1775,7 +1765,7 @@ bool ValidateMemoryBarrier(Context *context, GLbitfield barriers) ...@@ -1775,7 +1765,7 @@ bool ValidateMemoryBarrier(Context *context, GLbitfield barriers)
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1792,7 +1782,7 @@ bool ValidateMemoryBarrier(Context *context, GLbitfield barriers) ...@@ -1792,7 +1782,7 @@ bool ValidateMemoryBarrier(Context *context, GLbitfield barriers)
GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT; GL_ATOMIC_COUNTER_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT;
if ((barriers & ~supported_barrier_bits) != 0) if ((barriers & ~supported_barrier_bits) != 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMemoryBarrierBit); context->validationError(GL_INVALID_VALUE, kErrorInvalidMemoryBarrierBit);
return false; return false;
} }
...@@ -1803,7 +1793,7 @@ bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers) ...@@ -1803,7 +1793,7 @@ bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers)
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
...@@ -1818,7 +1808,7 @@ bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers) ...@@ -1818,7 +1808,7 @@ bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers)
GL_TEXTURE_FETCH_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT; GL_TEXTURE_FETCH_BARRIER_BIT | GL_UNIFORM_BARRIER_BIT;
if ((barriers & ~supported_barrier_bits) != 0) if ((barriers & ~supported_barrier_bits) != 0)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMemoryBarrierBit); context->validationError(GL_INVALID_VALUE, kErrorInvalidMemoryBarrierBit);
return false; return false;
} }
...@@ -1829,13 +1819,13 @@ bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask) ...@@ -1829,13 +1819,13 @@ bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask)
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
if (maskNumber >= context->getCaps().maxSampleMaskWords) if (maskNumber >= context->getCaps().maxSampleMaskWords)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidSampleMaskNumber); context->validationError(GL_INVALID_VALUE, kErrorInvalidSampleMaskNumber);
return false; return false;
} }
...@@ -1850,7 +1840,7 @@ bool ValidateFramebufferTextureEXT(Context *context, ...@@ -1850,7 +1840,7 @@ bool ValidateFramebufferTextureEXT(Context *context,
{ {
if (!context->getExtensions().geometryShader) if (!context->getExtensions().geometryShader)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), GeometryShaderExtensionNotEnabled); context->validationError(GL_INVALID_OPERATION, kErrorGeometryShaderExtensionNotEnabled);
return false; return false;
} }
...@@ -1870,13 +1860,13 @@ bool ValidateFramebufferTextureEXT(Context *context, ...@@ -1870,13 +1860,13 @@ bool ValidateFramebufferTextureEXT(Context *context,
// three-dimensional or two-dimensional array texture. // three-dimensional or two-dimensional array texture.
if (tex == nullptr) if (tex == nullptr)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidTextureName); context->validationError(GL_INVALID_VALUE, kErrorInvalidTextureName);
return false; return false;
} }
if (!ValidMipLevel(context, tex->getType(), level)) if (!ValidMipLevel(context, tex->getType(), level))
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel); context->validationError(GL_INVALID_VALUE, kErrorInvalidMipLevel);
return false; return false;
} }
} }
...@@ -1901,19 +1891,19 @@ bool ValidateTexStorage3DMultisampleOES(Context *context, ...@@ -1901,19 +1891,19 @@ bool ValidateTexStorage3DMultisampleOES(Context *context,
{ {
if (!context->getExtensions().textureStorageMultisample2DArray) if (!context->getExtensions().textureStorageMultisample2DArray)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), MultisampleArrayExtensionRequired); context->validationError(GL_INVALID_ENUM, kErrorMultisampleArrayExtensionRequired);
return false; return false;
} }
if (target != TextureType::_2DMultisampleArray) if (target != TextureType::_2DMultisampleArray)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), TargetMustBeTexture2DMultisampleArrayOES); context->validationError(GL_INVALID_ENUM, kErrorTargetMustBeTexture2DMultisampleArrayOES);
return false; return false;
} }
if (width < 1 || height < 1 || depth < 1) if (width < 1 || height < 1 || depth < 1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeSize); context->validationError(GL_INVALID_VALUE, kErrorNegativeSize);
return false; return false;
} }
...@@ -1928,17 +1918,17 @@ bool ValidateGetProgramResourceLocationIndexEXT(Context *context, ...@@ -1928,17 +1918,17 @@ bool ValidateGetProgramResourceLocationIndexEXT(Context *context,
{ {
if (!context->getExtensions().blendFuncExtended) if (!context->getExtensions().blendFuncExtended)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled); context->validationError(GL_INVALID_OPERATION, kErrorExtensionNotEnabled);
return false; return false;
} }
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required); context->validationError(GL_INVALID_OPERATION, kErrorES31Required);
return false; return false;
} }
if (programInterface != GL_PROGRAM_OUTPUT) if (programInterface != GL_PROGRAM_OUTPUT)
{ {
ANGLE_VALIDATION_ERR(context, InvalidEnum(), ProgramInterfaceMustBeProgramOutput); context->validationError(GL_INVALID_ENUM, kErrorProgramInterfaceMustBeProgramOutput);
return false; return false;
} }
Program *programObject = GetValidProgram(context, program); Program *programObject = GetValidProgram(context, program);
...@@ -1948,7 +1938,7 @@ bool ValidateGetProgramResourceLocationIndexEXT(Context *context, ...@@ -1948,7 +1938,7 @@ bool ValidateGetProgramResourceLocationIndexEXT(Context *context,
} }
if (!programObject->isLinked()) if (!programObject->isLinked())
{ {
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked); context->validationError(GL_INVALID_OPERATION, kErrorProgramNotLinked);
return false; return false;
} }
return true; return true;
......
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