1 // 2 // Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // ErrorStrings.h: Contains mapping of commonly used error messages 8 9 #ifndef LIBANGLE_ERRORSTRINGS_H_ 10 #define LIBANGLE_ERRORSTRINGS_H_ 11 12 #define ERRMSG(name, message) \ 13 static const constexpr char *kError##name = static_cast<const char *>(message); 14 #define ANGLE_VALIDATION_ERR(context, error, errorName) \ 15 context->handleError(error << kError##errorName) 16 17 namespace gl 18 { 19 ERRMSG(BufferNotBound, "A buffer must be bound."); 20 ERRMSG(CompressedTextureDimensionsMustMatchData, 21 "Compressed texture dimensions must exactly match the dimensions of the data passed in."); 22 ERRMSG(CompressedTexturesNotAttachable, "Compressed textures cannot be attached to a framebuffer."); 23 ERRMSG(CubemapFacesEqualDimensions, "Each cubemap face must have equal width and height."); 24 ERRMSG(CubemapIncomplete, 25 "Texture is not cubemap complete. All cubemaps faces must be defined and be the same size."); 26 ERRMSG(DefaultFramebufferInvalidAttachment, 27 "Invalid attachment when the default framebuffer is bound."); 28 ERRMSG(DefaultFramebufferTarget, "It is invalid to change default FBO's attachments"); 29 ERRMSG(EnumNotSupported, "Enum is not currently supported."); 30 ERRMSG(EnumRequiresGLES31, "Enum requires GLES 3.1"); 31 ERRMSG(ES31Required, "OpenGL ES 3.1 Required"); 32 ERRMSG(ES3Required, "OpenGL ES 3.0 Required."); 33 ERRMSG(ExceedsMaxElement, "Element value exceeds maximum element index."); 34 ERRMSG(ExpectedProgramName, "Expected a program name, but found a shader name."); 35 ERRMSG(ExpectedShaderName, "Expected a shader name, but found a program name."); 36 ERRMSG(ExtensionNotEnabled, "Extension is not enabled."); 37 ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Texture."); 38 ERRMSG(FramebufferIncompleteAttachment, 39 "Attachment type must be compatible with attachment object."); 40 ERRMSG(GenerateMipmapNotAllowed, "Texture format does not support mipmap generation."); 41 ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count."); 42 ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS."); 43 ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS."); 44 ERRMSG(InsufficientBufferSize, "Insufficient buffer size."); 45 ERRMSG(InsufficientVertexBufferSize, "Vertex buffer is not big enough for the draw call"); 46 ERRMSG(IntegerOverflow, "Integer overflow."); 47 ERRMSG(InvalidAttachment, "Invalid Attachment Type."); 48 ERRMSG(InvalidBlendEquation, "Invalid blend equation."); 49 ERRMSG(InvalidBlendFunction, "Invalid blend function."); 50 ERRMSG(InvalidBorder, "Border must be 0."); 51 ERRMSG(InvalidBufferTypes, "Invalid buffer target enum."); 52 ERRMSG(InvalidBufferUsage, "Invalid buffer usage enum."); 53 ERRMSG(InvalidClearMask, "Invalid mask bits."); 54 ERRMSG(InvalidConstantColor, 55 "CONSTANT_COLOR (or ONE_MINUS_CONSTANT_COLOR) and CONSTANT_ALPHA (or " 56 "ONE_MINUS_CONSTANT_ALPHA) cannot be used together as source and destination factors in the " 57 "blend function."); 58 ERRMSG(InvalidCoverMode, "Invalid cover mode."); 59 ERRMSG(InvalidCullMode, "Cull mode not recognized."); 60 ERRMSG(InvalidDebugSeverity, "Invalid debug severity."); 61 ERRMSG(InvalidDebugSource, "Invalid debug source."); 62 ERRMSG(InvalidDebugType, "Invalid debug type."); 63 ERRMSG(InvalidDepthRange, "Near value cannot be greater than far."); 64 ERRMSG(InvalidDrawMode, "Invalid draw mode."); 65 ERRMSG(InvalidDrawModeTransformFeedback, 66 "Draw mode must match current transform feedback object's draw mode."); 67 ERRMSG(InvalidFillMode, "Invalid fill mode."); 68 ERRMSG(InvalidFilterTexture, "Texture only supports NEAREST and LINEAR filtering."); 69 ERRMSG(InvalidFormat, "Invalid format."); 70 ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target."); 71 ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture."); 72 ERRMSG(InvalidFramebufferAttachmentParameter, "Invalid parameter name for framebuffer attachment."); 73 ERRMSG(InvalidInternalFormat, "Invalid internal format."); 74 ERRMSG(InvalidMatrixMode, "Invalid matrix mode."); 75 ERRMSG(InvalidMipLevel, "Level of detail outside of range."); 76 ERRMSG(InvalidName, "Invalid name."); 77 ERRMSG(InvalidNameCharacters, "Name contains invalid characters."); 78 ERRMSG(InvalidPname, "Invalid pname."); 79 ERRMSG(InvalidPrecision, "Invalid or unsupported precision type."); 80 ERRMSG(InvalidProgramName, "Program object expected."); 81 ERRMSG(InvalidQueryId, "Invalid query Id."); 82 ERRMSG(InvalidQueryTarget, "Invalid query target."); 83 ERRMSG(InvalidQueryType, "Invalid query type."); 84 ERRMSG(InvalidRange, "Invalid range."); 85 ERRMSG(InvalidRenderbufferInternalFormat, "Invalid renderbuffer internalformat."); 86 ERRMSG(InvalidRenderbufferTarget, "Invalid renderbuffer target."); 87 ERRMSG(InvalidRenderbufferTextureParameter, "Invalid parameter name for renderbuffer attachment."); 88 ERRMSG(InvalidRenderbufferWidthHeight, 89 "Renderbuffer width and height cannot be negative and cannot exceed maximum texture size."); 90 ERRMSG(InvalidSampleMaskNumber, 91 "MaskNumber cannot be greater than or equal to the value of MAX_SAMPLE_MASK_WORDS."); 92 ERRMSG(InvalidSampler, "Sampler is not valid"); 93 ERRMSG(InvalidShaderName, "Shader object expected."); 94 ERRMSG(InvalidShaderType, "Invalid shader type."); 95 ERRMSG(InvalidStencil, "Invalid stencil."); 96 ERRMSG(InvalidStencilBitMask, "Invalid stencil bit mask."); 97 ERRMSG(InvalidTarget, "Invalid target."); 98 ERRMSG(InvalidTextureFilterParam, "Texture filter not recognized."); 99 ERRMSG(InvalidTextureRange, "Cannot be less than 0 or greater than maximum number of textures."); 100 ERRMSG(InvalidTextureTarget, "Invalid or unsupported texture target."); 101 ERRMSG(InvalidTextureWrap, "Texture wrap mode not recognized."); 102 ERRMSG(InvalidType, "Invalid type."); 103 ERRMSG(InvalidTypePureInt, "Invalid type, should be integer"); 104 ERRMSG(InvalidUnpackAlignment, "Unpack alignment must be 1, 2, 4, or 8."); 105 ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4."); 106 ERRMSG(InvalidWidth, "Invalid width."); 107 ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type."); 108 ERRMSG(LevelNotZero, "Texture level must be zero."); 109 ERRMSG(MismatchedByteCountType, "Buffer size does not align with data type."); 110 ERRMSG(MismatchedFormat, "Format must match internal format."); 111 ERRMSG(MismatchedTargetAndFormat, "Invalid texture target and format combination."); 112 ERRMSG(MismatchedTypeAndFormat, "Invalid format and type combination."); 113 ERRMSG(MismatchedVariableProgram, "Variable is not part of the current program."); 114 ERRMSG(MissingReadAttachment, "Missing read attachment."); 115 ERRMSG(MustHaveElementArrayBinding, "Must have element array buffer binding."); 116 ERRMSG(NameBeginsWithGL, "Attributes that begin with 'gl_' are not allowed."); 117 ERRMSG(NegativeAttachments, "Negative number of attachments."); 118 ERRMSG(NegativeBufferSize, "Negative buffer size."); 119 ERRMSG(NegativeCount, "Negative count."); 120 ERRMSG(NegativeLength, "Negative length."); 121 ERRMSG(NegativeMaxCount, "Negative maxcount."); 122 ERRMSG(NegativeOffset, "Negative offset."); 123 ERRMSG(NegativePrimcount, "Primcount must be greater than or equal to zero."); 124 ERRMSG(NegativeSize, "Cannot have negative height or width."); 125 ERRMSG(NegativeStart, "Cannot have negative start."); 126 ERRMSG(NegativeStride, "Cannot have negative stride."); 127 ERRMSG(NoSuchPath, "No such path object."); 128 ERRMSG(NoTransformFeedbackOutputVariables, 129 "The active program has specified no output variables to record."); 130 ERRMSG(NoZeroDivisor, "At least one enabled attribute must have a divisor of zero."); 131 ERRMSG(ObjectNotGenerated, "Object cannot be used because it has not been generated."); 132 ERRMSG(OffsetMustBeMultipleOfType, "Offset must be a multiple of the passed in datatype."); 133 ERRMSG(OutsideOfBounds, "Parameter outside of bounds."); 134 ERRMSG(ParamOverflow, "The provided parameters overflow with the provided buffer."); 135 ERRMSG(PixelDataNotNull, "Pixel data must be null."); 136 ERRMSG(PixelDataNull, "Pixel data cannot be null."); 137 ERRMSG(ProgramDoesNotExist, "Program doesn't exist."); 138 ERRMSG(ProgramNotBound, "A program must be bound."); 139 ERRMSG(ProgramNotLinked, "Program not linked."); 140 ERRMSG(QueryActive, "Query is active."); 141 ERRMSG(QueryExtensionNotEnabled, "Query extension not enabled."); 142 ERRMSG(ReadBufferNone, "Read buffer is GL_NONE."); 143 ERRMSG(RenderbufferNotBound, "A renderbuffer must be bound."); 144 ERRMSG(ResourceMaxTextureSize, "Desired resource size is greater than max texture size."); 145 ERRMSG(ShaderAttachmentHasShader, "Shader attachment already has a shader."); 146 ERRMSG(ShaderSourceInvalidCharacters, "Shader source contains invalid characters."); 147 ERRMSG(ShaderToDetachMustBeAttached, 148 "Shader to be detached must be currently attached to the program."); 149 ERRMSG(SourceTextureTooSmall, "The specified dimensions are outside of the bounds of the texture."); 150 ERRMSG(StencilReferenceMaskOrMismatch, 151 "Stencil reference and mask values must be the same for front facing and back facing " 152 "triangles."); 153 ERRMSG(StrideMustBeMultipleOfType, "Stride must be a multiple of the passed in datatype."); 154 ERRMSG(TextureNotBound, "A texture must be bound."); 155 ERRMSG(TextureNotPow2, "The texture is a non-power-of-two texture."); 156 ERRMSG(TransformFeedbackDoesNotExist, "Transform feedback object that does not exist."); 157 ERRMSG(TypeMismatch, 158 "Passed in texture target and format must match the one originally used to define the " 159 "texture."); 160 ERRMSG(TypeNotUnsignedShortByte, "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported."); 161 ERRMSG(UniformSizeMismatch, "Uniform size does not match uniform method."); 162 ERRMSG(UnknownParameter, "Unknown parameter value."); 163 ERRMSG(VertexArrayNoBuffer, "An enabled vertex array has no buffer."); 164 ERRMSG(VertexArrayNoBufferPointer, "An enabled vertex array has no buffer and no pointer."); 165 ERRMSG(ViewportNegativeSize, "Viewport size cannot be negative."); 166 ERRMSG(Webgl2NameLengthLimitExceeded, "Location lengths must not be greater than 1024 characters."); 167 ERRMSG(WebglBindAttribLocationReservedPrefix, 168 "Attributes that begin with 'webgl_', or '_webgl_' are not allowed."); 169 ERRMSG(WebglNameLengthLimitExceeded, 170 "Location name lengths must not be greater than 256 characters."); 171 } 172 #undef ERRMSG 173 #endif // LIBANGLE_ERRORSTRINGS_H_ 174