Lines Matching full:context
16 #include "libANGLE/Context.h"
39 bool IsPartialBlit(const Context *context, in IsPartialBlit() argument
60 if (context->getState().isScissorTestEnabled()) in IsPartialBlit()
62 const Rectangle &scissor = context->getState().getScissor(); in IsPartialBlit()
147 bool IsValidCopyTextureDestinationFormatType(const Context *context, in IsValidCopyTextureDestinationFormatType() argument
153 context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat); in IsValidCopyTextureDestinationFormatType()
159 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in IsValidCopyTextureDestinationFormatType()
164 if (!internalFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions())) in IsValidCopyTextureDestinationFormatType()
166 context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat); in IsValidCopyTextureDestinationFormatType()
173 bool IsValidCopyTextureDestinationTargetEnum(const Context *context, TextureTarget target) in IsValidCopyTextureDestinationTargetEnum() argument
187 return context->getExtensions().textureRectangle; in IsValidCopyTextureDestinationTargetEnum()
194 bool IsValidCopyTextureDestinationTarget(const Context *context, in IsValidCopyTextureDestinationTarget() argument
201 bool IsValidCopyTextureSourceTarget(const Context *context, TextureType type) in IsValidCopyTextureSourceTarget() argument
208 return context->getExtensions().textureRectangle; in IsValidCopyTextureSourceTarget()
210 return context->getExtensions().eglImageExternalOES; in IsValidCopyTextureSourceTarget()
212 return context->getExtensions().webglVideoTexture; in IsValidCopyTextureSourceTarget()
218 bool IsValidCopyTextureSourceLevel(const Context *context, TextureType type, GLint level) in IsValidCopyTextureSourceLevel() argument
220 if (!ValidMipLevel(context, type, level)) in IsValidCopyTextureSourceLevel()
225 if (level > 0 && context->getClientVersion() < ES_3_0) in IsValidCopyTextureSourceLevel()
233 bool IsValidCopyTextureDestinationLevel(const Context *context, in IsValidCopyTextureDestinationLevel() argument
240 if (!ValidMipLevel(context, type, level)) in IsValidCopyTextureDestinationLevel()
245 if (!ValidImageSizeParameters(context, type, level, width, height, 1, isSubImage)) in IsValidCopyTextureDestinationLevel()
250 const Caps &caps = context->getCaps(); in IsValidCopyTextureDestinationLevel()
321 static inline bool Valid1to4ComponentFloatColorBufferFormat(const Context *context, GLenum format) in Valid1to4ComponentFloatColorBufferFormat() argument
323 return (context->getExtensions().textureFloatOES && in Valid1to4ComponentFloatColorBufferFormat()
326 (context->getExtensions().textureHalfFloat && in Valid1to4ComponentFloatColorBufferFormat()
331 static inline bool Valid2to4ComponentFloatColorBufferFormat(const Context *context, GLenum format) in Valid2to4ComponentFloatColorBufferFormat() argument
333 return (context->getExtensions().textureFloatOES && in Valid2to4ComponentFloatColorBufferFormat()
335 (context->getExtensions().textureHalfFloat && in Valid2to4ComponentFloatColorBufferFormat()
339 static inline bool Valid3to4ComponentFloatColorBufferFormat(const Context *context, GLenum format) in Valid3to4ComponentFloatColorBufferFormat() argument
341 return (context->getExtensions().textureFloatOES && in Valid3to4ComponentFloatColorBufferFormat()
343 (context->getExtensions().textureHalfFloat && in Valid3to4ComponentFloatColorBufferFormat()
347 static inline bool Valid4ComponentFloatColorBufferFormat(const Context *context, GLenum format) in Valid4ComponentFloatColorBufferFormat() argument
349 return (context->getExtensions().textureFloatOES && format == GL_RGBA32F) || in Valid4ComponentFloatColorBufferFormat()
350 (context->getExtensions().textureHalfFloat && format == GL_RGBA16F); in Valid4ComponentFloatColorBufferFormat()
353 bool ValidateES2CopyTexImageParameters(const Context *context, in ValidateES2CopyTexImageParameters() argument
366 if (!ValidTexture2DDestinationTarget(context, target)) in ValidateES2CopyTexImageParameters()
368 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateES2CopyTexImageParameters()
373 if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage)) in ValidateES2CopyTexImageParameters()
380 if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage, in ValidateES2CopyTexImageParameters()
387 const Framebuffer *framebuffer = context->getState().getReadFramebuffer(); in ValidateES2CopyTexImageParameters()
401 !Valid4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
403 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
413 !Valid1to4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
415 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
427 !Valid1to4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
429 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
440 !Valid2to4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
442 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
453 !Valid3to4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
455 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
464 !Valid4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
466 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
484 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
488 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
491 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
495 if (formatInfo.type == GL_FLOAT && !context->getExtensions().textureFloatOES) in ValidateES2CopyTexImageParameters()
497 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
509 !Valid4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
511 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
522 !Valid1to4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
524 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
533 !Valid2to4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
535 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
544 !Valid3to4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
546 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
555 !Valid4ComponentFloatColorBufferFormat(context, colorbufferFormat)) in ValidateES2CopyTexImageParameters()
557 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
563 if (context->getExtensions().textureCompressionDXT1) in ValidateES2CopyTexImageParameters()
565 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
568 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
571 if (context->getExtensions().textureCompressionDXT3) in ValidateES2CopyTexImageParameters()
573 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
576 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
579 if (context->getExtensions().textureCompressionDXT5) in ValidateES2CopyTexImageParameters()
581 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
584 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
587 if (context->getExtensions().compressedETC1RGB8TextureOES) in ValidateES2CopyTexImageParameters()
589 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
592 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
599 if (context->getExtensions().lossyETCDecode) in ValidateES2CopyTexImageParameters()
601 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
604 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
610 if (context->getExtensions().compressedTexturePVRTC) in ValidateES2CopyTexImageParameters()
612 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
615 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
621 if (context->getExtensions().compressedTexturePVRTCsRGB) in ValidateES2CopyTexImageParameters()
623 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
626 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
631 if (context->getExtensions().depthTextureAny()) in ValidateES2CopyTexImageParameters()
633 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
636 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
640 if (context->getExtensions().depthTextureAny() || in ValidateES2CopyTexImageParameters()
641 context->getExtensions().packedDepthStencilOES || in ValidateES2CopyTexImageParameters()
642 context->getExtensions().depthTextureCubeMapOES) in ValidateES2CopyTexImageParameters()
644 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2CopyTexImageParameters()
647 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
650 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2CopyTexImageParameters()
659 bool ValidCap(const Context *context, GLenum cap, bool queryOnly) in ValidCap() argument
666 return context->getExtensions().multisampleCompatibility; in ValidCap()
681 return (context->getClientMajorVersion() >= 3); in ValidCap()
685 return context->getExtensions().debug; in ValidCap()
688 return queryOnly && context->getExtensions().bindGeneratesResource; in ValidCap()
691 return queryOnly && context->getExtensions().clientArrays; in ValidCap()
694 return context->getExtensions().sRGBWriteControl; in ValidCap()
697 return context->getClientVersion() >= Version(3, 1); in ValidCap()
700 return queryOnly && context->getExtensions().robustResourceInitialization; in ValidCap()
703 return context->getExtensions().webglCompatibility; in ValidCap()
714 if (context->getExtensions().clipDistanceAPPLE || in ValidCap()
715 context->getExtensions().clipCullDistanceEXT) in ValidCap()
721 return context->getExtensions().sampleShadingOES; in ValidCap()
725 if (context->getClientVersion().major != 1) in ValidCap()
760 return context->getClientVersion() < Version(2, 0); in ValidCap()
762 return context->getClientVersion() < Version(2, 0) && in ValidCap()
763 context->getExtensions().pointSizeArrayOES; in ValidCap()
765 return context->getClientVersion() < Version(2, 0) && in ValidCap()
766 context->getExtensions().textureCubeMapOES; in ValidCap()
768 return context->getClientVersion() < Version(2, 0) && in ValidCap()
769 context->getExtensions().pointSpriteOES; in ValidCap()
808 bool ValidateWebGLNamePrefix(const Context *context, const GLchar *name) in ValidateWebGLNamePrefix() argument
810 ASSERT(context->isWebGL()); in ValidateWebGLNamePrefix()
816 context->validationError(GL_INVALID_OPERATION, kWebglBindAttribLocationReservedPrefix); in ValidateWebGLNamePrefix()
823 bool ValidateWebGLNameLength(const Context *context, size_t length) in ValidateWebGLNameLength() argument
825 ASSERT(context->isWebGL()); in ValidateWebGLNameLength()
827 if (context->isWebGL1() && length > 256) in ValidateWebGLNameLength()
832 context->validationError(GL_INVALID_VALUE, kWebglNameLengthLimitExceeded); in ValidateWebGLNameLength()
840 context->validationError(GL_INVALID_VALUE, kWebgl2NameLengthLimitExceeded); in ValidateWebGLNameLength()
847 bool ValidBlendFunc(const Context *context, GLenum val) in ValidBlendFunc() argument
849 const Extensions &ext = context->getExtensions(); in ValidBlendFunc()
883 bool ValidSrcBlendFunc(const Context *context, GLenum val) in ValidSrcBlendFunc() argument
885 if (ValidBlendFunc(context, val)) in ValidSrcBlendFunc()
894 bool ValidDstBlendFunc(const Context *context, GLenum val) in ValidDstBlendFunc() argument
896 if (ValidBlendFunc(context, val)) in ValidDstBlendFunc()
901 if (context->getClientMajorVersion() >= 3) in ValidDstBlendFunc()
908 bool ValidateES2TexImageParameters(const Context *context, in ValidateES2TexImageParameters() argument
924 if (!ValidTexture2DDestinationTarget(context, target)) in ValidateES2TexImageParameters()
926 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateES2TexImageParameters()
930 return ValidateES2TexImageParametersBase(context, target, level, internalformat, isCompressed, in ValidateES2TexImageParameters()
937 bool ValidateES2TexImageParametersBase(const Context *context, in ValidateES2TexImageParametersBase() argument
955 if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage)) in ValidateES2TexImageParametersBase()
961 if (!ValidMipLevel(context, texType, level)) in ValidateES2TexImageParametersBase()
963 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateES2TexImageParametersBase()
970 context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize); in ValidateES2TexImageParametersBase()
974 const Caps &caps = context->getCaps(); in ValidateES2TexImageParametersBase()
984 context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize); in ValidateES2TexImageParametersBase()
993 context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize); in ValidateES2TexImageParametersBase()
998 context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed); in ValidateES2TexImageParametersBase()
1006 context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions); in ValidateES2TexImageParametersBase()
1013 context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize); in ValidateES2TexImageParametersBase()
1019 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateES2TexImageParametersBase()
1023 Texture *texture = context->getTextureByType(texType); in ValidateES2TexImageParametersBase()
1026 context->validationError(GL_INVALID_OPERATION, kBufferNotBound); in ValidateES2TexImageParametersBase()
1033 context->validationError(GL_INVALID_VALUE, kInvalidBorder); in ValidateES2TexImageParametersBase()
1049 context->validationError(GL_INVALID_ENUM, kInvalidInternalFormat); in ValidateES2TexImageParametersBase()
1053 if (!internalFormatInfo.textureSupport(context->getClientVersion(), in ValidateES2TexImageParametersBase()
1054 context->getExtensions())) in ValidateES2TexImageParametersBase()
1056 context->validationError(GL_INVALID_ENUM, kInvalidInternalFormat); in ValidateES2TexImageParametersBase()
1070 !context->getExtensions().compressedETC1RGB8SubTexture) in ValidateES2TexImageParametersBase()
1072 context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat); in ValidateES2TexImageParametersBase()
1076 if (!ValidCompressedSubImageSize(context, actualInternalFormat, xoffset, yoffset, 0, in ValidateES2TexImageParametersBase()
1081 context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize); in ValidateES2TexImageParametersBase()
1087 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1093 if (!ValidCompressedImageSize(context, actualInternalFormat, level, width, height, 1)) in ValidateES2TexImageParametersBase()
1095 context->validationError(GL_INVALID_OPERATION, kInvalidCompressedImageSize); in ValidateES2TexImageParametersBase()
1116 if (!context->getExtensions().textureFormat2101010REV) in ValidateES2TexImageParametersBase()
1118 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1123 context->validationError(GL_INVALID_ENUM, kInvalidType); in ValidateES2TexImageParametersBase()
1142 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1148 if (!context->getExtensions().textureRG) in ValidateES2TexImageParametersBase()
1150 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1158 if (!context->getExtensions().textureFloatOES) in ValidateES2TexImageParametersBase()
1160 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1165 if (!context->getExtensions().textureFloatOES && in ValidateES2TexImageParametersBase()
1166 !context->getExtensions().textureHalfFloat) in ValidateES2TexImageParametersBase()
1168 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1174 if (!context->getExtensions().textureNorm16) in ValidateES2TexImageParametersBase()
1176 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1181 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1196 if (!context->getExtensions().textureNorm16) in ValidateES2TexImageParametersBase()
1198 context->validationError(GL_INVALID_OPERATION, in ValidateES2TexImageParametersBase()
1204 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1220 if (!context->getExtensions().textureNorm16) in ValidateES2TexImageParametersBase()
1222 context->validationError(GL_INVALID_OPERATION, in ValidateES2TexImageParametersBase()
1228 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1233 if (!context->getExtensions().textureFormatBGRA8888) in ValidateES2TexImageParametersBase()
1235 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1243 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1249 if (!context->getExtensions().sRGB) in ValidateES2TexImageParametersBase()
1251 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1259 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1276 if (!context->getExtensions().depthBufferFloat2NV) in ValidateES2TexImageParametersBase()
1278 context->validationError(GL_INVALID_OPERATION, in ValidateES2TexImageParametersBase()
1284 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1294 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1304 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1309 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1317 if (context->getExtensions().textureCompressionDXT1) in ValidateES2TexImageParametersBase()
1319 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1322 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1325 if (context->getExtensions().textureCompressionDXT3) in ValidateES2TexImageParametersBase()
1327 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1330 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1333 if (context->getExtensions().textureCompressionDXT5) in ValidateES2TexImageParametersBase()
1335 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1338 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1341 if (context->getExtensions().compressedETC1RGB8TextureOES) in ValidateES2TexImageParametersBase()
1343 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1346 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1353 if (context->getExtensions().lossyETCDecode) in ValidateES2TexImageParametersBase()
1355 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1358 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1364 if (context->getExtensions().compressedTexturePVRTC) in ValidateES2TexImageParametersBase()
1366 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1369 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1375 if (context->getExtensions().compressedTexturePVRTCsRGB) in ValidateES2TexImageParametersBase()
1377 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1380 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1384 if (!context->getExtensions().depthTextureANGLE && in ValidateES2TexImageParametersBase()
1385 !((context->getExtensions().packedDepthStencilOES || in ValidateES2TexImageParametersBase()
1386 context->getExtensions().depthTextureCubeMapOES) && in ValidateES2TexImageParametersBase()
1387 context->getExtensions().depthTextureOES)) in ValidateES2TexImageParametersBase()
1389 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1403 if (!context->getExtensions().depthTextureCubeMapOES) in ValidateES2TexImageParametersBase()
1405 context->validationError(GL_INVALID_OPERATION, in ValidateES2TexImageParametersBase()
1411 context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat); in ValidateES2TexImageParametersBase()
1417 if (!context->getExtensions().depthTextureOES) in ValidateES2TexImageParametersBase()
1421 context->validationError(GL_INVALID_OPERATION, kPixelDataNotNull); in ValidateES2TexImageParametersBase()
1426 context->validationError(GL_INVALID_OPERATION, kLevelNotZero); in ValidateES2TexImageParametersBase()
1432 if (!context->getExtensions().stencilIndex8) in ValidateES2TexImageParametersBase()
1434 context->validationError(GL_INVALID_OPERATION, kInvalidFormat); in ValidateES2TexImageParametersBase()
1450 context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat); in ValidateES2TexImageParametersBase()
1456 context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat); in ValidateES2TexImageParametersBase()
1477 if (!context->getExtensions().colorBufferFloatRGBA) in ValidateES2TexImageParametersBase()
1479 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexImageParametersBase()
1487 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1492 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1498 if (!context->getExtensions().colorBufferFloatRGB) in ValidateES2TexImageParametersBase()
1500 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexImageParametersBase()
1508 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1513 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1519 if (!context->getExtensions().textureFormatBGRA8888) in ValidateES2TexImageParametersBase()
1521 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexImageParametersBase()
1527 if (!(context->getExtensions().depthTextureAny())) in ValidateES2TexImageParametersBase()
1529 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexImageParametersBase()
1535 if (!(context->getExtensions().depthTextureANGLE || in ValidateES2TexImageParametersBase()
1536 context->getExtensions().packedDepthStencilOES || in ValidateES2TexImageParametersBase()
1537 context->getExtensions().depthTextureCubeMapOES)) in ValidateES2TexImageParametersBase()
1539 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexImageParametersBase()
1545 if (!context->getExtensions().stencilIndex8) in ValidateES2TexImageParametersBase()
1547 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexImageParametersBase()
1554 if (!context->getExtensions().textureRG) in ValidateES2TexImageParametersBase()
1556 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexImageParametersBase()
1563 if (!context->getExtensions().sRGB) in ValidateES2TexImageParametersBase()
1565 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1571 if (!context->getExtensions().textureFormat2101010REV) in ValidateES2TexImageParametersBase()
1573 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1579 context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat); in ValidateES2TexImageParametersBase()
1588 if (context->getExtensions().textureFormat2101010REV && in ValidateES2TexImageParametersBase()
1604 if (!context->getExtensions().textureNorm16) in ValidateES2TexImageParametersBase()
1606 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1611 context->validationError(GL_INVALID_VALUE, kInvalidInternalFormat); in ValidateES2TexImageParametersBase()
1618 if (!context->getExtensions().textureFloatOES) in ValidateES2TexImageParametersBase()
1620 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1626 if (!context->getExtensions().textureHalfFloat) in ValidateES2TexImageParametersBase()
1628 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexImageParametersBase()
1639 context->validationError(GL_INVALID_OPERATION, kInvalidTextureLevel); in ValidateES2TexImageParametersBase()
1645 context->validationError(GL_INVALID_OPERATION, err::kTextureFormatMismatch); in ValidateES2TexImageParametersBase()
1649 if (context->getExtensions().webglCompatibility) in ValidateES2TexImageParametersBase()
1654 context->validationError(GL_INVALID_OPERATION, kTextureTypeMismatch); in ValidateES2TexImageParametersBase()
1662 context->validationError(GL_INVALID_VALUE, kOffsetOverflow); in ValidateES2TexImageParametersBase()
1667 context->getState().getTargetBuffer(BufferBinding::PixelUnpack) == nullptr) in ValidateES2TexImageParametersBase()
1669 context->validationError(GL_INVALID_VALUE, kPixelDataNull); in ValidateES2TexImageParametersBase()
1677 context->validationError(GL_INVALID_OPERATION, kTextureIsImmutable); in ValidateES2TexImageParametersBase()
1689 context->validationError(GL_INVALID_OPERATION, kInvalidFormatCombination); in ValidateES2TexImageParametersBase()
1694 return ValidImageDataSize(context, texType, width, height, 1, sizeCheckFormat, type, pixels, in ValidateES2TexImageParametersBase()
1698 bool ValidateES2TexStorageParametersBase(const Context *context, in ValidateES2TexStorageParametersBase() argument
1708 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateES2TexStorageParametersBase()
1714 context->validationError(GL_INVALID_VALUE, kTextureSizeTooSmall); in ValidateES2TexStorageParametersBase()
1720 context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions); in ValidateES2TexStorageParametersBase()
1726 context->validationError(GL_INVALID_OPERATION, kInvalidMipLevels); in ValidateES2TexStorageParametersBase()
1733 context->validationError(GL_INVALID_ENUM, kInvalidFormat); in ValidateES2TexStorageParametersBase()
1737 const Caps &caps = context->getCaps(); in ValidateES2TexStorageParametersBase()
1744 context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize); in ValidateES2TexStorageParametersBase()
1751 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateES2TexStorageParametersBase()
1757 context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize); in ValidateES2TexStorageParametersBase()
1762 context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed); in ValidateES2TexStorageParametersBase()
1769 context->validationError(GL_INVALID_VALUE, kResourceMaxTextureSize); in ValidateES2TexStorageParametersBase()
1774 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1778 if (levels != 1 && !context->getExtensions().textureNPOTOES) in ValidateES2TexStorageParametersBase()
1782 context->validationError(GL_INVALID_OPERATION, kDimensionsMustBePow2); in ValidateES2TexStorageParametersBase()
1791 if (!context->getExtensions().textureCompressionDXT1) in ValidateES2TexStorageParametersBase()
1793 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1798 if (!context->getExtensions().textureCompressionDXT3) in ValidateES2TexStorageParametersBase()
1800 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1805 if (!context->getExtensions().textureCompressionDXT5) in ValidateES2TexStorageParametersBase()
1807 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1812 if (!context->getExtensions().compressedETC1RGB8TextureOES) in ValidateES2TexStorageParametersBase()
1814 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1823 if (!context->getExtensions().lossyETCDecode) in ValidateES2TexStorageParametersBase()
1825 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1833 if (!context->getExtensions().compressedTexturePVRTC) in ValidateES2TexStorageParametersBase()
1835 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1843 if (!context->getExtensions().compressedTexturePVRTCsRGB) in ValidateES2TexStorageParametersBase()
1845 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1854 if (!context->getExtensions().textureFloatOES) in ValidateES2TexStorageParametersBase()
1856 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1865 if (!context->getExtensions().textureHalfFloat) in ValidateES2TexStorageParametersBase()
1867 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1873 if (!context->getExtensions().textureRG) in ValidateES2TexStorageParametersBase()
1875 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1881 if (!context->getExtensions().textureRG || !context->getExtensions().textureHalfFloat) in ValidateES2TexStorageParametersBase()
1883 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1889 if (!context->getExtensions().textureRG || !context->getExtensions().textureFloatOES) in ValidateES2TexStorageParametersBase()
1891 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1897 if (!(context->getExtensions().depthTextureAny())) in ValidateES2TexStorageParametersBase()
1899 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1908 if (!context->getExtensions().depthTextureCubeMapOES) in ValidateES2TexStorageParametersBase()
1910 context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); in ValidateES2TexStorageParametersBase()
1915 context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); in ValidateES2TexStorageParametersBase()
1920 if (!context->getExtensions().depthTextureOES) in ValidateES2TexStorageParametersBase()
1924 context->validationError(GL_INVALID_OPERATION, kInvalidMipLevels); in ValidateES2TexStorageParametersBase()
1930 if (!(context->getExtensions().depthTextureANGLE || in ValidateES2TexStorageParametersBase()
1931 ((context->getExtensions().packedDepthStencilOES || in ValidateES2TexStorageParametersBase()
1932 context->getExtensions().depthTextureCubeMapOES) && in ValidateES2TexStorageParametersBase()
1933 context->getExtensions().textureStorage))) in ValidateES2TexStorageParametersBase()
1935 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateES2TexStorageParametersBase()
1944 if (!context->getExtensions().depthTextureCubeMapOES) in ValidateES2TexStorageParametersBase()
1946 context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); in ValidateES2TexStorageParametersBase()
1951 context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); in ValidateES2TexStorageParametersBase()
1955 if (!context->getExtensions().packedDepthStencilOES && in ValidateES2TexStorageParametersBase()
1956 !context->getExtensions().depthTextureCubeMapOES) in ValidateES2TexStorageParametersBase()
1961 context->validationError(GL_INVALID_OPERATION, kInvalidMipLevels); in ValidateES2TexStorageParametersBase()
1971 Texture *texture = context->getTextureByType(target); in ValidateES2TexStorageParametersBase()
1974 context->validationError(GL_INVALID_OPERATION, kMissingTexture); in ValidateES2TexStorageParametersBase()
1980 context->validationError(GL_INVALID_OPERATION, kTextureIsImmutable); in ValidateES2TexStorageParametersBase()
1987 bool ValidateDiscardFramebufferEXT(const Context *context, in ValidateDiscardFramebufferEXT() argument
1992 if (!context->getExtensions().discardFramebuffer) in ValidateDiscardFramebufferEXT()
1994 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateDiscardFramebufferEXT()
2004 (context->getState().getTargetFramebuffer(GL_FRAMEBUFFER)->isDefault()); in ValidateDiscardFramebufferEXT()
2007 context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget); in ValidateDiscardFramebufferEXT()
2011 return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments, in ValidateDiscardFramebufferEXT()
2015 bool ValidateBindVertexArrayOES(const Context *context, VertexArrayID array) in ValidateBindVertexArrayOES() argument
2017 if (!context->getExtensions().vertexArrayObjectOES) in ValidateBindVertexArrayOES()
2019 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateBindVertexArrayOES()
2023 return ValidateBindVertexArrayBase(context, array); in ValidateBindVertexArrayOES()
2026 bool ValidateDeleteVertexArraysOES(const Context *context, GLsizei n, const VertexArrayID *arrays) in ValidateDeleteVertexArraysOES() argument
2028 if (!context->getExtensions().vertexArrayObjectOES) in ValidateDeleteVertexArraysOES()
2030 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateDeleteVertexArraysOES()
2034 return ValidateGenOrDelete(context, n); in ValidateDeleteVertexArraysOES()
2037 bool ValidateGenVertexArraysOES(const Context *context, GLsizei n, const VertexArrayID *arrays) in ValidateGenVertexArraysOES() argument
2039 if (!context->getExtensions().vertexArrayObjectOES) in ValidateGenVertexArraysOES()
2041 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGenVertexArraysOES()
2045 return ValidateGenOrDelete(context, n); in ValidateGenVertexArraysOES()
2048 bool ValidateIsVertexArrayOES(const Context *context, VertexArrayID array) in ValidateIsVertexArrayOES() argument
2050 if (!context->getExtensions().vertexArrayObjectOES) in ValidateIsVertexArrayOES()
2052 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateIsVertexArrayOES()
2059 bool ValidateProgramBinaryOES(const Context *context, in ValidateProgramBinaryOES() argument
2065 if (!context->getExtensions().getProgramBinaryOES) in ValidateProgramBinaryOES()
2067 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateProgramBinaryOES()
2071 return ValidateProgramBinaryBase(context, program, binaryFormat, binary, length); in ValidateProgramBinaryOES()
2074 bool ValidateGetProgramBinaryOES(const Context *context, in ValidateGetProgramBinaryOES() argument
2081 if (!context->getExtensions().getProgramBinaryOES) in ValidateGetProgramBinaryOES()
2083 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetProgramBinaryOES()
2087 return ValidateGetProgramBinaryBase(context, program, bufSize, length, binaryFormat, binary); in ValidateGetProgramBinaryOES()
2145 bool ValidateDebugMessageControlKHR(const Context *context, in ValidateDebugMessageControlKHR() argument
2153 if (!context->getExtensions().debug) in ValidateDebugMessageControlKHR()
2155 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateDebugMessageControlKHR()
2161 context->validationError(GL_INVALID_ENUM, kInvalidDebugSource); in ValidateDebugMessageControlKHR()
2167 context->validationError(GL_INVALID_ENUM, kInvalidDebugType); in ValidateDebugMessageControlKHR()
2173 context->validationError(GL_INVALID_ENUM, kInvalidDebugSeverity); in ValidateDebugMessageControlKHR()
2181 context->validationError(GL_INVALID_OPERATION, kInvalidDebugSourceType); in ValidateDebugMessageControlKHR()
2187 context->validationError(GL_INVALID_OPERATION, kInvalidDebugSeverity); in ValidateDebugMessageControlKHR()
2195 bool ValidateDebugMessageInsertKHR(const Context *context, in ValidateDebugMessageInsertKHR() argument
2203 if (!context->getExtensions().debug) in ValidateDebugMessageInsertKHR()
2205 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateDebugMessageInsertKHR()
2209 if (!context->getState().getDebug().isOutputEnabled()) in ValidateDebugMessageInsertKHR()
2218 context->validationError(GL_INVALID_ENUM, kInvalidDebugSource); in ValidateDebugMessageInsertKHR()
2224 context->validationError(GL_INVALID_ENUM, kInvalidDebugType); in ValidateDebugMessageInsertKHR()
2230 context->validationError(GL_INVALID_ENUM, kInvalidDebugSource); in ValidateDebugMessageInsertKHR()
2235 if (messageLength > context->getExtensions().maxDebugMessageLength) in ValidateDebugMessageInsertKHR()
2237 context->validationError(GL_INVALID_VALUE, kExceedsMaxDebugMessageLength); in ValidateDebugMessageInsertKHR()
2244 bool ValidateDebugMessageCallbackKHR(const Context *context, in ValidateDebugMessageCallbackKHR() argument
2248 if (!context->getExtensions().debug) in ValidateDebugMessageCallbackKHR()
2250 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateDebugMessageCallbackKHR()
2257 bool ValidateGetDebugMessageLogKHR(const Context *context, in ValidateGetDebugMessageLogKHR() argument
2267 if (!context->getExtensions().debug) in ValidateGetDebugMessageLogKHR()
2269 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetDebugMessageLogKHR()
2275 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetDebugMessageLogKHR()
2282 bool ValidatePushDebugGroupKHR(const Context *context, in ValidatePushDebugGroupKHR() argument
2288 if (!context->getExtensions().debug) in ValidatePushDebugGroupKHR()
2290 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidatePushDebugGroupKHR()
2296 context->validationError(GL_INVALID_ENUM, kInvalidDebugSource); in ValidatePushDebugGroupKHR()
2301 if (messageLength > context->getExtensions().maxDebugMessageLength) in ValidatePushDebugGroupKHR()
2303 context->validationError(GL_INVALID_VALUE, kExceedsMaxDebugMessageLength); in ValidatePushDebugGroupKHR()
2307 size_t currentStackSize = context->getState().getDebug().getGroupStackDepth(); in ValidatePushDebugGroupKHR()
2308 if (currentStackSize >= context->getExtensions().maxDebugGroupStackDepth) in ValidatePushDebugGroupKHR()
2310 context->validationError(GL_STACK_OVERFLOW, kExceedsMaxDebugGroupStackDepth); in ValidatePushDebugGroupKHR()
2317 bool ValidatePopDebugGroupKHR(const Context *context) in ValidatePopDebugGroupKHR() argument
2319 if (!context->getExtensions().debug) in ValidatePopDebugGroupKHR()
2321 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidatePopDebugGroupKHR()
2325 size_t currentStackSize = context->getState().getDebug().getGroupStackDepth(); in ValidatePopDebugGroupKHR()
2328 context->validationError(GL_STACK_UNDERFLOW, kCannotPopDefaultDebugGroup); in ValidatePopDebugGroupKHR()
2335 static bool ValidateObjectIdentifierAndName(const Context *context, GLenum identifier, GLuint name) in ValidateObjectIdentifierAndName() argument
2340 if (context->getBuffer({name}) == nullptr) in ValidateObjectIdentifierAndName()
2342 context->validationError(GL_INVALID_VALUE, kInvalidBufferName); in ValidateObjectIdentifierAndName()
2348 if (context->getShader({name}) == nullptr) in ValidateObjectIdentifierAndName()
2350 context->validationError(GL_INVALID_VALUE, kInvalidShaderName); in ValidateObjectIdentifierAndName()
2356 if (context->getProgramNoResolveLink({name}) == nullptr) in ValidateObjectIdentifierAndName()
2358 context->validationError(GL_INVALID_VALUE, kInvalidProgramName); in ValidateObjectIdentifierAndName()
2364 if (context->getVertexArray({name}) == nullptr) in ValidateObjectIdentifierAndName()
2366 context->validationError(GL_INVALID_VALUE, kInvalidVertexArrayName); in ValidateObjectIdentifierAndName()
2372 if (context->getQuery({name}) == nullptr) in ValidateObjectIdentifierAndName()
2374 context->validationError(GL_INVALID_VALUE, kInvalidQueryName); in ValidateObjectIdentifierAndName()
2380 if (context->getTransformFeedback({name}) == nullptr) in ValidateObjectIdentifierAndName()
2382 context->validationError(GL_INVALID_VALUE, kInvalidTransformFeedbackName); in ValidateObjectIdentifierAndName()
2388 if (context->getSampler({name}) == nullptr) in ValidateObjectIdentifierAndName()
2390 context->validationError(GL_INVALID_VALUE, kInvalidSamplerName); in ValidateObjectIdentifierAndName()
2396 if (context->getTexture({name}) == nullptr) in ValidateObjectIdentifierAndName()
2398 context->validationError(GL_INVALID_VALUE, kInvalidTextureName); in ValidateObjectIdentifierAndName()
2404 if (!context->isRenderbuffer({name})) in ValidateObjectIdentifierAndName()
2406 context->validationError(GL_INVALID_VALUE, kInvalidRenderbufferName); in ValidateObjectIdentifierAndName()
2412 if (context->getFramebuffer({name}) == nullptr) in ValidateObjectIdentifierAndName()
2414 context->validationError(GL_INVALID_VALUE, kInvalidFramebufferName); in ValidateObjectIdentifierAndName()
2420 if (context->getProgramPipeline({name}) == nullptr) in ValidateObjectIdentifierAndName()
2422 context->validationError(GL_INVALID_VALUE, kInvalidProgramPipelineName); in ValidateObjectIdentifierAndName()
2428 context->validationError(GL_INVALID_ENUM, kInvalidIndentifier); in ValidateObjectIdentifierAndName()
2433 static bool ValidateLabelLength(const Context *context, GLsizei length, const GLchar *label) in ValidateLabelLength() argument
2449 if (labelLength > context->getExtensions().maxLabelLength) in ValidateLabelLength()
2451 context->validationError(GL_INVALID_VALUE, kExceedsMaxLabelLength); in ValidateLabelLength()
2458 bool ValidateObjectLabelKHR(const Context *context, in ValidateObjectLabelKHR() argument
2464 if (!context->getExtensions().debug) in ValidateObjectLabelKHR()
2466 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateObjectLabelKHR()
2470 if (!ValidateObjectIdentifierAndName(context, identifier, name)) in ValidateObjectLabelKHR()
2475 if (!ValidateLabelLength(context, length, label)) in ValidateObjectLabelKHR()
2483 bool ValidateGetObjectLabelKHR(const Context *context, in ValidateGetObjectLabelKHR() argument
2490 if (!context->getExtensions().debug) in ValidateGetObjectLabelKHR()
2492 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetObjectLabelKHR()
2498 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetObjectLabelKHR()
2502 if (!ValidateObjectIdentifierAndName(context, identifier, name)) in ValidateGetObjectLabelKHR()
2510 static bool ValidateObjectPtrName(const Context *context, const void *ptr) in ValidateObjectPtrName() argument
2512 if (context->getSync(reinterpret_cast<GLsync>(const_cast<void *>(ptr))) == nullptr) in ValidateObjectPtrName()
2514 context->validationError(GL_INVALID_VALUE, kInvalidSyncPointer); in ValidateObjectPtrName()
2521 bool ValidateObjectPtrLabelKHR(const Context *context, in ValidateObjectPtrLabelKHR() argument
2526 if (!context->getExtensions().debug) in ValidateObjectPtrLabelKHR()
2528 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateObjectPtrLabelKHR()
2532 if (!ValidateObjectPtrName(context, ptr)) in ValidateObjectPtrLabelKHR()
2537 if (!ValidateLabelLength(context, length, label)) in ValidateObjectPtrLabelKHR()
2545 bool ValidateGetObjectPtrLabelKHR(const Context *context, in ValidateGetObjectPtrLabelKHR() argument
2551 if (!context->getExtensions().debug) in ValidateGetObjectPtrLabelKHR()
2553 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetObjectPtrLabelKHR()
2559 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetObjectPtrLabelKHR()
2563 if (!ValidateObjectPtrName(context, ptr)) in ValidateGetObjectPtrLabelKHR()
2571 bool ValidateGetPointervKHR(const Context *context, GLenum pname, void *const *params) in ValidateGetPointervKHR() argument
2573 if (!context->getExtensions().debug) in ValidateGetPointervKHR()
2575 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetPointervKHR()
2579 // TODO: represent this in Context::getQueryParameterInfo. in ValidateGetPointervKHR()
2587 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateGetPointervKHR()
2594 bool ValidateGetPointervRobustANGLERobustANGLE(const Context *context, in ValidateGetPointervRobustANGLERobustANGLE() argument
2604 bool ValidateBlitFramebufferANGLE(const Context *context, in ValidateBlitFramebufferANGLE() argument
2616 if (!context->getExtensions().framebufferBlitANGLE) in ValidateBlitFramebufferANGLE()
2618 context->validationError(GL_INVALID_OPERATION, kBlitExtensionNotAvailable); in ValidateBlitFramebufferANGLE()
2625 context->validationError(GL_INVALID_OPERATION, kBlitExtensionScaleOrFlip); in ValidateBlitFramebufferANGLE()
2631 context->validationError(GL_INVALID_ENUM, kBlitExtensionLinear); in ValidateBlitFramebufferANGLE()
2635 Framebuffer *readFramebuffer = context->getState().getReadFramebuffer(); in ValidateBlitFramebufferANGLE()
2636 Framebuffer *drawFramebuffer = context->getState().getDrawFramebuffer(); in ValidateBlitFramebufferANGLE()
2654 context->validationError(GL_INVALID_OPERATION, in ValidateBlitFramebufferANGLE()
2673 context->validationError(GL_INVALID_OPERATION, in ValidateBlitFramebufferANGLE()
2682 context->validationError(GL_INVALID_OPERATION, in ValidateBlitFramebufferANGLE()
2689 GLint samples = readFramebuffer->getSamples(context); in ValidateBlitFramebufferANGLE()
2691 IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0, in ValidateBlitFramebufferANGLE()
2694 context->validationError(GL_INVALID_OPERATION, in ValidateBlitFramebufferANGLE()
2708 readFramebuffer->getAttachment(context, attachments[i]); in ValidateBlitFramebufferANGLE()
2710 drawFramebuffer->getAttachment(context, attachments[i]); in ValidateBlitFramebufferANGLE()
2714 if (IsPartialBlit(context, readBuffer, drawBuffer, srcX0, srcY0, srcX1, srcY1, in ValidateBlitFramebufferANGLE()
2718 context->validationError(GL_INVALID_OPERATION, in ValidateBlitFramebufferANGLE()
2725 context->validationError(GL_INVALID_OPERATION, in ValidateBlitFramebufferANGLE()
2733 return ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, in ValidateBlitFramebufferANGLE()
2737 bool ValidateBlitFramebufferNV(const Context *context, in ValidateBlitFramebufferNV() argument
2749 if (!context->getExtensions().framebufferBlitANGLE) in ValidateBlitFramebufferNV()
2751 context->validationError(GL_INVALID_OPERATION, kBlitExtensionNotAvailable); in ValidateBlitFramebufferNV()
2755 return ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, in ValidateBlitFramebufferNV()
2759 bool ValidateClear(const Context *context, GLbitfield mask) in ValidateClear() argument
2761 Framebuffer *fbo = context->getState().getDrawFramebuffer(); in ValidateClear()
2762 const Extensions &extensions = context->getExtensions(); in ValidateClear()
2764 if (!ValidateFramebufferComplete(context, fbo)) in ValidateClear()
2771 context->validationError(GL_INVALID_VALUE, kInvalidClearMask); in ValidateClear()
2784 context, drawBufferIdx, validComponentTypes, ArraySize(validComponentTypes))) in ValidateClear()
2793 const State &state = context->getState(); in ValidateClear()
2797 context->validationError(GL_INVALID_OPERATION, kMultiviewTimerQuery); in ValidateClear()
2805 bool ValidateDrawBuffersEXT(const Context *context, GLsizei n, const GLenum *bufs) in ValidateDrawBuffersEXT() argument
2807 if (!context->getExtensions().drawBuffers) in ValidateDrawBuffersEXT()
2809 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateDrawBuffersEXT()
2813 return ValidateDrawBuffersBase(context, n, bufs); in ValidateDrawBuffersEXT()
2816 bool ValidateTexImage2D(const Context *context, in ValidateTexImage2D() argument
2827 if (context->getClientMajorVersion() < 3) in ValidateTexImage2D()
2829 return ValidateES2TexImageParameters(context, target, level, internalformat, false, false, in ValidateTexImage2D()
2833 ASSERT(context->getClientMajorVersion() >= 3); in ValidateTexImage2D()
2834 return ValidateES3TexImage2DParameters(context, target, level, internalformat, false, false, 0, in ValidateTexImage2D()
2839 bool ValidateTexImage2DRobustANGLE(const Context *context, in ValidateTexImage2DRobustANGLE() argument
2851 if (!ValidateRobustEntryPoint(context, bufSize)) in ValidateTexImage2DRobustANGLE()
2856 if (context->getClientMajorVersion() < 3) in ValidateTexImage2DRobustANGLE()
2858 return ValidateES2TexImageParameters(context, target, level, internalformat, false, false, in ValidateTexImage2DRobustANGLE()
2863 ASSERT(context->getClientMajorVersion() >= 3); in ValidateTexImage2DRobustANGLE()
2864 return ValidateES3TexImage2DParameters(context, target, level, internalformat, false, false, 0, in ValidateTexImage2DRobustANGLE()
2869 bool ValidateTexSubImage2D(const Context *context, in ValidateTexSubImage2D() argument
2881 if (context->getClientMajorVersion() < 3) in ValidateTexSubImage2D()
2883 return ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, xoffset, in ValidateTexSubImage2D()
2887 ASSERT(context->getClientMajorVersion() >= 3); in ValidateTexSubImage2D()
2888 return ValidateES3TexImage2DParameters(context, target, level, GL_NONE, false, true, xoffset, in ValidateTexSubImage2D()
2893 bool ValidateTexSubImage2DRobustANGLE(const Context *context, in ValidateTexSubImage2DRobustANGLE() argument
2905 if (!ValidateRobustEntryPoint(context, bufSize)) in ValidateTexSubImage2DRobustANGLE()
2910 if (context->getClientMajorVersion() < 3) in ValidateTexSubImage2DRobustANGLE()
2912 return ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, xoffset, in ValidateTexSubImage2DRobustANGLE()
2917 ASSERT(context->getClientMajorVersion() >= 3); in ValidateTexSubImage2DRobustANGLE()
2918 return ValidateES3TexImage2DParameters(context, target, level, GL_NONE, false, true, xoffset, in ValidateTexSubImage2DRobustANGLE()
2923 bool ValidateTexSubImage3DOES(const Context *context, in ValidateTexSubImage3DOES() argument
2936 return ValidateTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width, height, in ValidateTexSubImage3DOES()
2940 bool ValidateCompressedTexImage2D(const Context *context, in ValidateCompressedTexImage2D() argument
2950 if (context->getClientMajorVersion() < 3) in ValidateCompressedTexImage2D()
2952 if (!ValidateES2TexImageParameters(context, target, level, internalformat, true, false, 0, in ValidateCompressedTexImage2D()
2960 ASSERT(context->getClientMajorVersion() >= 3); in ValidateCompressedTexImage2D()
2961 if (!ValidateES3TexImage2DParameters(context, target, level, internalformat, true, false, 0, in ValidateCompressedTexImage2D()
2974 context->validationError(GL_INVALID_OPERATION, kIntegerOverflow); in ValidateCompressedTexImage2D()
2980 context->validationError(GL_INVALID_VALUE, kCompressedTextureDimensionsMustMatchData); in ValidateCompressedTexImage2D()
2986 context->validationError(GL_INVALID_ENUM, kRectangleTextureCompressed); in ValidateCompressedTexImage2D()
2993 bool ValidateCompressedTexImage2DRobustANGLE(const Context *context, in ValidateCompressedTexImage2DRobustANGLE() argument
3004 if (!ValidateRobustCompressedTexImageBase(context, imageSize, dataSize)) in ValidateCompressedTexImage2DRobustANGLE()
3009 return ValidateCompressedTexImage2D(context, target, level, internalformat, width, height, in ValidateCompressedTexImage2DRobustANGLE()
3013 bool ValidateCompressedTexImage3DOES(const Context *context, in ValidateCompressedTexImage3DOES() argument
3024 return ValidateCompressedTexImage3D(context, target, level, internalformat, width, height, in ValidateCompressedTexImage3DOES()
3028 bool ValidateCompressedTexSubImage2DRobustANGLE(const Context *context, in ValidateCompressedTexSubImage2DRobustANGLE() argument
3040 if (!ValidateRobustCompressedTexImageBase(context, imageSize, dataSize)) in ValidateCompressedTexSubImage2DRobustANGLE()
3045 return ValidateCompressedTexSubImage2D(context, target, level, xoffset, yoffset, width, height, in ValidateCompressedTexSubImage2DRobustANGLE()
3049 bool ValidateCompressedTexSubImage2D(const Context *context, in ValidateCompressedTexSubImage2D() argument
3060 if (context->getClientMajorVersion() < 3) in ValidateCompressedTexSubImage2D()
3062 if (!ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true, xoffset, in ValidateCompressedTexSubImage2D()
3070 ASSERT(context->getClientMajorVersion() >= 3); in ValidateCompressedTexSubImage2D()
3071 if (!ValidateES3TexImage2DParameters(context, target, level, GL_NONE, true, true, xoffset, in ValidateCompressedTexSubImage2D()
3083 context->validationError(GL_INVALID_OPERATION, kIntegerOverflow); in ValidateCompressedTexSubImage2D()
3089 context->validationError(GL_INVALID_VALUE, kInvalidCompressedImageSize); in ValidateCompressedTexSubImage2D()
3096 bool ValidateCompressedTexSubImage3DOES(const Context *context, in ValidateCompressedTexSubImage3DOES() argument
3109 return ValidateCompressedTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width, in ValidateCompressedTexSubImage3DOES()
3113 bool ValidateGetBufferPointervOES(const Context *context, in ValidateGetBufferPointervOES() argument
3118 if (!context->getExtensions().mapBufferOES) in ValidateGetBufferPointervOES()
3120 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetBufferPointervOES()
3124 return ValidateGetBufferPointervBase(context, target, pname, nullptr, params); in ValidateGetBufferPointervOES()
3127 bool ValidateMapBufferOES(const Context *context, BufferBinding target, GLenum access) in ValidateMapBufferOES() argument
3129 if (!context->getExtensions().mapBufferOES) in ValidateMapBufferOES()
3131 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateMapBufferOES()
3135 if (!context->isValidBufferBinding(target)) in ValidateMapBufferOES()
3137 context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes); in ValidateMapBufferOES()
3141 Buffer *buffer = context->getState().getTargetBuffer(target); in ValidateMapBufferOES()
3145 context->validationError(GL_INVALID_OPERATION, kBufferNotMappable); in ValidateMapBufferOES()
3151 context->validationError(GL_INVALID_ENUM, kInvalidAccessBits); in ValidateMapBufferOES()
3160 context->validationError(GL_INVALID_OPERATION, kBufferNotMappable); in ValidateMapBufferOES()
3166 context->validationError(GL_INVALID_OPERATION, kBufferAlreadyMapped); in ValidateMapBufferOES()
3170 return ValidateMapBufferBase(context, target); in ValidateMapBufferOES()
3173 bool ValidateUnmapBufferOES(const Context *context, BufferBinding target) in ValidateUnmapBufferOES() argument
3175 if (!context->getExtensions().mapBufferOES) in ValidateUnmapBufferOES()
3177 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateUnmapBufferOES()
3181 return ValidateUnmapBufferBase(context, target); in ValidateUnmapBufferOES()
3184 bool ValidateMapBufferRangeEXT(const Context *context, in ValidateMapBufferRangeEXT() argument
3190 if (!context->getExtensions().mapBufferRange) in ValidateMapBufferRangeEXT()
3192 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateMapBufferRangeEXT()
3196 return ValidateMapBufferRangeBase(context, target, offset, length, access); in ValidateMapBufferRangeEXT()
3199 bool ValidateMapBufferBase(const Context *context, BufferBinding target) in ValidateMapBufferBase() argument
3201 Buffer *buffer = context->getState().getTargetBuffer(target); in ValidateMapBufferBase()
3205 if (context->getState().isTransformFeedbackActive()) in ValidateMapBufferBase()
3207 TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); in ValidateMapBufferBase()
3213 context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback); in ValidateMapBufferBase()
3219 if (context->getExtensions().webglCompatibility && in ValidateMapBufferBase()
3222 context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback); in ValidateMapBufferBase()
3229 bool ValidateFlushMappedBufferRangeEXT(const Context *context, in ValidateFlushMappedBufferRangeEXT() argument
3234 if (!context->getExtensions().mapBufferRange) in ValidateFlushMappedBufferRangeEXT()
3236 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateFlushMappedBufferRangeEXT()
3240 return ValidateFlushMappedBufferRangeBase(context, target, offset, length); in ValidateFlushMappedBufferRangeEXT()
3243 bool ValidateBindUniformLocationCHROMIUM(const Context *context, in ValidateBindUniformLocationCHROMIUM() argument
3248 if (!context->getExtensions().bindUniformLocation) in ValidateBindUniformLocationCHROMIUM()
3250 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateBindUniformLocationCHROMIUM()
3254 Program *programObject = GetValidProgram(context, program); in ValidateBindUniformLocationCHROMIUM()
3262 context->validationError(GL_INVALID_VALUE, kNegativeLocation); in ValidateBindUniformLocationCHROMIUM()
3266 const Caps &caps = context->getCaps(); in ValidateBindUniformLocationCHROMIUM()
3270 context->validationError(GL_INVALID_VALUE, kInvalidBindUniformLocation); in ValidateBindUniformLocationCHROMIUM()
3276 if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name))) in ValidateBindUniformLocationCHROMIUM()
3278 context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters); in ValidateBindUniformLocationCHROMIUM()
3284 context->validationError(GL_INVALID_VALUE, kNameBeginsWithGL); in ValidateBindUniformLocationCHROMIUM()
3291 bool ValidateCoverageModulationCHROMIUM(const Context *context, GLenum components) in ValidateCoverageModulationCHROMIUM() argument
3293 if (!context->getExtensions().framebufferMixedSamples) in ValidateCoverageModulationCHROMIUM()
3295 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateCoverageModulationCHROMIUM()
3306 context->validationError(GL_INVALID_ENUM, kInvalidCoverageComponents); in ValidateCoverageModulationCHROMIUM()
3313 bool ValidateCopyTextureCHROMIUM(const Context *context, in ValidateCopyTextureCHROMIUM() argument
3325 if (!context->getExtensions().copyTexture) in ValidateCopyTextureCHROMIUM()
3327 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateCopyTextureCHROMIUM()
3331 const Texture *source = context->getTexture(sourceId); in ValidateCopyTextureCHROMIUM()
3334 context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture); in ValidateCopyTextureCHROMIUM()
3338 if (!IsValidCopyTextureSourceTarget(context, source->getType())) in ValidateCopyTextureCHROMIUM()
3340 context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat); in ValidateCopyTextureCHROMIUM()
3348 if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel)) in ValidateCopyTextureCHROMIUM()
3350 context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureLevel); in ValidateCopyTextureCHROMIUM()
3358 context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat); in ValidateCopyTextureCHROMIUM()
3365 context->validationError(GL_INVALID_OPERATION, kInvalidSourceTextureInternalFormat); in ValidateCopyTextureCHROMIUM()
3369 if (!IsValidCopyTextureDestinationTargetEnum(context, destTarget)) in ValidateCopyTextureCHROMIUM()
3371 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateCopyTextureCHROMIUM()
3375 const Texture *dest = context->getTexture(destId); in ValidateCopyTextureCHROMIUM()
3378 context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture); in ValidateCopyTextureCHROMIUM()
3382 if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget)) in ValidateCopyTextureCHROMIUM()
3384 context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType); in ValidateCopyTextureCHROMIUM()
3388 if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, sourceWidth, in ValidateCopyTextureCHROMIUM()
3391 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateCopyTextureCHROMIUM()
3395 if (!IsValidCopyTextureDestinationFormatType(context, internalFormat, destType)) in ValidateCopyTextureCHROMIUM()
3402 context->validationError(GL_INVALID_VALUE, kCubemapFacesEqualDimensions); in ValidateCopyTextureCHROMIUM()
3408 context->validationError(GL_INVALID_OPERATION, kDestinationImmutable); in ValidateCopyTextureCHROMIUM()
3415 bool ValidateCopySubTextureCHROMIUM(const Context *context, in ValidateCopySubTextureCHROMIUM() argument
3431 if (!context->getExtensions().copyTexture) in ValidateCopySubTextureCHROMIUM()
3433 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateCopySubTextureCHROMIUM()
3437 const Texture *source = context->getTexture(sourceId); in ValidateCopySubTextureCHROMIUM()
3440 context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture); in ValidateCopySubTextureCHROMIUM()
3444 if (!IsValidCopyTextureSourceTarget(context, source->getType())) in ValidateCopySubTextureCHROMIUM()
3446 context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureType); in ValidateCopySubTextureCHROMIUM()
3454 if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel)) in ValidateCopySubTextureCHROMIUM()
3456 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateCopySubTextureCHROMIUM()
3463 context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureLevel); in ValidateCopySubTextureCHROMIUM()
3469 context->validationError(GL_INVALID_VALUE, kNegativeOffset); in ValidateCopySubTextureCHROMIUM()
3475 context->validationError(GL_INVALID_VALUE, kNegativeSize); in ValidateCopySubTextureCHROMIUM()
3482 context->validationError(GL_INVALID_VALUE, kSourceTextureTooSmall); in ValidateCopySubTextureCHROMIUM()
3489 context->validationError(GL_INVALID_OPERATION, kInvalidInternalFormat); in ValidateCopySubTextureCHROMIUM()
3493 if (!IsValidCopyTextureDestinationTargetEnum(context, destTarget)) in ValidateCopySubTextureCHROMIUM()
3495 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateCopySubTextureCHROMIUM()
3499 const Texture *dest = context->getTexture(destId); in ValidateCopySubTextureCHROMIUM()
3502 context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture); in ValidateCopySubTextureCHROMIUM()
3506 if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget)) in ValidateCopySubTextureCHROMIUM()
3508 context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType); in ValidateCopySubTextureCHROMIUM()
3512 if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, width, height, in ValidateCopySubTextureCHROMIUM()
3515 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateCopySubTextureCHROMIUM()
3521 context->validationError(GL_INVALID_OPERATION, kDestinationLevelNotDefined); in ValidateCopySubTextureCHROMIUM()
3528 context->validationError(GL_INVALID_OPERATION, kInvalidFormatCombination); in ValidateCopySubTextureCHROMIUM()
3534 context->validationError(GL_INVALID_VALUE, kNegativeOffset); in ValidateCopySubTextureCHROMIUM()
3541 context->validationError(GL_INVALID_VALUE, kOffsetOverflow); in ValidateCopySubTextureCHROMIUM()
3548 bool ValidateCompressedCopyTextureCHROMIUM(const Context *context, in ValidateCompressedCopyTextureCHROMIUM() argument
3552 if (!context->getExtensions().copyCompressedTexture) in ValidateCompressedCopyTextureCHROMIUM()
3554 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateCompressedCopyTextureCHROMIUM()
3558 const Texture *source = context->getTexture(sourceId); in ValidateCompressedCopyTextureCHROMIUM()
3561 context->validationError(GL_INVALID_VALUE, kInvalidSourceTexture); in ValidateCompressedCopyTextureCHROMIUM()
3567 context->validationError(GL_INVALID_VALUE, kInvalidSourceTextureType); in ValidateCompressedCopyTextureCHROMIUM()
3574 context->validationError(GL_INVALID_VALUE, kSourceTextureLevelZeroDefined); in ValidateCompressedCopyTextureCHROMIUM()
3581 context->validationError(GL_INVALID_OPERATION, kSourceTextureMustBeCompressed); in ValidateCompressedCopyTextureCHROMIUM()
3585 const Texture *dest = context->getTexture(destId); in ValidateCompressedCopyTextureCHROMIUM()
3588 context->validationError(GL_INVALID_VALUE, kInvalidDestinationTexture); in ValidateCompressedCopyTextureCHROMIUM()
3594 context->validationError(GL_INVALID_VALUE, kInvalidDestinationTextureType); in ValidateCompressedCopyTextureCHROMIUM()
3600 context->validationError(GL_INVALID_OPERATION, kDestinationImmutable); in ValidateCompressedCopyTextureCHROMIUM()
3607 bool ValidateCreateShader(const Context *context, ShaderType type) in ValidateCreateShader() argument
3616 if (context->getClientVersion() < ES_3_1) in ValidateCreateShader()
3618 context->validationError(GL_INVALID_ENUM, kES31Required); in ValidateCreateShader()
3624 if (!context->getExtensions().geometryShaderAny() && in ValidateCreateShader()
3625 context->getClientVersion() < ES_3_2) in ValidateCreateShader()
3627 context->validationError(GL_INVALID_ENUM, kInvalidShaderType); in ValidateCreateShader()
3633 if (!context->getExtensions().tessellationShaderEXT && in ValidateCreateShader()
3634 context->getClientVersion() < ES_3_2) in ValidateCreateShader()
3636 context->validationError(GL_INVALID_ENUM, kInvalidShaderType); in ValidateCreateShader()
3642 if (!context->getExtensions().tessellationShaderEXT && in ValidateCreateShader()
3643 context->getClientVersion() < ES_3_2) in ValidateCreateShader()
3645 context->validationError(GL_INVALID_ENUM, kInvalidShaderType); in ValidateCreateShader()
3651 context->validationError(GL_INVALID_ENUM, kInvalidShaderType); in ValidateCreateShader()
3658 bool ValidateBufferData(const Context *context, in ValidateBufferData() argument
3666 context->validationError(GL_INVALID_VALUE, kNegativeSize); in ValidateBufferData()
3683 if (context->getClientMajorVersion() < 3) in ValidateBufferData()
3685 context->validationError(GL_INVALID_ENUM, kInvalidBufferUsage); in ValidateBufferData()
3691 context->validationError(GL_INVALID_ENUM, kInvalidBufferUsage); in ValidateBufferData()
3695 if (!context->isValidBufferBinding(target)) in ValidateBufferData()
3697 context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes); in ValidateBufferData()
3701 Buffer *buffer = context->getState().getTargetBuffer(target); in ValidateBufferData()
3705 context->validationError(GL_INVALID_OPERATION, kBufferNotBound); in ValidateBufferData()
3709 if (context->getExtensions().webglCompatibility && in ValidateBufferData()
3712 context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback); in ValidateBufferData()
3718 context->validationError(GL_INVALID_OPERATION, kBufferImmutable); in ValidateBufferData()
3725 bool ValidateBufferSubData(const Context *context, in ValidateBufferSubData() argument
3733 context->validationError(GL_INVALID_VALUE, kNegativeSize); in ValidateBufferSubData()
3739 context->validationError(GL_INVALID_VALUE, kNegativeOffset); in ValidateBufferSubData()
3743 if (!context->isValidBufferBinding(target)) in ValidateBufferSubData()
3745 context->validationError(GL_INVALID_ENUM, kInvalidBufferTypes); in ValidateBufferSubData()
3749 Buffer *buffer = context->getState().getTargetBuffer(target); in ValidateBufferSubData()
3753 context->validationError(GL_INVALID_OPERATION, kBufferNotBound); in ValidateBufferSubData()
3759 context->validationError(GL_INVALID_OPERATION, kBufferMapped); in ValidateBufferSubData()
3763 if (context->getExtensions().webglCompatibility && in ValidateBufferSubData()
3766 context->validationError(GL_INVALID_OPERATION, kBufferBoundForTransformFeedback); in ValidateBufferSubData()
3773 context->validationError(GL_INVALID_OPERATION, kBufferNotUpdatable); in ValidateBufferSubData()
3782 context->validationError(GL_INVALID_VALUE, kParamOverflow); in ValidateBufferSubData()
3788 context->validationError(GL_INVALID_VALUE, kInsufficientBufferSize); in ValidateBufferSubData()
3795 bool ValidateRequestExtensionANGLE(const Context *context, const GLchar *name) in ValidateRequestExtensionANGLE() argument
3797 if (!context->getExtensions().requestExtension) in ValidateRequestExtensionANGLE()
3799 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateRequestExtensionANGLE()
3803 if (!context->isExtensionRequestable(name)) in ValidateRequestExtensionANGLE()
3805 context->validationError(GL_INVALID_OPERATION, kExtensionNotRequestable); in ValidateRequestExtensionANGLE()
3812 bool ValidateDisableExtensionANGLE(const Context *context, const GLchar *name) in ValidateDisableExtensionANGLE() argument
3814 if (!context->getExtensions().requestExtension) in ValidateDisableExtensionANGLE()
3816 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateDisableExtensionANGLE()
3820 if (!context->isExtensionDisablable(name)) in ValidateDisableExtensionANGLE()
3822 context->validationError(GL_INVALID_OPERATION, kExtensionNotDisablable); in ValidateDisableExtensionANGLE()
3829 bool ValidateActiveTexture(const Context *context, GLenum texture) in ValidateActiveTexture() argument
3831 if (context->getClientMajorVersion() < 2) in ValidateActiveTexture()
3833 return ValidateMultitextureUnit(context, texture); in ValidateActiveTexture()
3838 GL_TEXTURE0 + static_cast<GLuint>(context->getCaps().maxCombinedTextureImageUnits) - 1) in ValidateActiveTexture()
3840 context->validationError(GL_INVALID_ENUM, kInvalidCombinedImageUnit); in ValidateActiveTexture()
3847 bool ValidateAttachShader(const Context *context, ShaderProgramID program, ShaderProgramID shader) in ValidateAttachShader() argument
3849 Program *programObject = GetValidProgram(context, program); in ValidateAttachShader()
3855 Shader *shaderObject = GetValidShader(context, shader); in ValidateAttachShader()
3863 context->validationError(GL_INVALID_OPERATION, kShaderAttachmentHasShader); in ValidateAttachShader()
3870 bool ValidateBindAttribLocation(const Context *context, in ValidateBindAttribLocation() argument
3877 context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute); in ValidateBindAttribLocation()
3883 context->validationError(GL_INVALID_OPERATION, kNameBeginsWithGL); in ValidateBindAttribLocation()
3887 if (context->isWebGL()) in ValidateBindAttribLocation()
3895 context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters); in ValidateBindAttribLocation()
3899 if (!ValidateWebGLNameLength(context, length) || !ValidateWebGLNamePrefix(context, name)) in ValidateBindAttribLocation()
3905 return GetValidProgram(context, program) != nullptr; in ValidateBindAttribLocation()
3908 bool ValidateBindFramebuffer(const Context *context, GLenum target, FramebufferID framebuffer) in ValidateBindFramebuffer() argument
3910 return ValidateBindFramebufferBase(context, target, framebuffer); in ValidateBindFramebuffer()
3913 bool ValidateBindRenderbuffer(const Context *context, GLenum target, RenderbufferID renderbuffer) in ValidateBindRenderbuffer() argument
3915 return ValidateBindRenderbufferBase(context, target, renderbuffer); in ValidateBindRenderbuffer()
3918 static bool ValidBlendEquationMode(const Context *context, GLenum mode) in ValidBlendEquationMode() argument
3929 return context->getClientVersion() >= ES_3_0 || context->getExtensions().blendMinMax; in ValidBlendEquationMode()
3936 bool ValidateBlendColor(const Context *context, in ValidateBlendColor() argument
3945 bool ValidateBlendEquation(const Context *context, GLenum mode) in ValidateBlendEquation() argument
3947 if (!ValidBlendEquationMode(context, mode)) in ValidateBlendEquation()
3949 context->validationError(GL_INVALID_ENUM, kInvalidBlendEquation); in ValidateBlendEquation()
3956 bool ValidateBlendEquationSeparate(const Context *context, GLenum modeRGB, GLenum modeAlpha) in ValidateBlendEquationSeparate() argument
3958 if (!ValidBlendEquationMode(context, modeRGB)) in ValidateBlendEquationSeparate()
3960 context->validationError(GL_INVALID_ENUM, kInvalidBlendEquation); in ValidateBlendEquationSeparate()
3964 if (!ValidBlendEquationMode(context, modeAlpha)) in ValidateBlendEquationSeparate()
3966 context->validationError(GL_INVALID_ENUM, kInvalidBlendEquation); in ValidateBlendEquationSeparate()
3973 bool ValidateBlendFunc(const Context *context, GLenum sfactor, GLenum dfactor) in ValidateBlendFunc() argument
3975 return ValidateBlendFuncSeparate(context, sfactor, dfactor, sfactor, dfactor); in ValidateBlendFunc()
3978 bool ValidateBlendFuncSeparate(const Context *context, in ValidateBlendFuncSeparate() argument
3984 if (!ValidSrcBlendFunc(context, srcRGB)) in ValidateBlendFuncSeparate()
3986 context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction); in ValidateBlendFuncSeparate()
3990 if (!ValidDstBlendFunc(context, dstRGB)) in ValidateBlendFuncSeparate()
3992 context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction); in ValidateBlendFuncSeparate()
3996 if (!ValidSrcBlendFunc(context, srcAlpha)) in ValidateBlendFuncSeparate()
3998 context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction); in ValidateBlendFuncSeparate()
4002 if (!ValidDstBlendFunc(context, dstAlpha)) in ValidateBlendFuncSeparate()
4004 context->validationError(GL_INVALID_ENUM, kInvalidBlendFunction); in ValidateBlendFuncSeparate()
4008 if (context->getLimitations().noSimultaneousConstantColorAndAlphaBlendFunc || in ValidateBlendFuncSeparate()
4009 context->getExtensions().webglCompatibility) in ValidateBlendFuncSeparate()
4021 if (context->getExtensions().webglCompatibility) in ValidateBlendFuncSeparate()
4023 context->validationError(GL_INVALID_OPERATION, kInvalidConstantColor); in ValidateBlendFuncSeparate()
4028 context->validationError(GL_INVALID_OPERATION, kConstantColorAlphaLimitation); in ValidateBlendFuncSeparate()
4036 bool ValidateGetString(const Context *context, GLenum name) in ValidateGetString() argument
4048 if (!context->getExtensions().requestExtension) in ValidateGetString()
4050 context->validationError(GL_INVALID_ENUM, kInvalidName); in ValidateGetString()
4056 if (!context->getExtensions().getSerializedContextStringANGLE) in ValidateGetString()
4058 context->validationError(GL_INVALID_ENUM, kInvalidName); in ValidateGetString()
4064 context->validationError(GL_INVALID_ENUM, kInvalidName); in ValidateGetString()
4071 bool ValidateLineWidth(const Context *context, GLfloat width) in ValidateLineWidth() argument
4075 context->validationError(GL_INVALID_VALUE, kInvalidWidth); in ValidateLineWidth()
4082 bool ValidateDepthRangef(const Context *context, GLfloat zNear, GLfloat zFar) in ValidateDepthRangef() argument
4084 if (context->getExtensions().webglCompatibility && zNear > zFar) in ValidateDepthRangef()
4086 context->validationError(GL_INVALID_OPERATION, kInvalidDepthRange); in ValidateDepthRangef()
4093 bool ValidateRenderbufferStorage(const Context *context, in ValidateRenderbufferStorage() argument
4099 return ValidateRenderbufferStorageParametersBase(context, target, 0, internalformat, width, in ValidateRenderbufferStorage()
4103 bool ValidateRenderbufferStorageMultisampleANGLE(const Context *context, in ValidateRenderbufferStorageMultisampleANGLE() argument
4110 if (!context->getExtensions().framebufferMultisample) in ValidateRenderbufferStorageMultisampleANGLE()
4112 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateRenderbufferStorageMultisampleANGLE()
4117 // to MAX_SAMPLES_ANGLE (Context::getCaps().maxSamples) otherwise GL_INVALID_VALUE is in ValidateRenderbufferStorageMultisampleANGLE()
4119 if (samples > context->getCaps().maxSamples) in ValidateRenderbufferStorageMultisampleANGLE()
4121 context->validationError(GL_INVALID_VALUE, kSamplesOutOfRange); in ValidateRenderbufferStorageMultisampleANGLE()
4128 // The TextureCaps::getMaxSamples method is only guarenteed to be valid when the context is ES3. in ValidateRenderbufferStorageMultisampleANGLE()
4129 if (context->getClientMajorVersion() >= 3) in ValidateRenderbufferStorageMultisampleANGLE()
4131 const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); in ValidateRenderbufferStorageMultisampleANGLE()
4134 context->validationError(GL_OUT_OF_MEMORY, kSamplesOutOfRange); in ValidateRenderbufferStorageMultisampleANGLE()
4139 return ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, in ValidateRenderbufferStorageMultisampleANGLE()
4143 bool ValidateCheckFramebufferStatus(const Context *context, GLenum target) in ValidateCheckFramebufferStatus() argument
4145 if (!ValidFramebufferTarget(context, target)) in ValidateCheckFramebufferStatus()
4147 context->validationError(GL_INVALID_ENUM, kInvalidFramebufferTarget); in ValidateCheckFramebufferStatus()
4154 bool ValidateClearColor(const Context *context, in ValidateClearColor() argument
4163 bool ValidateClearDepthf(const Context *context, GLfloat depth) in ValidateClearDepthf() argument
4168 bool ValidateClearStencil(const Context *context, GLint s) in ValidateClearStencil() argument
4173 bool ValidateColorMask(const Context *context, in ValidateColorMask() argument
4182 bool ValidateCompileShader(const Context *context, ShaderProgramID shader) in ValidateCompileShader() argument
4187 bool ValidateCreateProgram(const Context *context) in ValidateCreateProgram() argument
4192 bool ValidateCullFace(const Context *context, CullFaceMode mode) in ValidateCullFace() argument
4202 context->validationError(GL_INVALID_ENUM, kInvalidCullMode); in ValidateCullFace()
4209 bool ValidateDeleteProgram(const Context *context, ShaderProgramID program) in ValidateDeleteProgram() argument
4216 if (!context->getProgramResolveLink(program)) in ValidateDeleteProgram()
4218 if (context->getShader(program)) in ValidateDeleteProgram()
4220 context->validationError(GL_INVALID_OPERATION, kExpectedProgramName); in ValidateDeleteProgram()
4225 context->validationError(GL_INVALID_VALUE, kInvalidProgramName); in ValidateDeleteProgram()
4233 bool ValidateDeleteShader(const Context *context, ShaderProgramID shader) in ValidateDeleteShader() argument
4240 if (!context->getShader(shader)) in ValidateDeleteShader()
4242 if (context->getProgramResolveLink(shader)) in ValidateDeleteShader()
4244 context->validationError(GL_INVALID_OPERATION, kInvalidShaderName); in ValidateDeleteShader()
4249 context->validationError(GL_INVALID_VALUE, kExpectedShaderName); in ValidateDeleteShader()
4257 bool ValidateDepthFunc(const Context *context, GLenum func) in ValidateDepthFunc() argument
4272 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateDepthFunc()
4279 bool ValidateDepthMask(const Context *context, GLboolean flag) in ValidateDepthMask() argument
4284 bool ValidateDetachShader(const Context *context, ShaderProgramID program, ShaderProgramID shader) in ValidateDetachShader() argument
4286 Program *programObject = GetValidProgram(context, program); in ValidateDetachShader()
4292 Shader *shaderObject = GetValidShader(context, shader); in ValidateDetachShader()
4301 context->validationError(GL_INVALID_OPERATION, kShaderToDetachMustBeAttached); in ValidateDetachShader()
4308 bool ValidateDisableVertexAttribArray(const Context *context, GLuint index) in ValidateDisableVertexAttribArray() argument
4312 context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute); in ValidateDisableVertexAttribArray()
4319 bool ValidateEnableVertexAttribArray(const Context *context, GLuint index) in ValidateEnableVertexAttribArray() argument
4323 context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute); in ValidateEnableVertexAttribArray()
4330 bool ValidateFinish(const Context *context) in ValidateFinish() argument
4335 bool ValidateFlush(const Context *context) in ValidateFlush() argument
4340 bool ValidateFrontFace(const Context *context, GLenum mode) in ValidateFrontFace() argument
4348 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateFrontFace()
4355 bool ValidateGetActiveAttrib(const Context *context, in ValidateGetActiveAttrib() argument
4366 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetActiveAttrib()
4370 Program *programObject = GetValidProgram(context, program); in ValidateGetActiveAttrib()
4379 context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxActiveUniform); in ValidateGetActiveAttrib()
4386 bool ValidateGetActiveUniform(const Context *context, in ValidateGetActiveUniform() argument
4397 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetActiveUniform()
4401 Program *programObject = GetValidProgram(context, program); in ValidateGetActiveUniform()
4410 context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxActiveUniform); in ValidateGetActiveUniform()
4417 bool ValidateGetAttachedShaders(const Context *context, in ValidateGetAttachedShaders() argument
4425 context->validationError(GL_INVALID_VALUE, kNegativeMaxCount); in ValidateGetAttachedShaders()
4429 Program *programObject = GetValidProgram(context, program); in ValidateGetAttachedShaders()
4439 bool ValidateGetAttribLocation(const Context *context, ShaderProgramID program, const GLchar *name) in ValidateGetAttribLocation() argument
4443 if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name))) in ValidateGetAttribLocation()
4445 context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters); in ValidateGetAttribLocation()
4449 Program *programObject = GetValidProgram(context, program); in ValidateGetAttribLocation()
4453 context->validationError(GL_INVALID_OPERATION, kProgramNotBound); in ValidateGetAttribLocation()
4459 context->validationError(GL_INVALID_OPERATION, kProgramNotLinked); in ValidateGetAttribLocation()
4466 bool ValidateGetBooleanv(const Context *context, GLenum pname, const GLboolean *params) in ValidateGetBooleanv() argument
4470 return ValidateStateQuery(context, pname, &nativeType, &numParams); in ValidateGetBooleanv()
4473 bool ValidateGetError(const Context *context) in ValidateGetError() argument
4478 bool ValidateGetFloatv(const Context *context, GLenum pname, const GLfloat *params) in ValidateGetFloatv() argument
4482 return ValidateStateQuery(context, pname, &nativeType, &numParams); in ValidateGetFloatv()
4485 bool ValidateGetIntegerv(const Context *context, GLenum pname, const GLint *params) in ValidateGetIntegerv() argument
4489 return ValidateStateQuery(context, pname, &nativeType, &numParams); in ValidateGetIntegerv()
4492 bool ValidateGetProgramInfoLog(const Context *context, in ValidateGetProgramInfoLog() argument
4500 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetProgramInfoLog()
4504 Program *programObject = GetValidProgram(context, program); in ValidateGetProgramInfoLog()
4513 bool ValidateGetShaderInfoLog(const Context *context, in ValidateGetShaderInfoLog() argument
4521 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetShaderInfoLog()
4525 Shader *shaderObject = GetValidShader(context, shader); in ValidateGetShaderInfoLog()
4534 bool ValidateGetShaderPrecisionFormat(const Context *context, in ValidateGetShaderPrecisionFormat() argument
4546 context->validationError(GL_INVALID_OPERATION, kUnimplementedComputeShaderPrecision); in ValidateGetShaderPrecisionFormat()
4549 context->validationError(GL_INVALID_ENUM, kInvalidShaderType); in ValidateGetShaderPrecisionFormat()
4564 context->validationError(GL_INVALID_ENUM, kInvalidPrecision); in ValidateGetShaderPrecisionFormat()
4571 bool ValidateGetShaderSource(const Context *context, in ValidateGetShaderSource() argument
4579 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetShaderSource()
4583 Shader *shaderObject = GetValidShader(context, shader); in ValidateGetShaderSource()
4592 bool ValidateGetUniformLocation(const Context *context, ShaderProgramID program, const GLchar *name) in ValidateGetUniformLocation() argument
4601 if (context->getExtensions().webglCompatibility && !IsValidESSLString(name, strlen(name))) in ValidateGetUniformLocation()
4603 context->validationError(GL_INVALID_VALUE, kInvalidNameCharacters); in ValidateGetUniformLocation()
4607 Program *programObject = GetValidProgram(context, program); in ValidateGetUniformLocation()
4616 context->validationError(GL_INVALID_OPERATION, kProgramNotLinked); in ValidateGetUniformLocation()
4623 bool ValidateHint(const Context *context, GLenum target, GLenum mode) in ValidateHint() argument
4633 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateHint()
4643 if (!context->getExtensions().textureFilteringCHROMIUM) in ValidateHint()
4645 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateHint()
4651 if (context->getClientVersion() < ES_3_0 && in ValidateHint()
4652 !context->getExtensions().standardDerivativesOES) in ValidateHint()
4654 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateHint()
4663 if (context->getClientMajorVersion() >= 2) in ValidateHint()
4665 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateHint()
4671 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateHint()
4678 bool ValidateIsBuffer(const Context *context, BufferID buffer) in ValidateIsBuffer() argument
4683 bool ValidateIsFramebuffer(const Context *context, FramebufferID framebuffer) in ValidateIsFramebuffer() argument
4688 bool ValidateIsProgram(const Context *context, ShaderProgramID program) in ValidateIsProgram() argument
4693 bool ValidateIsRenderbuffer(const Context *context, RenderbufferID renderbuffer) in ValidateIsRenderbuffer() argument
4698 bool ValidateIsShader(const Context *context, ShaderProgramID shader) in ValidateIsShader() argument
4703 bool ValidateIsTexture(const Context *context, TextureID texture) in ValidateIsTexture() argument
4708 bool ValidatePixelStorei(const Context *context, GLenum pname, GLint param) in ValidatePixelStorei() argument
4710 if (context->getClientMajorVersion() < 3) in ValidatePixelStorei()
4716 context->validationError(GL_INVALID_ENUM, kInvalidPname); in ValidatePixelStorei()
4722 if (!context->getExtensions().unpackSubimage) in ValidatePixelStorei()
4724 context->validationError(GL_INVALID_ENUM, kInvalidPname); in ValidatePixelStorei()
4732 if (!context->getExtensions().packSubimage) in ValidatePixelStorei()
4734 context->validationError(GL_INVALID_ENUM, kInvalidPname); in ValidatePixelStorei()
4743 context->validationError(GL_INVALID_VALUE, kNegativeParam); in ValidatePixelStorei()
4752 context->validationError(GL_INVALID_VALUE, kInvalidUnpackAlignment); in ValidatePixelStorei()
4760 context->validationError(GL_INVALID_VALUE, kInvalidUnpackAlignment); in ValidatePixelStorei()
4766 if (!context->getExtensions().packReverseRowOrder) in ValidatePixelStorei()
4768 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidatePixelStorei()
4783 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidatePixelStorei()
4790 bool ValidatePolygonOffset(const Context *context, GLfloat factor, GLfloat units) in ValidatePolygonOffset() argument
4795 bool ValidateReleaseShaderCompiler(const Context *context) in ValidateReleaseShaderCompiler() argument
4800 bool ValidateSampleCoverage(const Context *context, GLfloat value, GLboolean invert) in ValidateSampleCoverage() argument
4805 bool ValidateScissor(const Context *context, GLint x, GLint y, GLsizei width, GLsizei height) in ValidateScissor() argument
4809 context->validationError(GL_INVALID_VALUE, kNegativeSize); in ValidateScissor()
4816 bool ValidateShaderBinary(const Context *context, in ValidateShaderBinary() argument
4823 const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; in ValidateShaderBinary()
4827 context->validationError(GL_INVALID_ENUM, kInvalidShaderBinaryFormat); in ValidateShaderBinary()
4834 bool ValidateShaderSource(const Context *context, in ValidateShaderSource() argument
4842 context->validationError(GL_INVALID_VALUE, kNegativeCount); in ValidateShaderSource()
4846 Shader *shaderObject = GetValidShader(context, shader); in ValidateShaderSource()
4855 bool ValidateStencilFunc(const Context *context, GLenum func, GLint ref, GLuint mask) in ValidateStencilFunc() argument
4859 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilFunc()
4866 bool ValidateStencilFuncSeparate(const Context *context, in ValidateStencilFuncSeparate() argument
4874 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilFuncSeparate()
4880 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilFuncSeparate()
4887 bool ValidateStencilMask(const Context *context, GLuint mask) in ValidateStencilMask() argument
4892 bool ValidateStencilMaskSeparate(const Context *context, GLenum face, GLuint mask) in ValidateStencilMaskSeparate() argument
4896 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilMaskSeparate()
4903 bool ValidateStencilOp(const Context *context, GLenum fail, GLenum zfail, GLenum zpass) in ValidateStencilOp() argument
4907 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilOp()
4913 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilOp()
4919 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilOp()
4926 bool ValidateStencilOpSeparate(const Context *context, in ValidateStencilOpSeparate() argument
4934 context->validationError(GL_INVALID_ENUM, kInvalidStencil); in ValidateStencilOpSeparate()
4938 return ValidateStencilOp(context, fail, zfail, zpass); in ValidateStencilOpSeparate()
4941 bool ValidateUniform1f(const Context *context, UniformLocation location, GLfloat x) in ValidateUniform1f() argument
4943 return ValidateUniform(context, GL_FLOAT, location, 1); in ValidateUniform1f()
4946 bool ValidateUniform1fv(const Context *context, in ValidateUniform1fv() argument
4951 return ValidateUniform(context, GL_FLOAT, location, count); in ValidateUniform1fv()
4954 bool ValidateUniform1i(const Context *context, UniformLocation location, GLint x) in ValidateUniform1i() argument
4956 return ValidateUniform1iv(context, location, 1, &x); in ValidateUniform1i()
4959 bool ValidateUniform2fv(const Context *context, in ValidateUniform2fv() argument
4964 return ValidateUniform(context, GL_FLOAT_VEC2, location, count); in ValidateUniform2fv()
4967 bool ValidateUniform2i(const Context *context, UniformLocation location, GLint x, GLint y) in ValidateUniform2i() argument
4969 return ValidateUniform(context, GL_INT_VEC2, location, 1); in ValidateUniform2i()
4972 bool ValidateUniform2iv(const Context *context, in ValidateUniform2iv() argument
4977 return ValidateUniform(context, GL_INT_VEC2, location, count); in ValidateUniform2iv()
4980 bool ValidateUniform3f(const Context *context, in ValidateUniform3f() argument
4986 return ValidateUniform(context, GL_FLOAT_VEC3, location, 1); in ValidateUniform3f()
4989 bool ValidateUniform3fv(const Context *context, in ValidateUniform3fv() argument
4994 return ValidateUniform(context, GL_FLOAT_VEC3, location, count); in ValidateUniform3fv()
4997 bool ValidateUniform3i(const Context *context, UniformLocation location, GLint x, GLint y, GLint z) in ValidateUniform3i() argument
4999 return ValidateUniform(context, GL_INT_VEC3, location, 1); in ValidateUniform3i()
5002 bool ValidateUniform3iv(const Context *context, in ValidateUniform3iv() argument
5007 return ValidateUniform(context, GL_INT_VEC3, location, count); in ValidateUniform3iv()
5010 bool ValidateUniform4f(const Context *context, in ValidateUniform4f() argument
5017 return ValidateUniform(context, GL_FLOAT_VEC4, location, 1); in ValidateUniform4f()
5020 bool ValidateUniform4fv(const Context *context, in ValidateUniform4fv() argument
5025 return ValidateUniform(context, GL_FLOAT_VEC4, location, count); in ValidateUniform4fv()
5028 bool ValidateUniform4i(const Context *context, in ValidateUniform4i() argument
5035 return ValidateUniform(context, GL_INT_VEC4, location, 1); in ValidateUniform4i()
5038 bool ValidateUniform4iv(const Context *context, in ValidateUniform4iv() argument
5043 return ValidateUniform(context, GL_INT_VEC4, location, count); in ValidateUniform4iv()
5046 bool ValidateUniformMatrix2fv(const Context *context, in ValidateUniformMatrix2fv() argument
5052 return ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose); in ValidateUniformMatrix2fv()
5055 bool ValidateUniformMatrix3fv(const Context *context, in ValidateUniformMatrix3fv() argument
5061 return ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose); in ValidateUniformMatrix3fv()
5064 bool ValidateUniformMatrix4fv(const Context *context, in ValidateUniformMatrix4fv() argument
5070 return ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose); in ValidateUniformMatrix4fv()
5073 bool ValidateValidateProgram(const Context *context, ShaderProgramID program) in ValidateValidateProgram() argument
5075 Program *programObject = GetValidProgram(context, program); in ValidateValidateProgram()
5085 bool ValidateVertexAttrib1f(const Context *context, GLuint index, GLfloat x) in ValidateVertexAttrib1f() argument
5087 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib1f()
5090 bool ValidateVertexAttrib1fv(const Context *context, GLuint index, const GLfloat *values) in ValidateVertexAttrib1fv() argument
5092 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib1fv()
5095 bool ValidateVertexAttrib2f(const Context *context, GLuint index, GLfloat x, GLfloat y) in ValidateVertexAttrib2f() argument
5097 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib2f()
5100 bool ValidateVertexAttrib2fv(const Context *context, GLuint index, const GLfloat *values) in ValidateVertexAttrib2fv() argument
5102 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib2fv()
5105 bool ValidateVertexAttrib3f(const Context *context, GLuint index, GLfloat x, GLfloat y, GLfloat z) in ValidateVertexAttrib3f() argument
5107 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib3f()
5110 bool ValidateVertexAttrib3fv(const Context *context, GLuint index, const GLfloat *values) in ValidateVertexAttrib3fv() argument
5112 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib3fv()
5115 bool ValidateVertexAttrib4f(const Context *context, in ValidateVertexAttrib4f() argument
5122 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib4f()
5125 bool ValidateVertexAttrib4fv(const Context *context, GLuint index, const GLfloat *values) in ValidateVertexAttrib4fv() argument
5127 return ValidateVertexAttribIndex(context, index); in ValidateVertexAttrib4fv()
5130 bool ValidateViewport(const Context *context, GLint x, GLint y, GLsizei width, GLsizei height) in ValidateViewport() argument
5134 context->validationError(GL_INVALID_VALUE, kViewportNegativeSize); in ValidateViewport()
5141 bool ValidateGetFramebufferAttachmentParameteriv(const Context *context, in ValidateGetFramebufferAttachmentParameteriv() argument
5147 return ValidateGetFramebufferAttachmentParameterivBase(context, target, attachment, pname, in ValidateGetFramebufferAttachmentParameteriv()
5151 bool ValidateGetProgramiv(const Context *context, in ValidateGetProgramiv() argument
5156 return ValidateGetProgramivBase(context, program, pname, nullptr); in ValidateGetProgramiv()
5159 bool ValidateCopyTexImage2D(const Context *context, in ValidateCopyTexImage2D() argument
5169 if (context->getClientMajorVersion() < 3) in ValidateCopyTexImage2D()
5171 return ValidateES2CopyTexImageParameters(context, target, level, internalformat, false, 0, in ValidateCopyTexImage2D()
5175 ASSERT(context->getClientMajorVersion() == 3); in ValidateCopyTexImage2D()
5176 return ValidateES3CopyTexImage2DParameters(context, target, level, internalformat, false, 0, 0, in ValidateCopyTexImage2D()
5180 bool ValidateCopyTexSubImage2D(const Context *context, in ValidateCopyTexSubImage2D() argument
5190 if (context->getClientMajorVersion() < 3) in ValidateCopyTexSubImage2D()
5192 return ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, in ValidateCopyTexSubImage2D()
5196 return ValidateES3CopyTexImage2DParameters(context, target, level, GL_NONE, true, xoffset, in ValidateCopyTexSubImage2D()
5200 bool ValidateCopyTexSubImage3DOES(const Context *context, in ValidateCopyTexSubImage3DOES() argument
5211 return ValidateCopyTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, x, y, width, in ValidateCopyTexSubImage3DOES()
5215 bool ValidateDeleteBuffers(const Context *context, GLint n, const BufferID *buffers) in ValidateDeleteBuffers() argument
5217 return ValidateGenOrDelete(context, n); in ValidateDeleteBuffers()
5220 bool ValidateDeleteFramebuffers(const Context *context, GLint n, const FramebufferID *framebuffers) in ValidateDeleteFramebuffers() argument
5222 return ValidateGenOrDelete(context, n); in ValidateDeleteFramebuffers()
5225 bool ValidateDeleteRenderbuffers(const Context *context, in ValidateDeleteRenderbuffers() argument
5229 return ValidateGenOrDelete(context, n); in ValidateDeleteRenderbuffers()
5232 bool ValidateDeleteTextures(const Context *context, GLint n, const TextureID *textures) in ValidateDeleteTextures() argument
5234 return ValidateGenOrDelete(context, n); in ValidateDeleteTextures()
5237 bool ValidateDisable(const Context *context, GLenum cap) in ValidateDisable() argument
5239 if (!ValidCap(context, cap, false)) in ValidateDisable()
5241 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateDisable()
5248 bool ValidateEnable(const Context *context, GLenum cap) in ValidateEnable() argument
5250 if (!ValidCap(context, cap, false)) in ValidateEnable()
5252 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateEnable()
5256 if (context->getLimitations().noSampleAlphaToCoverageSupport && in ValidateEnable()
5259 context->validationError(GL_INVALID_OPERATION, kNoSampleAlphaToCoveragesLimitation); in ValidateEnable()
5270 bool ValidateFramebufferRenderbuffer(const Context *context, in ValidateFramebufferRenderbuffer() argument
5276 return ValidateFramebufferRenderbufferBase(context, target, attachment, renderbuffertarget, in ValidateFramebufferRenderbuffer()
5280 bool ValidateFramebufferTexture2D(const Context *context, in ValidateFramebufferTexture2D() argument
5289 if (context->getClientMajorVersion() < 3 && !context->getExtensions().fboRenderMipmapOES && in ValidateFramebufferTexture2D()
5292 context->validationError(GL_INVALID_VALUE, kInvalidFramebufferTextureLevel); in ValidateFramebufferTexture2D()
5296 if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level)) in ValidateFramebufferTexture2D()
5303 Texture *tex = context->getTexture(texture); in ValidateFramebufferTexture2D()
5306 const Caps &caps = context->getCaps(); in ValidateFramebufferTexture2D()
5314 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateFramebufferTexture2D()
5319 context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); in ValidateFramebufferTexture2D()
5329 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateFramebufferTexture2D()
5334 context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch); in ValidateFramebufferTexture2D()
5349 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateFramebufferTexture2D()
5354 context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch); in ValidateFramebufferTexture2D()
5362 if (context->getClientVersion() < ES_3_1 && in ValidateFramebufferTexture2D()
5363 !context->getExtensions().textureMultisample) in ValidateFramebufferTexture2D()
5365 context->validationError(GL_INVALID_OPERATION, in ValidateFramebufferTexture2D()
5372 context->validationError(GL_INVALID_VALUE, kLevelNotZero); in ValidateFramebufferTexture2D()
5377 context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch); in ValidateFramebufferTexture2D()
5385 if (!context->getExtensions().yuvTargetEXT) in ValidateFramebufferTexture2D()
5387 context->validationError(GL_INVALID_OPERATION, kYUVTargetExtensionRequired); in ValidateFramebufferTexture2D()
5393 context->validationError(GL_INVALID_OPERATION, kInvalidAttachment); in ValidateFramebufferTexture2D()
5399 context->validationError(GL_INVALID_OPERATION, kTextureTargetMismatch); in ValidateFramebufferTexture2D()
5406 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateFramebufferTexture2D()
5414 bool ValidateFramebufferTexture3DOES(const Context *context, in ValidateFramebufferTexture3DOES() argument
5425 if (!context->getExtensions().texture3DOES) in ValidateFramebufferTexture3DOES()
5427 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateFramebufferTexture3DOES()
5433 if (context->getClientMajorVersion() < 3 && !context->getExtensions().fboRenderMipmapOES && in ValidateFramebufferTexture3DOES()
5436 context->validationError(GL_INVALID_VALUE, kInvalidFramebufferTextureLevel); in ValidateFramebufferTexture3DOES()
5440 if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level)) in ValidateFramebufferTexture3DOES()
5447 Texture *tex = context->getTexture(texture); in ValidateFramebufferTexture3DOES()
5450 const Caps &caps = context->getCaps(); in ValidateFramebufferTexture3DOES()
5458 context->validationError(GL_INVALID_VALUE, kInvalidMipLevel); in ValidateFramebufferTexture3DOES()
5463 context->validationError(GL_INVALID_VALUE, kInvalidZOffset); in ValidateFramebufferTexture3DOES()
5468 context->validationError(GL_INVALID_OPERATION, kInvalidTextureType); in ValidateFramebufferTexture3DOES()
5475 context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); in ValidateFramebufferTexture3DOES()
5483 bool ValidateGenBuffers(const Context *context, GLint n, const BufferID *buffers) in ValidateGenBuffers() argument
5485 return ValidateGenOrDelete(context, n); in ValidateGenBuffers()
5488 bool ValidateGenFramebuffers(const Context *context, GLint n, const FramebufferID *framebuffers) in ValidateGenFramebuffers() argument
5490 return ValidateGenOrDelete(context, n); in ValidateGenFramebuffers()
5493 bool ValidateGenRenderbuffers(const Context *context, GLint n, const RenderbufferID *renderbuffers) in ValidateGenRenderbuffers() argument
5495 return ValidateGenOrDelete(context, n); in ValidateGenRenderbuffers()
5498 bool ValidateGenTextures(const Context *context, GLint n, const TextureID *textures) in ValidateGenTextures() argument
5500 return ValidateGenOrDelete(context, n); in ValidateGenTextures()
5503 bool ValidateGenerateMipmap(const Context *context, TextureType target) in ValidateGenerateMipmap() argument
5505 return ValidateGenerateMipmapBase(context, target); in ValidateGenerateMipmap()
5508 bool ValidateGetBufferParameteriv(const Context *context, in ValidateGetBufferParameteriv() argument
5513 return ValidateGetBufferParameterBase(context, target, pname, false, nullptr); in ValidateGetBufferParameteriv()
5516 bool ValidateGetRenderbufferParameteriv(const Context *context, in ValidateGetRenderbufferParameteriv() argument
5521 return ValidateGetRenderbufferParameterivBase(context, target, pname, nullptr); in ValidateGetRenderbufferParameteriv()
5524 bool ValidateGetShaderiv(const Context *context, in ValidateGetShaderiv() argument
5529 return ValidateGetShaderivBase(context, shader, pname, nullptr); in ValidateGetShaderiv()
5532 bool ValidateGetTexParameterfv(const Context *context, in ValidateGetTexParameterfv() argument
5537 return ValidateGetTexParameterBase(context, target, pname, nullptr); in ValidateGetTexParameterfv()
5540 bool ValidateGetTexParameteriv(const Context *context, in ValidateGetTexParameteriv() argument
5545 return ValidateGetTexParameterBase(context, target, pname, nullptr); in ValidateGetTexParameteriv()
5548 bool ValidateGetTexParameterIivOES(const Context *context, in ValidateGetTexParameterIivOES() argument
5553 if (context->getClientMajorVersion() < 3) in ValidateGetTexParameterIivOES()
5555 context->validationError(GL_INVALID_OPERATION, kES3Required); in ValidateGetTexParameterIivOES()
5558 return ValidateGetTexParameterBase(context, target, pname, nullptr); in ValidateGetTexParameterIivOES()
5561 bool ValidateGetTexParameterIuivOES(const Context *context, in ValidateGetTexParameterIuivOES() argument
5566 if (context->getClientMajorVersion() < 3) in ValidateGetTexParameterIuivOES()
5568 context->validationError(GL_INVALID_OPERATION, kES3Required); in ValidateGetTexParameterIuivOES()
5571 return ValidateGetTexParameterBase(context, target, pname, nullptr); in ValidateGetTexParameterIuivOES()
5574 bool ValidateGetUniformfv(const Context *context, in ValidateGetUniformfv() argument
5579 return ValidateGetUniformBase(context, program, location); in ValidateGetUniformfv()
5582 bool ValidateGetUniformiv(const Context *context, in ValidateGetUniformiv() argument
5587 return ValidateGetUniformBase(context, program, location); in ValidateGetUniformiv()
5590 bool ValidateGetVertexAttribfv(const Context *context, in ValidateGetVertexAttribfv() argument
5595 return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, false); in ValidateGetVertexAttribfv()
5598 bool ValidateGetVertexAttribiv(const Context *context, in ValidateGetVertexAttribiv() argument
5603 return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, false); in ValidateGetVertexAttribiv()
5606 bool ValidateGetVertexAttribPointerv(const Context *context, in ValidateGetVertexAttribPointerv() argument
5611 return ValidateGetVertexAttribBase(context, index, pname, nullptr, true, false); in ValidateGetVertexAttribPointerv()
5614 bool ValidateIsEnabled(const Context *context, GLenum cap) in ValidateIsEnabled() argument
5616 if (!ValidCap(context, cap, true)) in ValidateIsEnabled()
5618 context->validationError(GL_INVALID_ENUM, kEnumNotSupported); in ValidateIsEnabled()
5625 bool ValidateLinkProgram(const Context *context, ShaderProgramID program) in ValidateLinkProgram() argument
5627 if (context->hasActiveTransformFeedback(program)) in ValidateLinkProgram()
5630 context->validationError(GL_INVALID_OPERATION, kTransformFeedbackActiveDuringLink); in ValidateLinkProgram()
5634 Program *programObject = GetValidProgram(context, program); in ValidateLinkProgram()
5643 bool ValidateReadPixels(const Context *context, in ValidateReadPixels() argument
5652 return ValidateReadPixelsBase(context, x, y, width, height, format, type, -1, nullptr, nullptr, in ValidateReadPixels()
5656 bool ValidateTexParameterf(const Context *context, TextureType target, GLenum pname, GLfloat param) in ValidateTexParameterf() argument
5658 return ValidateTexParameterBase(context, target, pname, -1, false, ¶m); in ValidateTexParameterf()
5661 bool ValidateTexParameterfv(const Context *context, in ValidateTexParameterfv() argument
5666 return ValidateTexParameterBase(context, target, pname, -1, true, params); in ValidateTexParameterfv()
5669 bool ValidateTexParameteri(const Context *context, TextureType target, GLenum pname, GLint param) in ValidateTexParameteri() argument
5671 return ValidateTexParameterBase(context, target, pname, -1, false, ¶m); in ValidateTexParameteri()
5674 bool ValidateTexParameteriv(const Context *context, in ValidateTexParameteriv() argument
5679 return ValidateTexParameterBase(context, target, pname, -1, true, params); in ValidateTexParameteriv()
5682 bool ValidateTexParameterIivOES(const Context *context, in ValidateTexParameterIivOES() argument
5687 if (context->getClientMajorVersion() < 3) in ValidateTexParameterIivOES()
5689 context->validationError(GL_INVALID_OPERATION, kES3Required); in ValidateTexParameterIivOES()
5692 return ValidateTexParameterBase(context, target, pname, -1, true, params); in ValidateTexParameterIivOES()
5695 bool ValidateTexParameterIuivOES(const Context *context, in ValidateTexParameterIuivOES() argument
5700 if (context->getClientMajorVersion() < 3) in ValidateTexParameterIuivOES()
5702 context->validationError(GL_INVALID_OPERATION, kES3Required); in ValidateTexParameterIuivOES()
5705 return ValidateTexParameterBase(context, target, pname, -1, true, params); in ValidateTexParameterIuivOES()
5708 bool ValidateUseProgram(const Context *context, ShaderProgramID program) in ValidateUseProgram() argument
5712 Program *programObject = context->getProgramResolveLink(program); in ValidateUseProgram()
5716 if (context->getShader(program)) in ValidateUseProgram()
5718 context->validationError(GL_INVALID_OPERATION, kExpectedProgramName); in ValidateUseProgram()
5723 context->validationError(GL_INVALID_VALUE, kInvalidProgramName); in ValidateUseProgram()
5729 context->validationError(GL_INVALID_OPERATION, kProgramNotLinked); in ValidateUseProgram()
5733 if (context->getState().isTransformFeedbackActiveUnpaused()) in ValidateUseProgram()
5736 context->validationError(GL_INVALID_OPERATION, kTransformFeedbackUseProgram); in ValidateUseProgram()
5743 bool ValidateDeleteFencesNV(const Context *context, GLsizei n, const FenceNVID *fences) in ValidateDeleteFencesNV() argument
5745 if (!context->getExtensions().fenceNV) in ValidateDeleteFencesNV()
5747 context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported); in ValidateDeleteFencesNV()
5753 context->validationError(GL_INVALID_VALUE, kNegativeCount); in ValidateDeleteFencesNV()
5760 bool ValidateFinishFenceNV(const Context *context, FenceNVID fence) in ValidateFinishFenceNV() argument
5762 if (!context->getExtensions().fenceNV) in ValidateFinishFenceNV()
5764 context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported); in ValidateFinishFenceNV()
5768 FenceNV *fenceObject = context->getFenceNV(fence); in ValidateFinishFenceNV()
5772 context->validationError(GL_INVALID_OPERATION, kInvalidFence); in ValidateFinishFenceNV()
5778 context->validationError(GL_INVALID_OPERATION, kInvalidFenceState); in ValidateFinishFenceNV()
5785 bool ValidateGenFencesNV(const Context *context, GLsizei n, const FenceNVID *fences) in ValidateGenFencesNV() argument
5787 if (!context->getExtensions().fenceNV) in ValidateGenFencesNV()
5789 context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported); in ValidateGenFencesNV()
5795 context->validationError(GL_INVALID_VALUE, kNegativeCount); in ValidateGenFencesNV()
5802 bool ValidateGetFenceivNV(const Context *context, in ValidateGetFenceivNV() argument
5807 if (!context->getExtensions().fenceNV) in ValidateGetFenceivNV()
5809 context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported); in ValidateGetFenceivNV()
5813 FenceNV *fenceObject = context->getFenceNV(fence); in ValidateGetFenceivNV()
5817 context->validationError(GL_INVALID_OPERATION, kInvalidFence); in ValidateGetFenceivNV()
5823 context->validationError(GL_INVALID_OPERATION, kInvalidFenceState); in ValidateGetFenceivNV()
5834 context->validationError(GL_INVALID_ENUM, kInvalidPname); in ValidateGetFenceivNV()
5841 bool ValidateGetGraphicsResetStatusEXT(const Context *context) in ValidateGetGraphicsResetStatusEXT() argument
5843 if (!context->getExtensions().robustness) in ValidateGetGraphicsResetStatusEXT()
5845 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetGraphicsResetStatusEXT()
5852 bool ValidateGetTranslatedShaderSourceANGLE(const Context *context, in ValidateGetTranslatedShaderSourceANGLE() argument
5858 if (!context->getExtensions().translatedShaderSource) in ValidateGetTranslatedShaderSourceANGLE()
5860 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateGetTranslatedShaderSourceANGLE()
5866 context->validationError(GL_INVALID_VALUE, kNegativeBufferSize); in ValidateGetTranslatedShaderSourceANGLE()
5870 Shader *shaderObject = context->getShader(shader); in ValidateGetTranslatedShaderSourceANGLE()
5874 context->validationError(GL_INVALID_OPERATION, kInvalidShaderName); in ValidateGetTranslatedShaderSourceANGLE()
5881 bool ValidateIsFenceNV(const Context *context, FenceNVID fence) in ValidateIsFenceNV() argument
5883 if (!context->getExtensions().fenceNV) in ValidateIsFenceNV()
5885 context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported); in ValidateIsFenceNV()
5892 bool ValidateSetFenceNV(const Context *context, FenceNVID fence, GLenum condition) in ValidateSetFenceNV() argument
5894 if (!context->getExtensions().fenceNV) in ValidateSetFenceNV()
5896 context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported); in ValidateSetFenceNV()
5902 context->validationError(GL_INVALID_ENUM, kInvalidFenceCondition); in ValidateSetFenceNV()
5906 FenceNV *fenceObject = context->getFenceNV(fence); in ValidateSetFenceNV()
5910 context->validationError(GL_INVALID_OPERATION, kInvalidFence); in ValidateSetFenceNV()
5917 bool ValidateTestFenceNV(const Context *context, FenceNVID fence) in ValidateTestFenceNV() argument
5919 if (!context->getExtensions().fenceNV) in ValidateTestFenceNV()
5921 context->validationError(GL_INVALID_OPERATION, kNVFenceNotSupported); in ValidateTestFenceNV()
5925 FenceNV *fenceObject = context->getFenceNV(fence); in ValidateTestFenceNV()
5929 context->validationError(GL_INVALID_OPERATION, kInvalidFence); in ValidateTestFenceNV()
5935 context->validationError(GL_INVALID_OPERATION, kInvalidFenceState); in ValidateTestFenceNV()
5942 bool ValidateTexStorage2DEXT(const Context *context, in ValidateTexStorage2DEXT() argument
5949 if (!context->getExtensions().textureStorage) in ValidateTexStorage2DEXT()
5951 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateTexStorage2DEXT()
5955 if (context->getClientMajorVersion() < 3) in ValidateTexStorage2DEXT()
5957 return ValidateES2TexStorageParametersBase(context, type, levels, internalformat, width, in ValidateTexStorage2DEXT()
5961 ASSERT(context->getClientMajorVersion() >= 3); in ValidateTexStorage2DEXT()
5962 return ValidateES3TexStorage2DParameters(context, type, levels, internalformat, width, height, in ValidateTexStorage2DEXT()
5966 bool ValidateVertexAttribDivisorANGLE(const Context *context, GLuint index, GLuint divisor) in ValidateVertexAttribDivisorANGLE() argument
5968 if (!context->getExtensions().instancedArraysANGLE) in ValidateVertexAttribDivisorANGLE()
5970 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateVertexAttribDivisorANGLE()
5976 context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute); in ValidateVertexAttribDivisorANGLE()
5980 if (context->getLimitations().attributeZeroRequiresZeroDivisorInEXT) in ValidateVertexAttribDivisorANGLE()
5984 context->validationError(GL_INVALID_OPERATION, kAttributeZeroRequiresDivisorLimitation); in ValidateVertexAttribDivisorANGLE()
5996 bool ValidateVertexAttribDivisorEXT(const Context *context, GLuint index, GLuint divisor) in ValidateVertexAttribDivisorEXT() argument
5998 if (!context->getExtensions().instancedArraysEXT) in ValidateVertexAttribDivisorEXT()
6000 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateVertexAttribDivisorEXT()
6006 context->validationError(GL_INVALID_VALUE, kIndexExceedsMaxVertexAttribute); in ValidateVertexAttribDivisorEXT()
6013 bool ValidateTexImage3DOES(const Context *context, in ValidateTexImage3DOES() argument
6025 return ValidateTexImage3D(context, target, level, internalformat, width, height, depth, border, in ValidateTexImage3DOES()
6029 bool ValidatePopGroupMarkerEXT(const Context *context) in ValidatePopGroupMarkerEXT() argument
6031 if (!context->getExtensions().debugMarker) in ValidatePopGroupMarkerEXT()
6035 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidatePopGroupMarkerEXT()
6042 bool ValidateTexStorage1DEXT(const Context *context, in ValidateTexStorage1DEXT() argument
6049 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateTexStorage1DEXT()
6053 bool ValidateTexStorage3DEXT(const Context *context, in ValidateTexStorage3DEXT() argument
6061 if (!context->getExtensions().textureStorage) in ValidateTexStorage3DEXT()
6063 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateTexStorage3DEXT()
6067 if (context->getClientMajorVersion() < 3) in ValidateTexStorage3DEXT()
6069 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateTexStorage3DEXT()
6073 return ValidateES3TexStorage3DParameters(context, target, levels, internalformat, width, height, in ValidateTexStorage3DEXT()
6077 bool ValidateMaxShaderCompilerThreadsKHR(const Context *context, GLuint count) in ValidateMaxShaderCompilerThreadsKHR() argument
6079 if (!context->getExtensions().parallelShaderCompile) in ValidateMaxShaderCompilerThreadsKHR()
6081 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateMaxShaderCompilerThreadsKHR()
6087 bool ValidateMultiDrawArraysANGLE(const Context *context, in ValidateMultiDrawArraysANGLE() argument
6093 if (!context->getExtensions().multiDraw) in ValidateMultiDrawArraysANGLE()
6095 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateMultiDrawArraysANGLE()
6100 if (!ValidateDrawArrays(context, mode, firsts[drawID], counts[drawID])) in ValidateMultiDrawArraysANGLE()
6108 bool ValidateMultiDrawElementsANGLE(const Context *context, in ValidateMultiDrawElementsANGLE() argument
6115 if (!context->getExtensions().multiDraw) in ValidateMultiDrawElementsANGLE()
6117 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateMultiDrawElementsANGLE()
6122 if (!ValidateDrawElements(context, mode, counts[drawID], type, indices[drawID])) in ValidateMultiDrawElementsANGLE()
6130 bool ValidateProvokingVertexANGLE(const Context *context, ProvokingVertexConvention modePacked) in ValidateProvokingVertexANGLE() argument
6132 if (!context->getExtensions().provokingVertex) in ValidateProvokingVertexANGLE()
6134 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateProvokingVertexANGLE()
6144 context->validationError(GL_INVALID_ENUM, kInvalidProvokingVertex); in ValidateProvokingVertexANGLE()
6151 bool ValidateFramebufferTexture2DMultisampleEXT(const Context *context, in ValidateFramebufferTexture2DMultisampleEXT() argument
6159 if (!context->getExtensions().multisampledRenderToTexture) in ValidateFramebufferTexture2DMultisampleEXT()
6161 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateFramebufferTexture2DMultisampleEXT()
6171 // must be less than or equal to MAX_SAMPLES_EXT (Context::getCaps().maxSamples) in ValidateFramebufferTexture2DMultisampleEXT()
6173 if (samples > context->getCaps().maxSamples) in ValidateFramebufferTexture2DMultisampleEXT()
6175 context->validationError(GL_INVALID_VALUE, kSamplesOutOfRange); in ValidateFramebufferTexture2DMultisampleEXT()
6179 if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level)) in ValidateFramebufferTexture2DMultisampleEXT()
6186 // The TextureCaps::getMaxSamples method is only guarenteed to be valid when the context is ES3. in ValidateFramebufferTexture2DMultisampleEXT()
6187 if (texture.value != 0 && context->getClientMajorVersion() >= 3) in ValidateFramebufferTexture2DMultisampleEXT()
6189 Texture *tex = context->getTexture(texture); in ValidateFramebufferTexture2DMultisampleEXT()
6191 const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); in ValidateFramebufferTexture2DMultisampleEXT()
6194 context->validationError(GL_INVALID_OPERATION, kSamplesOutOfRange); in ValidateFramebufferTexture2DMultisampleEXT()
6200 if (!context->getExtensions().multisampledRenderToTexture2 && in ValidateFramebufferTexture2DMultisampleEXT()
6203 context->validationError(GL_INVALID_ENUM, kInvalidAttachment); in ValidateFramebufferTexture2DMultisampleEXT()
6207 if (!ValidTexture2DDestinationTarget(context, textarget)) in ValidateFramebufferTexture2DMultisampleEXT()
6209 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in ValidateFramebufferTexture2DMultisampleEXT()
6216 bool ValidateRenderbufferStorageMultisampleEXT(const Context *context, in ValidateRenderbufferStorageMultisampleEXT() argument
6223 if (!context->getExtensions().multisampledRenderToTexture) in ValidateRenderbufferStorageMultisampleEXT()
6225 context->validationError(GL_INVALID_OPERATION, kExtensionNotEnabled); in ValidateRenderbufferStorageMultisampleEXT()
6228 if (!ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width, in ValidateRenderbufferStorageMultisampleEXT()
6235 // must be less than or equal to MAX_SAMPLES_EXT (Context::getCaps().maxSamples) in ValidateRenderbufferStorageMultisampleEXT()
6237 if (samples > context->getCaps().maxSamples) in ValidateRenderbufferStorageMultisampleEXT()
6239 context->validationError(GL_INVALID_VALUE, kSamplesOutOfRange); in ValidateRenderbufferStorageMultisampleEXT()
6246 // The TextureCaps::getMaxSamples method is only guarenteed to be valid when the context is ES3. in ValidateRenderbufferStorageMultisampleEXT()
6247 if (context->getClientMajorVersion() >= 3) in ValidateRenderbufferStorageMultisampleEXT()
6249 const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); in ValidateRenderbufferStorageMultisampleEXT()
6252 context->validationError(GL_OUT_OF_MEMORY, kSamplesOutOfRange); in ValidateRenderbufferStorageMultisampleEXT()
6260 void RecordBindTextureTypeError(const Context *context, TextureType target) in RecordBindTextureTypeError() argument
6262 ASSERT(!context->getStateCache().isValidBindTextureType(target)); in RecordBindTextureTypeError()
6267 ASSERT(!context->getExtensions().textureRectangle); in RecordBindTextureTypeError()
6268 context->validationError(GL_INVALID_ENUM, kTextureRectangleNotSupported); in RecordBindTextureTypeError()
6273 ASSERT(context->getClientMajorVersion() < 3); in RecordBindTextureTypeError()
6274 context->validationError(GL_INVALID_ENUM, kES3Required); in RecordBindTextureTypeError()
6278 ASSERT(context->getClientVersion() < Version(3, 1) && in RecordBindTextureTypeError()
6279 !context->getExtensions().textureMultisample); in RecordBindTextureTypeError()
6280 context->validationError(GL_INVALID_ENUM, kMultisampleTextureExtensionOrES31Required); in RecordBindTextureTypeError()
6284 ASSERT(!context->getExtensions().textureStorageMultisample2DArrayOES); in RecordBindTextureTypeError()
6285 context->validationError(GL_INVALID_ENUM, kMultisampleArrayExtensionRequired); in RecordBindTextureTypeError()
6289 ASSERT(!context->getExtensions().eglImageExternalOES && in RecordBindTextureTypeError()
6290 !context->getExtensions().eglStreamConsumerExternalNV); in RecordBindTextureTypeError()
6291 context->validationError(GL_INVALID_ENUM, kExternalTextureNotSupported); in RecordBindTextureTypeError()
6295 ASSERT(!context->getExtensions().webglVideoTexture); in RecordBindTextureTypeError()
6296 context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled); in RecordBindTextureTypeError()
6300 ASSERT(!context->getExtensions().textureBufferOES && in RecordBindTextureTypeError()
6301 !context->getExtensions().textureBufferEXT); in RecordBindTextureTypeError()
6302 context->validationError(GL_INVALID_ENUM, kExtensionNotEnabled); in RecordBindTextureTypeError()
6306 context->validationError(GL_INVALID_ENUM, kInvalidTextureTarget); in RecordBindTextureTypeError()