Commit c3e3731c by Jamie Madill Committed by Commit Bot

Give every validation error a constant.

Makes the code more consistent and organized. Also reduces binary size by about 4k. Also refactors validation for GetBufferPointerv. Bug: angleproject:2957 Change-Id: Ib076ce936193e9840eef2499bf815489cdb48479 Reviewed-on: https://chromium-review.googlesource.com/c/1350489 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent ec06305b
...@@ -18,6 +18,10 @@ namespace err ...@@ -18,6 +18,10 @@ namespace err
// clang-format off // clang-format off
MSG k3DDepthStencil = "Format cannot be GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL if target is GL_TEXTURE_3D"; MSG k3DDepthStencil = "Format cannot be GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL if target is GL_TEXTURE_3D";
MSG kANGLECopyTexture3DUnavailable = "GL_ANGLE_copy_texture_3d extension not available."; MSG kANGLECopyTexture3DUnavailable = "GL_ANGLE_copy_texture_3d extension not available.";
MSG kAtomicCounterResourceName = "Active atomic counter resources are not assigned name strings.";
MSG kAttributeZeroRequiresDivisorLimitation = "The current context doesn't support setting a non-zero divisor on the attribute with index zero. Please reorder the attributes in your vertex shader so that attribute zero can have a zero divisor.";
MSG kBaseLevelNegative = "Base level must be at least 0.";
MSG kBaseLevelNonZero = "Base level must be 0.";
MSG kBaseLevelOutOfRange = "Texture base level out of range"; MSG kBaseLevelOutOfRange = "Texture base level out of range";
MSG kBlitDepthOrStencilFormatMismatch = "Depth/stencil buffer format combination not allowed for blit."; MSG kBlitDepthOrStencilFormatMismatch = "Depth/stencil buffer format combination not allowed for blit.";
MSG kBlitDimensionsOutOfRange = "BlitFramebuffer dimensions out of 32-bit integer range."; MSG kBlitDimensionsOutOfRange = "BlitFramebuffer dimensions out of 32-bit integer range.";
...@@ -48,18 +52,30 @@ MSG kBlitTypeMismatchFixedOrFloat = "If the read buffer contains fixed-point or ...@@ -48,18 +52,30 @@ MSG kBlitTypeMismatchFixedOrFloat = "If the read buffer contains fixed-point or
MSG kBlitTypeMismatchFixedPoint = "If the read buffer contains fixed-point values = the draw buffer must as well."; MSG kBlitTypeMismatchFixedPoint = "If the read buffer contains fixed-point values = the draw buffer must as well.";
MSG kBlitTypeMismatchSignedInteger = "If the read buffer contains signed integer values the draw buffer must as well."; MSG kBlitTypeMismatchSignedInteger = "If the read buffer contains signed integer values the draw buffer must as well.";
MSG kBlitTypeMismatchUnsignedInteger = "If the read buffer contains unsigned integer values the draw buffer must as well."; MSG kBlitTypeMismatchUnsignedInteger = "If the read buffer contains unsigned integer values the draw buffer must as well.";
MSG kBufferAlreadyMapped = "Buffer is already mapped.";
MSG kBufferBoundForTransformFeedback = "Buffer is bound for transform feedback."; MSG kBufferBoundForTransformFeedback = "Buffer is bound for transform feedback.";
MSG kBufferMapped = "An active buffer is mapped"; MSG kBufferMapped = "An active buffer is mapped";
MSG kBufferNotBound = "A buffer must be bound."; MSG kBufferNotBound = "A buffer must be bound.";
MSG kBufferNotMappable = "Attempted to map buffer object zero.";
MSG kBufferNotMapped = "Buffer is not mapped.";
MSG kBufferOffsetOverflow = "Buffer offset overflow.";
MSG kBufferPointerNotAvailable = "Can not get pointer for reserved buffer name zero.";
MSG kCannotPopDefaultDebugGroup = "Cannot pop the default debug group.";
MSG kClientDataInVertexArray = "Client data cannot be used with a non-default vertex array object.";
MSG kColorNumberGreaterThanMaxDrawBuffers = "Color number for primary color greater than or equal to MAX_DRAW_BUFFERS"; MSG kColorNumberGreaterThanMaxDrawBuffers = "Color number for primary color greater than or equal to MAX_DRAW_BUFFERS";
MSG kColorNumberGreaterThanMaxDualSourceDrawBuffers = "Color number for secondary color greater than or equal to MAX_DUAL_SOURCE_DRAW_BUFFERS"; MSG kColorNumberGreaterThanMaxDualSourceDrawBuffers = "Color number for secondary color greater than or equal to MAX_DUAL_SOURCE_DRAW_BUFFERS";
MSG kCompressedDataSizeTooSmall = "dataSize is too small";
MSG kCompressedMismatch = "Compressed data is valid if-and-only-if the texture is compressed."; MSG kCompressedMismatch = "Compressed data is valid if-and-only-if the texture is compressed.";
MSG kCompressedTextureDimensionsMustMatchData = "Compressed texture dimensions must exactly match the dimensions of the data passed in."; MSG kCompressedTextureDimensionsMustMatchData = "Compressed texture dimensions must exactly match the dimensions of the data passed in.";
MSG kCompressedTexturesNotAttachable = "Compressed textures cannot be attached to a framebuffer."; MSG kCompressedTexturesNotAttachable = "Compressed textures cannot be attached to a framebuffer.";
MSG kConstantColorAlphaLimitation = "Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR not supported by this implementation.";
MSG kCopyAlias = "The read and write copy regions alias memory."; MSG kCopyAlias = "The read and write copy regions alias memory.";
MSG kCubemapFacesEqualDimensions = "Each cubemap face must have equal width and height."; MSG kCubemapFacesEqualDimensions = "Each cubemap face must have equal width and height.";
MSG kCubemapIncomplete = "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size."; MSG kCubemapIncomplete = "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size.";
MSG kDataTypeNotAligned = "Data is not evenly divisible into the number of bytes needed to store in memory a datum indicated by type.";
MSG kDefaultFramebuffer = "Default framebuffer is bound.";
MSG kDefaultFramebufferInvalidAttachment = "Invalid attachment when the default framebuffer is bound."; MSG kDefaultFramebufferInvalidAttachment = "Invalid attachment when the default framebuffer is bound.";
MSG kDefaultFramebufferInvalidDrawBuffer = "Only NONE or BACK are valid draw buffers for the default framebuffer";
MSG kDefaultFramebufferTarget = "It is invalid to change default FBO's attachments"; MSG kDefaultFramebufferTarget = "It is invalid to change default FBO's attachments";
MSG kDefaultVertexArray = "Default vertex array object is bound."; MSG kDefaultVertexArray = "Default vertex array object is bound.";
MSG kDestinationImmutable = "Destination texture cannot be immutable."; MSG kDestinationImmutable = "Destination texture cannot be immutable.";
...@@ -70,28 +86,59 @@ MSG kDispatchIndirectBufferNotBound = "Dispatch indirect buffer must be bound."; ...@@ -70,28 +86,59 @@ MSG kDispatchIndirectBufferNotBound = "Dispatch indirect buffer must be bound.";
MSG kDrawBufferTypeMismatch = "Fragment shader output type does not match the bound framebuffer attachment type."; MSG kDrawBufferTypeMismatch = "Fragment shader output type does not match the bound framebuffer attachment type.";
MSG kDrawFramebufferIncomplete = "Draw framebuffer is incomplete"; MSG kDrawFramebufferIncomplete = "Draw framebuffer is incomplete";
MSG kDrawIndirectBufferNotBound = "Draw indirect buffer must be bound."; MSG kDrawIndirectBufferNotBound = "Draw indirect buffer must be bound.";
MSG kES31Required = "OpenGL ES 3.1 Required"; MSG kEGLImageCannotCreate2DMultisampled = "Cannot create a 2D texture from a multisampled EGL image.";
MSG kES3Required = "OpenGL ES 3.0 Required."; MSG kEGLImageRenderbufferFormatNotSupported = "EGL image internal format is not supported as a renderbuffer.";
MSG kEGLImageTextureFormatNotSupported = "EGL image internal format is not supported as a texture.";
MSG kElementArrayBufferBoundForTransformFeedback = "It is undefined behavior to use an element array buffer that is bound for transform feedback."; MSG kElementArrayBufferBoundForTransformFeedback = "It is undefined behavior to use an element array buffer that is bound for transform feedback.";
MSG kElementArrayNoBufferOrPointer = "No element array buffer and no pointer.";
MSG kEnumNotSupported = "Enum is not currently supported."; MSG kEnumNotSupported = "Enum is not currently supported.";
MSG kEnumRequiresGLES30 = "Enum requires GLES 3.0";
MSG kEnumRequiresGLES31 = "Enum requires GLES 3.1"; MSG kEnumRequiresGLES31 = "Enum requires GLES 3.1";
MSG kES31Required = "OpenGL ES 3.1 Required";
MSG kES3Required = "OpenGL ES 3.0 Required.";
MSG kExceedsComputeWorkGroupCountX = "num_groups_x cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[0]";
MSG kExceedsComputeWorkGroupCountY = "num_groups_y cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[1]";
MSG kExceedsComputeWorkGroupCountZ = "num_groups_z cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[2]";
MSG kExceedsElementRange = "Element value exceeds element range.";
MSG kExceedsFramebufferHeight = "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_HEIGHT.";
MSG kExceedsFramebufferSamples = "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_SAMPLES.";
MSG kExceedsFramebufferWidth = "Params less than 0 or greater than GL_MAX_FRAMEBUFFER_WIDTH.";
MSG kExceedsMaxColorAttachments = "Index is greater than the maximum supported color attachments";
MSG kExceedsMaxDebugGroupStackDepth = "Cannot push more than GL_MAX_DEBUG_GROUP_STACK_DEPTH debug groups.";
MSG kExceedsMaxDebugMessageLength = "Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.";
MSG kExceedsMaxDrawBuffers = "Draw buffer greater than MAX_DRAW_BUFFERS.";
MSG kExceedsMaxElement = "Element value exceeds maximum element index."; MSG kExceedsMaxElement = "Element value exceeds maximum element index.";
MSG kExceedsMaxImageUnits = "Index must be within [0, MAX_IMAGE_UNITS).";
MSG kExceedsMaxLabelLength = "Label length is larger than GL_MAX_LABEL_LENGTH.";
MSG kExceedsMaxShaderStorageBufferBindings = "Index must be within [0, MAX_SHADER_STORAGE_BUFFER_BINDINGS).";
MSG kExceedsMaxVertexAttribBindings = "Index must be within [0, MAX_VERTEX_ATTRIB_BINDINGS).";
MSG kExceedsMaxVertexAttribStride = "Stride must be within [0, MAX_VERTEX_ATTRIB_STRIDE).";
MSG kExceedsNumExtensions = "Index must be within [0, NUM_EXTENSIONS).";
MSG kExceedsNumRequestableExtensions = "Index must be within [0, NUM_REQUESTABLE_EXTENSIONS_ANGLE).";
MSG kExpectedProgramName = "Expected a program name = but found a shader name."; MSG kExpectedProgramName = "Expected a program name = but found a shader name.";
MSG kExpectedShaderName = "Expected a shader name = but found a program name."; MSG kExpectedShaderName = "Expected a shader name = but found a program name.";
MSG kExtensionNotEnabled = "Extension is not enabled."; MSG kExtensionNotEnabled = "Extension is not enabled.";
MSG kExtensionNotRequestable = "Extension is not requestable.";
MSG kExternalTextureNotSupported = "External texture extension not enabled";
MSG kFeedbackLoop = "Feedback loop formed between Framebuffer and active Texture."; MSG kFeedbackLoop = "Feedback loop formed between Framebuffer and active Texture.";
MSG kFixedNotInWebGL = "GL_FIXED is not supported in WebGL.";
MSG kFormatNotRenderable = "Internal format is not renderable.";
MSG kFragDataBindingIndexOutOfRange = "Fragment output color index must be zero or one."; MSG kFragDataBindingIndexOutOfRange = "Fragment output color index must be zero or one.";
MSG kFragmentInputTypeNotFloatingPoint = "Fragment input type is not a floating point scalar or vector.";
MSG kFramebufferIncomplete = "Framebuffer is incomplete."; MSG kFramebufferIncomplete = "Framebuffer is incomplete.";
MSG kFramebufferIncompleteAttachment = "Attachment type must be compatible with attachment object."; MSG kFramebufferIncompleteAttachment = "Attachment type must be compatible with attachment object.";
MSG kFramebufferTextureInvalidLayer = "Layer invalid for framebuffer texture attachment."; MSG kFramebufferTextureInvalidLayer = "Layer invalid for framebuffer texture attachment.";
MSG kFramebufferTextureInvalidMipLevel = "Mip level invalid for framebuffer texture attachment."; MSG kFramebufferTextureInvalidMipLevel = "Mip level invalid for framebuffer texture attachment.";
MSG kFramebufferTextureLayerIncorrectTextureType = "Texture is not a three-dimensional or two-dimensionsal array texture."; MSG kFramebufferTextureLayerIncorrectTextureType = "Texture is not a three-dimensional or two-dimensionsal array texture.";
MSG kGLES1Only = "GLES1-only function.";
MSG kGenerateMipmapNotAllowed = "Texture format does not support mipmap generation."; MSG kGenerateMipmapNotAllowed = "Texture format does not support mipmap generation.";
MSG kGenerateMipmapZeroSize = "Cannot generate mipmaps for a zero-size texture in a WebGL context."; MSG kGenerateMipmapZeroSize = "Cannot generate mipmaps for a zero-size texture in a WebGL context.";
MSG kGeometryShaderExtensionNotEnabled = "GL_EXT_geometry_shader extension not enabled."; MSG kGeometryShaderExtensionNotEnabled = "GL_EXT_geometry_shader extension not enabled.";
MSG kGLES1Only = "GLES1-only function.";
MSG kImageSizeMustBeZero = "imageSize must be 0 if no texture data is provided.";
MSG kImageSizeTooSmall = "imageSize is too small.";
MSG kImmutableTextureBound = "The value of TEXTURE_IMMUTABLE_FORMAT for the texture currently bound to target on the active texture unit is true."; MSG kImmutableTextureBound = "The value of TEXTURE_IMMUTABLE_FORMAT for the texture currently bound to target on the active texture unit is true.";
MSG kIncompatibleDrawModeAgainstGeometryShader = "Primitive mode is incompatible with the input primitive type of the geometry shader."; MSG kIncompatibleDrawModeAgainstGeometryShader = "Primitive mode is incompatible with the input primitive type of the geometry shader.";
MSG kIndexExceedsActiveUniformBlockCount = "Index exceeds active uniform block count.";
MSG kIndexExceedsMaxActiveUniform = "Index must be less than program active uniform count."; MSG kIndexExceedsMaxActiveUniform = "Index must be less than program active uniform count.";
MSG kIndexExceedsMaxActiveUniformBlock = "Index must be less than program active uniform block count."; MSG kIndexExceedsMaxActiveUniformBlock = "Index must be less than program active uniform block count.";
MSG kIndexExceedsMaxAtomicCounterBufferBindings = "Index must be less than MAX_ATOMIC_COUNTER_BUFFER_BINDINGS."; MSG kIndexExceedsMaxAtomicCounterBufferBindings = "Index must be less than MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.";
...@@ -101,58 +148,84 @@ MSG kIndexExceedsMaxUniformBufferBindings = "Index must be less than MAX_UNIFORM ...@@ -101,58 +148,84 @@ MSG kIndexExceedsMaxUniformBufferBindings = "Index must be less than MAX_UNIFORM
MSG kIndexExceedsMaxVertexAttribute = "Index must be less than MAX_VERTEX_ATTRIBS."; MSG kIndexExceedsMaxVertexAttribute = "Index must be less than MAX_VERTEX_ATTRIBS.";
MSG kIndexExceedsMaxWorkgroupDimensions = "Index must be less than the number of workgroup dimensions (3)."; MSG kIndexExceedsMaxWorkgroupDimensions = "Index must be less than the number of workgroup dimensions (3).";
MSG kIndexExceedsSamples = "Index must be less than the value of SAMPLES."; MSG kIndexExceedsSamples = "Index must be less than the value of SAMPLES.";
MSG kIndexExceedsTransformFeedbackBufferBindings = "Index is greater than or equal to the number of TRANSFORM_FEEDBACK_BUFFER indexed binding points.";
MSG kInsufficientBufferSize = "Insufficient buffer size."; MSG kInsufficientBufferSize = "Insufficient buffer size.";
MSG kInsufficientParams = "More parameters are required than were provided.";
MSG kInsufficientVertexBufferSize = "Vertex buffer is not big enough for the draw call"; MSG kInsufficientVertexBufferSize = "Vertex buffer is not big enough for the draw call";
MSG kIntegerOverflow = "Integer overflow."; MSG kIntegerOverflow = "Integer overflow.";
MSG kInternalFormatRequiresTexture2DArray = "internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY."; MSG kInternalFormatRequiresTexture2DArray = "internalformat is an ETC2/EAC format and target is not GL_TEXTURE_2D_ARRAY.";
MSG kInvalidAccessBits = "Invalid access bits.";
MSG kInvalidAccessBitsFlush = "The explicit flushing bit may only be set if the buffer is mapped for writing.";
MSG kInvalidAccessBitsRead = "Invalid access bits when mapping buffer for reading";
MSG kInvalidAccessBitsReadWrite = "Need to map buffer for either reading or writing.";
MSG kInvalidAttachment = "Invalid Attachment Type."; MSG kInvalidAttachment = "Invalid Attachment Type.";
MSG kInvalidBindBufferSize = "Invalid buffer binding size.";
MSG kInvalidBindUniformLocation = "Location must be less than (MAX_VERTEX_UNIFORM_VECTORS + MAX_FRAGMENT_UNIFORM_VECTORS) * 4";
MSG kInvalidBlendEquation = "Invalid blend equation."; MSG kInvalidBlendEquation = "Invalid blend equation.";
MSG kInvalidBlendFunction = "Invalid blend function."; MSG kInvalidBlendFunction = "Invalid blend function.";
MSG kInvalidBooleanValue = "Invalid boolean value. Must be GL_FALSE or GL_TRUE."; MSG kInvalidBooleanValue = "Invalid boolean value. Must be GL_FALSE or GL_TRUE.";
MSG kInvalidBorder = "Border must be 0."; MSG kInvalidBorder = "Border must be 0.";
MSG kInvalidBufferName = "name is not a valid buffer.";
MSG kInvalidBufferTypes = "Invalid buffer target."; MSG kInvalidBufferTypes = "Invalid buffer target.";
MSG kInvalidBufferUsage = "Invalid buffer usage enum."; MSG kInvalidBufferUsage = "Invalid buffer usage enum.";
MSG kInvalidClearMask = "Invalid mask bits."; MSG kInvalidClearMask = "Invalid mask bits.";
MSG kInvalidClientState = "Invalid client vertex array type."; MSG kInvalidClientState = "Invalid client vertex array type.";
MSG kInvalidClipPlane = "Invalid clip plane."; MSG kInvalidClipPlane = "Invalid clip plane.";
MSG kInvalidCombinedImageUnit = "Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_COMBINED_IMAGE_UNITS)"; MSG kInvalidCombinedImageUnit = "Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_COMBINED_IMAGE_UNITS)";
MSG kInvalidComponents = "Invalid components.";
MSG kInvalidCompressedFormat = "Not a valid compressed texture format."; MSG kInvalidCompressedFormat = "Not a valid compressed texture format.";
MSG kInvalidCompressedImageSize = "Invalid compressed image size."; MSG kInvalidCompressedImageSize = "Invalid compressed image size.";
MSG kInvalidConstantColor = "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 blend function."; MSG kInvalidConstantColor = "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 blend function.";
MSG kInvalidCopyCombination = "Invalid copy texture format combination."; MSG kInvalidCopyCombination = "Invalid copy texture format combination.";
MSG kInvalidCoverageComponents = "components is not one of GL_RGB, GL_RGBA, GL_ALPHA or GL_NONE.";
MSG kInvalidCoverMode = "Invalid cover mode."; MSG kInvalidCoverMode = "Invalid cover mode.";
MSG kInvalidCullMode = "Cull mode not recognized."; MSG kInvalidCullMode = "Cull mode not recognized.";
MSG kInvalidDebugSeverity = "Invalid debug severity."; MSG kInvalidDebugSeverity = "Invalid debug severity.";
MSG kInvalidDebugSource = "Invalid debug source."; MSG kInvalidDebugSource = "Invalid debug source.";
MSG kInvalidDebugSourceType = "If count is greater than zero, source and type cannot be GL_DONT_CARE.";
MSG kInvalidDebugType = "Invalid debug type."; MSG kInvalidDebugType = "Invalid debug type.";
MSG kInvalidDefaultReadBuffer = "Read buffer must be GL_NONE or GL_BACK when reading from the default framebuffer.";
MSG kInvalidDepthRange = "Near value cannot be greater than far."; MSG kInvalidDepthRange = "Near value cannot be greater than far.";
MSG kInvalidDepthStencilDrawBuffer = "Draw buffer must be zero when using depth or stencil."; MSG kInvalidDepthStencilDrawBuffer = "Draw buffer must be zero when using depth or stencil.";
MSG kInvalidDestinationTexture = "Destination texture is not a valid texture object."; MSG kInvalidDestinationTexture = "Destination texture is not a valid texture object.";
MSG kInvalidDestinationTextureType = "Invalid destination texture type."; MSG kInvalidDestinationTextureType = "Invalid destination texture type.";
MSG kInvalidDrawBuffer = "Invalid draw buffer.";
MSG kInvalidDrawBufferCountForDefault = "The default framebuffer must have exactly one draw buffer.";
MSG kInvalidDrawBufferValue = "Ith value does not match COLOR_ATTACHMENTi or NONE.";
MSG kInvalidDrawMode = "Invalid draw mode."; MSG kInvalidDrawMode = "Invalid draw mode.";
MSG kInvalidDrawModeTransformFeedback = "Draw mode must match current transform feedback object's draw mode."; MSG kInvalidDrawModeTransformFeedback = "Draw mode must match current transform feedback object's draw mode.";
MSG kInvalidEGLImage = "EGL image is not valid.";
MSG kInvalidElementRange = "Invalid element range.";
MSG kInvalidFence = "Invalid fence object."; MSG kInvalidFence = "Invalid fence object.";
MSG kInvalidFenceCondition = "Invalid value for condition."; MSG kInvalidFenceCondition = "Invalid value for condition.";
MSG kInvalidFenceState = "Fence must be set."; MSG kInvalidFenceState = "Fence must be set.";
MSG kInvalidFillMode = "Invalid fill mode."; MSG kInvalidFillMode = "Invalid fill mode.";
MSG kInvalidFilterTexture = "Texture only supports NEAREST and LINEAR filtering."; MSG kInvalidFilterTexture = "Texture only supports NEAREST and LINEAR filtering.";
MSG kInvalidFlags = "Invalid value for flags."; MSG kInvalidFlags = "Invalid value for flags.";
MSG kInvalidFlushOutOfRange = "Flushed range does not fit into buffer mapping dimensions.";
MSG kInvalidFlushTarget = "Attempted to flush a buffer not mapped for explicit flushing.";
MSG kInvalidFlushZero = "Attempted to flush buffer object zero.";
MSG kInvalidFogDensity = "Invalid fog density (must be nonnegative)."; MSG kInvalidFogDensity = "Invalid fog density (must be nonnegative).";
MSG kInvalidFogMode = "Invalid fog mode."; MSG kInvalidFogMode = "Invalid fog mode.";
MSG kInvalidFogParameter = "Invalid fog parameter."; MSG kInvalidFogParameter = "Invalid fog parameter.";
MSG kInvalidFormat = "Invalid format."; MSG kInvalidFormat = "Invalid format.";
MSG kInvalidFormatCombination = "Invalid combination of format = type and internalFormat."; MSG kInvalidFormatCombination = "Invalid combination of format = type and internalFormat.";
MSG kInvalidFragmentInputBinding = "No such binding.";
MSG kInvalidFramebufferAttachmentParameter = "Invalid parameter name for framebuffer attachment."; MSG kInvalidFramebufferAttachmentParameter = "Invalid parameter name for framebuffer attachment.";
MSG kInvalidFramebufferLayer = "Framebuffer layer cannot be less than 0 or greater than GL_MAX_FRAMEBUFFER_LAYERS_EXT."; MSG kInvalidFramebufferLayer = "Framebuffer layer cannot be less than 0 or greater than GL_MAX_FRAMEBUFFER_LAYERS_EXT.";
MSG kInvalidFramebufferName = "name is not a valid framebuffer.";
MSG kInvalidFramebufferTarget = "Invalid framebuffer target."; MSG kInvalidFramebufferTarget = "Invalid framebuffer target.";
MSG kInvalidFramebufferTextureLevel = "Mipmap level must be 0 when attaching a texture."; MSG kInvalidFramebufferTextureLevel = "Mipmap level must be 0 when attaching a texture.";
MSG kInvalidImageUnit = "Image unit cannot be greater than or equal to the value of MAX_IMAGE_UNITS."; MSG kInvalidImageAccess = "access is not one of the supported tokens.";
MSG kInvalidImageFormat = "format is not one of supported image unit formats.";
MSG kInvalidIndentifier = "Invalid identifier.";
MSG kInvalidIndirectOffset = "indirect must be a multiple of the size of uint in basic machine units."; MSG kInvalidIndirectOffset = "indirect must be a multiple of the size of uint in basic machine units.";
MSG kInvalidInternalFormat = "Invalid internal format."; MSG kInvalidInternalFormat = "Invalid internal format.";
MSG kInvalidLight = "Invalid light."; MSG kInvalidLight = "Invalid light.";
MSG kInvalidLightModelParameter = "Invalid light model parameter."; MSG kInvalidLightModelParameter = "Invalid light model parameter.";
MSG kInvalidLightParameter = "Invalid light parameter."; MSG kInvalidLightParameter = "Invalid light parameter.";
MSG kInvalidLogicOp = "Invalid logical operation."; MSG kInvalidLogicOp = "Invalid logical operation.";
MSG kInvalidMapPointerQuery = "GL_BUFFER_MAP_POINTER can only be queried with GetBufferPointerv.";
MSG kInvalidMaterialFace = "Invalid material face."; MSG kInvalidMaterialFace = "Invalid material face.";
MSG kInvalidMaterialParameter = "Invalid material parameter."; MSG kInvalidMaterialParameter = "Invalid material parameter.";
MSG kInvalidMatrixMode = "Invalid matrix mode."; MSG kInvalidMatrixMode = "Invalid matrix mode.";
...@@ -163,32 +236,66 @@ MSG kInvalidMultisampledFramebufferOperation = "Invalid operation on multisample ...@@ -163,32 +236,66 @@ MSG kInvalidMultisampledFramebufferOperation = "Invalid operation on multisample
MSG kInvalidMultitextureUnit = "Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)"; MSG kInvalidMultitextureUnit = "Specified unit must be in [GL_TEXTURE0 = GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)";
MSG kInvalidName = "Invalid name."; MSG kInvalidName = "Invalid name.";
MSG kInvalidNameCharacters = "Name contains invalid characters."; MSG kInvalidNameCharacters = "Name contains invalid characters.";
MSG kInvalidPathCoefficientsArray = "No coefficients array given.";
MSG kInvalidPathCommand = "Invalid command.";
MSG kInvalidPathCommandsArray = "No commands array given.";
MSG kInvalidPathComponents = "Unexpected number of components";
MSG kInvalidPathCoordinateType = "Invalid coordinate type.";
MSG kInvalidPathEndCaps = "Invalid end caps.";
MSG kInvalidPathGenMode = "Invalid gen mode.";
MSG kInvalidPathJoinStyle = "Invalid join style.";
MSG kInvalidPathMatrix = "Invalid matrix.";
MSG kInvalidPathMiterLimit = "Invalid miter limit.";
MSG kInvalidPathNameArray = "No path name array.";
MSG kInvalidPathNameType = "Invalid path name type.";
MSG kInvalidPathNumCommands = "Invalid number of commands.";
MSG kInvalidPathNumCoords = "Invalid number of coordinates.";
MSG kInvalidPathNumCoordsArray = "No coordinate array given.";
MSG kInvalidPathNumPaths = "Invalid (negative) numPaths.";
MSG kInvalidPathParameter = "Invalid path parameter.";
MSG kInvalidPathStrokeWidth = "Invalid stroke width.";
MSG kInvalidPathValueArray = "No value array.";
MSG kInvalidPname = "Invalid pname."; MSG kInvalidPname = "Invalid pname.";
MSG kInvalidPointerQuery = "Invalid pointer query.";
MSG kInvalidPointParameter = "Invalid point parameter."; MSG kInvalidPointParameter = "Invalid point parameter.";
MSG kInvalidPointParameterValue = "Invalid point parameter value (must be non-negative)."; MSG kInvalidPointParameterValue = "Invalid point parameter value (must be non-negative).";
MSG kInvalidPointSizeValue = "Invalid point size (must be positive)."; MSG kInvalidPointSizeValue = "Invalid point size (must be positive).";
MSG kInvalidPointerQuery = "Invalid pointer query.";
MSG kInvalidPrecision = "Invalid or unsupported precision type."; MSG kInvalidPrecision = "Invalid or unsupported precision type.";
MSG kInvalidPrimitiveMode = "Invalid primitive mode.";
MSG kInvalidProgramBinaryFormat = "Program binary format is not valid.";
MSG kInvalidProgramInterface = "Invalid program interface.";
MSG kInvalidProgramName = "Program object expected."; MSG kInvalidProgramName = "Program object expected.";
MSG kInvalidProgramResourceIndex = "Invalid program resource index.";
MSG kInvalidProgramResourceProperty = "Invalid program resource property.";
MSG kInvalidProjectionMatrix = "Invalid projection matrix. Left/right = top/bottom = near/far intervals cannot be zero = and near/far cannot be less than zero."; MSG kInvalidProjectionMatrix = "Invalid projection matrix. Left/right = top/bottom = near/far intervals cannot be zero = and near/far cannot be less than zero.";
MSG kInvalidPropCount = "Invalid propCount.";
MSG kInvalidPropertyForProgramInterface = "Not an allowed program resource property for this program interface";
MSG kInvalidQueryId = "Invalid query Id."; MSG kInvalidQueryId = "Invalid query Id.";
MSG kInvalidQueryName = "name is not a valid query.";
MSG kInvalidQueryTarget = "Invalid query target."; MSG kInvalidQueryTarget = "Invalid query target.";
MSG kInvalidQueryType = "Invalid query type."; MSG kInvalidQueryType = "Invalid query type.";
MSG kInvalidRange = "Invalid range."; MSG kInvalidRange = "Invalid range.";
MSG kInvalidReadBuffer = "Invalid read buffer";
MSG kInvalidRenderbufferInternalFormat = "Invalid renderbuffer internalformat."; MSG kInvalidRenderbufferInternalFormat = "Invalid renderbuffer internalformat.";
MSG kInvalidRenderbufferName = "name is not a valid renderbuffer.";
MSG kInvalidRenderbufferTarget = "Invalid renderbuffer target."; MSG kInvalidRenderbufferTarget = "Invalid renderbuffer target.";
MSG kInvalidRenderbufferTextureParameter = "Invalid parameter name for renderbuffer attachment."; MSG kInvalidRenderbufferTextureParameter = "Invalid parameter name for renderbuffer attachment.";
MSG kInvalidRenderbufferWidthHeight = "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size."; MSG kInvalidRenderbufferWidthHeight = "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size.";
MSG kInvalidSampleMaskNumber = "MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS."; MSG kInvalidSampleMaskNumber = "MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS.";
MSG kInvalidSampler = "Sampler is not valid"; MSG kInvalidSampler = "Sampler is not valid";
MSG kInvalidSamplerName = "name is not a valid sampler.";
MSG kInvalidShaderBinaryFormat = "Invalid shader binary format.";
MSG kInvalidShaderName = "Shader object expected."; MSG kInvalidShaderName = "Shader object expected.";
MSG kInvalidShaderType = "Invalid shader type."; MSG kInvalidShaderType = "Invalid shader type.";
MSG kInvalidShadingModel = "Invalid shading model."; MSG kInvalidShadingModel = "Invalid shading model.";
MSG kInvalidSourceTexture = "Source texture is not a valid texture object."; MSG kInvalidSourceTexture = "Source texture is not a valid texture object.";
MSG kInvalidSourceTextureInternalFormat = "Source texture internal format is invalid.";
MSG kInvalidSourceTextureLevel = "Invalid source texture level."; MSG kInvalidSourceTextureLevel = "Invalid source texture level.";
MSG kInvalidSourceTextureSize = "Invalid source texture height or width."; MSG kInvalidSourceTextureSize = "Invalid source texture height or width.";
MSG kInvalidSourceTextureType = "Source texture must be a valid texture type.";
MSG kInvalidStencil = "Invalid stencil."; MSG kInvalidStencil = "Invalid stencil.";
MSG kInvalidStencilBitMask = "Invalid stencil bit mask."; MSG kInvalidStencilBitMask = "Invalid stencil bit mask.";
MSG kInvalidSyncPointer = "Not a valid sync pointer.";
MSG kInvalidTarget = "Invalid target."; MSG kInvalidTarget = "Invalid target.";
MSG kInvalidTextureCombine = "Invalid texture combine mode."; MSG kInvalidTextureCombine = "Invalid texture combine mode.";
MSG kInvalidTextureCombineOp = "Invalid texture combine operand."; MSG kInvalidTextureCombineOp = "Invalid texture combine operand.";
...@@ -198,57 +305,74 @@ MSG kInvalidTextureEnvParameter = "Invalid texture environment parameter."; ...@@ -198,57 +305,74 @@ MSG kInvalidTextureEnvParameter = "Invalid texture environment parameter.";
MSG kInvalidTextureEnvScale = "Invalid texture environment scale."; MSG kInvalidTextureEnvScale = "Invalid texture environment scale.";
MSG kInvalidTextureEnvTarget = "Invalid texture environment target."; MSG kInvalidTextureEnvTarget = "Invalid texture environment target.";
MSG kInvalidTextureFilterParam = "Texture filter not recognized."; MSG kInvalidTextureFilterParam = "Texture filter not recognized.";
MSG kInvalidTextureLevel = "Texture level does not exist.";
MSG kInvalidTextureName = "Not a valid texture object name."; MSG kInvalidTextureName = "Not a valid texture object name.";
MSG kInvalidTextureRange = "Cannot be less than 0 or greater than maximum number of textures."; MSG kInvalidTextureRange = "Cannot be less than 0 or greater than maximum number of textures.";
MSG kInvalidTextureTarget = "Invalid or unsupported texture target."; MSG kInvalidTextureTarget = "Invalid or unsupported texture target.";
MSG kInvalidTextureType = "Texture has incompatible target.";
MSG kInvalidTextureWrap = "Texture wrap mode not recognized."; MSG kInvalidTextureWrap = "Texture wrap mode not recognized.";
MSG kInvalidTimeout = "Invalid value for timeout."; MSG kInvalidTimeout = "Invalid value for timeout.";
MSG kInvalidTransformFeedbackAttribsCount = "Count exeeds MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS."; MSG kInvalidTransformation = "Invalid transformation.";
MSG kInvalidTransformFeedbackAttribsCount = "Count exceeds MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS.";
MSG kInvalidTransformFeedbackName = "name is not a valid transform feedback.";
MSG kInvalidType = "Invalid type."; MSG kInvalidType = "Invalid type.";
MSG kInvalidTypePureInt = "Invalid type = should be integer"; MSG kInvalidTypePureInt = "Invalid type = should be integer";
MSG kInvalidUniformCount = "Only array uniforms may have count > 1."; MSG kInvalidUniformCount = "Only array uniforms may have count > 1.";
MSG kInvalidUniformLocation = "Invalid uniform location"; MSG kInvalidUniformLocation = "Invalid uniform location";
MSG kInvalidUnpackAlignment = "Unpack alignment must be 1 = 2 = 4 = or 8."; MSG kInvalidUnpackAlignment = "Unpack alignment must be 1 = 2 = 4 = or 8.";
MSG kInvalidVaryingLocation = "Location exceeds max varying.";
MSG kInvalidVertexArray = "Vertex array does not exist."; MSG kInvalidVertexArray = "Vertex array does not exist.";
MSG kInvalidVertexArrayName = "name is not a valid vertex array.";
MSG kInvalidVertexAttribSize2101010 = "Type is INT_2_10_10_10_REV or UNSIGNED_INT_2_10_10_10_REV and size is not 4.";
MSG kInvalidVertexAttrSize = "Vertex attribute size must be 1 = 2 = 3 = or 4."; MSG kInvalidVertexAttrSize = "Vertex attribute size must be 1 = 2 = 3 = or 4.";
MSG kInvalidVertexPointerSize = "Size for built-in vertex attribute is outside allowed range."; MSG kInvalidVertexPointerSize = "Size for built-in vertex attribute is outside allowed range.";
MSG kInvalidVertexPointerStride = "Invalid stride for built-in vertex attribute."; MSG kInvalidVertexPointerStride = "Invalid stride for built-in vertex attribute.";
MSG kInvalidVertexPointerType = "Invalid type for built-in vertex attribute."; MSG kInvalidVertexPointerType = "Invalid type for built-in vertex attribute.";
MSG kInvalidWidth = "Invalid width."; MSG kInvalidWidth = "Invalid width.";
MSG kInvalidWrapModeTexture = "Invalid wrap mode for texture type."; MSG kInvalidWrapModeTexture = "Invalid wrap mode for texture type.";
MSG kLengthZero = "Length must not be zero.";
MSG kLevelNotZero = "Texture level must be zero."; MSG kLevelNotZero = "Texture level must be zero.";
MSG kLightParameterOutOfRange = "Light parameter out of range."; MSG kLightParameterOutOfRange = "Light parameter out of range.";
MSG kMapOutOfRange = "Mapped range does not fit into buffer dimensions.";
MSG kMaterialParameterOutOfRange = "Material parameter out of range."; MSG kMaterialParameterOutOfRange = "Material parameter out of range.";
MSG kMatrixStackOverflow = "Current matrix stack is full."; MSG kMatrixStackOverflow = "Current matrix stack is full.";
MSG kMatrixStackUnderflow = "Current matrix stack has only a single matrix."; MSG kMatrixStackUnderflow = "Current matrix stack has only a single matrix.";
MSG kMaxActiveVariablesInterface = "MAX_NUM_ACTIVE_VARIABLES requires a buffer or block interface.";
MSG kMismatchedFormat = "Format must match internal format."; MSG kMismatchedFormat = "Format must match internal format.";
MSG kMismatchedTargetAndFormat = "Invalid texture target and format combination."; MSG kMismatchedTargetAndFormat = "Invalid texture target and format combination.";
MSG kMismatchedTypeAndFormat = "Invalid format and type combination."; MSG kMismatchedTypeAndFormat = "Invalid format and type combination.";
MSG kMismatchedVariableProgram = "Variable is not part of the current program."; MSG kMismatchedVariableProgram = "Variable is not part of the current program.";
MSG kMissingName = "No name given.";
MSG kMissingReadAttachment = "Missing read attachment."; MSG kMissingReadAttachment = "Missing read attachment.";
MSG kMissingTexture = "No Texture is bound to the specified target."; MSG kMissingTexture = "No Texture is bound to the specified target.";
MSG kMissingTextureName = "texture is not the name of an existing texture object.";
MSG kMultisampleArrayExtensionRequired = "GL_ANGLE_texture_multisample_array not enabled."; MSG kMultisampleArrayExtensionRequired = "GL_ANGLE_texture_multisample_array not enabled.";
MSG kMultisampleTextureExtensionOrES31Required = "GL_ANGLE_texture_multisample or GLES 3.1 required."; MSG kMultisampleTextureExtensionOrES31Required = "GL_ANGLE_texture_multisample or GLES 3.1 required.";
MSG kMultiviewActive = "The number of views in the active draw framebuffer is greater than 1."; MSG kMultiviewActive = "The number of views in the active draw framebuffer is greater than 1.";
MSG kMultiviewMismatch = "The number of views in the active program and draw framebuffer does not match."; MSG kMultiviewMismatch = "The number of views in the active program and draw framebuffer does not match.";
MSG kMultiviewNotAvailable = "ANGLE_multiview is not available."; MSG kMultiviewNotAvailable = "ANGLE_multiview is not available.";
MSG kMultiviewReadFramebuffer = "The active read framebuffer object has multiview attachments.";
MSG kMultiviewTimerQuery = "There is an active query for target GL_TIME_ELAPSED_EXT when the number of views in the active draw framebuffer is greater than 1."; MSG kMultiviewTimerQuery = "There is an active query for target GL_TIME_ELAPSED_EXT when the number of views in the active draw framebuffer is greater than 1.";
MSG kMultiviewTransformFeedback = "There is an active transform feedback object when the number of views in the active draw framebuffer is greater than 1."; MSG kMultiviewTransformFeedback = "There is an active transform feedback object when the number of views in the active draw framebuffer is greater than 1.";
MSG kMultiviewViewsTooLarge = "numViews cannot be greater than GL_MAX_VIEWS_ANGLE."; MSG kMultiviewViewsTooLarge = "numViews cannot be greater than GL_MAX_VIEWS_ANGLE.";
MSG kMultiviewViewsTooSmall = "numViews cannot be less than 1."; MSG kMultiviewViewsTooSmall = "numViews cannot be less than 1.";
MSG kMustHaveElementArrayBinding = "Must have element array buffer bound."; MSG kMustHaveElementArrayBinding = "Must have element array buffer bound.";
MSG kNVFenceNotSupported = "GL_NV_fence is not supported";
MSG kNameBeginsWithGL = "Attributes that begin with 'gl_' are not allowed."; MSG kNameBeginsWithGL = "Attributes that begin with 'gl_' are not allowed.";
MSG kNegativeAttachments = "Negative number of attachments."; MSG kNegativeAttachments = "Negative number of attachments.";
MSG kNegativeBaseViewIndex = "Negative baseViewIndex.";
MSG kNegativeBufferSize = "Negative buffer size."; MSG kNegativeBufferSize = "Negative buffer size.";
MSG kNegativeBufSize = "Invalid bufSize.";
MSG kNegativeCount = "Negative count."; MSG kNegativeCount = "Negative count.";
MSG kNegativeHeightWidthDepth = "Cannot have negative height = width = or depth."; MSG kNegativeHeightWidthDepth = "Cannot have negative height = width = or depth.";
MSG kNegativeLayer = "Negative layer."; MSG kNegativeLayer = "Negative layer.";
MSG kNegativeLength = "Negative length."; MSG kNegativeLength = "Negative length.";
MSG kNegativeLevel = "Level is negative.";
MSG kNegativeLocation = "Location cannot be less than 0.";
MSG kNegativeMaxCount = "Negative maxcount."; MSG kNegativeMaxCount = "Negative maxcount.";
MSG kNegativeOffset = "Negative offset."; MSG kNegativeOffset = "Negative offset.";
MSG kNegativeParam = "param is negative.";
MSG kNegativePrimcount = "Primcount must be greater than or equal to zero."; MSG kNegativePrimcount = "Primcount must be greater than or equal to zero.";
MSG kNegativeSize = "Cannot have negative height or width."; MSG kNegativeSize = "Negative size.";
MSG kNegativeStart = "Cannot have negative start."; MSG kNegativeStart = "Cannot have negative start.";
MSG kNegativeStride = "Cannot have negative stride."; MSG kNegativeStride = "Cannot have negative stride.";
MSG kNegativeXYZ = "x = y = or z cannot be negative."; MSG kNegativeXYZ = "x = y = or z cannot be negative.";
...@@ -256,14 +380,24 @@ MSG kNoActiveComputeShaderStage = "No active compute shader stage in this progra ...@@ -256,14 +380,24 @@ MSG kNoActiveComputeShaderStage = "No active compute shader stage in this progra
MSG kNoActiveGeometryShaderStage = "No active geometry shader stage in this program."; MSG kNoActiveGeometryShaderStage = "No active geometry shader stage in this program.";
MSG kNoActiveGraphicsShaderStage = "It is a undefined behaviour to render without vertex shader stage or fragment shader stage."; MSG kNoActiveGraphicsShaderStage = "It is a undefined behaviour to render without vertex shader stage or fragment shader stage.";
MSG kNoActiveProgramWithComputeShader = "No active program for the compute shader stage."; MSG kNoActiveProgramWithComputeShader = "No active program for the compute shader stage.";
MSG kNoDefinedClearConversion = "No defined conversion between clear value and attachment format.";
MSG kNonPositiveDrawTextureDimension = "Both width and height argument of drawn texture must be positive.";
MSG kNoPathOrNoPathData = "No such path or path has no data.";
MSG kNoProgramBinaryFormats = "No program binary formats supported.";
MSG kNoReadFramebuffer = "No active read framebuffer.";
MSG kNoSampleAlphaToCoveragesLimitation = "Current renderer doesn't support alpha-to-coverage.";
MSG kNoSuchPath = "No such path object."; MSG kNoSuchPath = "No such path object.";
MSG kNoTransformArray = "No transform array given.";
MSG kNoTransformFeedbackOutputVariables = "The active program has specified no output variables to record."; MSG kNoTransformFeedbackOutputVariables = "The active program has specified no output variables to record.";
MSG kNoZeroDivisor = "At least one enabled attribute must have a divisor of zero."; MSG kNoZeroDivisor = "At least one enabled attribute must have a divisor of zero.";
MSG kNonPositiveDrawTextureDimension = "Both width and height argument of drawn texture must be positive."; MSG kNVFenceNotSupported = "GL_NV_fence is not supported";
MSG kObjectNotGenerated = "Object cannot be used because it has not been generated."; MSG kObjectNotGenerated = "Object cannot be used because it has not been generated.";
MSG kOffsetAlignment = "offset must be a multiple of 4.";
MSG kOffsetAndSizeAlignment = "Offset and size must be multiple of 4.";
MSG kOffsetMustBeMultipleOfType = "Offset must be a multiple of the passed in datatype."; MSG kOffsetMustBeMultipleOfType = "Offset must be a multiple of the passed in datatype.";
MSG kOffsetMustBeMultipleOfUint = "Offset must be a multiple of the size = in basic machine units = of uint"; MSG kOffsetMustBeMultipleOfUint = "Offset must be a multiple of the size = in basic machine units = of uint";
MSG kOffsetOverflow = "Offset overflows texture dimensions."; MSG kOffsetOverflow = "Offset overflows texture dimensions.";
MSG kOtherQueryActive = "Other query is active.";
MSG kOutsideOfBounds = "Parameter outside of bounds."; MSG kOutsideOfBounds = "Parameter outside of bounds.";
MSG kParamOverflow = "The provided parameters overflow with the provided buffer."; MSG kParamOverflow = "The provided parameters overflow with the provided buffer.";
MSG kPixelDataNotNull = "Pixel data must be null."; MSG kPixelDataNotNull = "Pixel data must be null.";
...@@ -277,6 +411,8 @@ MSG kProgramNotBound = "A program must be bound."; ...@@ -277,6 +411,8 @@ MSG kProgramNotBound = "A program must be bound.";
MSG kProgramNotLinked = "Program not linked."; MSG kProgramNotLinked = "Program not linked.";
MSG kQueryActive = "Query is active."; MSG kQueryActive = "Query is active.";
MSG kQueryExtensionNotEnabled = "Query extension not enabled."; MSG kQueryExtensionNotEnabled = "Query extension not enabled.";
MSG kQueryInactive = "Query is not active.";
MSG kQueryTargetMismatch = "Query type does not match target.";
MSG kReadBufferNone = "Read buffer is GL_NONE."; MSG kReadBufferNone = "Read buffer is GL_NONE.";
MSG kReadBufferNotAttached = "Read buffer has no attachment."; MSG kReadBufferNotAttached = "Read buffer has no attachment.";
MSG kRectangleTextureCompressed = "Rectangle texture cannot have a compressed format."; MSG kRectangleTextureCompressed = "Rectangle texture cannot have a compressed format.";
...@@ -285,24 +421,35 @@ MSG kRenderableInternalFormat = "SizedInternalformat must be color-renderable = ...@@ -285,24 +421,35 @@ MSG kRenderableInternalFormat = "SizedInternalformat must be color-renderable =
MSG kRenderbufferNotBound = "A renderbuffer must be bound."; MSG kRenderbufferNotBound = "A renderbuffer must be bound.";
MSG kResourceMaxRenderbufferSize = "Desired resource size is greater than max renderbuffer size."; MSG kResourceMaxRenderbufferSize = "Desired resource size is greater than max renderbuffer size.";
MSG kResourceMaxTextureSize = "Desired resource size is greater than max texture size."; MSG kResourceMaxTextureSize = "Desired resource size is greater than max texture size.";
MSG kSamplerUniformValueOutOfRange = "Sampler uniform value out of range.";
MSG kSamplesOutOfRange = "Samples must not be greater than maximum supported value for the format."; MSG kSamplesOutOfRange = "Samples must not be greater than maximum supported value for the format.";
MSG kSamplesZero = "Samples may not be zero."; MSG kSamplesZero = "Samples may not be zero.";
MSG kShaderAttachmentHasShader = "Shader attachment already has a shader."; MSG kShaderAttachmentHasShader = "Shader attachment already has a shader.";
MSG kShaderSourceInvalidCharacters = "Shader source contains invalid characters."; MSG kShaderSourceInvalidCharacters = "Shader source contains invalid characters.";
MSG kShaderStorageBufferOffsetAlignment = "Offset must be multiple of value of SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT.";
MSG kShaderToDetachMustBeAttached = "Shader to be detached must be currently attached to the program."; MSG kShaderToDetachMustBeAttached = "Shader to be detached must be currently attached to the program.";
MSG kSourceLevelNotDefined = "The source level of the source texture must be defined."; MSG kSourceLevelNotDefined = "The source level of the source texture must be defined.";
MSG kSourceTextureLevelZeroDefined = "Source texture must level 0 defined.";
MSG kSourceTextureMustBeCompressed = "Source texture must have a compressed internal format.";
MSG kSourceTextureTooSmall = "The specified dimensions are outside of the bounds of the texture."; MSG kSourceTextureTooSmall = "The specified dimensions are outside of the bounds of the texture.";
MSG kStencilReferenceMaskOrMismatch = "Stencil reference and mask values must be the same for front facing and back facing triangles."; MSG kStencilReferenceMaskOrMismatch = "Stencil reference and mask values must be the same for front facing and back facing triangles.";
MSG kStrideExceedsWebGLLimit = "Stride is over the maximum stride allowed by WebGL.";
MSG kStrideMustBeMultipleOfType = "Stride must be a multiple of the passed in datatype."; MSG kStrideMustBeMultipleOfType = "Stride must be a multiple of the passed in datatype.";
MSG kSyncMissing = "Sync object does not exist."; MSG kSyncMissing = "Sync object does not exist.";
MSG kTargetMustBeTexture2DMultisampleArrayOES = "Target must be TEXTURE_2D_MULTISAMPLE_ARRAY_OES."; MSG kTargetMustBeTexture2DMultisampleArrayOES = "Target must be TEXTURE_2D_MULTISAMPLE_ARRAY_OES.";
MSG kTextureIsImmutable = "Texture is immutable."; MSG kTextureIsImmutable = "Texture is immutable.";
MSG kTextureIsNotImmutable = "Texture is not immutable.";
MSG kTextureNotBound = "A texture must be bound."; MSG kTextureNotBound = "A texture must be bound.";
MSG kTextureNotPow2 = "The texture is a non-power-of-two texture."; MSG kTextureNotPow2 = "The texture is a non-power-of-two texture.";
MSG kTextureRectangleNotSupported = "Context does not support GL_ANGLE_texture_rectangle";
MSG kTextureSizeTooSmall = "Texture dimensions must all be greater than zero."; MSG kTextureSizeTooSmall = "Texture dimensions must all be greater than zero.";
MSG kTextureTargetMismatch = "Textarget must match the texture target type.";
MSG kTextureTargetRequiresES31 = "Texture target requires at least OpenGL ES 3.1."; MSG kTextureTargetRequiresES31 = "Texture target requires at least OpenGL ES 3.1.";
MSG kTextureTypeConflict = "Two textures of different types use the same sampler location."; MSG kTextureTypeConflict = "Two textures of different types use the same sampler location.";
MSG kTextureWidthOrHeightOutOfRange = "Width and height must be less than or equal to GL_MAX_TEXTURE_SIZE."; MSG kTextureWidthOrHeightOutOfRange = "Width and height must be less than or equal to GL_MAX_TEXTURE_SIZE.";
MSG kTransfomFeedbackAlreadyActive = "Transform feedback is already active.";
MSG kTransformFeedbackActiveDelete = "Attempt to delete an active transform feedback.";
MSG kTransformFeedbackActiveDuringLink = "Cannot link program while program is associated with an active transform feedback object.";
MSG kTransformFeedbackBufferDoubleBound = "A transform feedback buffer that would be written to is also bound to a non-transform-feedback target = which would cause undefined behavior."; MSG kTransformFeedbackBufferDoubleBound = "A transform feedback buffer that would be written to is also bound to a non-transform-feedback target = which would cause undefined behavior.";
MSG kTransformFeedbackBufferMultipleOutputs = "Transform feedback has a buffer bound to multiple outputs."; MSG kTransformFeedbackBufferMultipleOutputs = "Transform feedback has a buffer bound to multiple outputs.";
MSG kTransformFeedbackBufferTooSmall = "Not enough space in bound transform feedback buffers."; MSG kTransformFeedbackBufferTooSmall = "Not enough space in bound transform feedback buffers.";
...@@ -310,13 +457,19 @@ MSG kTransformFeedbackDoesNotExist = "Transform feedback object that does not ex ...@@ -310,13 +457,19 @@ MSG kTransformFeedbackDoesNotExist = "Transform feedback object that does not ex
MSG kTransformFeedbackNotActive = "No Transform Feedback object is active."; MSG kTransformFeedbackNotActive = "No Transform Feedback object is active.";
MSG kTransformFeedbackNotPaused = "The active Transform Feedback object is not paused."; MSG kTransformFeedbackNotPaused = "The active Transform Feedback object is not paused.";
MSG kTransformFeedbackPaused = "The active Transform Feedback object is paused."; MSG kTransformFeedbackPaused = "The active Transform Feedback object is paused.";
MSG kTransformFeedbackProgramBinary = "Cannot change program binary while program is associated with an active transform feedback object.";
MSG kTransformFeedbackTargetActive = "Target is TRANSFORM_FEEDBACK_BUFFER and transform feedback is currently active.";
MSG kTransformFeedbackUseProgram = "Cannot change active program while transform feedback is unpaused.";
MSG kTransformFeedbackVaryingIndexOutOfRange = "Index must be less than the transform feedback varying count in the program."; MSG kTransformFeedbackVaryingIndexOutOfRange = "Index must be less than the transform feedback varying count in the program.";
MSG kTypeMismatch = "Passed in texture target and format must match the one originally used to define the texture."; MSG kTypeMismatch = "Passed in texture target and format must match the one originally used to define the texture.";
MSG kTypeNotUnsignedShortByte = "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported."; MSG kTypeNotUnsignedShortByte = "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported.";
MSG kUniformBufferBoundForTransformFeedback = "It is undefined behavior to use an uniform buffer that is bound for transform feedback."; MSG kUniformBufferBoundForTransformFeedback = "It is undefined behavior to use an uniform buffer that is bound for transform feedback.";
MSG kUniformBufferOffsetAlignment = "Offset must be multiple of value of UNIFORM_BUFFER_OFFSET_ALIGNMENT.";
MSG kUniformBufferTooSmall = "It is undefined behaviour to use a uniform buffer that is too small."; MSG kUniformBufferTooSmall = "It is undefined behaviour to use a uniform buffer that is too small.";
MSG kUniformBufferUnbound = "It is undefined behaviour to have a used but unbound uniform buffer."; MSG kUniformBufferUnbound = "It is undefined behaviour to have a used but unbound uniform buffer.";
MSG kUniformSizeMismatch = "Uniform size does not match uniform method."; MSG kUniformSizeMismatch = "Uniform size does not match uniform method.";
MSG kUniformTypeMismatch = "Uniform type does not match uniform method.";
MSG kUnimplementedComputeShaderPrecision = "Compute shader precision not yet implemented.";
MSG kUnknownParameter = "Unknown parameter value."; MSG kUnknownParameter = "Unknown parameter value.";
MSG kUnsizedInternalFormatUnsupported = "Internalformat is one of the unsupported unsized base internalformats."; MSG kUnsizedInternalFormatUnsupported = "Internalformat is one of the unsupported unsized base internalformats.";
MSG kUnsupportedDrawModeForTransformFeedback = "The draw command is unsupported when transform feedback is active and not paused."; MSG kUnsupportedDrawModeForTransformFeedback = "The draw command is unsupported when transform feedback is active and not paused.";
...@@ -325,6 +478,7 @@ MSG kVertexArrayNoBufferPointer = "An enabled vertex array has no buffer and no ...@@ -325,6 +478,7 @@ MSG kVertexArrayNoBufferPointer = "An enabled vertex array has no buffer and no
MSG kVertexBufferBoundForTransformFeedback = "It is undefined behavior to use a vertex buffer that is bound for transform feedback."; MSG kVertexBufferBoundForTransformFeedback = "It is undefined behavior to use a vertex buffer that is bound for transform feedback.";
MSG kVertexShaderTypeMismatch = "Vertex shader input type does not match the type of the bound vertex attribute."; MSG kVertexShaderTypeMismatch = "Vertex shader input type does not match the type of the bound vertex attribute.";
MSG kViewportNegativeSize = "Viewport size cannot be negative."; MSG kViewportNegativeSize = "Viewport size cannot be negative.";
MSG kViewsExceedMaxArrayLayers = "baseViewIndex+numViews cannot be greater than GL_MAX_ARRAY_TEXTURE_LAYERS.";
MSG kWebgl2NameLengthLimitExceeded = "Location lengths must not be greater than 1024 characters."; MSG kWebgl2NameLengthLimitExceeded = "Location lengths must not be greater than 1024 characters.";
MSG kWebglBindAttribLocationReservedPrefix = "Attributes that begin with 'webgl_' = or '_webgl_' are not allowed."; MSG kWebglBindAttribLocationReservedPrefix = "Attributes that begin with 'webgl_' = or '_webgl_' are not allowed.";
MSG kWebglNameLengthLimitExceeded = "Location name lengths must not be greater than 256 characters."; MSG kWebglNameLengthLimitExceeded = "Location name lengths must not be greater than 256 characters.";
......
...@@ -952,14 +952,13 @@ bool ValidImageDataSize(Context *context, ...@@ -952,14 +952,13 @@ bool ValidImageDataSize(Context *context,
ASSERT(imageSize >= 0); ASSERT(imageSize >= 0);
if (pixels == nullptr && imageSize != 0) if (pixels == nullptr && imageSize != 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kImageSizeMustBeZero);
"imageSize must be 0 if no texture data is provided.");
return false; return false;
} }
if (pixels != nullptr && endByte > static_cast<GLuint>(imageSize)) if (pixels != nullptr && endByte > static_cast<GLuint>(imageSize))
{ {
context->validationError(GL_INVALID_OPERATION, "imageSize is too small"); context->validationError(GL_INVALID_OPERATION, kImageSizeTooSmall);
return false; return false;
} }
} }
...@@ -1003,8 +1002,7 @@ bool ValidateWebGLVertexAttribPointer(Context *context, ...@@ -1003,8 +1002,7 @@ bool ValidateWebGLVertexAttribPointer(Context *context,
constexpr GLsizei kMaxWebGLStride = 255; constexpr GLsizei kMaxWebGLStride = 255;
if (stride > kMaxWebGLStride) if (stride > kMaxWebGLStride)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kStrideExceedsWebGLLimit);
"Stride is over the maximum stride allowed by WebGL.");
return false; return false;
} }
...@@ -1619,7 +1617,7 @@ bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id) ...@@ -1619,7 +1617,7 @@ bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id)
if (id == 0) if (id == 0)
{ {
context->validationError(GL_INVALID_OPERATION, "Query id is 0"); context->validationError(GL_INVALID_OPERATION, kInvalidQueryId);
return false; return false;
} }
...@@ -1641,7 +1639,7 @@ bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id) ...@@ -1641,7 +1639,7 @@ bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id)
if (context->getGLState().isQueryActive(target)) if (context->getGLState().isQueryActive(target))
{ {
context->validationError(GL_INVALID_OPERATION, "Other query is active"); context->validationError(GL_INVALID_OPERATION, kOtherQueryActive);
return false; return false;
} }
...@@ -1657,7 +1655,7 @@ bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id) ...@@ -1657,7 +1655,7 @@ bool ValidateBeginQueryBase(Context *context, QueryType target, GLuint id)
// check for type mismatch // check for type mismatch
if (queryObject->getType() != target) if (queryObject->getType() != target)
{ {
context->validationError(GL_INVALID_OPERATION, "Query type does not match target"); context->validationError(GL_INVALID_OPERATION, kQueryTargetMismatch);
return false; return false;
} }
...@@ -1688,7 +1686,7 @@ bool ValidateEndQueryBase(Context *context, QueryType target) ...@@ -1688,7 +1686,7 @@ bool ValidateEndQueryBase(Context *context, QueryType target)
if (queryObject == nullptr) if (queryObject == nullptr)
{ {
context->validationError(GL_INVALID_OPERATION, "Query target not active"); context->validationError(GL_INVALID_OPERATION, kQueryInactive);
return false; return false;
} }
...@@ -1711,7 +1709,7 @@ bool ValidateQueryCounterEXT(Context *context, GLuint id, QueryType target) ...@@ -1711,7 +1709,7 @@ bool ValidateQueryCounterEXT(Context *context, GLuint id, QueryType target)
{ {
if (!context->getExtensions().disjointTimerQuery) if (!context->getExtensions().disjointTimerQuery)
{ {
context->validationError(GL_INVALID_OPERATION, "Disjoint timer query not enabled"); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
...@@ -1755,7 +1753,7 @@ bool ValidateGetQueryivBase(Context *context, QueryType target, GLenum pname, GL ...@@ -1755,7 +1753,7 @@ bool ValidateGetQueryivBase(Context *context, QueryType target, GLenum pname, GL
case GL_CURRENT_QUERY_EXT: case GL_CURRENT_QUERY_EXT:
if (target == QueryType::Timestamp) if (target == QueryType::Timestamp)
{ {
context->validationError(GL_INVALID_ENUM, "Cannot use current query for timestamp"); context->validationError(GL_INVALID_ENUM, kInvalidQueryTarget);
return false; return false;
} }
break; break;
...@@ -1866,7 +1864,7 @@ bool ValidateGetQueryObjectivEXT(Context *context, GLuint id, GLenum pname, GLin ...@@ -1866,7 +1864,7 @@ bool ValidateGetQueryObjectivEXT(Context *context, GLuint id, GLenum pname, GLin
{ {
if (!context->getExtensions().disjointTimerQuery) if (!context->getExtensions().disjointTimerQuery)
{ {
context->validationError(GL_INVALID_OPERATION, "Timer query extension not enabled"); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
return ValidateGetQueryObjectValueBase(context, id, pname, nullptr); return ValidateGetQueryObjectValueBase(context, id, pname, nullptr);
...@@ -1881,7 +1879,7 @@ bool ValidateGetQueryObjectivRobustANGLE(Context *context, ...@@ -1881,7 +1879,7 @@ bool ValidateGetQueryObjectivRobustANGLE(Context *context,
{ {
if (!context->getExtensions().disjointTimerQuery) if (!context->getExtensions().disjointTimerQuery)
{ {
context->validationError(GL_INVALID_OPERATION, "Timer query extension not enabled"); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
...@@ -2130,14 +2128,14 @@ bool ValidateUniform1ivValue(Context *context, ...@@ -2130,14 +2128,14 @@ bool ValidateUniform1ivValue(Context *context,
{ {
if (value[i] < 0 || value[i] >= max) if (value[i] < 0 || value[i] >= max)
{ {
context->validationError(GL_INVALID_VALUE, "sampler uniform value out of range"); context->validationError(GL_INVALID_VALUE, kSamplerUniformValueOutOfRange);
return false; return false;
} }
} }
return true; return true;
} }
context->validationError(GL_INVALID_OPERATION, "wrong type of value for uniform"); context->validationError(GL_INVALID_OPERATION, kUniformTypeMismatch);
return false; return false;
} }
...@@ -2149,7 +2147,7 @@ bool ValidateUniformMatrixValue(Context *context, GLenum valueType, GLenum unifo ...@@ -2149,7 +2147,7 @@ bool ValidateUniformMatrixValue(Context *context, GLenum valueType, GLenum unifo
return true; return true;
} }
context->validationError(GL_INVALID_OPERATION, "wrong type of value for uniform"); context->validationError(GL_INVALID_OPERATION, kUniformTypeMismatch);
return false; return false;
} }
...@@ -2226,8 +2224,7 @@ bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsi ...@@ -2226,8 +2224,7 @@ bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsi
case GL_TEXTURE_BINDING_RECTANGLE_ANGLE: case GL_TEXTURE_BINDING_RECTANGLE_ANGLE:
if (!context->getExtensions().textureRectangle) if (!context->getExtensions().textureRectangle)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"ANGLE_texture_rectangle extension not present");
return false; return false;
} }
break; break;
...@@ -2235,10 +2232,7 @@ bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsi ...@@ -2235,10 +2232,7 @@ bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsi
if (!context->getExtensions().eglStreamConsumerExternal && if (!context->getExtensions().eglStreamConsumerExternal &&
!context->getExtensions().eglImageExternal) !context->getExtensions().eglImageExternal)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"Neither NV_EGL_stream_consumer_external "
"nor GL_OES_EGL_image_external "
"extensions enabled");
return false; return false;
} }
break; break;
...@@ -2471,8 +2465,7 @@ bool ValidateCopyTexImageParametersBase(Context *context, ...@@ -2471,8 +2465,7 @@ bool ValidateCopyTexImageParametersBase(Context *context,
// framebuffer is more than one. // framebuffer is more than one.
if (readFramebuffer->readDisallowedByMultiview()) if (readFramebuffer->readDisallowedByMultiview())
{ {
context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, kMultiviewReadFramebuffer);
"The active read framebuffer object has multiview attachments.");
return false; return false;
} }
...@@ -3073,7 +3066,7 @@ bool ValidateDrawElementsCommon(Context *context, ...@@ -3073,7 +3066,7 @@ bool ValidateDrawElementsCommon(Context *context,
// WebGL buffers cannot be mapped/unmapped because the MapBufferRange, // WebGL buffers cannot be mapped/unmapped because the MapBufferRange,
// FlushMappedBufferRange, and UnmapBuffer entry points are removed from the // FlushMappedBufferRange, and UnmapBuffer entry points are removed from the
// WebGL 2.0 API. https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14 // WebGL 2.0 API. https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14
context->validationError(GL_INVALID_OPERATION, "Index buffer is mapped."); context->validationError(GL_INVALID_OPERATION, kBufferMapped);
return false; return false;
} }
} }
...@@ -3092,8 +3085,7 @@ bool ValidateDrawElementsCommon(Context *context, ...@@ -3092,8 +3085,7 @@ bool ValidateDrawElementsCommon(Context *context,
{ {
// This is an application error that would normally result in a crash, but we catch // This is an application error that would normally result in a crash, but we catch
// it and return an error // it and return an error
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kElementArrayNoBufferOrPointer);
"No element array buffer and no pointer.");
return false; return false;
} }
} }
...@@ -3462,10 +3454,7 @@ bool ValidateDiscardFramebufferBase(Context *context, ...@@ -3462,10 +3454,7 @@ bool ValidateDiscardFramebufferBase(Context *context,
if (attachments[i] >= GL_COLOR_ATTACHMENT0 + context->getCaps().maxColorAttachments) if (attachments[i] >= GL_COLOR_ATTACHMENT0 + context->getCaps().maxColorAttachments)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExceedsMaxColorAttachments);
"Requested color attachment is "
"greater than the maximum supported "
"color attachments");
return false; return false;
} }
} }
...@@ -3564,17 +3553,14 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeg ...@@ -3564,17 +3553,14 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeg
case TextureType::_2D: case TextureType::_2D:
if (!context->getExtensions().eglImage) if (!context->getExtensions().eglImage)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"GL_TEXTURE_2D texture target requires GL_OES_EGL_image.");
} }
break; break;
case TextureType::External: case TextureType::External:
if (!context->getExtensions().eglImageExternal) if (!context->getExtensions().eglImageExternal)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"GL_TEXTURE_EXTERNAL_OES texture target "
"requires GL_OES_EGL_image_external.");
} }
break; break;
...@@ -3588,21 +3574,19 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeg ...@@ -3588,21 +3574,19 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeg
ASSERT(context->getCurrentDisplay()); ASSERT(context->getCurrentDisplay());
if (!context->getCurrentDisplay()->isValidImage(imageObject)) if (!context->getCurrentDisplay()->isValidImage(imageObject))
{ {
context->validationError(GL_INVALID_VALUE, "EGL image is not valid."); context->validationError(GL_INVALID_VALUE, kInvalidEGLImage);
return false; return false;
} }
if (imageObject->getSamples() > 0) if (imageObject->getSamples() > 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kEGLImageCannotCreate2DMultisampled);
"cannot create a 2D texture from a multisampled EGL image.");
return false; return false;
} }
if (!imageObject->isTexturable(context)) if (!imageObject->isTexturable(context))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kEGLImageTextureFormatNotSupported);
"EGL image internal format is not supported as a texture.");
return false; return false;
} }
...@@ -3634,14 +3618,13 @@ bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context, ...@@ -3634,14 +3618,13 @@ bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
ASSERT(context->getCurrentDisplay()); ASSERT(context->getCurrentDisplay());
if (!context->getCurrentDisplay()->isValidImage(imageObject)) if (!context->getCurrentDisplay()->isValidImage(imageObject))
{ {
context->validationError(GL_INVALID_VALUE, "EGL image is not valid."); context->validationError(GL_INVALID_VALUE, kInvalidEGLImage);
return false; return false;
} }
if (!imageObject->isRenderable(context)) if (!imageObject->isRenderable(context))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kEGLImageRenderbufferFormatNotSupported);
"EGL image internal format is not supported as a renderbuffer.");
return false; return false;
} }
...@@ -3677,17 +3660,14 @@ bool ValidateProgramBinaryBase(Context *context, ...@@ -3677,17 +3660,14 @@ bool ValidateProgramBinaryBase(Context *context,
if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) ==
programBinaryFormats.end()) programBinaryFormats.end())
{ {
context->validationError(GL_INVALID_ENUM, "Program binary format is not valid."); context->validationError(GL_INVALID_ENUM, kInvalidProgramBinaryFormat);
return false; return false;
} }
if (context->hasActiveTransformFeedback(program)) if (context->hasActiveTransformFeedback(program))
{ {
// ES 3.0.4 section 2.15 page 91 // ES 3.0.4 section 2.15 page 91
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTransformFeedbackProgramBinary);
"Cannot change program binary while program "
"is associated with an active transform "
"feedback object.");
return false; return false;
} }
...@@ -3715,7 +3695,7 @@ bool ValidateGetProgramBinaryBase(Context *context, ...@@ -3715,7 +3695,7 @@ bool ValidateGetProgramBinaryBase(Context *context,
if (context->getCaps().programBinaryFormats.empty()) if (context->getCaps().programBinaryFormats.empty())
{ {
context->validationError(GL_INVALID_OPERATION, "No program binary formats supported."); context->validationError(GL_INVALID_OPERATION, kNoProgramBinaryFormats);
return false; return false;
} }
...@@ -3756,13 +3736,12 @@ bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs) ...@@ -3756,13 +3736,12 @@ bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs)
// was changed to GL_INVALID_ENUM in 3.1, which dEQP also expects. // was changed to GL_INVALID_ENUM in 3.1, which dEQP also expects.
// 3.1 is still a bit ambiguous about the error, but future specs are // 3.1 is still a bit ambiguous about the error, but future specs are
// expected to clarify that GL_INVALID_ENUM is the correct error. // expected to clarify that GL_INVALID_ENUM is the correct error.
context->validationError(GL_INVALID_ENUM, "Invalid buffer value"); context->validationError(GL_INVALID_ENUM, kInvalidDrawBuffer);
return false; return false;
} }
else if (bufs[colorAttachment] >= maxColorAttachment) else if (bufs[colorAttachment] >= maxColorAttachment)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExceedsMaxColorAttachments);
"Buffer value is greater than MAX_DRAW_BUFFERS");
return false; return false;
} }
else if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment && else if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment &&
...@@ -3770,8 +3749,7 @@ bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs) ...@@ -3770,8 +3749,7 @@ bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs)
{ {
// INVALID_OPERATION-GL is bound to buffer and ith argument // INVALID_OPERATION-GL is bound to buffer and ith argument
// is not COLOR_ATTACHMENTi or NONE // is not COLOR_ATTACHMENTi or NONE
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidDrawBufferValue);
"Ith value does not match COLOR_ATTACHMENTi or NONE");
return false; return false;
} }
} }
...@@ -3782,16 +3760,13 @@ bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs) ...@@ -3782,16 +3760,13 @@ bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs)
{ {
if (n != 1) if (n != 1)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidDrawBufferCountForDefault);
"n must be 1 when GL is bound to the default framebuffer");
return false; return false;
} }
if (bufs[0] != GL_NONE && bufs[0] != GL_BACK) if (bufs[0] != GL_NONE && bufs[0] != GL_BACK)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kDefaultFramebufferInvalidDrawBuffer);
GL_INVALID_OPERATION,
"Only NONE or BACK are valid values when drawing to the default framebuffer");
return false; return false;
} }
} }
...@@ -3810,17 +3785,9 @@ bool ValidateGetBufferPointervBase(Context *context, ...@@ -3810,17 +3785,9 @@ bool ValidateGetBufferPointervBase(Context *context,
*length = 0; *length = 0;
} }
if (context->getClientMajorVersion() < 3 && !context->getExtensions().mapBuffer)
{
context->validationError(
GL_INVALID_OPERATION,
"Context does not support OpenGL ES 3.0 or GL_OES_mapbuffer is not enabled.");
return false;
}
if (!context->isValidBufferBinding(target)) if (!context->isValidBufferBinding(target))
{ {
context->validationError(GL_INVALID_ENUM, "Buffer target not valid"); context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes);
return false; return false;
} }
...@@ -3839,8 +3806,7 @@ bool ValidateGetBufferPointervBase(Context *context, ...@@ -3839,8 +3806,7 @@ bool ValidateGetBufferPointervBase(Context *context,
// GLES 3.1 section 6.6 explicitly specifies this error. // GLES 3.1 section 6.6 explicitly specifies this error.
if (context->getGLState().getTargetBuffer(target) == nullptr) if (context->getGLState().getTargetBuffer(target) == nullptr)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kBufferPointerNotAvailable);
"Can not get pointer for reserved buffer name zero.");
return false; return false;
} }
...@@ -3864,7 +3830,7 @@ bool ValidateUnmapBufferBase(Context *context, BufferBinding target) ...@@ -3864,7 +3830,7 @@ bool ValidateUnmapBufferBase(Context *context, BufferBinding target)
if (buffer == nullptr || !buffer->isMapped()) if (buffer == nullptr || !buffer->isMapped())
{ {
context->validationError(GL_INVALID_OPERATION, "Buffer not mapped."); context->validationError(GL_INVALID_OPERATION, kBufferNotMapped);
return false; return false;
} }
...@@ -3899,7 +3865,7 @@ bool ValidateMapBufferRangeBase(Context *context, ...@@ -3899,7 +3865,7 @@ bool ValidateMapBufferRangeBase(Context *context,
if (!buffer) if (!buffer)
{ {
context->validationError(GL_INVALID_OPERATION, "Attempted to map buffer object zero."); context->validationError(GL_INVALID_OPERATION, kBufferNotMappable);
return false; return false;
} }
...@@ -3909,8 +3875,7 @@ bool ValidateMapBufferRangeBase(Context *context, ...@@ -3909,8 +3875,7 @@ bool ValidateMapBufferRangeBase(Context *context,
if (!checkedSize.IsValid() || checkedSize.ValueOrDie() > static_cast<size_t>(buffer->getSize())) if (!checkedSize.IsValid() || checkedSize.ValueOrDie() > static_cast<size_t>(buffer->getSize()))
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kMapOutOfRange);
"Mapped range does not fit into buffer dimensions.");
return false; return false;
} }
...@@ -3921,27 +3886,26 @@ bool ValidateMapBufferRangeBase(Context *context, ...@@ -3921,27 +3886,26 @@ bool ValidateMapBufferRangeBase(Context *context,
if (access & ~(allAccessBits)) if (access & ~(allAccessBits))
{ {
context->validationError(GL_INVALID_VALUE, "Invalid access bits"); context->validationError(GL_INVALID_VALUE, kInvalidAccessBits);
return false; return false;
} }
if (length == 0) if (length == 0)
{ {
context->validationError(GL_INVALID_OPERATION, "Buffer mapping length is zero."); context->validationError(GL_INVALID_OPERATION, kLengthZero);
return false; return false;
} }
if (buffer->isMapped()) if (buffer->isMapped())
{ {
context->validationError(GL_INVALID_OPERATION, "Buffer is already mapped."); context->validationError(GL_INVALID_OPERATION, kBufferAlreadyMapped);
return false; return false;
} }
// Check for invalid bit combinations // Check for invalid bit combinations
if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidAccessBitsReadWrite);
"Need to map buffer for either reading or writing.");
return false; return false;
} }
...@@ -3950,16 +3914,13 @@ bool ValidateMapBufferRangeBase(Context *context, ...@@ -3950,16 +3914,13 @@ bool ValidateMapBufferRangeBase(Context *context,
if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0) if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidAccessBitsRead);
"Invalid access bits when mapping buffer for reading");
return false; return false;
} }
if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0) if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kInvalidAccessBitsFlush);
GL_INVALID_OPERATION,
"The explicit flushing bit may only be set if the buffer is mapped for writing.");
return false; return false;
} }
...@@ -3993,14 +3954,13 @@ bool ValidateFlushMappedBufferRangeBase(Context *context, ...@@ -3993,14 +3954,13 @@ bool ValidateFlushMappedBufferRangeBase(Context *context,
if (buffer == nullptr) if (buffer == nullptr)
{ {
context->validationError(GL_INVALID_OPERATION, "Attempted to flush buffer object zero."); context->validationError(GL_INVALID_OPERATION, kInvalidFlushZero);
return false; return false;
} }
if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidFlushTarget);
"Attempted to flush a buffer not mapped for explicit flushing.");
return false; return false;
} }
...@@ -4011,8 +3971,7 @@ bool ValidateFlushMappedBufferRangeBase(Context *context, ...@@ -4011,8 +3971,7 @@ bool ValidateFlushMappedBufferRangeBase(Context *context,
if (!checkedSize.IsValid() || if (!checkedSize.IsValid() ||
checkedSize.ValueOrDie() > static_cast<size_t>(buffer->getMapLength())) checkedSize.ValueOrDie() > static_cast<size_t>(buffer->getMapLength()))
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidFlushOutOfRange);
"Flushed range does not fit into buffer mapping dimensions.");
return false; return false;
} }
...@@ -4033,8 +3992,7 @@ bool ValidateRobustEntryPoint(Context *context, GLsizei bufSize) ...@@ -4033,8 +3992,7 @@ bool ValidateRobustEntryPoint(Context *context, GLsizei bufSize)
{ {
if (!context->getExtensions().robustClientMemory) if (!context->getExtensions().robustClientMemory)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_ANGLE_robust_client_memory is not available.");
return false; return false;
} }
...@@ -4051,8 +4009,7 @@ bool ValidateRobustBufferSize(Context *context, GLsizei bufSize, GLsizei numPara ...@@ -4051,8 +4009,7 @@ bool ValidateRobustBufferSize(Context *context, GLsizei bufSize, GLsizei numPara
{ {
if (bufSize < numParams) if (bufSize < numParams)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInsufficientParams);
"More parameters are required than were provided.");
return false; return false;
} }
...@@ -4449,10 +4406,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL ...@@ -4449,10 +4406,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL
case GL_PROGRAM_BINARY_LENGTH: case GL_PROGRAM_BINARY_LENGTH:
if (context->getClientMajorVersion() < 3 && !context->getExtensions().getProgramBinary) if (context->getClientMajorVersion() < 3 && !context->getExtensions().getProgramBinary)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"Querying GL_PROGRAM_BINARY_LENGTH "
"requires GL_OES_get_program_binary or "
"ES 3.0.");
return false; return false;
} }
break; break;
...@@ -4465,7 +4419,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL ...@@ -4465,7 +4419,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL
case GL_PROGRAM_BINARY_RETRIEVABLE_HINT: case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->validationError(GL_INVALID_ENUM, kES3Required); context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
return false; return false;
} }
break; break;
...@@ -4474,7 +4428,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL ...@@ -4474,7 +4428,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL
case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS: case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS:
if (context->getClientVersion() < Version(3, 1)) if (context->getClientVersion() < Version(3, 1))
{ {
context->validationError(GL_INVALID_ENUM, kES31Required); context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
return false; return false;
} }
break; break;
...@@ -4482,7 +4436,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL ...@@ -4482,7 +4436,7 @@ bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GL
case GL_COMPUTE_WORK_GROUP_SIZE: case GL_COMPUTE_WORK_GROUP_SIZE:
if (context->getClientVersion() < Version(3, 1)) if (context->getClientVersion() < Version(3, 1))
{ {
context->validationError(GL_INVALID_ENUM, kES31Required); context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
return false; return false;
} }
...@@ -5121,8 +5075,7 @@ bool ValidateVertexFormatBase(Context *context, ...@@ -5121,8 +5075,7 @@ bool ValidateVertexFormatBase(Context *context,
case GL_UNSIGNED_INT: case GL_UNSIGNED_INT:
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
"Vertex type not supported before OpenGL ES 3.0.");
return false; return false;
} }
break; break;
...@@ -5139,8 +5092,7 @@ bool ValidateVertexFormatBase(Context *context, ...@@ -5139,8 +5092,7 @@ bool ValidateVertexFormatBase(Context *context,
case GL_HALF_FLOAT: case GL_HALF_FLOAT:
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
"Vertex type not supported before OpenGL ES 3.0.");
return false; return false;
} }
if (pureInteger) if (pureInteger)
...@@ -5154,8 +5106,7 @@ bool ValidateVertexFormatBase(Context *context, ...@@ -5154,8 +5106,7 @@ bool ValidateVertexFormatBase(Context *context,
case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_2_10_10_10_REV:
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
"Vertex type not supported before OpenGL ES 3.0.");
return false; return false;
} }
if (pureInteger) if (pureInteger)
...@@ -5165,10 +5116,7 @@ bool ValidateVertexFormatBase(Context *context, ...@@ -5165,10 +5116,7 @@ bool ValidateVertexFormatBase(Context *context,
} }
if (size != 4) if (size != 4)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidVertexAttribSize2101010);
"Type is INT_2_10_10_10_REV or "
"UNSIGNED_INT_2_10_10_10_REV and "
"size is not 4.");
return false; return false;
} }
break; break;
...@@ -5198,9 +5146,7 @@ bool ValidateWebGLFramebufferAttachmentClearType(Context *context, ...@@ -5198,9 +5146,7 @@ bool ValidateWebGLFramebufferAttachmentClearType(Context *context,
const GLenum *end = validComponentTypes + validComponentTypeCount; const GLenum *end = validComponentTypes + validComponentTypeCount;
if (std::find(validComponentTypes, end, componentType) == end) if (std::find(validComponentTypes, end, componentType) == end)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kNoDefinedClearConversion);
GL_INVALID_OPERATION,
"No defined conversion between clear value and attachment format.");
return false; return false;
} }
} }
...@@ -5220,7 +5166,7 @@ bool ValidateRobustCompressedTexImageBase(Context *context, GLsizei imageSize, G ...@@ -5220,7 +5166,7 @@ bool ValidateRobustCompressedTexImageBase(Context *context, GLsizei imageSize, G
{ {
if (dataSize < imageSize) if (dataSize < imageSize)
{ {
context->validationError(GL_INVALID_OPERATION, "dataSize is too small"); context->validationError(GL_INVALID_OPERATION, kCompressedDataSizeTooSmall);
} }
} }
return true; return true;
...@@ -5262,8 +5208,7 @@ bool ValidateGetBufferParameterBase(Context *context, ...@@ -5262,8 +5208,7 @@ bool ValidateGetBufferParameterBase(Context *context,
case GL_BUFFER_ACCESS_OES: case GL_BUFFER_ACCESS_OES:
if (!extensions.mapBuffer) if (!extensions.mapBuffer)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"pname requires OpenGL ES 3.0 or GL_OES_mapbuffer.");
return false; return false;
} }
break; break;
...@@ -5273,10 +5218,7 @@ bool ValidateGetBufferParameterBase(Context *context, ...@@ -5273,10 +5218,7 @@ bool ValidateGetBufferParameterBase(Context *context,
if (context->getClientMajorVersion() < 3 && !extensions.mapBuffer && if (context->getClientMajorVersion() < 3 && !extensions.mapBuffer &&
!extensions.mapBufferRange) !extensions.mapBufferRange)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"pname requires OpenGL ES 3.0, "
"GL_OES_mapbuffer or "
"GL_EXT_map_buffer_range.");
return false; return false;
} }
break; break;
...@@ -5284,9 +5226,7 @@ bool ValidateGetBufferParameterBase(Context *context, ...@@ -5284,9 +5226,7 @@ bool ValidateGetBufferParameterBase(Context *context,
case GL_BUFFER_MAP_POINTER: case GL_BUFFER_MAP_POINTER:
if (!pointerVersion) if (!pointerVersion)
{ {
context->validationError( context->validationError(GL_INVALID_ENUM, kInvalidMapPointerQuery);
GL_INVALID_ENUM,
"GL_BUFFER_MAP_POINTER can only be queried with GetBufferPointerv.");
return false; return false;
} }
break; break;
...@@ -5296,8 +5236,7 @@ bool ValidateGetBufferParameterBase(Context *context, ...@@ -5296,8 +5236,7 @@ bool ValidateGetBufferParameterBase(Context *context,
case GL_BUFFER_MAP_LENGTH: case GL_BUFFER_MAP_LENGTH:
if (context->getClientMajorVersion() < 3 && !extensions.mapBufferRange) if (context->getClientMajorVersion() < 3 && !extensions.mapBufferRange)
{ {
context->validationError( context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
GL_INVALID_ENUM, "pname requires OpenGL ES 3.0 or GL_EXT_map_buffer_range.");
return false; return false;
} }
break; break;
...@@ -5477,7 +5416,7 @@ bool ValidateGetTexParameterBase(Context *context, ...@@ -5477,7 +5416,7 @@ bool ValidateGetTexParameterBase(Context *context,
case GL_TEXTURE_USAGE_ANGLE: case GL_TEXTURE_USAGE_ANGLE:
if (!context->getExtensions().textureUsage) if (!context->getExtensions().textureUsage)
{ {
context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled); context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false; return false;
} }
break; break;
...@@ -5492,7 +5431,7 @@ bool ValidateGetTexParameterBase(Context *context, ...@@ -5492,7 +5431,7 @@ bool ValidateGetTexParameterBase(Context *context,
case GL_TEXTURE_IMMUTABLE_FORMAT: case GL_TEXTURE_IMMUTABLE_FORMAT:
if (context->getClientMajorVersion() < 3 && !context->getExtensions().textureStorage) if (context->getClientMajorVersion() < 3 && !context->getExtensions().textureStorage)
{ {
context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled); context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false; return false;
} }
break; break;
...@@ -5511,7 +5450,7 @@ bool ValidateGetTexParameterBase(Context *context, ...@@ -5511,7 +5450,7 @@ bool ValidateGetTexParameterBase(Context *context,
case GL_TEXTURE_COMPARE_FUNC: case GL_TEXTURE_COMPARE_FUNC:
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->validationError(GL_INVALID_ENUM, "pname requires OpenGL ES 3.0."); context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES30);
return false; return false;
} }
break; break;
...@@ -5519,8 +5458,7 @@ bool ValidateGetTexParameterBase(Context *context, ...@@ -5519,8 +5458,7 @@ bool ValidateGetTexParameterBase(Context *context,
case GL_TEXTURE_SRGB_DECODE_EXT: case GL_TEXTURE_SRGB_DECODE_EXT:
if (!context->getExtensions().textureSRGBDecode) if (!context->getExtensions().textureSRGBDecode)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"GL_EXT_texture_sRGB_decode is not enabled.");
return false; return false;
} }
break; break;
...@@ -5547,7 +5485,7 @@ bool ValidateGetTexParameterBase(Context *context, ...@@ -5547,7 +5485,7 @@ bool ValidateGetTexParameterBase(Context *context,
case GL_MEMORY_SIZE_ANGLE: case GL_MEMORY_SIZE_ANGLE:
if (!context->getExtensions().memorySize) if (!context->getExtensions().memorySize)
{ {
context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled); context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false; return false;
} }
break; break;
...@@ -5586,7 +5524,7 @@ bool ValidateGetVertexAttribBase(Context *context, ...@@ -5586,7 +5524,7 @@ bool ValidateGetVertexAttribBase(Context *context,
if (pureIntegerEntryPoint && context->getClientMajorVersion() < 3) if (pureIntegerEntryPoint && context->getClientMajorVersion() < 3)
{ {
context->validationError(GL_INVALID_OPERATION, "Context does not support OpenGL ES 3.0."); context->validationError(GL_INVALID_OPERATION, kES3Required);
return false; return false;
} }
...@@ -5624,10 +5562,7 @@ bool ValidateGetVertexAttribBase(Context *context, ...@@ -5624,10 +5562,7 @@ bool ValidateGetVertexAttribBase(Context *context,
if (context->getClientMajorVersion() < 3 && if (context->getClientMajorVersion() < 3 &&
!context->getExtensions().instancedArrays) !context->getExtensions().instancedArrays)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"GL_VERTEX_ATTRIB_ARRAY_DIVISOR "
"requires OpenGL ES 3.0 or "
"GL_ANGLE_instanced_arrays.");
return false; return false;
} }
break; break;
...@@ -5635,8 +5570,7 @@ bool ValidateGetVertexAttribBase(Context *context, ...@@ -5635,8 +5570,7 @@ bool ValidateGetVertexAttribBase(Context *context,
case GL_VERTEX_ATTRIB_ARRAY_INTEGER: case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
if (context->getClientMajorVersion() < 3) if (context->getClientMajorVersion() < 3)
{ {
context->validationError( context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
GL_INVALID_ENUM, "GL_VERTEX_ATTRIB_ARRAY_INTEGER requires OpenGL ES 3.0.");
return false; return false;
} }
break; break;
...@@ -5645,8 +5579,7 @@ bool ValidateGetVertexAttribBase(Context *context, ...@@ -5645,8 +5579,7 @@ bool ValidateGetVertexAttribBase(Context *context,
case GL_VERTEX_ATTRIB_RELATIVE_OFFSET: case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
"Vertex Attrib Bindings require OpenGL ES 3.1.");
return false; return false;
} }
break; break;
...@@ -5742,8 +5675,7 @@ bool ValidateReadPixelsBase(Context *context, ...@@ -5742,8 +5675,7 @@ bool ValidateReadPixelsBase(Context *context,
// in the current read framebuffer is more than one. // in the current read framebuffer is more than one.
if (framebuffer->readDisallowedByMultiview()) if (framebuffer->readDisallowedByMultiview())
{ {
context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, context->validationError(GL_INVALID_FRAMEBUFFER_OPERATION, kMultiviewReadFramebuffer);
"Attempting to read from a multi-view framebuffer.");
return false; return false;
} }
...@@ -5791,7 +5723,7 @@ bool ValidateReadPixelsBase(Context *context, ...@@ -5791,7 +5723,7 @@ bool ValidateReadPixelsBase(Context *context,
if (pixelPackBuffer != nullptr && pixelPackBuffer->isMapped()) if (pixelPackBuffer != nullptr && pixelPackBuffer->isMapped())
{ {
// ...the buffer object's data store is currently mapped. // ...the buffer object's data store is currently mapped.
context->validationError(GL_INVALID_OPERATION, "Pixel pack buffer is mapped."); context->validationError(GL_INVALID_OPERATION, kBufferMapped);
return false; return false;
} }
if (context->getExtensions().webglCompatibility && pixelPackBuffer != nullptr && if (context->getExtensions().webglCompatibility && pixelPackBuffer != nullptr &&
...@@ -5959,10 +5891,7 @@ bool ValidateTexParameterBase(Context *context, ...@@ -5959,10 +5891,7 @@ bool ValidateTexParameterBase(Context *context,
} }
if (target == TextureType::External && !context->getExtensions().eglImageExternalEssl3) if (target == TextureType::External && !context->getExtensions().eglImageExternalEssl3)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"ES3 texture parameters are not "
"available without "
"GL_OES_EGL_image_external_essl3.");
return false; return false;
} }
break; break;
...@@ -5993,8 +5922,7 @@ bool ValidateTexParameterBase(Context *context, ...@@ -5993,8 +5922,7 @@ bool ValidateTexParameterBase(Context *context,
case GL_TEXTURE_COMPARE_MODE: case GL_TEXTURE_COMPARE_MODE:
case GL_TEXTURE_COMPARE_FUNC: case GL_TEXTURE_COMPARE_FUNC:
case GL_TEXTURE_BORDER_COLOR: case GL_TEXTURE_BORDER_COLOR:
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kInvalidPname);
"Invalid parameter for 2D multisampled textures.");
return false; return false;
} }
} }
...@@ -6104,27 +6032,24 @@ bool ValidateTexParameterBase(Context *context, ...@@ -6104,27 +6032,24 @@ bool ValidateTexParameterBase(Context *context,
case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_BASE_LEVEL:
if (ConvertToGLint(params[0]) < 0) if (ConvertToGLint(params[0]) < 0)
{ {
context->validationError(GL_INVALID_VALUE, "Base level must be at least 0."); context->validationError(GL_INVALID_VALUE, kBaseLevelNegative);
return false; return false;
} }
if (target == TextureType::External && static_cast<GLuint>(params[0]) != 0) if (target == TextureType::External && static_cast<GLuint>(params[0]) != 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kBaseLevelNonZero);
"Base level must be 0 for external textures.");
return false; return false;
} }
if ((target == TextureType::_2DMultisample || if ((target == TextureType::_2DMultisample ||
target == TextureType::_2DMultisampleArray) && target == TextureType::_2DMultisampleArray) &&
static_cast<GLuint>(params[0]) != 0) static_cast<GLuint>(params[0]) != 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kBaseLevelNonZero);
"Base level must be 0 for multisampled textures.");
return false; return false;
} }
if (target == TextureType::Rectangle && static_cast<GLuint>(params[0]) != 0) if (target == TextureType::Rectangle && static_cast<GLuint>(params[0]) != 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kBaseLevelNonZero);
"Base level must be 0 for rectangle textures.");
return false; return false;
} }
break; break;
...@@ -6259,8 +6184,7 @@ bool ValidateGetActiveUniformBlockivBase(Context *context, ...@@ -6259,8 +6184,7 @@ bool ValidateGetActiveUniformBlockivBase(Context *context,
if (uniformBlockIndex >= programObject->getActiveUniformBlockCount()) if (uniformBlockIndex >= programObject->getActiveUniformBlockCount())
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kIndexExceedsActiveUniformBlockCount);
"uniformBlockIndex exceeds active uniform block count.");
return false; return false;
} }
...@@ -6460,8 +6384,7 @@ bool ValidateGetSamplerParameterBase(Context *context, ...@@ -6460,8 +6384,7 @@ bool ValidateGetSamplerParameterBase(Context *context,
case GL_TEXTURE_SRGB_DECODE_EXT: case GL_TEXTURE_SRGB_DECODE_EXT:
if (!context->getExtensions().textureSRGBDecode) if (!context->getExtensions().textureSRGBDecode)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"GL_EXT_texture_sRGB_decode is not enabled.");
return false; return false;
} }
break; break;
...@@ -6507,7 +6430,7 @@ bool ValidateGetInternalFormativBase(Context *context, ...@@ -6507,7 +6430,7 @@ bool ValidateGetInternalFormativBase(Context *context,
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
if (!formatCaps.renderbuffer) if (!formatCaps.renderbuffer)
{ {
context->validationError(GL_INVALID_ENUM, "Internal format is not renderable."); context->validationError(GL_INVALID_ENUM, kFormatNotRenderable);
return false; return false;
} }
...@@ -6690,7 +6613,7 @@ bool ValidateGetTexLevelParameterBase(Context *context, ...@@ -6690,7 +6613,7 @@ bool ValidateGetTexLevelParameterBase(Context *context,
if (context->getTargetTexture(type) == nullptr) if (context->getTargetTexture(type) == nullptr)
{ {
context->validationError(GL_INVALID_ENUM, "No texture bound."); context->validationError(GL_INVALID_ENUM, kTextureNotBound);
return false; return false;
} }
......
...@@ -96,20 +96,19 @@ bool ValidateInstancedPathParameters(gl::Context *context, ...@@ -96,20 +96,19 @@ bool ValidateInstancedPathParameters(gl::Context *context,
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
if (paths == nullptr) if (paths == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "No path name array."); context->validationError(GL_INVALID_VALUE, kInvalidPathNameArray);
return false; return false;
} }
if (numPaths < 0) if (numPaths < 0)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid (negative) numPaths."); context->validationError(GL_INVALID_VALUE, kInvalidPathNumPaths);
return false; return false;
} }
...@@ -161,7 +160,7 @@ bool ValidateInstancedPathParameters(gl::Context *context, ...@@ -161,7 +160,7 @@ bool ValidateInstancedPathParameters(gl::Context *context,
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid path name type."); context->validationError(GL_INVALID_ENUM, kInvalidPathNameType);
return false; return false;
} }
...@@ -189,12 +188,12 @@ bool ValidateInstancedPathParameters(gl::Context *context, ...@@ -189,12 +188,12 @@ bool ValidateInstancedPathParameters(gl::Context *context,
componentCount = 12; componentCount = 12;
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid transformation."); context->validationError(GL_INVALID_ENUM, kInvalidTransformation);
return false; return false;
} }
if (componentCount != 0 && transformValues == nullptr) if (componentCount != 0 && transformValues == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "No transform array given."); context->validationError(GL_INVALID_VALUE, kNoTransformArray);
return false; return false;
} }
...@@ -481,7 +480,7 @@ bool ValidateES2CopyTexImageParameters(Context *context, ...@@ -481,7 +480,7 @@ bool ValidateES2CopyTexImageParameters(Context *context,
TextureType texType = TextureTargetToType(target); TextureType texType = TextureTargetToType(target);
if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage)) if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage))
{ {
context->validationError(GL_INVALID_VALUE, "Invalid texture dimensions."); // Error is already handled.
return false; return false;
} }
...@@ -721,14 +720,12 @@ bool ValidateES2CopyTexImageParameters(Context *context, ...@@ -721,14 +720,12 @@ bool ValidateES2CopyTexImageParameters(Context *context,
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE: case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
if (context->getExtensions().lossyETCDecode) if (context->getExtensions().lossyETCDecode)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
"ETC lossy decode formats can't be copied to.");
return false; return false;
} }
else else
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"ANGLE_lossy_etc_decode extension is not supported.");
return false; return false;
} }
break; break;
...@@ -1044,8 +1041,7 @@ bool ValidateMatrixMode(Context *context, GLenum matrixMode) ...@@ -1044,8 +1041,7 @@ bool ValidateMatrixMode(Context *context, GLenum matrixMode)
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
...@@ -1126,8 +1122,7 @@ void RecordBindTextureTypeError(Context *context, TextureType target) ...@@ -1126,8 +1122,7 @@ void RecordBindTextureTypeError(Context *context, TextureType target)
{ {
case TextureType::Rectangle: case TextureType::Rectangle:
ASSERT(!context->getExtensions().textureRectangle); ASSERT(!context->getExtensions().textureRectangle);
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kTextureRectangleNotSupported);
"Context does not support GL_ANGLE_texture_rectangle");
break; break;
case TextureType::_3D: case TextureType::_3D:
...@@ -1150,7 +1145,7 @@ void RecordBindTextureTypeError(Context *context, TextureType target) ...@@ -1150,7 +1145,7 @@ void RecordBindTextureTypeError(Context *context, TextureType target)
case TextureType::External: case TextureType::External:
ASSERT(!context->getExtensions().eglImageExternal && ASSERT(!context->getExtensions().eglImageExternal &&
!context->getExtensions().eglStreamConsumerExternal); !context->getExtensions().eglStreamConsumerExternal);
context->validationError(GL_INVALID_ENUM, "External texture extension not enabled"); context->validationError(GL_INVALID_ENUM, kExternalTextureNotSupported);
break; break;
default: default:
...@@ -1239,8 +1234,7 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1239,8 +1234,7 @@ bool ValidateES2TexImageParameters(Context *context,
} }
if (isCompressed) if (isCompressed)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
"Rectangle texture cannot have a compressed format.");
return false; return false;
} }
break; break;
...@@ -1277,7 +1271,7 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1277,7 +1271,7 @@ bool ValidateES2TexImageParameters(Context *context,
const InternalFormat &textureInternalFormat = *texture->getFormat(target, level).info; const InternalFormat &textureInternalFormat = *texture->getFormat(target, level).info;
if (textureInternalFormat.internalFormat == GL_NONE) if (textureInternalFormat.internalFormat == GL_NONE)
{ {
context->validationError(GL_INVALID_OPERATION, "Texture level does not exist."); context->validationError(GL_INVALID_OPERATION, kInvalidTextureLevel);
return false; return false;
} }
...@@ -1358,8 +1352,7 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1358,8 +1352,7 @@ bool ValidateES2TexImageParameters(Context *context,
height, texture->getWidth(target, level), height, texture->getWidth(target, level),
texture->getHeight(target, level))) texture->getHeight(target, level)))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
"Invalid compressed format dimension.");
return false; return false;
} }
...@@ -1373,8 +1366,7 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1373,8 +1366,7 @@ bool ValidateES2TexImageParameters(Context *context,
{ {
if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height)) if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
"Invalid compressed format dimension.");
return false; return false;
} }
} }
...@@ -1590,14 +1582,12 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1590,14 +1582,12 @@ bool ValidateES2TexImageParameters(Context *context,
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE: case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
if (context->getExtensions().lossyETCDecode) if (context->getExtensions().lossyETCDecode)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
"ETC lossy decode formats can't work with this type.");
return false; return false;
} }
else else
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"ANGLE_lossy_etc_decode extension is not supported.");
return false; return false;
} }
break; break;
...@@ -1637,9 +1627,7 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1637,9 +1627,7 @@ bool ValidateES2TexImageParameters(Context *context,
case GL_RGBA32F: case GL_RGBA32F:
if (!context->getExtensions().colorBufferFloatRGBA) if (!context->getExtensions().colorBufferFloatRGBA)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kInvalidFormat);
"Sized GL_RGBA32F internal format requires "
"GL_CHROMIUM_color_buffer_float_rgba");
return false; return false;
} }
if (type != GL_FLOAT) if (type != GL_FLOAT)
...@@ -1657,9 +1645,7 @@ bool ValidateES2TexImageParameters(Context *context, ...@@ -1657,9 +1645,7 @@ bool ValidateES2TexImageParameters(Context *context,
case GL_RGB32F: case GL_RGB32F:
if (!context->getExtensions().colorBufferFloatRGB) if (!context->getExtensions().colorBufferFloatRGB)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kInvalidFormat);
"Sized GL_RGB32F internal format requires "
"GL_CHROMIUM_color_buffer_float_rgb");
return false; return false;
} }
if (type != GL_FLOAT) if (type != GL_FLOAT)
...@@ -1837,8 +1823,7 @@ bool ValidateES2TexStorageParameters(Context *context, ...@@ -1837,8 +1823,7 @@ bool ValidateES2TexStorageParameters(Context *context,
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE: case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE:
if (!context->getExtensions().lossyETCDecode) if (!context->getExtensions().lossyETCDecode)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"ANGLE_lossy_etc_decode extension is not supported.");
return false; return false;
} }
break; break;
...@@ -2122,17 +2107,13 @@ bool ValidateDebugMessageControlKHR(Context *context, ...@@ -2122,17 +2107,13 @@ bool ValidateDebugMessageControlKHR(Context *context,
{ {
if (source == GL_DONT_CARE || type == GL_DONT_CARE) if (source == GL_DONT_CARE || type == GL_DONT_CARE)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kInvalidDebugSourceType);
GL_INVALID_OPERATION,
"If count is greater than zero, source and severity cannot be GL_DONT_CARE.");
return false; return false;
} }
if (severity != GL_DONT_CARE) if (severity != GL_DONT_CARE)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kInvalidDebugSeverity);
GL_INVALID_OPERATION,
"If count is greater than zero, severity must be GL_DONT_CARE.");
return false; return false;
} }
} }
...@@ -2182,8 +2163,7 @@ bool ValidateDebugMessageInsertKHR(Context *context, ...@@ -2182,8 +2163,7 @@ bool ValidateDebugMessageInsertKHR(Context *context,
size_t messageLength = (length < 0) ? strlen(buf) : length; size_t messageLength = (length < 0) ? strlen(buf) : length;
if (messageLength > context->getExtensions().maxDebugMessageLength) if (messageLength > context->getExtensions().maxDebugMessageLength)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxDebugMessageLength);
"Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.");
return false; return false;
} }
...@@ -2249,17 +2229,14 @@ bool ValidatePushDebugGroupKHR(Context *context, ...@@ -2249,17 +2229,14 @@ bool ValidatePushDebugGroupKHR(Context *context,
size_t messageLength = (length < 0) ? strlen(message) : length; size_t messageLength = (length < 0) ? strlen(message) : length;
if (messageLength > context->getExtensions().maxDebugMessageLength) if (messageLength > context->getExtensions().maxDebugMessageLength)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxDebugMessageLength);
"Message length is larger than GL_MAX_DEBUG_MESSAGE_LENGTH.");
return false; return false;
} }
size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth(); size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth();
if (currentStackSize >= context->getExtensions().maxDebugGroupStackDepth) if (currentStackSize >= context->getExtensions().maxDebugGroupStackDepth)
{ {
context->validationError( context->validationError(GL_STACK_OVERFLOW, kExceedsMaxDebugGroupStackDepth);
GL_STACK_OVERFLOW,
"Cannot push more than GL_MAX_DEBUG_GROUP_STACK_DEPTH debug groups.");
return false; return false;
} }
...@@ -2277,7 +2254,7 @@ bool ValidatePopDebugGroupKHR(Context *context) ...@@ -2277,7 +2254,7 @@ bool ValidatePopDebugGroupKHR(Context *context)
size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth(); size_t currentStackSize = context->getGLState().getDebug().getGroupStackDepth();
if (currentStackSize <= 1) if (currentStackSize <= 1)
{ {
context->validationError(GL_STACK_UNDERFLOW, "Cannot pop the default debug group."); context->validationError(GL_STACK_UNDERFLOW, kCannotPopDefaultDebugGroup);
return false; return false;
} }
...@@ -2291,7 +2268,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2291,7 +2268,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_BUFFER: case GL_BUFFER:
if (context->getBuffer(name) == nullptr) if (context->getBuffer(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid buffer."); context->validationError(GL_INVALID_VALUE, kInvalidBufferName);
return false; return false;
} }
return true; return true;
...@@ -2299,7 +2276,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2299,7 +2276,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_SHADER: case GL_SHADER:
if (context->getShader(name) == nullptr) if (context->getShader(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid shader."); context->validationError(GL_INVALID_VALUE, kInvalidShaderName);
return false; return false;
} }
return true; return true;
...@@ -2307,7 +2284,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2307,7 +2284,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_PROGRAM: case GL_PROGRAM:
if (context->getProgramNoResolveLink(name) == nullptr) if (context->getProgramNoResolveLink(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid program."); context->validationError(GL_INVALID_VALUE, kInvalidProgramName);
return false; return false;
} }
return true; return true;
...@@ -2315,7 +2292,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2315,7 +2292,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_VERTEX_ARRAY: case GL_VERTEX_ARRAY:
if (context->getVertexArray(name) == nullptr) if (context->getVertexArray(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid vertex array."); context->validationError(GL_INVALID_VALUE, kInvalidVertexArrayName);
return false; return false;
} }
return true; return true;
...@@ -2323,7 +2300,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2323,7 +2300,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_QUERY: case GL_QUERY:
if (context->getQuery(name) == nullptr) if (context->getQuery(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid query."); context->validationError(GL_INVALID_VALUE, kInvalidQueryName);
return false; return false;
} }
return true; return true;
...@@ -2331,8 +2308,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2331,8 +2308,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_TRANSFORM_FEEDBACK: case GL_TRANSFORM_FEEDBACK:
if (context->getTransformFeedback(name) == nullptr) if (context->getTransformFeedback(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidTransformFeedbackName);
"name is not a valid transform feedback.");
return false; return false;
} }
return true; return true;
...@@ -2340,7 +2316,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2340,7 +2316,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_SAMPLER: case GL_SAMPLER:
if (context->getSampler(name) == nullptr) if (context->getSampler(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid sampler."); context->validationError(GL_INVALID_VALUE, kInvalidSamplerName);
return false; return false;
} }
return true; return true;
...@@ -2348,7 +2324,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2348,7 +2324,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_TEXTURE: case GL_TEXTURE:
if (context->getTexture(name) == nullptr) if (context->getTexture(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid texture."); context->validationError(GL_INVALID_VALUE, kInvalidTextureName);
return false; return false;
} }
return true; return true;
...@@ -2356,7 +2332,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2356,7 +2332,7 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_RENDERBUFFER: case GL_RENDERBUFFER:
if (context->getRenderbuffer(name) == nullptr) if (context->getRenderbuffer(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid renderbuffer."); context->validationError(GL_INVALID_VALUE, kInvalidRenderbufferName);
return false; return false;
} }
return true; return true;
...@@ -2364,13 +2340,13 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier, ...@@ -2364,13 +2340,13 @@ static bool ValidateObjectIdentifierAndName(Context *context, GLenum identifier,
case GL_FRAMEBUFFER: case GL_FRAMEBUFFER:
if (context->getFramebuffer(name) == nullptr) if (context->getFramebuffer(name) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid framebuffer."); context->validationError(GL_INVALID_VALUE, kInvalidFramebufferName);
return false; return false;
} }
return true; return true;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid identifier."); context->validationError(GL_INVALID_ENUM, kInvalidIndentifier);
return false; return false;
} }
} }
...@@ -2393,8 +2369,7 @@ static bool ValidateLabelLength(Context *context, GLsizei length, const GLchar * ...@@ -2393,8 +2369,7 @@ static bool ValidateLabelLength(Context *context, GLsizei length, const GLchar *
if (labelLength > context->getExtensions().maxLabelLength) if (labelLength > context->getExtensions().maxLabelLength)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxLabelLength);
"Label length is larger than GL_MAX_LABEL_LENGTH.");
return false; return false;
} }
...@@ -2457,7 +2432,7 @@ static bool ValidateObjectPtrName(Context *context, const void *ptr) ...@@ -2457,7 +2432,7 @@ static bool ValidateObjectPtrName(Context *context, const void *ptr)
{ {
if (context->getSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr))) == nullptr) if (context->getSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr))) == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "name is not a valid sync."); context->validationError(GL_INVALID_VALUE, kInvalidSyncPointer);
return false; return false;
} }
...@@ -2712,11 +2687,7 @@ bool ValidateClear(Context *context, GLbitfield mask) ...@@ -2712,11 +2687,7 @@ bool ValidateClear(Context *context, GLbitfield mask)
Framebuffer *framebuffer = state.getDrawFramebuffer(); Framebuffer *framebuffer = state.getDrawFramebuffer();
if (framebuffer->getNumViews() > 1 && state.isQueryActive(QueryType::TimeElapsed)) if (framebuffer->getNumViews() > 1 && state.isQueryActive(QueryType::TimeElapsed))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kMultiviewTimerQuery);
"There is an active query for target "
"GL_TIME_ELAPSED_EXT when the number of "
"views in the active draw framebuffer is "
"greater than 1.");
return false; return false;
} }
} }
...@@ -2728,7 +2699,7 @@ bool ValidateDrawBuffersEXT(Context *context, GLsizei n, const GLenum *bufs) ...@@ -2728,7 +2699,7 @@ bool ValidateDrawBuffersEXT(Context *context, GLsizei n, const GLenum *bufs)
{ {
if (!context->getExtensions().drawBuffers) if (!context->getExtensions().drawBuffers)
{ {
context->validationError(GL_INVALID_OPERATION, "Extension not supported."); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
...@@ -2888,8 +2859,7 @@ bool ValidateCompressedTexImage2D(Context *context, ...@@ -2888,8 +2859,7 @@ bool ValidateCompressedTexImage2D(Context *context,
if (target == TextureTarget::Rectangle) if (target == TextureTarget::Rectangle)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed);
"Rectangle texture cannot have a compressed format.");
return false; return false;
} }
...@@ -2989,6 +2959,12 @@ bool ValidateGetBufferPointervOES(Context *context, ...@@ -2989,6 +2959,12 @@ bool ValidateGetBufferPointervOES(Context *context,
GLenum pname, GLenum pname,
void **params) void **params)
{ {
if (!context->getExtensions().mapBuffer)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
return ValidateGetBufferPointervBase(context, target, pname, nullptr, params); return ValidateGetBufferPointervBase(context, target, pname, nullptr, params);
} }
...@@ -2996,7 +2972,7 @@ bool ValidateMapBufferOES(Context *context, BufferBinding target, GLenum access) ...@@ -2996,7 +2972,7 @@ bool ValidateMapBufferOES(Context *context, BufferBinding target, GLenum access)
{ {
if (!context->getExtensions().mapBuffer) if (!context->getExtensions().mapBuffer)
{ {
context->validationError(GL_INVALID_OPERATION, "Map buffer extension not available."); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
...@@ -3010,19 +2986,19 @@ bool ValidateMapBufferOES(Context *context, BufferBinding target, GLenum access) ...@@ -3010,19 +2986,19 @@ bool ValidateMapBufferOES(Context *context, BufferBinding target, GLenum access)
if (buffer == nullptr) if (buffer == nullptr)
{ {
context->validationError(GL_INVALID_OPERATION, "Attempted to map buffer object zero."); context->validationError(GL_INVALID_OPERATION, kBufferNotMappable);
return false; return false;
} }
if (access != GL_WRITE_ONLY_OES) if (access != GL_WRITE_ONLY_OES)
{ {
context->validationError(GL_INVALID_ENUM, "Non-write buffer mapping not supported."); context->validationError(GL_INVALID_ENUM, kInvalidAccessBits);
return false; return false;
} }
if (buffer->isMapped()) if (buffer->isMapped())
{ {
context->validationError(GL_INVALID_OPERATION, "Buffer is already mapped."); context->validationError(GL_INVALID_OPERATION, kBufferAlreadyMapped);
return false; return false;
} }
...@@ -3033,7 +3009,7 @@ bool ValidateUnmapBufferOES(Context *context, BufferBinding target) ...@@ -3033,7 +3009,7 @@ bool ValidateUnmapBufferOES(Context *context, BufferBinding target)
{ {
if (!context->getExtensions().mapBuffer) if (!context->getExtensions().mapBuffer)
{ {
context->validationError(GL_INVALID_OPERATION, "Map buffer extension not available."); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
...@@ -3048,7 +3024,7 @@ bool ValidateMapBufferRangeEXT(Context *context, ...@@ -3048,7 +3024,7 @@ bool ValidateMapBufferRangeEXT(Context *context,
{ {
if (!context->getExtensions().mapBufferRange) if (!context->getExtensions().mapBufferRange)
{ {
context->validationError(GL_INVALID_OPERATION, "Map buffer range extension not available."); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
...@@ -3069,8 +3045,7 @@ bool ValidateMapBufferBase(Context *context, BufferBinding target) ...@@ -3069,8 +3045,7 @@ bool ValidateMapBufferBase(Context *context, BufferBinding target)
const auto &transformFeedbackBuffer = transformFeedback->getIndexedBuffer(i); const auto &transformFeedbackBuffer = transformFeedback->getIndexedBuffer(i);
if (transformFeedbackBuffer.get() == buffer) if (transformFeedbackBuffer.get() == buffer)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback);
"Buffer is currently bound for transform feedback.");
return false; return false;
} }
} }
...@@ -3093,7 +3068,7 @@ bool ValidateFlushMappedBufferRangeEXT(Context *context, ...@@ -3093,7 +3068,7 @@ bool ValidateFlushMappedBufferRangeEXT(Context *context,
{ {
if (!context->getExtensions().mapBufferRange) if (!context->getExtensions().mapBufferRange)
{ {
context->validationError(GL_INVALID_OPERATION, "Map buffer range extension not available."); context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false; return false;
} }
...@@ -3123,7 +3098,7 @@ bool ValidateBindTexture(Context *context, TextureType target, GLuint texture) ...@@ -3123,7 +3098,7 @@ bool ValidateBindTexture(Context *context, TextureType target, GLuint texture)
if (!context->getGLState().isBindGeneratesResourceEnabled() && if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isTextureGenerated(texture)) !context->isTextureGenerated(texture))
{ {
context->validationError(GL_INVALID_OPERATION, "Texture was not generated"); context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
return false; return false;
} }
...@@ -3137,8 +3112,7 @@ bool ValidateBindUniformLocationCHROMIUM(Context *context, ...@@ -3137,8 +3112,7 @@ bool ValidateBindUniformLocationCHROMIUM(Context *context,
{ {
if (!context->getExtensions().bindUniformLocation) if (!context->getExtensions().bindUniformLocation)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_bind_uniform_location is not available.");
return false; return false;
} }
...@@ -3150,7 +3124,7 @@ bool ValidateBindUniformLocationCHROMIUM(Context *context, ...@@ -3150,7 +3124,7 @@ bool ValidateBindUniformLocationCHROMIUM(Context *context,
if (location < 0) if (location < 0)
{ {
context->validationError(GL_INVALID_VALUE, "Location cannot be less than 0."); context->validationError(GL_INVALID_VALUE, kNegativeLocation);
return false; return false;
} }
...@@ -3158,10 +3132,7 @@ bool ValidateBindUniformLocationCHROMIUM(Context *context, ...@@ -3158,10 +3132,7 @@ bool ValidateBindUniformLocationCHROMIUM(Context *context,
if (static_cast<size_t>(location) >= if (static_cast<size_t>(location) >=
(caps.maxVertexUniformVectors + caps.maxFragmentUniformVectors) * 4) (caps.maxVertexUniformVectors + caps.maxFragmentUniformVectors) * 4)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidBindUniformLocation);
"Location must be less than "
"(MAX_VERTEX_UNIFORM_VECTORS + "
"MAX_FRAGMENT_UNIFORM_VECTORS) * 4");
return false; return false;
} }
...@@ -3186,8 +3157,7 @@ bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components) ...@@ -3186,8 +3157,7 @@ bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components)
{ {
if (!context->getExtensions().framebufferMixedSamples) if (!context->getExtensions().framebufferMixedSamples)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_framebuffer_mixed_samples is not available.");
return false; return false;
} }
switch (components) switch (components)
...@@ -3198,9 +3168,7 @@ bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components) ...@@ -3198,9 +3168,7 @@ bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components)
case GL_NONE: case GL_NONE:
break; break;
default: default:
context->validationError( context->validationError(GL_INVALID_ENUM, kInvalidCoverageComponents);
GL_INVALID_ENUM,
"GLenum components is not one of GL_RGB, GL_RGBA, GL_ALPHA or GL_NONE.");
return false; return false;
} }
...@@ -3218,7 +3186,7 @@ bool ValidateMatrixLoadfCHROMIUM(Context *context, GLenum matrixMode, const GLfl ...@@ -3218,7 +3186,7 @@ bool ValidateMatrixLoadfCHROMIUM(Context *context, GLenum matrixMode, const GLfl
if (matrix == nullptr) if (matrix == nullptr)
{ {
context->validationError(GL_INVALID_OPERATION, "Invalid matrix."); context->validationError(GL_INVALID_OPERATION, kInvalidPathMatrix);
return false; return false;
} }
...@@ -3234,8 +3202,7 @@ bool ValidateGenPathsCHROMIUM(Context *context, GLsizei range) ...@@ -3234,8 +3202,7 @@ bool ValidateGenPathsCHROMIUM(Context *context, GLsizei range)
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
...@@ -3260,8 +3227,7 @@ bool ValidateDeletePathsCHROMIUM(Context *context, GLuint path, GLsizei range) ...@@ -3260,8 +3227,7 @@ bool ValidateDeletePathsCHROMIUM(Context *context, GLuint path, GLsizei range)
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
...@@ -3294,8 +3260,7 @@ bool ValidatePathCommandsCHROMIUM(Context *context, ...@@ -3294,8 +3260,7 @@ bool ValidatePathCommandsCHROMIUM(Context *context,
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
if (!context->isPathGenerated(path)) if (!context->isPathGenerated(path))
...@@ -3306,28 +3271,28 @@ bool ValidatePathCommandsCHROMIUM(Context *context, ...@@ -3306,28 +3271,28 @@ bool ValidatePathCommandsCHROMIUM(Context *context,
if (numCommands < 0) if (numCommands < 0)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid number of commands."); context->validationError(GL_INVALID_VALUE, kInvalidPathNumCommands);
return false; return false;
} }
else if (numCommands > 0) else if (numCommands > 0)
{ {
if (!commands) if (!commands)
{ {
context->validationError(GL_INVALID_VALUE, "No commands array given."); context->validationError(GL_INVALID_VALUE, kInvalidPathCommandsArray);
return false; return false;
} }
} }
if (numCoords < 0) if (numCoords < 0)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid number of coordinates."); context->validationError(GL_INVALID_VALUE, kInvalidPathNumCoords);
return false; return false;
} }
else if (numCoords > 0) else if (numCoords > 0)
{ {
if (!coords) if (!coords)
{ {
context->validationError(GL_INVALID_VALUE, "No coordinate array given."); context->validationError(GL_INVALID_VALUE, kInvalidPathNumCoordsArray);
return false; return false;
} }
} }
...@@ -3356,7 +3321,7 @@ bool ValidatePathCommandsCHROMIUM(Context *context, ...@@ -3356,7 +3321,7 @@ bool ValidatePathCommandsCHROMIUM(Context *context,
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid coordinate type."); context->validationError(GL_INVALID_ENUM, kInvalidPathCoordinateType);
return false; return false;
} }
...@@ -3393,13 +3358,14 @@ bool ValidatePathCommandsCHROMIUM(Context *context, ...@@ -3393,13 +3358,14 @@ bool ValidatePathCommandsCHROMIUM(Context *context,
expectedNumCoords += 5; expectedNumCoords += 5;
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid command."); context->validationError(GL_INVALID_ENUM, kInvalidPathCommand);
return false; return false;
} }
} }
if (expectedNumCoords != numCoords) if (expectedNumCoords != numCoords)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid number of coordinates."); context->validationError(GL_INVALID_VALUE, kInvalidPathNumCoords);
return false; return false;
} }
...@@ -3410,8 +3376,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, ...@@ -3410,8 +3376,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname,
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
if (!context->isPathGenerated(path)) if (!context->isPathGenerated(path))
...@@ -3425,7 +3390,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, ...@@ -3425,7 +3390,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname,
case GL_PATH_STROKE_WIDTH_CHROMIUM: case GL_PATH_STROKE_WIDTH_CHROMIUM:
if (value < 0.0f) if (value < 0.0f)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid stroke width."); context->validationError(GL_INVALID_VALUE, kInvalidPathStrokeWidth);
return false; return false;
} }
break; break;
...@@ -3437,7 +3402,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, ...@@ -3437,7 +3402,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname,
case GL_ROUND_CHROMIUM: case GL_ROUND_CHROMIUM:
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid end caps."); context->validationError(GL_INVALID_ENUM, kInvalidPathEndCaps);
return false; return false;
} }
break; break;
...@@ -3449,14 +3414,14 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, ...@@ -3449,14 +3414,14 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname,
case GL_ROUND_CHROMIUM: case GL_ROUND_CHROMIUM:
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid join style."); context->validationError(GL_INVALID_ENUM, kInvalidPathJoinStyle);
return false; return false;
} }
break; break;
case GL_PATH_MITER_LIMIT_CHROMIUM: case GL_PATH_MITER_LIMIT_CHROMIUM:
if (value < 0.0f) if (value < 0.0f)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid miter limit."); context->validationError(GL_INVALID_VALUE, kInvalidPathMiterLimit);
return false; return false;
} }
break; break;
...@@ -3466,7 +3431,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, ...@@ -3466,7 +3431,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname,
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid path parameter."); context->validationError(GL_INVALID_ENUM, kInvalidPathParameter);
return false; return false;
} }
return true; return true;
...@@ -3482,8 +3447,7 @@ bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pn ...@@ -3482,8 +3447,7 @@ bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pn
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
...@@ -3492,9 +3456,10 @@ bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pn ...@@ -3492,9 +3456,10 @@ bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pn
context->validationError(GL_INVALID_OPERATION, kNoSuchPath); context->validationError(GL_INVALID_OPERATION, kNoSuchPath);
return false; return false;
} }
if (!value) if (!value)
{ {
context->validationError(GL_INVALID_VALUE, "No value array."); context->validationError(GL_INVALID_VALUE, kInvalidPathValueArray);
return false; return false;
} }
...@@ -3508,7 +3473,7 @@ bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pn ...@@ -3508,7 +3473,7 @@ bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pn
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid path parameter."); context->validationError(GL_INVALID_ENUM, kInvalidPathParameter);
return false; return false;
} }
...@@ -3525,8 +3490,7 @@ bool ValidatePathStencilFuncCHROMIUM(Context *context, GLenum func, GLint ref, G ...@@ -3525,8 +3490,7 @@ bool ValidatePathStencilFuncCHROMIUM(Context *context, GLenum func, GLint ref, G
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
...@@ -3559,8 +3523,7 @@ bool ValidateStencilFillPathCHROMIUM(Context *context, GLuint path, GLenum fillM ...@@ -3559,8 +3523,7 @@ bool ValidateStencilFillPathCHROMIUM(Context *context, GLuint path, GLenum fillM
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
if (context->isPathGenerated(path) && !context->isPath(path)) if (context->isPathGenerated(path) && !context->isPath(path))
...@@ -3592,13 +3555,13 @@ bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint refe ...@@ -3592,13 +3555,13 @@ bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint refe
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
if (context->isPathGenerated(path) && !context->isPath(path)) if (context->isPathGenerated(path) && !context->isPath(path))
{ {
context->validationError(GL_INVALID_OPERATION, "No such path or path has no data."); context->validationError(GL_INVALID_OPERATION, kNoPathOrNoPathData);
return false; return false;
} }
...@@ -3609,8 +3572,7 @@ bool ValidateCoverPathCHROMIUM(Context *context, GLuint path, GLenum coverMode) ...@@ -3609,8 +3572,7 @@ bool ValidateCoverPathCHROMIUM(Context *context, GLuint path, GLenum coverMode)
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
if (context->isPathGenerated(path) && !context->isPath(path)) if (context->isPathGenerated(path) && !context->isPath(path))
...@@ -3665,8 +3627,7 @@ bool ValidateIsPathCHROMIUM(Context *context, GLuint path) ...@@ -3665,8 +3627,7 @@ bool ValidateIsPathCHROMIUM(Context *context, GLuint path)
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
return true; return true;
...@@ -3857,15 +3818,14 @@ bool ValidateBindFragmentInputLocationCHROMIUM(Context *context, ...@@ -3857,15 +3818,14 @@ bool ValidateBindFragmentInputLocationCHROMIUM(Context *context,
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
const GLint MaxLocation = context->getCaps().maxVaryingVectors * 4; const GLint MaxLocation = context->getCaps().maxVaryingVectors * 4;
if (location >= MaxLocation) if (location >= MaxLocation)
{ {
context->validationError(GL_INVALID_VALUE, "Location exceeds max varying."); context->validationError(GL_INVALID_VALUE, kInvalidVaryingLocation);
return false; return false;
} }
...@@ -3878,7 +3838,7 @@ bool ValidateBindFragmentInputLocationCHROMIUM(Context *context, ...@@ -3878,7 +3838,7 @@ bool ValidateBindFragmentInputLocationCHROMIUM(Context *context,
if (!name) if (!name)
{ {
context->validationError(GL_INVALID_VALUE, "No name given."); context->validationError(GL_INVALID_VALUE, kMissingName);
return false; return false;
} }
...@@ -3900,8 +3860,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context, ...@@ -3900,8 +3860,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
{ {
if (!context->getExtensions().pathRendering) if (!context->getExtensions().pathRendering)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_path_rendering is not available.");
return false; return false;
} }
...@@ -3923,7 +3882,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context, ...@@ -3923,7 +3882,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
case GL_NONE: case GL_NONE:
if (components != 0) if (components != 0)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid components."); context->validationError(GL_INVALID_VALUE, kInvalidComponents);
return false; return false;
} }
break; break;
...@@ -3933,18 +3892,18 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context, ...@@ -3933,18 +3892,18 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
case GL_CONSTANT_CHROMIUM: case GL_CONSTANT_CHROMIUM:
if (components < 1 || components > 4) if (components < 1 || components > 4)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid components."); context->validationError(GL_INVALID_VALUE, kInvalidComponents);
return false; return false;
} }
if (!coeffs) if (!coeffs)
{ {
context->validationError(GL_INVALID_VALUE, "No coefficients array given."); context->validationError(GL_INVALID_VALUE, kInvalidPathCoefficientsArray);
return false; return false;
} }
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid gen mode."); context->validationError(GL_INVALID_ENUM, kInvalidPathGenMode);
return false; return false;
} }
...@@ -3957,7 +3916,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context, ...@@ -3957,7 +3916,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
if (!binding.valid) if (!binding.valid)
{ {
context->validationError(GL_INVALID_OPERATION, "No such binding."); context->validationError(GL_INVALID_OPERATION, kInvalidFragmentInputBinding);
return false; return false;
} }
...@@ -3979,14 +3938,12 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context, ...@@ -3979,14 +3938,12 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
expectedComponents = 4; expectedComponents = 4;
break; break;
default: default:
context->validationError( context->validationError(GL_INVALID_OPERATION, kFragmentInputTypeNotFloatingPoint);
GL_INVALID_OPERATION,
"Fragment input type is not a floating point scalar or vector.");
return false; return false;
} }
if (expectedComponents != components && genMode != GL_NONE) if (expectedComponents != components && genMode != GL_NONE)
{ {
context->validationError(GL_INVALID_OPERATION, "Unexpected number of components"); context->validationError(GL_INVALID_OPERATION, kInvalidPathComponents);
return false; return false;
} }
} }
...@@ -4007,15 +3964,14 @@ bool ValidateCopyTextureCHROMIUM(Context *context, ...@@ -4007,15 +3964,14 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
{ {
if (!context->getExtensions().copyTexture) if (!context->getExtensions().copyTexture)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_copy_texture extension not available.");
return false; return false;
} }
const Texture *source = context->getTexture(sourceId); const Texture *source = context->getTexture(sourceId);
if (source == nullptr) if (source == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "Source texture is not a valid texture object."); context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
return false; return false;
} }
...@@ -4031,7 +3987,7 @@ bool ValidateCopyTextureCHROMIUM(Context *context, ...@@ -4031,7 +3987,7 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel)) if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel))
{ {
context->validationError(GL_INVALID_VALUE, "Source texture level is not valid."); context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureLevel);
return false; return false;
} }
...@@ -4046,8 +4002,7 @@ bool ValidateCopyTextureCHROMIUM(Context *context, ...@@ -4046,8 +4002,7 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
const InternalFormat &sourceFormat = *source->getFormat(sourceTarget, sourceLevel).info; const InternalFormat &sourceFormat = *source->getFormat(sourceTarget, sourceLevel).info;
if (!IsValidCopyTextureSourceInternalFormatEnum(sourceFormat.internalFormat)) if (!IsValidCopyTextureSourceInternalFormatEnum(sourceFormat.internalFormat))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidSourceTextureInternalFormat);
"Source texture internal format is invalid.");
return false; return false;
} }
...@@ -4060,14 +4015,13 @@ bool ValidateCopyTextureCHROMIUM(Context *context, ...@@ -4060,14 +4015,13 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
const Texture *dest = context->getTexture(destId); const Texture *dest = context->getTexture(destId);
if (dest == nullptr) if (dest == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
"Destination texture is not a valid texture object.");
return false; return false;
} }
if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget)) if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget))
{ {
context->validationError(GL_INVALID_VALUE, "Destination texture a valid texture type."); context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType);
return false; return false;
} }
...@@ -4085,14 +4039,13 @@ bool ValidateCopyTextureCHROMIUM(Context *context, ...@@ -4085,14 +4039,13 @@ bool ValidateCopyTextureCHROMIUM(Context *context,
if (dest->getType() == TextureType::CubeMap && sourceWidth != sourceHeight) if (dest->getType() == TextureType::CubeMap && sourceWidth != sourceHeight)
{ {
context->validationError( context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions);
GL_INVALID_VALUE, "Destination width and height must be equal for cube map textures.");
return false; return false;
} }
if (dest->getImmutableFormat()) if (dest->getImmutableFormat())
{ {
context->validationError(GL_INVALID_OPERATION, "Destination texture is immutable."); context->validationError(GL_INVALID_OPERATION, kDestinationImmutable);
return false; return false;
} }
...@@ -4117,21 +4070,20 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, ...@@ -4117,21 +4070,20 @@ bool ValidateCopySubTextureCHROMIUM(Context *context,
{ {
if (!context->getExtensions().copyTexture) if (!context->getExtensions().copyTexture)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_copy_texture extension not available.");
return false; return false;
} }
const Texture *source = context->getTexture(sourceId); const Texture *source = context->getTexture(sourceId);
if (source == nullptr) if (source == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "Source texture is not a valid texture object."); context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
return false; return false;
} }
if (!IsValidCopyTextureSourceTarget(context, source->getType())) if (!IsValidCopyTextureSourceTarget(context, source->getType()))
{ {
context->validationError(GL_INVALID_VALUE, "Source texture a valid texture type."); context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureType);
return false; return false;
} }
...@@ -4148,14 +4100,13 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, ...@@ -4148,14 +4100,13 @@ bool ValidateCopySubTextureCHROMIUM(Context *context,
if (source->getWidth(sourceTarget, sourceLevel) == 0 || if (source->getWidth(sourceTarget, sourceLevel) == 0 ||
source->getHeight(sourceTarget, sourceLevel) == 0) source->getHeight(sourceTarget, sourceLevel) == 0)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureLevel);
"The source level of the source texture must be defined.");
return false; return false;
} }
if (x < 0 || y < 0) if (x < 0 || y < 0)
{ {
context->validationError(GL_INVALID_VALUE, "x and y cannot be negative."); context->validationError(GL_INVALID_VALUE, kNegativeOffset);
return false; return false;
} }
...@@ -4188,37 +4139,33 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, ...@@ -4188,37 +4139,33 @@ bool ValidateCopySubTextureCHROMIUM(Context *context,
const Texture *dest = context->getTexture(destId); const Texture *dest = context->getTexture(destId);
if (dest == nullptr) if (dest == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
"Destination texture is not a valid texture object.");
return false; return false;
} }
if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget)) if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget))
{ {
context->validationError(GL_INVALID_VALUE, "Destination texture a valid texture type."); context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType);
return false; return false;
} }
if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, width, height, if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, width, height,
true)) true))
{ {
context->validationError(GL_INVALID_VALUE, "Destination texture level is not valid."); context->validationError(GL_INVALID_VALUE, kInvalidMipLevel);
return false; return false;
} }
if (dest->getWidth(destTarget, destLevel) == 0 || dest->getHeight(destTarget, destLevel) == 0) if (dest->getWidth(destTarget, destLevel) == 0 || dest->getHeight(destTarget, destLevel) == 0)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kDestinationLevelNotDefined);
GL_INVALID_OPERATION,
"The destination level of the destination texture must be defined.");
return false; return false;
} }
const InternalFormat &destFormat = *dest->getFormat(destTarget, destLevel).info; const InternalFormat &destFormat = *dest->getFormat(destTarget, destLevel).info;
if (!IsValidCopySubTextureDestionationInternalFormat(destFormat.internalFormat)) if (!IsValidCopySubTextureDestionationInternalFormat(destFormat.internalFormat))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidFormatCombination);
"Destination internal format and type combination is not valid.");
return false; return false;
} }
...@@ -4231,8 +4178,7 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, ...@@ -4231,8 +4178,7 @@ bool ValidateCopySubTextureCHROMIUM(Context *context,
if (static_cast<size_t>(xoffset + width) > dest->getWidth(destTarget, destLevel) || if (static_cast<size_t>(xoffset + width) > dest->getWidth(destTarget, destLevel) ||
static_cast<size_t>(yoffset + height) > dest->getHeight(destTarget, destLevel)) static_cast<size_t>(yoffset + height) > dest->getHeight(destTarget, destLevel))
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kOffsetOverflow);
"Destination texture not large enough to copy to.");
return false; return false;
} }
...@@ -4243,57 +4189,53 @@ bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GL ...@@ -4243,57 +4189,53 @@ bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GL
{ {
if (!context->getExtensions().copyCompressedTexture) if (!context->getExtensions().copyCompressedTexture)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_CHROMIUM_copy_compressed_texture extension not available.");
return false; return false;
} }
const gl::Texture *source = context->getTexture(sourceId); const gl::Texture *source = context->getTexture(sourceId);
if (source == nullptr) if (source == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, "Source texture is not a valid texture object."); context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture);
return false; return false;
} }
if (source->getType() != TextureType::_2D) if (source->getType() != TextureType::_2D)
{ {
context->validationError(GL_INVALID_VALUE, "Source texture must be of type GL_TEXTURE_2D."); context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureType);
return false; return false;
} }
if (source->getWidth(TextureTarget::_2D, 0) == 0 || if (source->getWidth(TextureTarget::_2D, 0) == 0 ||
source->getHeight(TextureTarget::_2D, 0) == 0) source->getHeight(TextureTarget::_2D, 0) == 0)
{ {
context->validationError(GL_INVALID_VALUE, "Source texture must level 0 defined."); context->validationError(GL_INVALID_VALUE, kSourceTextureLevelZeroDefined);
return false; return false;
} }
const gl::Format &sourceFormat = source->getFormat(TextureTarget::_2D, 0); const gl::Format &sourceFormat = source->getFormat(TextureTarget::_2D, 0);
if (!sourceFormat.info->compressed) if (!sourceFormat.info->compressed)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kSourceTextureMustBeCompressed);
"Source texture must have a compressed internal format.");
return false; return false;
} }
const gl::Texture *dest = context->getTexture(destId); const gl::Texture *dest = context->getTexture(destId);
if (dest == nullptr) if (dest == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture);
"Destination texture is not a valid texture object.");
return false; return false;
} }
if (dest->getType() != TextureType::_2D) if (dest->getType() != TextureType::_2D)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType);
"Destination texture must be of type GL_TEXTURE_2D.");
return false; return false;
} }
if (dest->getImmutableFormat()) if (dest->getImmutableFormat())
{ {
context->validationError(GL_INVALID_OPERATION, "Destination cannot be immutable."); context->validationError(GL_INVALID_OPERATION, kDestinationImmutable);
return false; return false;
} }
...@@ -4459,14 +4401,13 @@ bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name) ...@@ -4459,14 +4401,13 @@ bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name)
{ {
if (!context->getExtensions().requestExtension) if (!context->getExtensions().requestExtension)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_ANGLE_request_extension is not available.");
return false; return false;
} }
if (!context->isExtensionRequestable(name)) if (!context->isExtensionRequestable(name))
{ {
context->validationError(GL_INVALID_OPERATION, "Extension is not requestable."); context->validationError(GL_INVALID_OPERATION, kExtensionNotRequestable);
return false; return false;
} }
...@@ -4683,20 +4624,14 @@ bool ValidateBlendFuncSeparate(Context *context, ...@@ -4683,20 +4624,14 @@ bool ValidateBlendFuncSeparate(Context *context,
if (constantColorUsed && constantAlphaUsed) if (constantColorUsed && constantAlphaUsed)
{ {
const char *msg;
if (context->getExtensions().webglCompatibility) if (context->getExtensions().webglCompatibility)
{ {
msg = kInvalidConstantColor; context->validationError(GL_INVALID_OPERATION, kInvalidConstantColor);
} return false;
else
{
msg =
"Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and "
"GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR not supported by this "
"implementation.";
WARN() << msg;
} }
context->validationError(GL_INVALID_OPERATION, msg);
WARN() << kConstantColorAlphaLimitation;
context->validationError(GL_INVALID_OPERATION, kConstantColorAlphaLimitation);
return false; return false;
} }
} }
...@@ -4766,15 +4701,13 @@ bool ValidateVertexAttribPointer(Context *context, ...@@ -4766,15 +4701,13 @@ bool ValidateVertexAttribPointer(Context *context,
{ {
if (stride > caps.maxVertexAttribStride) if (stride > caps.maxVertexAttribStride)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribStride);
"stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE.");
return false; return false;
} }
if (index >= caps.maxVertexAttribBindings) if (index >= caps.maxVertexAttribBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
"index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false; return false;
} }
} }
...@@ -4788,9 +4721,7 @@ bool ValidateVertexAttribPointer(Context *context, ...@@ -4788,9 +4721,7 @@ bool ValidateVertexAttribPointer(Context *context,
if (!nullBufferAllowed && context->getGLState().getTargetBuffer(BufferBinding::Array) == 0 && if (!nullBufferAllowed && context->getGLState().getTargetBuffer(BufferBinding::Array) == 0 &&
ptr != nullptr) ptr != nullptr)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kClientDataInVertexArray);
GL_INVALID_OPERATION,
"Client data cannot be used with a non-default vertex array object.");
return false; return false;
} }
...@@ -4800,7 +4731,7 @@ bool ValidateVertexAttribPointer(Context *context, ...@@ -4800,7 +4731,7 @@ bool ValidateVertexAttribPointer(Context *context,
// The WebGL API does not support the GL_FIXED data type. // The WebGL API does not support the GL_FIXED data type.
if (type == GL_FIXED) if (type == GL_FIXED)
{ {
context->validationError(GL_INVALID_ENUM, "GL_FIXED is not supported in WebGL."); context->validationError(GL_INVALID_ENUM, kFixedNotInWebGL);
return false; return false;
} }
...@@ -4843,8 +4774,7 @@ bool ValidateRenderbufferStorageMultisampleANGLE(Context *context, ...@@ -4843,8 +4774,7 @@ bool ValidateRenderbufferStorageMultisampleANGLE(Context *context,
{ {
if (!context->getExtensions().framebufferMultisample) if (!context->getExtensions().framebufferMultisample)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
"GL_ANGLE_framebuffer_multisample not available");
return false; return false;
} }
...@@ -5274,8 +5204,7 @@ bool ValidateGetShaderPrecisionFormat(Context *context, ...@@ -5274,8 +5204,7 @@ bool ValidateGetShaderPrecisionFormat(Context *context,
case GL_FRAGMENT_SHADER: case GL_FRAGMENT_SHADER:
break; break;
case GL_COMPUTE_SHADER: case GL_COMPUTE_SHADER:
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kUnimplementedComputeShaderPrecision);
"compute shader precision not yet implemented.");
return false; return false;
default: default:
context->validationError(GL_INVALID_ENUM, kInvalidShaderType); context->validationError(GL_INVALID_ENUM, kInvalidShaderType);
...@@ -5375,8 +5304,7 @@ bool ValidateHint(Context *context, GLenum target, GLenum mode) ...@@ -5375,8 +5304,7 @@ bool ValidateHint(Context *context, GLenum target, GLenum mode)
if (context->getClientVersion() < ES_3_0 && if (context->getClientVersion() < ES_3_0 &&
!context->getExtensions().standardDerivatives) !context->getExtensions().standardDerivatives)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
"hint requires OES_standard_derivatives.");
return false; return false;
} }
break; break;
...@@ -5465,7 +5393,7 @@ bool ValidatePixelStorei(Context *context, GLenum pname, GLint param) ...@@ -5465,7 +5393,7 @@ bool ValidatePixelStorei(Context *context, GLenum pname, GLint param)
if (param < 0) if (param < 0)
{ {
context->validationError(GL_INVALID_VALUE, "Cannot use negative values in PixelStorei"); context->validationError(GL_INVALID_VALUE, kNegativeParam);
return false; return false;
} }
...@@ -5549,7 +5477,7 @@ bool ValidateShaderBinary(Context *context, ...@@ -5549,7 +5477,7 @@ bool ValidateShaderBinary(Context *context,
if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) ==
shaderBinaryFormats.end()) shaderBinaryFormats.end())
{ {
context->validationError(GL_INVALID_ENUM, "Invalid shader binary format."); context->validationError(GL_INVALID_ENUM, kInvalidShaderBinaryFormat);
return false; return false;
} }
...@@ -5950,12 +5878,11 @@ bool ValidateEnable(Context *context, GLenum cap) ...@@ -5950,12 +5878,11 @@ bool ValidateEnable(Context *context, GLenum cap)
if (context->getLimitations().noSampleAlphaToCoverageSupport && if (context->getLimitations().noSampleAlphaToCoverageSupport &&
cap == GL_SAMPLE_ALPHA_TO_COVERAGE) cap == GL_SAMPLE_ALPHA_TO_COVERAGE)
{ {
const char *errorMessage = "Current renderer doesn't support alpha-to-coverage"; context->validationError(GL_INVALID_OPERATION, kNoSampleAlphaToCoveragesLimitation);
context->validationError(GL_INVALID_OPERATION, errorMessage);
// We also output an error message to the debugger window if tracing is active, so that // We also output an error message to the debugger window if tracing is active, so that
// developers can see the error message. // developers can see the error message.
ERR() << errorMessage; ERR() << kNoSampleAlphaToCoveragesLimitation;
return false; return false;
} }
...@@ -6038,8 +5965,7 @@ bool ValidateFramebufferTexture2D(Context *context, ...@@ -6038,8 +5965,7 @@ bool ValidateFramebufferTexture2D(Context *context,
} }
if (tex->getType() != TextureType::Rectangle) if (tex->getType() != TextureType::Rectangle)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch);
"Textarget must match the texture target type.");
return false; return false;
} }
} }
...@@ -6059,8 +5985,7 @@ bool ValidateFramebufferTexture2D(Context *context, ...@@ -6059,8 +5985,7 @@ bool ValidateFramebufferTexture2D(Context *context,
} }
if (tex->getType() != TextureType::CubeMap) if (tex->getType() != TextureType::CubeMap)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch);
"Textarget must match the texture target type.");
return false; return false;
} }
} }
...@@ -6083,8 +6008,7 @@ bool ValidateFramebufferTexture2D(Context *context, ...@@ -6083,8 +6008,7 @@ bool ValidateFramebufferTexture2D(Context *context,
} }
if (tex->getType() != TextureType::_2DMultisample) if (tex->getType() != TextureType::_2DMultisample)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch);
"Textarget must match the texture target type.");
return false; return false;
} }
} }
...@@ -6310,10 +6234,7 @@ bool ValidateLinkProgram(Context *context, GLuint program) ...@@ -6310,10 +6234,7 @@ bool ValidateLinkProgram(Context *context, GLuint program)
if (context->hasActiveTransformFeedback(program)) if (context->hasActiveTransformFeedback(program))
{ {
// ES 3.0.4 section 2.15 page 91 // ES 3.0.4 section 2.15 page 91
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTransformFeedbackActiveDuringLink);
"Cannot link program while program is "
"associated with an active transform "
"feedback object.");
return false; return false;
} }
...@@ -6416,9 +6337,7 @@ bool ValidateUseProgram(Context *context, GLuint program) ...@@ -6416,9 +6337,7 @@ bool ValidateUseProgram(Context *context, GLuint program)
if (context->getGLState().isTransformFeedbackActiveUnpaused()) if (context->getGLState().isTransformFeedbackActiveUnpaused())
{ {
// ES 3.0.4 section 2.15 page 91 // ES 3.0.4 section 2.15 page 91
context->validationError( context->validationError(GL_INVALID_OPERATION, kTransformFeedbackUseProgram);
GL_INVALID_OPERATION,
"Cannot change active program while transform feedback is unpaused.");
return false; return false;
} }
...@@ -6663,16 +6582,11 @@ bool ValidateVertexAttribDivisorANGLE(Context *context, GLuint index, GLuint div ...@@ -6663,16 +6582,11 @@ bool ValidateVertexAttribDivisorANGLE(Context *context, GLuint index, GLuint div
{ {
if (index == 0 && divisor != 0) if (index == 0 && divisor != 0)
{ {
const char *errorMessage = context->validationError(GL_INVALID_OPERATION, kAttributeZeroRequiresDivisorLimitation);
"The current context doesn't support setting a non-zero divisor on the "
"attribute with index zero. "
"Please reorder the attributes in your vertex shader so that attribute zero "
"can have a zero divisor.";
context->validationError(GL_INVALID_OPERATION, errorMessage);
// We also output an error message to the debugger window if tracing is active, so // We also output an error message to the debugger window if tracing is active, so
// that developers can see the error message. // that developers can see the error message.
ERR() << errorMessage; ERR() << kAttributeZeroRequiresDivisorLimitation;
return false; return false;
} }
} }
......
...@@ -449,7 +449,7 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -449,7 +449,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat; isSubImage ? texture->getFormat(target, level).info->internalFormat : internalformat;
if (isSubImage && actualInternalFormat == GL_NONE) if (isSubImage && actualInternalFormat == GL_NONE)
{ {
context->validationError(GL_INVALID_OPERATION, "Texture level does not exist."); context->validationError(GL_INVALID_OPERATION, kInvalidMipLevel);
return false; return false;
} }
...@@ -460,8 +460,7 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -460,8 +460,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
{ {
if (!actualFormatInfo.compressed) if (!actualFormatInfo.compressed)
{ {
context->validationError( context->validationError(GL_INVALID_ENUM, kCompressedMismatch);
GL_INVALID_ENUM, "internalformat is not a supported compressed internal format.");
return false; return false;
} }
...@@ -471,15 +470,13 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -471,15 +470,13 @@ bool ValidateES3TexImageParametersBase(Context *context,
context, actualFormatInfo.internalFormat, xoffset, yoffset, width, height, context, actualFormatInfo.internalFormat, xoffset, yoffset, width, height,
texture->getWidth(target, level), texture->getHeight(target, level))) texture->getWidth(target, level), texture->getHeight(target, level)))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
"Invalid compressed format dimension.");
return false; return false;
} }
if (format != actualInternalFormat) if (format != actualInternalFormat)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kMismatchedFormat);
"Format must match the internal format of the texture.");
return false; return false;
} }
...@@ -493,8 +490,7 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -493,8 +490,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
{ {
if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height)) if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize);
"Invalid compressed format dimension.");
return false; return false;
} }
} }
...@@ -581,8 +577,7 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -581,8 +577,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
if ((offset % dataBytesPerPixel) != 0) if ((offset % dataBytesPerPixel) != 0)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kDataTypeNotAligned);
"Reads would overflow the pixel unpack buffer.");
return false; return false;
} }
} }
...@@ -590,7 +585,7 @@ bool ValidateES3TexImageParametersBase(Context *context, ...@@ -590,7 +585,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
// ...the buffer object's data store is currently mapped. // ...the buffer object's data store is currently mapped.
if (pixelUnpackBuffer->isMapped()) if (pixelUnpackBuffer->isMapped())
{ {
context->validationError(GL_INVALID_OPERATION, "Pixel unpack buffer is mapped."); context->validationError(GL_INVALID_OPERATION, kBufferMapped);
return false; return false;
} }
} }
...@@ -1424,7 +1419,7 @@ bool ValidateDrawRangeElements(Context *context, ...@@ -1424,7 +1419,7 @@ bool ValidateDrawRangeElements(Context *context,
if (end < start) if (end < start)
{ {
context->validationError(GL_INVALID_VALUE, "end < start"); context->validationError(GL_INVALID_VALUE, kInvalidElementRange);
return false; return false;
} }
...@@ -1447,7 +1442,7 @@ bool ValidateDrawRangeElements(Context *context, ...@@ -1447,7 +1442,7 @@ bool ValidateDrawRangeElements(Context *context,
if (indexRange.end > end || indexRange.start < start) if (indexRange.end > end || indexRange.start < start)
{ {
// GL spec says that behavior in this case is undefined - generating an error is fine. // GL spec says that behavior in this case is undefined - generating an error is fine.
context->validationError(GL_INVALID_OPERATION, "Indices are out of the start, end range."); context->validationError(GL_INVALID_OPERATION, kExceedsElementRange);
return false; return false;
} }
return true; return true;
...@@ -1476,7 +1471,7 @@ bool ValidateReadBuffer(Context *context, GLenum src) ...@@ -1476,7 +1471,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
if (readFBO == nullptr) if (readFBO == nullptr)
{ {
context->validationError(GL_INVALID_OPERATION, "No active read framebuffer."); context->validationError(GL_INVALID_OPERATION, kNoReadFramebuffer);
return false; return false;
} }
...@@ -1487,7 +1482,7 @@ bool ValidateReadBuffer(Context *context, GLenum src) ...@@ -1487,7 +1482,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
if (src != GL_BACK && (src < GL_COLOR_ATTACHMENT0 || src > GL_COLOR_ATTACHMENT31)) if (src != GL_BACK && (src < GL_COLOR_ATTACHMENT0 || src > GL_COLOR_ATTACHMENT31))
{ {
context->validationError(GL_INVALID_ENUM, "Unknown enum for 'src' in ReadBuffer"); context->validationError(GL_INVALID_ENUM, kInvalidReadBuffer);
return false; return false;
} }
...@@ -1495,9 +1490,7 @@ bool ValidateReadBuffer(Context *context, GLenum src) ...@@ -1495,9 +1490,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
{ {
if (src != GL_BACK) if (src != GL_BACK)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kInvalidDefaultReadBuffer);
GL_INVALID_OPERATION,
"'src' must be GL_NONE or GL_BACK when reading from the default framebuffer.");
return false; return false;
} }
} }
...@@ -1507,8 +1500,7 @@ bool ValidateReadBuffer(Context *context, GLenum src) ...@@ -1507,8 +1500,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
if (drawBuffer >= context->getCaps().maxDrawBuffers) if (drawBuffer >= context->getCaps().maxDrawBuffers)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kExceedsMaxDrawBuffers);
"'src' is greater than MAX_DRAW_BUFFERS.");
return false; return false;
} }
} }
...@@ -1569,8 +1561,7 @@ bool ValidateCompressedTexImage3D(Context *context, ...@@ -1569,8 +1561,7 @@ bool ValidateCompressedTexImage3D(Context *context,
// 3D texture target validation // 3D texture target validation
if (target != TextureType::_3D && target != TextureType::_2DArray) if (target != TextureType::_3D && target != TextureType::_2DArray)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget);
"Must specify a valid 3D texture destination target");
return false; return false;
} }
...@@ -1643,14 +1634,14 @@ static bool ValidateBindBufferCommon(Context *context, ...@@ -1643,14 +1634,14 @@ static bool ValidateBindBufferCommon(Context *context,
if (buffer != 0 && offset < 0) if (buffer != 0 && offset < 0)
{ {
context->validationError(GL_INVALID_VALUE, "buffer is non-zero and offset is negative."); context->validationError(GL_INVALID_VALUE, kNegativeOffset);
return false; return false;
} }
if (!context->getGLState().isBindGeneratesResourceEnabled() && if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isBufferGenerated(buffer)) !context->isBufferGenerated(buffer))
{ {
context->validationError(GL_INVALID_OPERATION, "Buffer was not generated."); context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
return false; return false;
} }
...@@ -1662,15 +1653,12 @@ static bool ValidateBindBufferCommon(Context *context, ...@@ -1662,15 +1653,12 @@ static bool ValidateBindBufferCommon(Context *context,
if (index >= caps.maxTransformFeedbackSeparateAttributes) if (index >= caps.maxTransformFeedbackSeparateAttributes)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE,
"index is greater than or equal to the " kIndexExceedsTransformFeedbackBufferBindings);
"number of TRANSFORM_FEEDBACK_BUFFER "
"indexed binding points.");
return false; return false;
} }
if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0)) if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0))
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kOffsetAndSizeAlignment);
"offset and size must be multiple of 4.");
return false; return false;
} }
...@@ -1678,9 +1666,7 @@ static bool ValidateBindBufferCommon(Context *context, ...@@ -1678,9 +1666,7 @@ static bool ValidateBindBufferCommon(Context *context,
context->getGLState().getCurrentTransformFeedback(); context->getGLState().getCurrentTransformFeedback();
if (curTransformFeedback && curTransformFeedback->isActive()) if (curTransformFeedback && curTransformFeedback->isActive())
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTransformFeedbackTargetActive);
"target is TRANSFORM_FEEDBACK_BUFFER and transform "
"feedback is currently active.");
return false; return false;
} }
break; break;
...@@ -1689,19 +1675,14 @@ static bool ValidateBindBufferCommon(Context *context, ...@@ -1689,19 +1675,14 @@ static bool ValidateBindBufferCommon(Context *context,
{ {
if (index >= caps.maxUniformBufferBindings) if (index >= caps.maxUniformBufferBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxUniformBufferBindings);
"index is greater than or equal to the "
"number of UNIFORM_BUFFER indexed "
"binding points.");
return false; return false;
} }
ASSERT(caps.uniformBufferOffsetAlignment); ASSERT(caps.uniformBufferOffsetAlignment);
if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0) if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0)
{ {
context->validationError( context->validationError(GL_INVALID_VALUE, kUniformBufferOffsetAlignment);
GL_INVALID_VALUE,
"offset must be multiple of value of UNIFORM_BUFFER_OFFSET_ALIGNMENT.");
return false; return false;
} }
break; break;
...@@ -1710,21 +1691,18 @@ static bool ValidateBindBufferCommon(Context *context, ...@@ -1710,21 +1691,18 @@ static bool ValidateBindBufferCommon(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
"ATOMIC_COUNTER_BUFFER is not supported before GLES 3.1");
return false; return false;
} }
if (index >= caps.maxAtomicCounterBufferBindings) if (index >= caps.maxAtomicCounterBufferBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE,
"index is greater than or equal to the " kIndexExceedsMaxAtomicCounterBufferBindings);
"number of ATOMIC_COUNTER_BUFFER "
"indexed binding points.");
return false; return false;
} }
if (buffer != 0 && (offset % 4) != 0) if (buffer != 0 && (offset % 4) != 0)
{ {
context->validationError(GL_INVALID_VALUE, "offset must be a multiple of 4."); context->validationError(GL_INVALID_VALUE, kOffsetAlignment);
return false; return false;
} }
break; break;
...@@ -1733,31 +1711,24 @@ static bool ValidateBindBufferCommon(Context *context, ...@@ -1733,31 +1711,24 @@ static bool ValidateBindBufferCommon(Context *context,
{ {
if (context->getClientVersion() < ES_3_1) if (context->getClientVersion() < ES_3_1)
{ {
context->validationError(GL_INVALID_ENUM, context->validationError(GL_INVALID_ENUM, kEnumRequiresGLES31);
"SHADER_STORAGE_BUFFER is not supported in GLES3.");
return false; return false;
} }
if (index >= caps.maxShaderStorageBufferBindings) if (index >= caps.maxShaderStorageBufferBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxShaderStorageBufferBindings);
"index is greater than or equal to the "
"number of SHADER_STORAGE_BUFFER "
"indexed binding points.");
return false; return false;
} }
ASSERT(caps.shaderStorageBufferOffsetAlignment); ASSERT(caps.shaderStorageBufferOffsetAlignment);
if (buffer != 0 && (offset % caps.shaderStorageBufferOffsetAlignment) != 0) if (buffer != 0 && (offset % caps.shaderStorageBufferOffsetAlignment) != 0)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kShaderStorageBufferOffsetAlignment);
"offset must be multiple of value of "
"SHADER_STORAGE_BUFFER_OFFSET_"
"ALIGNMENT.");
return false; return false;
} }
break; break;
} }
default: default:
context->validationError(GL_INVALID_ENUM, "the target is not supported."); context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false; return false;
} }
...@@ -1778,8 +1749,7 @@ bool ValidateBindBufferRange(Context *context, ...@@ -1778,8 +1749,7 @@ bool ValidateBindBufferRange(Context *context,
{ {
if (buffer != 0 && size <= 0) if (buffer != 0 && size <= 0)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidBindBufferSize);
"buffer is non-zero and size is less than or equal to zero.");
return false; return false;
} }
return ValidateBindBufferCommon(context, target, index, buffer, offset, size); return ValidateBindBufferCommon(context, target, index, buffer, offset, size);
...@@ -2418,8 +2388,7 @@ bool ValidateDeleteTransformFeedbacks(Context *context, GLint n, const GLuint *i ...@@ -2418,8 +2388,7 @@ bool ValidateDeleteTransformFeedbacks(Context *context, GLint n, const GLuint *i
if (transformFeedback != nullptr && transformFeedback->isActive()) if (transformFeedback != nullptr && transformFeedback->isActive())
{ {
// ES 3.0.4 section 2.15.1 page 86 // ES 3.0.4 section 2.15.1 page 86
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTransformFeedbackActiveDelete);
"Attempt to delete active transform feedback.");
return false; return false;
} }
} }
...@@ -2451,7 +2420,7 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod ...@@ -2451,7 +2420,7 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Invalid primitive mode."); context->validationError(GL_INVALID_ENUM, kInvalidPrimitiveMode);
return false; return false;
} }
...@@ -2460,7 +2429,7 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod ...@@ -2460,7 +2429,7 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod
if (transformFeedback->isActive()) if (transformFeedback->isActive())
{ {
context->validationError(GL_INVALID_OPERATION, "Transform feedback is already active."); context->validationError(GL_INVALID_OPERATION, kTransfomFeedbackAlreadyActive);
return false; return false;
} }
...@@ -2471,8 +2440,7 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod ...@@ -2471,8 +2440,7 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod
{ {
if (buffer->isMapped()) if (buffer->isMapped())
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kBufferMapped);
"Transform feedback has a mapped buffer.");
return false; return false;
} }
if ((context->getLimitations().noDoubleBoundTransformFeedbackBuffers || if ((context->getLimitations().noDoubleBoundTransformFeedbackBuffers ||
...@@ -2505,6 +2473,12 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod ...@@ -2505,6 +2473,12 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod
bool ValidateGetBufferPointerv(Context *context, BufferBinding target, GLenum pname, void **params) bool ValidateGetBufferPointerv(Context *context, BufferBinding target, GLenum pname, void **params)
{ {
if (context->getClientMajorVersion() < 3)
{
context->validationError(GL_INVALID_OPERATION, kES3Required);
return false;
}
return ValidateGetBufferPointervBase(context, target, pname, nullptr, params); return ValidateGetBufferPointervBase(context, target, pname, nullptr, params);
} }
...@@ -2522,6 +2496,12 @@ bool ValidateGetBufferPointervRobustANGLE(Context *context, ...@@ -2522,6 +2496,12 @@ bool ValidateGetBufferPointervRobustANGLE(Context *context,
GLsizei numParams = 0; GLsizei numParams = 0;
if (context->getClientMajorVersion() < 3 && !context->getExtensions().mapBuffer)
{
context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled);
return false;
}
if (!ValidateGetBufferPointervBase(context, target, pname, &numParams, params)) if (!ValidateGetBufferPointervBase(context, target, pname, &numParams, params))
{ {
return false; return false;
...@@ -2651,9 +2631,7 @@ bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLs ...@@ -2651,9 +2631,7 @@ bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLs
} }
if (index >= caps.maxShaderStorageBufferBindings) if (index >= caps.maxShaderStorageBufferBindings)
{ {
context->validationError( context->validationError(GL_INVALID_VALUE, kExceedsMaxShaderStorageBufferBindings);
GL_INVALID_VALUE,
"index is outside the valid range for GL_SHADER_STORAGE_BUFFER_BINDING");
return false; return false;
} }
break; break;
...@@ -2669,9 +2647,7 @@ bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLs ...@@ -2669,9 +2647,7 @@ bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLs
} }
if (index >= caps.maxVertexAttribBindings) if (index >= caps.maxVertexAttribBindings)
{ {
context->validationError( context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
GL_INVALID_VALUE,
"bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false; return false;
} }
break; break;
...@@ -2700,7 +2676,7 @@ bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLs ...@@ -2700,7 +2676,7 @@ bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLs
} }
if (index >= caps.maxImageUnits) if (index >= caps.maxImageUnits)
{ {
context->validationError(GL_INVALID_VALUE, kInvalidImageUnit); context->validationError(GL_INVALID_VALUE, kExceedsMaxImageUnits);
return false; return false;
} }
break; break;
...@@ -2831,15 +2807,14 @@ bool ValidateCopyBufferSubData(Context *context, ...@@ -2831,15 +2807,14 @@ bool ValidateCopyBufferSubData(Context *context,
if (!readBuffer || !writeBuffer) if (!readBuffer || !writeBuffer)
{ {
context->validationError(GL_INVALID_OPERATION, "No buffer bound to target"); context->validationError(GL_INVALID_OPERATION, kBufferNotBound);
return false; return false;
} }
// Verify that readBuffer and writeBuffer are not currently mapped // Verify that readBuffer and writeBuffer are not currently mapped
if (readBuffer->isMapped() || writeBuffer->isMapped()) if (readBuffer->isMapped() || writeBuffer->isMapped())
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kBufferMapped);
"Cannot call CopyBufferSubData on a mapped buffer");
return false; return false;
} }
...@@ -2866,17 +2841,22 @@ bool ValidateCopyBufferSubData(Context *context, ...@@ -2866,17 +2841,22 @@ bool ValidateCopyBufferSubData(Context *context,
return false; return false;
} }
if (readOffset < 0 || writeOffset < 0 || size < 0) if (readOffset < 0 || writeOffset < 0)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kNegativeOffset);
"readOffset, writeOffset and size must all be non-negative"); return false;
}
if (size < 0)
{
context->validationError(GL_INVALID_VALUE, kNegativeSize);
return false; return false;
} }
if (checkedReadSum.ValueOrDie() > readBuffer->getSize() || if (checkedReadSum.ValueOrDie() > readBuffer->getSize() ||
checkedWriteSum.ValueOrDie() > writeBuffer->getSize()) checkedWriteSum.ValueOrDie() > writeBuffer->getSize())
{ {
context->validationError(GL_INVALID_VALUE, "Buffer offset overflow in CopyBufferSubData"); context->validationError(GL_INVALID_VALUE, kBufferOffsetOverflow);
return false; return false;
} }
...@@ -2914,8 +2894,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index) ...@@ -2914,8 +2894,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index)
case GL_EXTENSIONS: case GL_EXTENSIONS:
if (index >= context->getExtensionStringCount()) if (index >= context->getExtensionStringCount())
{ {
context->validationError( context->validationError(GL_INVALID_VALUE, kExceedsNumExtensions);
GL_INVALID_VALUE, "index must be less than the number of extension strings.");
return false; return false;
} }
break; break;
...@@ -2928,9 +2907,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index) ...@@ -2928,9 +2907,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index)
} }
if (index >= context->getRequestableExtensionStringCount()) if (index >= context->getRequestableExtensionStringCount())
{ {
context->validationError( context->validationError(GL_INVALID_VALUE, kExceedsNumRequestableExtensions);
GL_INVALID_VALUE,
"index must be less than the number of requestable extension strings.");
return false; return false;
} }
break; break;
...@@ -3016,8 +2993,7 @@ bool ValidateVertexAttribIPointer(Context *context, ...@@ -3016,8 +2993,7 @@ bool ValidateVertexAttribIPointer(Context *context,
{ {
if (stride > caps.maxVertexAttribStride) if (stride > caps.maxVertexAttribStride)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribStride);
"stride cannot be greater than MAX_VERTEX_ATTRIB_STRIDE.");
return false; return false;
} }
...@@ -3026,8 +3002,7 @@ bool ValidateVertexAttribIPointer(Context *context, ...@@ -3026,8 +3002,7 @@ bool ValidateVertexAttribIPointer(Context *context,
// validation should be inherited. // validation should be inherited.
if (index >= caps.maxVertexAttribBindings) if (index >= caps.maxVertexAttribBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
"index must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false; return false;
} }
} }
...@@ -3039,9 +3014,7 @@ bool ValidateVertexAttribIPointer(Context *context, ...@@ -3039,9 +3014,7 @@ bool ValidateVertexAttribIPointer(Context *context,
if (context->getGLState().getVertexArrayId() != 0 && if (context->getGLState().getVertexArrayId() != 0 &&
context->getGLState().getTargetBuffer(BufferBinding::Array) == 0 && pointer != nullptr) context->getGLState().getTargetBuffer(BufferBinding::Array) == 0 && pointer != nullptr)
{ {
context->validationError( context->validationError(GL_INVALID_OPERATION, kClientDataInVertexArray);
GL_INVALID_OPERATION,
"Client data cannot be used with a non-default vertex array object.");
return false; return false;
} }
...@@ -3078,7 +3051,7 @@ bool ValidateGetSynciv(Context *context, ...@@ -3078,7 +3051,7 @@ bool ValidateGetSynciv(Context *context,
Sync *syncObject = context->getSync(sync); Sync *syncObject = context->getSync(sync);
if (!syncObject) if (!syncObject)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid sync object."); context->validationError(GL_INVALID_VALUE, kSyncMissing);
return false; return false;
} }
...@@ -3203,7 +3176,7 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context, ...@@ -3203,7 +3176,7 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context,
{ {
if (baseViewIndex < 0) if (baseViewIndex < 0)
{ {
context->validationError(GL_INVALID_VALUE, "baseViewIndex cannot be less than 0."); context->validationError(GL_INVALID_VALUE, kNegativeBaseViewIndex);
return false; return false;
} }
...@@ -3219,8 +3192,7 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context, ...@@ -3219,8 +3192,7 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context,
{ {
if (!context->getExtensions().multiviewMultisample) if (!context->getExtensions().multiviewMultisample)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidTextureType);
"Texture's target must be GL_TEXTURE_2D_ARRAY.");
return false; return false;
} }
} }
...@@ -3228,18 +3200,14 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context, ...@@ -3228,18 +3200,14 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context,
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (static_cast<GLuint>(baseViewIndex + numViews) > caps.maxArrayTextureLayers) if (static_cast<GLuint>(baseViewIndex + numViews) > caps.maxArrayTextureLayers)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kViewsExceedMaxArrayLayers);
"baseViewIndex+numViews cannot be "
"greater than "
"GL_MAX_ARRAY_TEXTURE_LAYERS.");
return false; return false;
} }
break; break;
} }
default: default:
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidTextureType);
"Texture's target must be GL_TEXTURE_2D_ARRAY.");
return false; return false;
} }
...@@ -3273,8 +3241,7 @@ bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context, ...@@ -3273,8 +3241,7 @@ bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context,
{ {
if (viewportOffsets[i] < 0) if (viewportOffsets[i] < 0)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kNegativeOffset);
"viewportOffsets cannot contain negative values.");
return false; return false;
} }
} }
...@@ -3287,8 +3254,7 @@ bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context, ...@@ -3287,8 +3254,7 @@ bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context,
case TextureType::_2D: case TextureType::_2D:
break; break;
default: default:
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kInvalidTextureType);
"Texture's target must be GL_TEXTURE_2D.");
return false; return false;
} }
......
...@@ -548,9 +548,7 @@ bool ValidateDrawElementsIndirect(Context *context, ...@@ -548,9 +548,7 @@ 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->validationError( context->validationError(GL_INVALID_OPERATION, kParamOverflow);
GL_INVALID_OPERATION,
"the command would source data beyond the end of the buffer object.");
return false; return false;
} }
...@@ -999,9 +997,7 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -999,9 +997,7 @@ 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->validationError( context->validationError(GL_INVALID_VALUE, kExceedsFramebufferWidth);
GL_INVALID_VALUE,
"Params less than 0 or greater than GL_MAX_FRAMEBUFFER_WIDTH.");
return false; return false;
} }
break; break;
...@@ -1011,9 +1007,7 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1011,9 +1007,7 @@ 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->validationError( context->validationError(GL_INVALID_VALUE, kExceedsFramebufferHeight);
GL_INVALID_VALUE,
"Params less than 0 or greater than GL_MAX_FRAMEBUFFER_HEIGHT.");
return false; return false;
} }
break; break;
...@@ -1023,9 +1017,7 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1023,9 +1017,7 @@ 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->validationError( context->validationError(GL_INVALID_VALUE, kExceedsFramebufferSamples);
GL_INVALID_VALUE,
"Params less than 0 or greater than GL_MAX_FRAMEBUFFER_SAMPLES.");
return false; return false;
} }
break; break;
...@@ -1060,7 +1052,7 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname ...@@ -1060,7 +1052,7 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
ASSERT(framebuffer); ASSERT(framebuffer);
if (framebuffer->id() == 0) if (framebuffer->id() == 0)
{ {
context->validationError(GL_INVALID_OPERATION, "Default framebuffer is bound to target."); context->validationError(GL_INVALID_OPERATION, kDefaultFramebuffer);
return false; return false;
} }
return true; return true;
...@@ -1104,7 +1096,7 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p ...@@ -1104,7 +1096,7 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p
if (framebuffer->id() == 0) if (framebuffer->id() == 0)
{ {
context->validationError(GL_INVALID_OPERATION, "Default framebuffer is bound to target."); context->validationError(GL_INVALID_OPERATION, kDefaultFramebuffer);
return false; return false;
} }
return true; return true;
...@@ -1140,7 +1132,7 @@ bool ValidateGetProgramResourceIndex(Context *context, ...@@ -1140,7 +1132,7 @@ bool ValidateGetProgramResourceIndex(Context *context,
if (!ValidateNamedProgramInterface(programInterface)) if (!ValidateNamedProgramInterface(programInterface))
{ {
context->validationError(GL_INVALID_ENUM, "Invalid program interface"); context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
return false; return false;
} }
...@@ -1161,15 +1153,14 @@ bool ValidateBindVertexBuffer(Context *context, ...@@ -1161,15 +1153,14 @@ bool ValidateBindVertexBuffer(Context *context,
if (!context->isBufferGenerated(buffer)) if (!context->isBufferGenerated(buffer))
{ {
context->validationError(GL_INVALID_OPERATION, "Buffer is not generated."); context->validationError(GL_INVALID_OPERATION, kObjectNotGenerated);
return false; return false;
} }
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (bindingIndex >= caps.maxVertexAttribBindings) if (bindingIndex >= caps.maxVertexAttribBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
"bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false; return false;
} }
...@@ -1181,8 +1172,7 @@ bool ValidateBindVertexBuffer(Context *context, ...@@ -1181,8 +1172,7 @@ bool ValidateBindVertexBuffer(Context *context,
if (stride < 0 || stride > caps.maxVertexAttribStride) if (stride < 0 || stride > caps.maxVertexAttribStride)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribStride);
"stride must be between 0 and MAX_VERTEX_ATTRIB_STRIDE.");
return false; return false;
} }
...@@ -1190,7 +1180,7 @@ bool ValidateBindVertexBuffer(Context *context, ...@@ -1190,7 +1180,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->validationError(GL_INVALID_OPERATION, "Default vertex array buffer is bound."); context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
return false; return false;
} }
...@@ -1208,8 +1198,7 @@ bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint ...@@ -1208,8 +1198,7 @@ bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (bindingIndex >= caps.maxVertexAttribBindings) if (bindingIndex >= caps.maxVertexAttribBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
"bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS.");
return false; return false;
} }
...@@ -1217,7 +1206,7 @@ bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint ...@@ -1217,7 +1206,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->validationError(GL_INVALID_OPERATION, "Default vertex array object is bound."); context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
return false; return false;
} }
...@@ -1256,7 +1245,7 @@ bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bi ...@@ -1256,7 +1245,7 @@ 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->validationError(GL_INVALID_OPERATION, "Default vertex array object is bound."); context->validationError(GL_INVALID_OPERATION, kDefaultVertexArray);
return false; return false;
} }
...@@ -1269,8 +1258,7 @@ bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bi ...@@ -1269,8 +1258,7 @@ bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bi
if (bindingIndex >= caps.maxVertexAttribBindings) if (bindingIndex >= caps.maxVertexAttribBindings)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxVertexAttribBindings);
"bindingindex must be smaller than MAX_VERTEX_ATTRIB_BINDINGS");
return false; return false;
} }
...@@ -1299,13 +1287,13 @@ bool ValidateGetProgramResourceName(Context *context, ...@@ -1299,13 +1287,13 @@ bool ValidateGetProgramResourceName(Context *context,
if (!ValidateNamedProgramInterface(programInterface)) if (!ValidateNamedProgramInterface(programInterface))
{ {
context->validationError(GL_INVALID_ENUM, "Invalid program interface"); context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
return false; return false;
} }
if (!ValidateProgramResourceIndex(programObject, programInterface, index)) if (!ValidateProgramResourceIndex(programObject, programInterface, index))
{ {
context->validationError(GL_INVALID_VALUE, "Invalid index"); context->validationError(GL_INVALID_VALUE, kInvalidProgramResourceIndex);
return false; return false;
} }
...@@ -1341,23 +1329,17 @@ bool ValidateDispatchCompute(Context *context, ...@@ -1341,23 +1329,17 @@ bool ValidateDispatchCompute(Context *context,
const Caps &caps = context->getCaps(); const Caps &caps = context->getCaps();
if (numGroupsX > caps.maxComputeWorkGroupCount[0]) if (numGroupsX > caps.maxComputeWorkGroupCount[0])
{ {
context->validationError( context->validationError(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountX);
GL_INVALID_VALUE,
"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->validationError( context->validationError(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountY);
GL_INVALID_VALUE,
"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->validationError( context->validationError(GL_INVALID_VALUE, kExceedsComputeWorkGroupCountZ);
GL_INVALID_VALUE,
"num_groups_z cannot be greater than MAX_COMPUTE_WORK_GROUP_COUNT[2]");
return false; return false;
} }
...@@ -1424,26 +1406,25 @@ bool ValidateBindImageTexture(Context *context, ...@@ -1424,26 +1406,25 @@ bool ValidateBindImageTexture(Context *context,
GLuint maxImageUnits = context->getCaps().maxImageUnits; GLuint maxImageUnits = context->getCaps().maxImageUnits;
if (unit >= maxImageUnits) if (unit >= maxImageUnits)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kExceedsMaxImageUnits);
"unit cannot be greater than or equal than MAX_IMAGE_UNITS");
return false; return false;
} }
if (level < 0) if (level < 0)
{ {
context->validationError(GL_INVALID_VALUE, "level is negative."); context->validationError(GL_INVALID_VALUE, kNegativeLevel);
return false; return false;
} }
if (layer < 0) if (layer < 0)
{ {
context->validationError(GL_INVALID_VALUE, "layer is negative."); context->validationError(GL_INVALID_VALUE, kNegativeLayer);
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->validationError(GL_INVALID_ENUM, "access is not one of the supported tokens."); context->validationError(GL_INVALID_ENUM, kInvalidImageAccess);
return false; return false;
} }
...@@ -1464,8 +1445,7 @@ bool ValidateBindImageTexture(Context *context, ...@@ -1464,8 +1445,7 @@ bool ValidateBindImageTexture(Context *context,
case GL_RGBA8_SNORM: case GL_RGBA8_SNORM:
break; break;
default: default:
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kInvalidImageFormat);
"format is not one of supported image unit formats.");
return false; return false;
} }
...@@ -1475,15 +1455,13 @@ bool ValidateBindImageTexture(Context *context, ...@@ -1475,15 +1455,13 @@ bool ValidateBindImageTexture(Context *context,
if (tex == nullptr) if (tex == nullptr)
{ {
context->validationError(GL_INVALID_VALUE, context->validationError(GL_INVALID_VALUE, kMissingTextureName);
"texture is not the name of an existing texture object.");
return false; return false;
} }
if (!tex->getImmutableFormat()) if (!tex->getImmutableFormat())
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kTextureIsNotImmutable);
"texture is not the name of an immutable texture object.");
return false; return false;
} }
} }
...@@ -1510,13 +1488,13 @@ bool ValidateGetProgramResourceLocation(Context *context, ...@@ -1510,13 +1488,13 @@ bool ValidateGetProgramResourceLocation(Context *context,
if (!programObject->isLinked()) if (!programObject->isLinked())
{ {
context->validationError(GL_INVALID_OPERATION, "Program is not successfully linked."); context->validationError(GL_INVALID_OPERATION, kProgramNotLinked);
return false; return false;
} }
if (!ValidateLocationProgramInterface(programInterface)) if (!ValidateLocationProgramInterface(programInterface))
{ {
context->validationError(GL_INVALID_ENUM, "Invalid program interface."); context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
return false; return false;
} }
return true; return true;
...@@ -1545,34 +1523,34 @@ bool ValidateGetProgramResourceiv(Context *context, ...@@ -1545,34 +1523,34 @@ bool ValidateGetProgramResourceiv(Context *context,
} }
if (!ValidateProgramInterface(programInterface)) if (!ValidateProgramInterface(programInterface))
{ {
context->validationError(GL_INVALID_ENUM, "Invalid program interface."); context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
return false; return false;
} }
if (propCount <= 0) if (propCount <= 0)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid propCount."); context->validationError(GL_INVALID_VALUE, kInvalidPropCount);
return false; return false;
} }
if (bufSize < 0) if (bufSize < 0)
{ {
context->validationError(GL_INVALID_VALUE, "Invalid bufSize."); context->validationError(GL_INVALID_VALUE, kNegativeBufSize);
return false; return false;
} }
if (!ValidateProgramResourceIndex(programObject, programInterface, index)) if (!ValidateProgramResourceIndex(programObject, programInterface, index))
{ {
context->validationError(GL_INVALID_VALUE, "Invalid index"); context->validationError(GL_INVALID_VALUE, kInvalidProgramResourceIndex);
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->validationError(GL_INVALID_ENUM, "Invalid prop."); context->validationError(GL_INVALID_ENUM, kInvalidProgramResourceProperty);
return false; return false;
} }
if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface)) if (!ValidateProgramResourcePropertyByInterface(props[i], programInterface))
{ {
context->validationError(GL_INVALID_OPERATION, "Not an allowed prop for interface"); context->validationError(GL_INVALID_OPERATION, kInvalidPropertyForProgramInterface);
return false; return false;
} }
} }
...@@ -1599,7 +1577,7 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1599,7 +1577,7 @@ bool ValidateGetProgramInterfaceiv(Context *context,
if (!ValidateProgramInterface(programInterface)) if (!ValidateProgramInterface(programInterface))
{ {
context->validationError(GL_INVALID_ENUM, "Invalid program interface."); context->validationError(GL_INVALID_ENUM, kInvalidProgramInterface);
return false; return false;
} }
...@@ -1611,14 +1589,13 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1611,14 +1589,13 @@ bool ValidateGetProgramInterfaceiv(Context *context,
break; break;
default: default:
context->validationError(GL_INVALID_ENUM, "Unknown property of program interface."); context->validationError(GL_INVALID_ENUM, kInvalidPname);
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->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION, kAtomicCounterResourceName);
"Active atomic counter resources are not assigned name strings.");
return false; return false;
} }
...@@ -1632,9 +1609,7 @@ bool ValidateGetProgramInterfaceiv(Context *context, ...@@ -1632,9 +1609,7 @@ bool ValidateGetProgramInterfaceiv(Context *context,
break; break;
default: default:
context->validationError( context->validationError(GL_INVALID_OPERATION, kMaxActiveVariablesInterface);
GL_INVALID_OPERATION,
"MAX_NUM_ACTIVE_VARIABLES requires a buffer or block interface.");
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment