• Home
  • Raw
  • Download

Lines Matching full:functions

7 // renderergl_utils.cpp: Conversion functions and other utility routines
44 const char *GetString(const FunctionsGL *functions, GLenum name) in GetString() argument
46 return reinterpret_cast<const char *>(functions->getString(name)); in GetString()
49 bool IsMesa(const FunctionsGL *functions, std::array<int, 3> *version) in IsMesa() argument
53 if (functions->standard != STANDARD_GL_DESKTOP) in IsMesa()
58 std::string nativeVersionString(GetString(functions, GL_VERSION)); in IsMesa()
72 int getAdrenoNumber(const FunctionsGL *functions) in getAdrenoNumber() argument
77 const char *nativeGLRenderer = GetString(functions, GL_RENDERER); in getAdrenoNumber()
87 int getMaliTNumber(const FunctionsGL *functions) in getMaliTNumber() argument
92 const char *nativeGLRenderer = GetString(functions, GL_RENDERER); in getMaliTNumber()
101 int getMaliGNumber(const FunctionsGL *functions) in getMaliGNumber() argument
106 const char *nativeGLRenderer = GetString(functions, GL_RENDERER); in getMaliGNumber()
115 bool IsAdreno42xOr3xx(const FunctionsGL *functions) in IsAdreno42xOr3xx() argument
117 int number = getAdrenoNumber(functions); in IsAdreno42xOr3xx()
118 return number != 0 && getAdrenoNumber(functions) < 430; in IsAdreno42xOr3xx()
121 bool IsAdreno4xx(const FunctionsGL *functions) in IsAdreno4xx() argument
123 int number = getAdrenoNumber(functions); in IsAdreno4xx()
127 bool IsAdreno5xxOrOlder(const FunctionsGL *functions) in IsAdreno5xxOrOlder() argument
129 int number = getAdrenoNumber(functions); in IsAdreno5xxOrOlder()
133 bool IsAdreno5xx(const FunctionsGL *functions) in IsAdreno5xx() argument
135 int number = getAdrenoNumber(functions); in IsAdreno5xx()
139 bool IsMaliT8xxOrOlder(const FunctionsGL *functions) in IsMaliT8xxOrOlder() argument
141 int number = getMaliTNumber(functions); in IsMaliT8xxOrOlder()
145 bool IsMaliG31OrOlder(const FunctionsGL *functions) in IsMaliG31OrOlder() argument
147 int number = getMaliGNumber(functions); in IsMaliG31OrOlder()
166 bool IsAndroidEmulator(const FunctionsGL *functions) in IsAndroidEmulator() argument
169 const char *nativeGLRenderer = GetString(functions, GL_RENDERER); in IsAndroidEmulator()
173 bool IsPowerVrRogue(const FunctionsGL *functions) in IsPowerVrRogue() argument
176 const char *nativeGLRenderer = GetString(functions, GL_RENDERER); in IsPowerVrRogue()
180 void ClearErrors(const FunctionsGL *functions, in ClearErrors() argument
185 GLenum error = functions->getError(); in ClearErrors()
190 error = functions->getError(); in ClearErrors()
194 #define ANGLE_GL_CLEAR_ERRORS() ClearErrors(functions, __FILE__, __FUNCTION__, __LINE__)
202 VendorID GetVendorID(const FunctionsGL *functions) in GetVendorID() argument
204 std::string nativeVendorString(GetString(functions, GL_VENDOR)); in GetVendorID()
208 nativeVendorString += GetString(functions, GL_RENDERER); in GetVendorID()
242 uint32_t GetDeviceID(const FunctionsGL *functions) in GetDeviceID() argument
244 std::string nativeRendererString(GetString(functions, GL_RENDERER)); in GetDeviceID()
265 static bool MeetsRequirements(const FunctionsGL *functions, in MeetsRequirements() argument
274 if (!functions->hasExtension(extension)) in MeetsRequirements()
291 if (functions->version >= requirements.version) in MeetsRequirements()
299 if (!functions->hasExtension(extension)) in MeetsRequirements()
312 static bool CheckSizedInternalFormatTextureRenderability(const FunctionsGL *functions, in CheckSizedInternalFormatTextureRenderability() argument
321 functions->getIntegerv(GL_TEXTURE_BINDING_2D, &oldTextureBinding); in CheckSizedInternalFormatTextureRenderability()
325 functions->genTextures(1, &texture); in CheckSizedInternalFormatTextureRenderability()
326 functions->bindTexture(GL_TEXTURE_2D, texture); in CheckSizedInternalFormatTextureRenderability()
329 functions->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); in CheckSizedInternalFormatTextureRenderability()
332 functions, features, formatInfo.internalFormat, formatInfo.format, formatInfo.type); in CheckSizedInternalFormatTextureRenderability()
334 functions->texImage2D(GL_TEXTURE_2D, 0, texImageFormat.internalFormat, kTextureSize, in CheckSizedInternalFormatTextureRenderability()
339 functions->getIntegerv(GL_FRAMEBUFFER_BINDING, &oldFramebufferBinding); in CheckSizedInternalFormatTextureRenderability()
343 functions->genFramebuffers(1, &fbo); in CheckSizedInternalFormatTextureRenderability()
344 functions->bindFramebuffer(GL_FRAMEBUFFER, fbo); in CheckSizedInternalFormatTextureRenderability()
345 functions->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, in CheckSizedInternalFormatTextureRenderability()
348 bool supported = functions->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; in CheckSizedInternalFormatTextureRenderability()
351 functions->deleteFramebuffers(1, &fbo); in CheckSizedInternalFormatTextureRenderability()
352 functions->bindFramebuffer(GL_FRAMEBUFFER, static_cast<GLuint>(oldFramebufferBinding)); in CheckSizedInternalFormatTextureRenderability()
355 functions->deleteTextures(1, &texture); in CheckSizedInternalFormatTextureRenderability()
356 functions->bindTexture(GL_TEXTURE_2D, static_cast<GLuint>(oldTextureBinding)); in CheckSizedInternalFormatTextureRenderability()
363 ASSERT(functions->getError() == GL_NO_ERROR); in CheckSizedInternalFormatTextureRenderability()
367 static bool CheckInternalFormatRenderbufferRenderability(const FunctionsGL *functions, in CheckInternalFormatRenderbufferRenderability() argument
376 functions->getIntegerv(GL_RENDERBUFFER_BINDING, &oldRenderbufferBinding); in CheckInternalFormatRenderbufferRenderability()
380 functions->genRenderbuffers(1, &renderbuffer); in CheckInternalFormatRenderbufferRenderability()
381 functions->bindRenderbuffer(GL_RENDERBUFFER, renderbuffer); in CheckInternalFormatRenderbufferRenderability()
384 nativegl::GetRenderbufferFormat(functions, features, formatInfo.internalFormat); in CheckInternalFormatRenderbufferRenderability()
386 functions->renderbufferStorage(GL_RENDERBUFFER, renderbufferFormat.internalFormat, in CheckInternalFormatRenderbufferRenderability()
391 functions->getIntegerv(GL_FRAMEBUFFER_BINDING, &oldFramebufferBinding); in CheckInternalFormatRenderbufferRenderability()
395 functions->genFramebuffers(1, &fbo); in CheckInternalFormatRenderbufferRenderability()
396 functions->bindFramebuffer(GL_FRAMEBUFFER, fbo); in CheckInternalFormatRenderbufferRenderability()
397 functions->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, in CheckInternalFormatRenderbufferRenderability()
400 bool supported = functions->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; in CheckInternalFormatRenderbufferRenderability()
403 functions->deleteFramebuffers(1, &fbo); in CheckInternalFormatRenderbufferRenderability()
404 functions->bindFramebuffer(GL_FRAMEBUFFER, static_cast<GLuint>(oldFramebufferBinding)); in CheckInternalFormatRenderbufferRenderability()
407 functions->deleteRenderbuffers(1, &renderbuffer); in CheckInternalFormatRenderbufferRenderability()
408 functions->bindRenderbuffer(GL_RENDERBUFFER, static_cast<GLuint>(oldRenderbufferBinding)); in CheckInternalFormatRenderbufferRenderability()
415 ASSERT(functions->getError() == GL_NO_ERROR); in CheckInternalFormatRenderbufferRenderability()
427 static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, in GenerateTextureFormatCaps() argument
432 ASSERT(functions->getError() == GL_NO_ERROR); in GenerateTextureFormatCaps()
437 nativegl::GetInternalFormatInfo(internalFormat, functions->standard); in GenerateTextureFormatCaps()
438 textureCaps.texturable = MeetsRequirements(functions, formatInfo.texture); in GenerateTextureFormatCaps()
440 textureCaps.texturable && MeetsRequirements(functions, formatInfo.filter); in GenerateTextureFormatCaps()
441 textureCaps.textureAttachment = MeetsRequirements(functions, formatInfo.textureAttachment); in GenerateTextureFormatCaps()
442 textureCaps.renderbuffer = MeetsRequirements(functions, formatInfo.renderbuffer); in GenerateTextureFormatCaps()
450 if (functions->isAtLeastGLES(gl::Version(3, 0)) && in GenerateTextureFormatCaps()
451 functions->hasGLESExtension("GL_EXT_color_buffer_half_float")) in GenerateTextureFormatCaps()
465 CheckSizedInternalFormatTextureRenderability(functions, features, internalFormat); in GenerateTextureFormatCaps()
470 CheckInternalFormatRenderbufferRenderability(functions, features, internalFormat); in GenerateTextureFormatCaps()
476 if (textureCaps.renderbuffer && functions->getInternalformativ) in GenerateTextureFormatCaps()
491 functions->getInternalformativ(GL_RENDERBUFFER, queryInternalFormat, GL_NUM_SAMPLE_COUNTS, in GenerateTextureFormatCaps()
493 GLenum error = functions->getError(); in GenerateTextureFormatCaps()
504 functions->getInternalformativ(GL_RENDERBUFFER, queryInternalFormat, GL_SAMPLES, in GenerateTextureFormatCaps()
527 if (functions->getInternalformatSampleivNV) in GenerateTextureFormatCaps()
529 ASSERT(functions->getError() == GL_NO_ERROR); in GenerateTextureFormatCaps()
530 functions->getInternalformatSampleivNV(GL_RENDERBUFFER, queryInternalFormat, in GenerateTextureFormatCaps()
536 if (functions->getError() != GL_NO_ERROR) in GenerateTextureFormatCaps()
560 ASSERT(functions->getError() == GL_NO_ERROR); in GenerateTextureFormatCaps()
564 static GLint QuerySingleGLInt(const FunctionsGL *functions, GLenum name) in QuerySingleGLInt() argument
567 functions->getIntegerv(name, &result); in QuerySingleGLInt()
571 static GLint QuerySingleIndexGLInt(const FunctionsGL *functions, GLenum name, GLuint index) in QuerySingleIndexGLInt() argument
574 functions->getIntegeri_v(name, index, &result); in QuerySingleIndexGLInt()
578 static GLint QueryGLIntRange(const FunctionsGL *functions, GLenum name, size_t index) in QueryGLIntRange() argument
581 functions->getIntegerv(name, result); in QueryGLIntRange()
585 static GLint64 QuerySingleGLInt64(const FunctionsGL *functions, GLenum name) in QuerySingleGLInt64() argument
590 if (!functions->getInteger64v) in QuerySingleGLInt64()
593 functions->getIntegerv(name, &result); in QuerySingleGLInt64()
599 functions->getInteger64v(name, &result); in QuerySingleGLInt64()
604 static GLfloat QuerySingleGLFloat(const FunctionsGL *functions, GLenum name) in QuerySingleGLFloat() argument
607 functions->getFloatv(name, &result); in QuerySingleGLFloat()
611 static GLfloat QueryGLFloatRange(const FunctionsGL *functions, GLenum name, size_t index) in QueryGLFloatRange() argument
614 functions->getFloatv(name, result); in QueryGLFloatRange()
618 static gl::TypePrecision QueryTypePrecision(const FunctionsGL *functions, in QueryTypePrecision() argument
623 functions->getShaderPrecisionFormat(shaderType, precisionType, precision.range.data(), in QueryTypePrecision()
628 static GLint QueryQueryValue(const FunctionsGL *functions, GLenum target, GLenum name) in QueryQueryValue() argument
631 functions->getQueryiv(target, name, &result); in QueryQueryValue()
646 void GenerateCaps(const FunctionsGL *functions, in GenerateCaps() argument
663 GenerateTextureFormatCaps(functions, features, internalFormat, maxSupportedESVersion); in GenerateCaps()
673 if (functions->isAtLeastGL(gl::Version(4, 3)) || in GenerateCaps()
674 functions->hasGLExtension("GL_ARB_ES3_compatibility") || in GenerateCaps()
675 functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
677 caps->maxElementIndex = QuerySingleGLInt64(functions, GL_MAX_ELEMENT_INDEX); in GenerateCaps()
703 if (functions->isAtLeastGL(gl::Version(1, 2)) || functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
704 functions->hasGLESExtension("GL_OES_texture_3D")) in GenerateCaps()
706 caps->max3DTextureSize = std::min({QuerySingleGLInt(functions, GL_MAX_3D_TEXTURE_SIZE), in GenerateCaps()
715 caps->max2DTextureSize = std::min(QuerySingleGLInt(functions, GL_MAX_TEXTURE_SIZE), in GenerateCaps()
718 std::min(QuerySingleGLInt(functions, GL_MAX_CUBE_MAP_TEXTURE_SIZE), in GenerateCaps()
721 if (functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
722 functions->hasGLExtension("GL_EXT_texture_array") || in GenerateCaps()
723 functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
726 std::min({QuerySingleGLInt(functions, GL_MAX_ARRAY_TEXTURE_LAYERS), textureSizeLimit, in GenerateCaps()
735 if (functions->isAtLeastGL(gl::Version(1, 5)) || in GenerateCaps()
736 functions->hasGLExtension("GL_EXT_texture_lod_bias") || in GenerateCaps()
737 functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
739 caps->maxLODBias = QuerySingleGLFloat(functions, GL_MAX_TEXTURE_LOD_BIAS); in GenerateCaps()
746 if (functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
747 functions->hasGLExtension("GL_EXT_framebuffer_object") || in GenerateCaps()
748 functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
750 caps->maxRenderbufferSize = QuerySingleGLInt(functions, GL_MAX_RENDERBUFFER_SIZE); in GenerateCaps()
751 caps->maxColorAttachments = QuerySingleGLInt(functions, GL_MAX_COLOR_ATTACHMENTS); in GenerateCaps()
753 else if (functions->isAtLeastGLES(gl::Version(2, 0))) in GenerateCaps()
755 caps->maxRenderbufferSize = QuerySingleGLInt(functions, GL_MAX_RENDERBUFFER_SIZE); in GenerateCaps()
764 if (functions->isAtLeastGL(gl::Version(2, 0)) || in GenerateCaps()
765 functions->hasGLExtension("ARB_draw_buffers") || in GenerateCaps()
766 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
767 functions->hasGLESExtension("GL_EXT_draw_buffers")) in GenerateCaps()
769 caps->maxDrawBuffers = QuerySingleGLInt(functions, GL_MAX_DRAW_BUFFERS); in GenerateCaps()
780 QueryGLIntRange(functions, GL_MAX_VIEWPORT_DIMS, 0); // GL 1.0 / ES 2.0 in GenerateCaps()
782 QueryGLIntRange(functions, GL_MAX_VIEWPORT_DIMS, 1); // GL 1.0 / ES 2.0 in GenerateCaps()
784 if (functions->standard == STANDARD_GL_DESKTOP && in GenerateCaps()
785 (functions->profile & GL_CONTEXT_CORE_PROFILE_BIT) != 0) in GenerateCaps()
790 std::max(1.0f, QueryGLFloatRange(functions, GL_POINT_SIZE_RANGE, 0)); in GenerateCaps()
791 caps->maxAliasedPointSize = QueryGLFloatRange(functions, GL_POINT_SIZE_RANGE, 1); in GenerateCaps()
796 std::max(1.0f, QueryGLFloatRange(functions, GL_ALIASED_POINT_SIZE_RANGE, 0)); in GenerateCaps()
797 caps->maxAliasedPointSize = QueryGLFloatRange(functions, GL_ALIASED_POINT_SIZE_RANGE, 1); in GenerateCaps()
801 QueryGLFloatRange(functions, GL_ALIASED_LINE_WIDTH_RANGE, 0); // GL 1.2 / ES 2.0 in GenerateCaps()
803 QueryGLFloatRange(functions, GL_ALIASED_LINE_WIDTH_RANGE, 1); // GL 1.2 / ES 2.0 in GenerateCaps()
806 if (functions->isAtLeastGL(gl::Version(1, 2)) || functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
808 caps->maxElementsIndices = QuerySingleGLInt(functions, GL_MAX_ELEMENTS_INDICES); in GenerateCaps()
809 caps->maxElementsVertices = QuerySingleGLInt(functions, GL_MAX_ELEMENTS_VERTICES); in GenerateCaps()
816 if (functions->isAtLeastGL(gl::Version(4, 1)) || in GenerateCaps()
817 functions->hasGLExtension("GL_ARB_get_program_binary") || in GenerateCaps()
818 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
819 functions->hasGLESExtension("GL_OES_get_program_binary")) in GenerateCaps()
823 GLint numBinaryFormats = QuerySingleGLInt(functions, GL_NUM_PROGRAM_BINARY_FORMATS_OES); in GenerateCaps()
836 if (functions->isAtLeastGL(gl::Version(4, 1)) || in GenerateCaps()
837 functions->hasGLExtension("GL_ARB_ES2_compatibility") || in GenerateCaps()
838 functions->isAtLeastGLES(gl::Version(2, 0))) in GenerateCaps()
840 caps->vertexHighpFloat = QueryTypePrecision(functions, GL_VERTEX_SHADER, GL_HIGH_FLOAT); in GenerateCaps()
841 caps->vertexMediumpFloat = QueryTypePrecision(functions, GL_VERTEX_SHADER, GL_MEDIUM_FLOAT); in GenerateCaps()
842 caps->vertexLowpFloat = QueryTypePrecision(functions, GL_VERTEX_SHADER, GL_LOW_FLOAT); in GenerateCaps()
843 caps->fragmentHighpFloat = QueryTypePrecision(functions, GL_FRAGMENT_SHADER, GL_HIGH_FLOAT); in GenerateCaps()
845 QueryTypePrecision(functions, GL_FRAGMENT_SHADER, GL_MEDIUM_FLOAT); in GenerateCaps()
846 caps->fragmentLowpFloat = QueryTypePrecision(functions, GL_FRAGMENT_SHADER, GL_LOW_FLOAT); in GenerateCaps()
847 caps->vertexHighpInt = QueryTypePrecision(functions, GL_VERTEX_SHADER, GL_HIGH_INT); in GenerateCaps()
848 caps->vertexMediumpInt = QueryTypePrecision(functions, GL_VERTEX_SHADER, GL_MEDIUM_INT); in GenerateCaps()
849 caps->vertexLowpInt = QueryTypePrecision(functions, GL_VERTEX_SHADER, GL_LOW_INT); in GenerateCaps()
850 caps->fragmentHighpInt = QueryTypePrecision(functions, GL_FRAGMENT_SHADER, GL_HIGH_INT); in GenerateCaps()
851 caps->fragmentMediumpInt = QueryTypePrecision(functions, GL_FRAGMENT_SHADER, GL_MEDIUM_INT); in GenerateCaps()
852 caps->fragmentLowpInt = QueryTypePrecision(functions, GL_FRAGMENT_SHADER, GL_LOW_INT); in GenerateCaps()
871 if (functions->isAtLeastGL(gl::Version(3, 2)) || functions->hasGLExtension("GL_ARB_sync") || in GenerateCaps()
872 functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
876 std::max<GLint64>(QuerySingleGLInt64(functions, GL_MAX_SERVER_WAIT_TIMEOUT), 0); in GenerateCaps()
884 if (functions->isAtLeastGL(gl::Version(2, 0)) || functions->isAtLeastGLES(gl::Version(2, 0))) in GenerateCaps()
886 caps->maxVertexAttributes = QuerySingleGLInt(functions, GL_MAX_VERTEX_ATTRIBS); in GenerateCaps()
888 QuerySingleGLInt(functions, GL_MAX_VERTEX_UNIFORM_COMPONENTS); in GenerateCaps()
890 QuerySingleGLInt(functions, GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS); in GenerateCaps()
898 if (functions->isAtLeastGL(gl::Version(4, 1)) || in GenerateCaps()
899 functions->hasGLExtension("GL_ARB_ES2_compatibility") || in GenerateCaps()
900 functions->isAtLeastGLES(gl::Version(2, 0))) in GenerateCaps()
902 caps->maxVertexUniformVectors = QuerySingleGLInt(functions, GL_MAX_VERTEX_UNIFORM_VECTORS); in GenerateCaps()
904 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_UNIFORM_VECTORS); in GenerateCaps()
916 if (functions->isAtLeastGL(gl::Version(3, 2)) || functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
919 QuerySingleGLInt(functions, GL_MAX_VERTEX_OUTPUT_COMPONENTS); in GenerateCaps()
929 if (functions->isAtLeastGL(gl::Version(2, 0)) || functions->isAtLeastGLES(gl::Version(2, 0))) in GenerateCaps()
932 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_UNIFORM_COMPONENTS); in GenerateCaps()
934 QuerySingleGLInt(functions, GL_MAX_TEXTURE_IMAGE_UNITS); in GenerateCaps()
942 if (functions->isAtLeastGL(gl::Version(3, 2)) || functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
945 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_INPUT_COMPONENTS); in GenerateCaps()
954 if (functions->isAtLeastGL(gl::Version(3, 0)) || functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
956 caps->minProgramTexelOffset = QuerySingleGLInt(functions, GL_MIN_PROGRAM_TEXEL_OFFSET); in GenerateCaps()
957 caps->maxProgramTexelOffset = QuerySingleGLInt(functions, GL_MAX_PROGRAM_TEXEL_OFFSET); in GenerateCaps()
966 if (functions->isAtLeastGL(gl::Version(3, 1)) || in GenerateCaps()
967 functions->hasGLExtension("GL_ARB_uniform_buffer_object") || in GenerateCaps()
968 functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
971 QuerySingleGLInt(functions, GL_MAX_VERTEX_UNIFORM_BLOCKS); in GenerateCaps()
973 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_UNIFORM_BLOCKS); in GenerateCaps()
975 QuerySingleGLInt(functions, GL_MAX_UNIFORM_BUFFER_BINDINGS); in GenerateCaps()
976 caps->maxUniformBlockSize = QuerySingleGLInt64(functions, GL_MAX_UNIFORM_BLOCK_SIZE); in GenerateCaps()
978 QuerySingleGLInt(functions, GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT); in GenerateCaps()
980 QuerySingleGLInt(functions, GL_MAX_COMBINED_UNIFORM_BLOCKS); in GenerateCaps()
982 QuerySingleGLInt64(functions, GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS); in GenerateCaps()
984 QuerySingleGLInt64(functions, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS); in GenerateCaps()
992 if (functions->isAtLeastGL(gl::Version(3, 2)) && in GenerateCaps()
993 (functions->profile & GL_CONTEXT_CORE_PROFILE_BIT) != 0) in GenerateCaps()
995 caps->maxVaryingComponents = QuerySingleGLInt(functions, GL_MAX_VERTEX_OUTPUT_COMPONENTS); in GenerateCaps()
997 else if (functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
998 functions->hasGLExtension("GL_ARB_ES2_compatibility") || in GenerateCaps()
999 functions->isAtLeastGLES(gl::Version(2, 0))) in GenerateCaps()
1001 caps->maxVaryingComponents = QuerySingleGLInt(functions, GL_MAX_VARYING_COMPONENTS); in GenerateCaps()
1003 else if (functions->isAtLeastGL(gl::Version(2, 0))) in GenerateCaps()
1005 caps->maxVaryingComponents = QuerySingleGLInt(functions, GL_MAX_VARYING_FLOATS); in GenerateCaps()
1013 if (functions->isAtLeastGL(gl::Version(4, 1)) || in GenerateCaps()
1014 functions->hasGLExtension("GL_ARB_ES2_compatibility") || in GenerateCaps()
1015 functions->isAtLeastGLES(gl::Version(2, 0))) in GenerateCaps()
1017 caps->maxVaryingVectors = QuerySingleGLInt(functions, GL_MAX_VARYING_VECTORS); in GenerateCaps()
1029 QuerySingleGLInt(functions, GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS); in GenerateCaps()
1032 if (functions->isAtLeastGL(gl::Version(4, 0)) || in GenerateCaps()
1033 functions->hasGLExtension("GL_ARB_transform_feedback2") || in GenerateCaps()
1034 functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
1037 QuerySingleGLInt(functions, GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS); in GenerateCaps()
1039 QuerySingleGLInt(functions, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS); in GenerateCaps()
1041 QuerySingleGLInt(functions, GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS); in GenerateCaps()
1056 if (functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
1057 functions->hasGLExtension("GL_EXT_framebuffer_multisample") || in GenerateCaps()
1058 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1059 functions->hasGLESExtension("GL_EXT_multisampled_render_to_texture")) in GenerateCaps()
1061 caps->maxSamples = std::min(QuerySingleGLInt(functions, GL_MAX_SAMPLES), sampleCountLimit); in GenerateCaps()
1075 if (!functions->isAtLeastGL(gl::Version(3, 3)) && in GenerateCaps()
1076 !functions->hasGLExtension("GL_ARB_sampler_objects") && in GenerateCaps()
1077 !functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
1084 if (!functions->isAtLeastGL(gl::Version(3, 3)) && in GenerateCaps()
1085 !functions->hasGLExtension("GL_ARB_texture_swizzle") && in GenerateCaps()
1086 !functions->hasGLExtension("GL_EXT_texture_swizzle") && in GenerateCaps()
1087 !functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
1093 if (functions->profile & GL_CONTEXT_CORE_PROFILE_BIT) in GenerateCaps()
1101 if (!functions->isAtLeastGL(gl::Version(4, 2)) && in GenerateCaps()
1102 !(functions->isAtLeastGL(gl::Version(3, 2)) && in GenerateCaps()
1103 functions->hasGLExtension("GL_ARB_shader_bit_encoding")) && in GenerateCaps()
1104 !functions->hasGLExtension("GL_ARB_shading_language_packing") && in GenerateCaps()
1105 !functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
1112 if (!functions->isAtLeastGL(gl::Version(3, 3)) && in GenerateCaps()
1113 !functions->hasGLExtension("GL_ARB_explicit_attrib_location") && in GenerateCaps()
1114 !functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
1119 if (functions->isAtLeastGL(gl::Version(4, 3)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1120 functions->hasGLExtension("GL_ARB_framebuffer_no_attachments")) in GenerateCaps()
1122 caps->maxFramebufferWidth = QuerySingleGLInt(functions, GL_MAX_FRAMEBUFFER_WIDTH); in GenerateCaps()
1123 caps->maxFramebufferHeight = QuerySingleGLInt(functions, GL_MAX_FRAMEBUFFER_HEIGHT); in GenerateCaps()
1125 std::min(QuerySingleGLInt(functions, GL_MAX_FRAMEBUFFER_SAMPLES), sampleCountLimit); in GenerateCaps()
1132 if (functions->isAtLeastGL(gl::Version(3, 2)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1133 functions->hasGLExtension("GL_ARB_texture_multisample")) in GenerateCaps()
1135 caps->maxSampleMaskWords = QuerySingleGLInt(functions, GL_MAX_SAMPLE_MASK_WORDS); in GenerateCaps()
1137 std::min(QuerySingleGLInt(functions, GL_MAX_COLOR_TEXTURE_SAMPLES), sampleCountLimit); in GenerateCaps()
1139 std::min(QuerySingleGLInt(functions, GL_MAX_DEPTH_TEXTURE_SAMPLES), sampleCountLimit); in GenerateCaps()
1141 std::min(QuerySingleGLInt(functions, GL_MAX_INTEGER_SAMPLES), sampleCountLimit); in GenerateCaps()
1148 if (functions->isAtLeastGL(gl::Version(4, 3)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1149 functions->hasGLExtension("GL_ARB_vertex_attrib_binding")) in GenerateCaps()
1152 QuerySingleGLInt(functions, GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET); in GenerateCaps()
1153 caps->maxVertexAttribBindings = QuerySingleGLInt(functions, GL_MAX_VERTEX_ATTRIB_BINDINGS); in GenerateCaps()
1158 (functions->standard == STANDARD_GL_DESKTOP && functions->version == gl::Version(4, 3))) in GenerateCaps()
1164 caps->maxVertexAttribStride = QuerySingleGLInt(functions, GL_MAX_VERTEX_ATTRIB_STRIDE); in GenerateCaps()
1172 if (functions->isAtLeastGL(gl::Version(4, 3)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1173 functions->hasGLExtension("GL_ARB_shader_storage_buffer_object")) in GenerateCaps()
1176 QuerySingleGLInt(functions, GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES); in GenerateCaps()
1178 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS); in GenerateCaps()
1180 QuerySingleGLInt(functions, GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS); in GenerateCaps()
1182 QuerySingleGLInt(functions, GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS); in GenerateCaps()
1184 QuerySingleGLInt64(functions, GL_MAX_SHADER_STORAGE_BLOCK_SIZE); in GenerateCaps()
1186 QuerySingleGLInt(functions, GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS); in GenerateCaps()
1188 QuerySingleGLInt(functions, GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT); in GenerateCaps()
1195 if (nativegl::SupportsCompute(functions)) in GenerateCaps()
1200 QuerySingleIndexGLInt(functions, GL_MAX_COMPUTE_WORK_GROUP_COUNT, index); in GenerateCaps()
1203 QuerySingleIndexGLInt(functions, GL_MAX_COMPUTE_WORK_GROUP_SIZE, index); in GenerateCaps()
1206 QuerySingleGLInt(functions, GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS); in GenerateCaps()
1208 QuerySingleGLInt(functions, GL_MAX_COMPUTE_UNIFORM_BLOCKS); in GenerateCaps()
1210 QuerySingleGLInt(functions, GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS); in GenerateCaps()
1212 QuerySingleGLInt(functions, GL_MAX_COMPUTE_SHARED_MEMORY_SIZE); in GenerateCaps()
1214 QuerySingleGLInt(functions, GL_MAX_COMPUTE_UNIFORM_COMPONENTS); in GenerateCaps()
1216 QuerySingleGLInt(functions, GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS); in GenerateCaps()
1218 QuerySingleGLInt(functions, GL_MAX_COMPUTE_ATOMIC_COUNTERS); in GenerateCaps()
1220 QuerySingleGLInt(functions, GL_MAX_COMPUTE_IMAGE_UNIFORMS); in GenerateCaps()
1222 QuerySingleGLInt(functions, GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS); in GenerateCaps()
1224 QuerySingleGLInt(functions, GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS); in GenerateCaps()
1231 if (functions->isAtLeastGL(gl::Version(4, 3)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1232 functions->hasGLExtension("GL_ARB_explicit_uniform_location")) in GenerateCaps()
1234 caps->maxUniformLocations = QuerySingleGLInt(functions, GL_MAX_UNIFORM_LOCATIONS); in GenerateCaps()
1241 if (functions->isAtLeastGL(gl::Version(4, 0)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1242 functions->hasGLExtension("GL_ARB_texture_gather")) in GenerateCaps()
1245 QuerySingleGLInt(functions, GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET); in GenerateCaps()
1247 QuerySingleGLInt(functions, GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET); in GenerateCaps()
1254 if (functions->isAtLeastGL(gl::Version(4, 2)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1255 functions->hasGLExtension("GL_ARB_shader_image_load_store")) in GenerateCaps()
1258 QuerySingleGLInt(functions, GL_MAX_VERTEX_IMAGE_UNIFORMS); in GenerateCaps()
1260 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_IMAGE_UNIFORMS); in GenerateCaps()
1261 caps->maxImageUnits = QuerySingleGLInt(functions, GL_MAX_IMAGE_UNITS); in GenerateCaps()
1263 QuerySingleGLInt(functions, GL_MAX_COMBINED_IMAGE_UNIFORMS); in GenerateCaps()
1270 if (functions->isAtLeastGL(gl::Version(4, 2)) || functions->isAtLeastGLES(gl::Version(3, 1)) || in GenerateCaps()
1271 functions->hasGLExtension("GL_ARB_shader_atomic_counters")) in GenerateCaps()
1274 QuerySingleGLInt(functions, GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS); in GenerateCaps()
1276 QuerySingleGLInt(functions, GL_MAX_VERTEX_ATOMIC_COUNTERS); in GenerateCaps()
1278 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS); in GenerateCaps()
1280 QuerySingleGLInt(functions, GL_MAX_FRAGMENT_ATOMIC_COUNTERS); in GenerateCaps()
1282 QuerySingleGLInt(functions, GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS); in GenerateCaps()
1284 QuerySingleGLInt(functions, GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE); in GenerateCaps()
1286 QuerySingleGLInt(functions, GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS); in GenerateCaps()
1288 QuerySingleGLInt(functions, GL_MAX_COMBINED_ATOMIC_COUNTERS); in GenerateCaps()
1310 if (!CanMapBufferForRead(functions)) in GenerateCaps()
1316 if (functions->isAtLeastGL(gl::Version(4, 0)) || in GenerateCaps()
1317 functions->hasGLESExtension("GL_OES_texture_cube_map_array") || in GenerateCaps()
1318 functions->hasGLESExtension("GL_EXT_texture_cube_map_array") || in GenerateCaps()
1319 functions->hasGLExtension("GL_ARB_texture_cube_map_array") || in GenerateCaps()
1320 functions->isAtLeastGLES(gl::Version(3, 2))) in GenerateCaps()
1331 if (!nativegl::SupportsVertexArrayObjects(functions) || in GenerateCaps()
1342 functions->hasExtension("GL_KHR_texture_compression_astc_hdr"); in GenerateCaps()
1345 functions->hasExtension("GL_KHR_texture_compression_astc_sliced_3d")) || in GenerateCaps()
1347 extensions->elementIndexUintOES = functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1348 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1349 functions->hasGLESExtension("GL_OES_element_index_uint"); in GenerateCaps()
1351 extensions->readFormatBGRA = functions->isAtLeastGL(gl::Version(1, 2)) || in GenerateCaps()
1352 functions->hasGLExtension("GL_EXT_bgra") || in GenerateCaps()
1353 functions->hasGLESExtension("GL_EXT_read_format_bgra"); in GenerateCaps()
1354 extensions->pixelBufferObjectNV = functions->isAtLeastGL(gl::Version(2, 1)) || in GenerateCaps()
1355 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1356 functions->hasGLExtension("GL_ARB_pixel_buffer_object") || in GenerateCaps()
1357 functions->hasGLExtension("GL_EXT_pixel_buffer_object") || in GenerateCaps()
1358 functions->hasGLESExtension("GL_NV_pixel_buffer_object"); in GenerateCaps()
1359 extensions->glSyncARB = nativegl::SupportsFenceSync(functions); in GenerateCaps()
1360 extensions->mapBufferOES = functions->isAtLeastGL(gl::Version(1, 5)) || in GenerateCaps()
1361 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1362 functions->hasGLESExtension("GL_OES_mapbuffer"); in GenerateCaps()
1363 extensions->mapBufferRange = functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
1364 functions->hasGLExtension("GL_ARB_map_buffer_range") || in GenerateCaps()
1365 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1366 functions->hasGLESExtension("GL_EXT_map_buffer_range"); in GenerateCaps()
1367 extensions->textureNPOTOES = functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1368 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1369 functions->hasGLESExtension("GL_OES_texture_npot"); in GenerateCaps()
1371 extensions->drawBuffers = functions->isAtLeastGL(gl::Version(2, 0)) || in GenerateCaps()
1372 functions->hasGLExtension("ARB_draw_buffers") || in GenerateCaps()
1373 functions->hasGLESExtension("GL_EXT_draw_buffers"); in GenerateCaps()
1376 (functions->isAtLeastGL(gl::Version(4, 0)) || in GenerateCaps()
1377 (functions->hasGLExtension("GL_EXT_draw_buffers2") && in GenerateCaps()
1378 functions->hasGLExtension("GL_ARB_draw_buffers_blend")) || in GenerateCaps()
1379 functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1380 functions->hasGLESExtension("GL_OES_draw_buffers_indexed") || in GenerateCaps()
1381 functions->hasGLESExtension("GL_EXT_draw_buffers_indexed")); in GenerateCaps()
1383 extensions->textureStorage = functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1384 functions->hasGLESExtension("GL_EXT_texture_storage"); in GenerateCaps()
1386 functions->hasGLExtension("GL_EXT_texture_filter_anisotropic") || in GenerateCaps()
1387 functions->hasGLESExtension("GL_EXT_texture_filter_anisotropic"); in GenerateCaps()
1388 extensions->occlusionQueryBoolean = nativegl::SupportsOcclusionQueries(functions); in GenerateCaps()
1391 ? QuerySingleGLFloat(functions, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT) in GenerateCaps()
1393 extensions->fenceNV = FenceNVGL::Supported(functions) || FenceNVSyncGL::Supported(functions); in GenerateCaps()
1394 extensions->blendMinMax = functions->isAtLeastGL(gl::Version(1, 5)) || in GenerateCaps()
1395 functions->hasGLExtension("GL_EXT_blend_minmax") || in GenerateCaps()
1396 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1397 functions->hasGLESExtension("GL_EXT_blend_minmax"); in GenerateCaps()
1398 extensions->framebufferBlitNV = functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
1399 functions->hasGLExtension("GL_EXT_framebuffer_blit") || in GenerateCaps()
1400 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1401 functions->hasGLESExtension("GL_NV_framebuffer_blit"); in GenerateCaps()
1403 extensions->framebufferBlitNV || functions->hasGLESExtension("GL_ANGLE_framebuffer_blit"); in GenerateCaps()
1407 (functions->hasGLESExtension("GL_EXT_multisampled_render_to_texture") || in GenerateCaps()
1408 functions->hasGLESExtension("GL_IMG_multisampled_render_to_texture")); in GenerateCaps()
1412 functions->hasGLESExtension("GL_EXT_multisampled_render_to_texture2"); in GenerateCaps()
1413 extensions->standardDerivativesOES = functions->isAtLeastGL(gl::Version(2, 0)) || in GenerateCaps()
1414 functions->hasGLExtension("GL_ARB_fragment_shader") || in GenerateCaps()
1415 functions->hasGLESExtension("GL_OES_standard_derivatives"); in GenerateCaps()
1416 extensions->shaderTextureLOD = functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
1417 functions->hasGLExtension("GL_ARB_shader_texture_lod") || in GenerateCaps()
1418 functions->hasGLESExtension("GL_EXT_shader_texture_lod"); in GenerateCaps()
1419 extensions->fragDepth = functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1420 functions->hasGLESExtension("GL_EXT_frag_depth"); in GenerateCaps()
1426 if (functions->hasGLExtension("GL_ARB_shader_viewport_layer_array") || in GenerateCaps()
1427 functions->hasGLExtension("GL_NV_viewport_array2")) in GenerateCaps()
1432 const int maxLayers = QuerySingleGLInt(functions, GL_MAX_ARRAY_TEXTURE_LAYERS); in GenerateCaps()
1434 const int maxViewports = QuerySingleGLInt(functions, GL_MAX_VIEWPORTS); in GenerateCaps()
1439 extensions->fboRenderMipmapOES = functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
1440 functions->hasGLExtension("GL_EXT_framebuffer_object") || in GenerateCaps()
1441 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1442 functions->hasGLESExtension("GL_OES_fbo_render_mipmap"); in GenerateCaps()
1444 functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1445 functions->hasGLESExtension("GL_OES_texture_border_clamp") || in GenerateCaps()
1446 functions->hasGLESExtension("GL_EXT_texture_border_clamp") || in GenerateCaps()
1447 functions->hasGLESExtension("GL_NV_texture_border_clamp"); in GenerateCaps()
1448 extensions->instancedArraysANGLE = functions->isAtLeastGL(gl::Version(3, 1)) || in GenerateCaps()
1449 (functions->hasGLExtension("GL_ARB_instanced_arrays") && in GenerateCaps()
1450 (functions->hasGLExtension("GL_ARB_draw_instanced") || in GenerateCaps()
1451 functions->hasGLExtension("GL_EXT_draw_instanced"))) || in GenerateCaps()
1452 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1453 functions->hasGLESExtension("GL_EXT_instanced_arrays"); in GenerateCaps()
1455 extensions->unpackSubimage = functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1456 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1457 functions->hasGLESExtension("GL_EXT_unpack_subimage"); in GenerateCaps()
1458 extensions->noperspectiveInterpolationNV = functions->isAtLeastGL(gl::Version(3, 0)); in GenerateCaps()
1459 extensions->packSubimage = functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1460 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1461 functions->hasGLESExtension("GL_NV_pack_subimage"); in GenerateCaps()
1462 extensions->vertexArrayObjectOES = functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
1463 functions->hasGLExtension("GL_ARB_vertex_array_object") || in GenerateCaps()
1464 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1465 functions->hasGLESExtension("GL_OES_vertex_array_object"); in GenerateCaps()
1466 extensions->debugMarker = functions->isAtLeastGL(gl::Version(4, 3)) || in GenerateCaps()
1467 functions->hasGLExtension("GL_KHR_debug") || in GenerateCaps()
1468 functions->hasGLExtension("GL_EXT_debug_marker") || in GenerateCaps()
1469 functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1470 functions->hasGLESExtension("GL_KHR_debug") || in GenerateCaps()
1471 functions->hasGLESExtension("GL_EXT_debug_marker"); in GenerateCaps()
1472 extensions->eglImageOES = functions->hasGLESExtension("GL_OES_EGL_image"); in GenerateCaps()
1473 extensions->eglImageExternalOES = functions->hasGLESExtension("GL_OES_EGL_image_external"); in GenerateCaps()
1475 functions->hasExtension("GL_EXT_EGL_image_external_wrap_modes"); in GenerateCaps()
1477 functions->hasGLESExtension("GL_OES_EGL_image_external_essl3"); in GenerateCaps()
1478 extensions->eglImageArray = functions->hasGLESExtension("GL_EXT_EGL_image_array"); in GenerateCaps()
1480 extensions->eglSyncOES = functions->hasGLESExtension("GL_OES_EGL_sync"); in GenerateCaps()
1483 (functions->isAtLeastGL(gl::Version(3, 3)) || in GenerateCaps()
1484 functions->hasGLExtension("GL_ARB_timer_query") || in GenerateCaps()
1485 functions->hasGLESExtension("GL_EXT_disjoint_timer_query"))) in GenerateCaps()
1493 QueryQueryValue(functions, GL_TIME_ELAPSED, GL_QUERY_COUNTER_BITS); in GenerateCaps()
1495 QueryQueryValue(functions, GL_TIMESTAMP, GL_QUERY_COUNTER_BITS); in GenerateCaps()
1503 functions->isAtLeastGL(gl::Version(1, 3)) || in GenerateCaps()
1504 functions->hasGLESExtension("GL_EXT_multisample_compatibility"); in GenerateCaps()
1507 functions->hasGLExtension("GL_NV_framebuffer_mixed_samples") || in GenerateCaps()
1508 functions->hasGLESExtension("GL_NV_framebuffer_mixed_samples"); in GenerateCaps()
1510 extensions->robustness = functions->isAtLeastGL(gl::Version(4, 5)) || in GenerateCaps()
1511 functions->hasGLExtension("GL_KHR_robustness") || in GenerateCaps()
1512 functions->hasGLExtension("GL_ARB_robustness") || in GenerateCaps()
1513 functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1514 functions->hasGLESExtension("GL_KHR_robustness") || in GenerateCaps()
1515 functions->hasGLESExtension("GL_EXT_robustness"); in GenerateCaps()
1519 (functions->hasGLExtension("GL_ARB_robust_buffer_access_behavior") || in GenerateCaps()
1520 functions->hasGLESExtension("GL_KHR_robust_buffer_access_behavior")); in GenerateCaps()
1523 extensions->syncQuery = SyncQueryGL::IsSupported(functions); in GenerateCaps()
1528 functions->isAtLeastGL(gl::Version(4, 2)) || functions->isAtLeastGLES(gl::Version(3, 2)); in GenerateCaps()
1533 extensions->textureMultisample = functions->isAtLeastGL(gl::Version(3, 2)) || in GenerateCaps()
1534 functions->hasGLExtension("GL_ARB_texture_multisample"); in GenerateCaps()
1536 extensions->textureSRGBDecode = functions->hasGLExtension("GL_EXT_texture_sRGB_decode") || in GenerateCaps()
1537 functions->hasGLESExtension("GL_EXT_texture_sRGB_decode"); in GenerateCaps()
1542 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1543 functions->hasGLESExtension("GL_EXT_compressed_ETC1_RGB8_sub_texture"); in GenerateCaps()
1549 VendorID vendor = GetVendorID(functions); in GenerateCaps()
1560 extensions->sRGBWriteControl = functions->isAtLeastGL(gl::Version(3, 0)) || in GenerateCaps()
1561 functions->hasGLExtension("GL_EXT_framebuffer_sRGB") || in GenerateCaps()
1562 functions->hasGLExtension("GL_ARB_framebuffer_sRGB") || in GenerateCaps()
1563 functions->hasGLESExtension("GL_EXT_sRGB_write_control"); in GenerateCaps()
1578 extensions->discardFramebuffer = functions->isAtLeastGL(gl::Version(4, 3)) || in GenerateCaps()
1579 functions->hasGLExtension("GL_ARB_invalidate_subdata") || in GenerateCaps()
1580 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1581 functions->hasGLESExtension("GL_EXT_discard_framebuffer") || in GenerateCaps()
1582 functions->hasGLESExtension("GL_ARB_invalidate_subdata"); in GenerateCaps()
1586 if (functions->isAtLeastGL(gl::Version(3, 1)) || in GenerateCaps()
1587 functions->hasGLExtension("GL_ARB_texture_rectangle")) in GenerateCaps()
1591 QuerySingleGLInt(functions, GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE), textureSizeLimit); in GenerateCaps()
1597 functions->isAtLeastGL(gl::Version(4, 3)) || functions->isAtLeastGLES(gl::Version(3, 2)); in GenerateCaps()
1602 bool hasInstancedGSSupport = functions->isAtLeastGL(gl::Version(4, 0)) && in GenerateCaps()
1603 functions->hasGLExtension("GL_ARB_shader_atomic_counters") && in GenerateCaps()
1604 functions->hasGLExtension("GL_ARB_shader_storage_buffer_object") && in GenerateCaps()
1605 functions->hasGLExtension("GL_ARB_shader_image_load_store"); in GenerateCaps()
1606 if (hasCoreGSSupport || functions->hasGLESExtension("GL_OES_geometry_shader") || in GenerateCaps()
1607 functions->hasGLESExtension("GL_EXT_geometry_shader") || hasInstancedGSSupport) in GenerateCaps()
1609 extensions->geometryShaderEXT = functions->hasGLESExtension("GL_EXT_geometry_shader") || in GenerateCaps()
1611 extensions->geometryShaderOES = functions->hasGLESExtension("GL_OES_geometry_shader") || in GenerateCaps()
1614 caps->maxFramebufferLayers = QuerySingleGLInt(functions, GL_MAX_FRAMEBUFFER_LAYERS_EXT); in GenerateCaps()
1625 caps->layerProvokingVertex = QuerySingleGLInt(functions, GL_LAYER_PROVOKING_VERTEX_EXT); in GenerateCaps()
1636 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT); in GenerateCaps()
1638 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT); in GenerateCaps()
1640 QuerySingleGLInt(functions, GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT); in GenerateCaps()
1642 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT); in GenerateCaps()
1644 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT); in GenerateCaps()
1646 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT); in GenerateCaps()
1648 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT); in GenerateCaps()
1650 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT); in GenerateCaps()
1652 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT); in GenerateCaps()
1654 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT); in GenerateCaps()
1656 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT); in GenerateCaps()
1658 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT); in GenerateCaps()
1660 QuerySingleGLInt(functions, GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT); in GenerateCaps()
1679 functions->standard == STANDARD_GL_DESKTOP && in GenerateCaps()
1680 functions->hasGLExtension("GL_ARB_blend_func_extended"); in GenerateCaps()
1691 extensions->floatBlend = functions->standard == STANDARD_GL_DESKTOP || in GenerateCaps()
1692 functions->hasGLESExtension("GL_EXT_float_blend") || in GenerateCaps()
1693 functions->isAtLeastGLES(gl::Version(3, 2)); in GenerateCaps()
1697 functions->isAtLeastGL(gl::Version(3, 2)) || functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1698 functions->hasGLESExtension("GL_OES_draw_elements_base_vertex") || in GenerateCaps()
1699 functions->hasGLESExtension("GL_EXT_draw_elements_base_vertex"); in GenerateCaps()
1703 functions->isAtLeastGL(gl::Version(3, 2)) || functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1704 functions->hasGLESExtension("GL_OES_draw_elements_base_vertex"); in GenerateCaps()
1708 functions->isAtLeastGL(gl::Version(3, 2)) || functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1709 functions->hasGLESExtension("GL_EXT_draw_elements_base_vertex"); in GenerateCaps()
1715 (features.allowEtcFormats.enabled || functions->standard == STANDARD_GL_ES) && in GenerateCaps()
1721 !features.allowEtcFormats.enabled && functions->standard == STANDARD_GL_DESKTOP; in GenerateCaps()
1726 !functions->isAtLeastGLES(gl::Version(3, 0))) in GenerateCaps()
1731 extensions->provokingVertex = functions->hasGLExtension("GL_ARB_provoking_vertex") || in GenerateCaps()
1732 functions->hasGLExtension("GL_EXT_provoking_vertex") || in GenerateCaps()
1733 functions->isAtLeastGL(gl::Version(3, 2)); in GenerateCaps()
1736 extensions->texture3DOES = functions->isAtLeastGL(gl::Version(1, 2)) || in GenerateCaps()
1737 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1738 functions->hasGLESExtension("GL_OES_texture_3D"); in GenerateCaps()
1740 extensions->memoryObject = functions->hasGLExtension("GL_EXT_memory_object") || in GenerateCaps()
1741 functions->hasGLESExtension("GL_EXT_memory_object"); in GenerateCaps()
1742 extensions->semaphore = functions->hasGLExtension("GL_EXT_semaphore") || in GenerateCaps()
1743 functions->hasGLESExtension("GL_EXT_semaphore"); in GenerateCaps()
1744 extensions->memoryObjectFd = functions->hasGLExtension("GL_EXT_memory_object_fd") || in GenerateCaps()
1745 functions->hasGLESExtension("GL_EXT_memory_object_fd"); in GenerateCaps()
1747 (functions->hasGLExtension("GL_EXT_semaphore_fd") || in GenerateCaps()
1748 functions->hasGLESExtension("GL_EXT_semaphore_fd")); in GenerateCaps()
1749 extensions->gpuShader5EXT = functions->isAtLeastGL(gl::Version(4, 0)) || in GenerateCaps()
1750 functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1751 functions->hasGLExtension("GL_ARB_gpu_shader5") || in GenerateCaps()
1752 functions->hasGLESExtension("GL_EXT_gpu_shader5"); in GenerateCaps()
1753 extensions->shaderIoBlocksOES = functions->isAtLeastGL(gl::Version(3, 2)) || in GenerateCaps()
1754 functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1755 functions->hasGLESExtension("GL_OES_shader_io_blocks") || in GenerateCaps()
1756 functions->hasGLESExtension("GL_EXT_shader_io_blocks"); in GenerateCaps()
1759 extensions->shadowSamplersEXT = functions->isAtLeastGL(gl::Version(2, 0)) || in GenerateCaps()
1760 functions->isAtLeastGLES(gl::Version(3, 0)) || in GenerateCaps()
1761 functions->hasGLESExtension("GL_EXT_shadow_samplers"); in GenerateCaps()
1764 extensions->clipDistanceAPPLE = functions->isAtLeastGL(gl::Version(3, 0)); in GenerateCaps()
1767 caps->maxClipDistances = QuerySingleGLInt(functions, GL_MAX_CLIP_DISTANCES_EXT); in GenerateCaps()
1780 if (functions->isAtLeastGL(gl::Version(4, 5)) || functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1781 functions->hasGLESExtension("GL_OES_shader_image_atomic")) in GenerateCaps()
1787 if (functions->isAtLeastGL(gl::Version(4, 3)) || functions->isAtLeastGLES(gl::Version(3, 2)) || in GenerateCaps()
1788 functions->hasGLESExtension("GL_OES_texture_buffer") || in GenerateCaps()
1789 functions->hasGLESExtension("GL_EXT_texture_buffer") || in GenerateCaps()
1790 functions->hasGLExtension("GL_ARB_texture_buffer_object")) in GenerateCaps()
1792 caps->maxTextureBufferSize = QuerySingleGLInt(functions, GL_MAX_TEXTURE_BUFFER_SIZE); in GenerateCaps()
1794 QuerySingleGLInt(functions, GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT); in GenerateCaps()
1804 extensions->yuvTargetEXT = functions->hasGLESExtension("GL_EXT_YUV_target"); in GenerateCaps()
1813 bool GetSystemInfoVendorIDAndDeviceID(const FunctionsGL *functions, in GetSystemInfoVendorIDAndDeviceID() argument
1826 *outVendor = GetVendorID(functions); in GetSystemInfoVendorIDAndDeviceID()
1827 *outDevice = GetDeviceID(functions); in GetSystemInfoVendorIDAndDeviceID()
1845 void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *features) in InitializeFeatures() argument
1852 GetSystemInfoVendorIDAndDeviceID(functions, &systemInfo, &vendor, &device); in InitializeFeatures()
1862 bool isMesa = IsMesa(functions, &mesaVersion); in InitializeFeatures()
1866 functions->standard == STANDARD_GL_DESKTOP && isAMD); in InitializeFeatures()
1869 functions->standard == STANDARD_GL_DESKTOP && isIntel); in InitializeFeatures()
1891 IsLinux() && functions->standard == STANDARD_GL_DESKTOP && isAMD); in InitializeFeatures()
1894 (IsApple() && functions->standard == STANDARD_GL_DESKTOP) || (IsLinux() && isAMD)); in InitializeFeatures()
1898 IsApple() && functions->standard == STANDARD_GL_DESKTOP && in InitializeFeatures()
1912 functions->standard == STANDARD_GL_DESKTOP && isNvidia); in InitializeFeatures()
1928 functions->isAtMostGL(gl::Version(4, 1)) || in InitializeFeatures()
1929 (functions->standard == STANDARD_GL_DESKTOP && isAMD)); in InitializeFeatures()
1973 IsIOS() || IsAndroid() || IsAndroidEmulator(functions)); in InitializeFeatures()
1992 IsAndroid() || isAMD || !functions->hasExtension("GL_KHR_robust_buffer_access_behavior")); in InitializeFeatures()
2002 (IsApple() && functions->standard == STANDARD_GL_ES)); in InitializeFeatures()
2012 functions->standard == STANDARD_GL_DESKTOP && in InitializeFeatures()
2013 functions->isAtLeastGL(gl::Version(3, 1)) && in InitializeFeatures()
2014 !functions->isAtLeastGL(gl::Version(4, 3))); in InitializeFeatures()
2030 !isIntel && functions->standard == STANDARD_GL_ES && in InitializeFeatures()
2031 functions->isAtLeastGLES(gl::Version(3, 1)) && in InitializeFeatures()
2032 functions->hasGLESExtension("GL_EXT_texture_norm16")); in InitializeFeatures()
2040 // IsApple() && functions->standard == STANDARD_GL_DESKTOP); in InitializeFeatures()
2053 (IsAndroid() && GetAndroidSdkLevel() < 27 && IsAdreno5xxOrOlder(functions)) || in InitializeFeatures()
2054 (IsAndroid() && IsMaliT8xxOrOlder(functions)) || in InitializeFeatures()
2055 (IsAndroid() && IsMaliG31OrOlder(functions))); in InitializeFeatures()
2065 IsApple() && functions->standard == STANDARD_GL_ES && !(isAMD && IsWindows())); in InitializeFeatures()
2074 if (IsApple() && functions->standard == STANDARD_GL_DESKTOP) in InitializeFeatures()
2116 ANGLE_FEATURE_CONDITION(features, keepBufferShadowCopy, !CanMapBufferForRead(functions)); in InitializeFeatures()
2125 ANGLE_FEATURE_CONDITION(features, initFragmentOutputVariables, IsAdreno42xOr3xx(functions)); in InitializeFeatures()
2133 !nativegl::SupportsVertexArrayObjects(functions)); in InitializeFeatures()
2154 IsAndroid() && IsAdreno4xx(functions) && GetAndroidSdkLevel() < 22; in InitializeFeatures()
2158 IsAndroid() && IsAdreno4xx(functions) && GetAndroidSdkLevel() == 24; in InitializeFeatures()
2160 IsAndroid() && IsAdreno5xx(functions) && GetAndroidSdkLevel() < 24; in InitializeFeatures()
2164 IsAndroid() && IsAdreno5xx(functions) && GetAndroidSdkLevel() == 25; in InitializeFeatures()
2178 void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features) in InitializeFrontendFeatures() argument
2180 VendorID vendor = GetVendorID(functions); in InitializeFrontendFeatures()
2188 ANGLE_FEATURE_CONDITION(features, disableProgramBinary, IsPowerVrRogue(functions)); in InitializeFrontendFeatures()
2191 void ReInitializeFeaturesAtGPUSwitch(const FunctionsGL *functions, angle::FeaturesGL *features) in ReInitializeFeaturesAtGPUSwitch() argument
2197 GetSystemInfoVendorIDAndDeviceID(functions, &systemInfo, &vendor, &device); in ReInitializeFeaturesAtGPUSwitch()
2212 bool SupportsVertexArrayObjects(const FunctionsGL *functions) in SupportsVertexArrayObjects() argument
2214 return functions->isAtLeastGLES(gl::Version(3, 0)) || in SupportsVertexArrayObjects()
2215 functions->hasGLESExtension("GL_OES_vertex_array_object") || in SupportsVertexArrayObjects()
2216 functions->isAtLeastGL(gl::Version(3, 0)) || in SupportsVertexArrayObjects()
2217 functions->hasGLExtension("GL_ARB_vertex_array_object"); in SupportsVertexArrayObjects()
2220 bool CanUseDefaultVertexArrayObject(const FunctionsGL *functions) in CanUseDefaultVertexArrayObject() argument
2222 return (functions->profile & GL_CONTEXT_CORE_PROFILE_BIT) == 0; in CanUseDefaultVertexArrayObject()
2225 bool SupportsCompute(const FunctionsGL *functions) in SupportsCompute() argument
2230 return (functions->isAtLeastGL(gl::Version(4, 3)) || in SupportsCompute()
2231 functions->isAtLeastGLES(gl::Version(3, 1)) || in SupportsCompute()
2232 (functions->isAtLeastGL(gl::Version(4, 2)) && in SupportsCompute()
2233 functions->hasGLExtension("GL_ARB_compute_shader") && in SupportsCompute()
2234 functions->hasGLExtension("GL_ARB_shader_storage_buffer_object"))); in SupportsCompute()
2237 bool SupportsFenceSync(const FunctionsGL *functions) in SupportsFenceSync() argument
2239 return functions->isAtLeastGL(gl::Version(3, 2)) || functions->hasGLExtension("GL_ARB_sync") || in SupportsFenceSync()
2240 functions->isAtLeastGLES(gl::Version(3, 0)); in SupportsFenceSync()
2243 bool SupportsOcclusionQueries(const FunctionsGL *functions) in SupportsOcclusionQueries() argument
2245 return functions->isAtLeastGL(gl::Version(1, 5)) || in SupportsOcclusionQueries()
2246 functions->hasGLExtension("GL_ARB_occlusion_query2") || in SupportsOcclusionQueries()
2247 functions->isAtLeastGLES(gl::Version(3, 0)) || in SupportsOcclusionQueries()
2248 functions->hasGLESExtension("GL_EXT_occlusion_query_boolean"); in SupportsOcclusionQueries()
2251 bool SupportsNativeRendering(const FunctionsGL *functions, in SupportsNativeRendering() argument
2257 bool hasInternalFormatQuery = functions->isAtLeastGL(gl::Version(4, 3)) || in SupportsNativeRendering()
2258 functions->hasGLExtension("GL_ARB_internalformat_query2"); in SupportsNativeRendering()
2268 functions->getInternalformativ(ToGLenum(type), internalFormat, GL_FRAMEBUFFER_RENDERABLE, 1, in SupportsNativeRendering()
2275 nativegl::GetInternalFormatInfo(internalFormat, functions->standard); in SupportsNativeRendering()
2276 return nativegl_gl::MeetsRequirements(functions, nativeInfo.textureAttachment); in SupportsNativeRendering()
2464 const FunctionsGL *functions = GetFunctionsGL(context); in ClearErrors() local
2465 ClearErrors(functions, file, function, line); in ClearErrors()
2474 const FunctionsGL *functions = GetFunctionsGL(context); in CheckError() local
2476 GLenum error = functions->getError(); in CheckError()
2487 GLenum nextError = functions->getError(); in CheckError()
2491 nextError = functions->getError(); in CheckError()
2500 bool CanMapBufferForRead(const FunctionsGL *functions) in CanMapBufferForRead() argument
2502 return (functions->mapBufferRange != nullptr) || in CanMapBufferForRead()
2503 (functions->mapBuffer != nullptr && functions->standard == STANDARD_GL_DESKTOP); in CanMapBufferForRead()
2506 uint8_t *MapBufferRangeWithFallback(const FunctionsGL *functions, in MapBufferRangeWithFallback() argument
2512 if (functions->mapBufferRange != nullptr) in MapBufferRangeWithFallback()
2514 return static_cast<uint8_t *>(functions->mapBufferRange(target, offset, length, access)); in MapBufferRangeWithFallback()
2516 else if (functions->mapBuffer != nullptr && in MapBufferRangeWithFallback()
2517 (functions->standard == STANDARD_GL_DESKTOP || access == GL_MAP_WRITE_BIT)) in MapBufferRangeWithFallback()
2541 return static_cast<uint8_t *>(functions->mapBuffer(target, accessEnum)) + offset; in MapBufferRangeWithFallback()
2648 std::string GetRendererString(const FunctionsGL *functions) in GetRendererString() argument
2650 return GetString(functions, GL_RENDERER); in GetRendererString()
2653 std::string GetVendorString(const FunctionsGL *functions) in GetVendorString() argument
2655 return GetString(functions, GL_VENDOR); in GetVendorString()
2658 std::string GetVersionString(const FunctionsGL *functions) in GetVersionString() argument
2660 return GetString(functions, GL_VERSION); in GetVersionString()