| 498 | } |
| 499 | |
| 500 | bool DriverGL::checkForFeatureSupported(FeatureType feature) |
| 501 | { |
| 502 | bool featureSupported = false; |
| 503 | switch (feature) |
| 504 | { |
| 505 | case FeatureType::ETC1: |
| 506 | featureSupported = hasExtension("GL_OES_compressed_ETC1_RGB8_texture"sv); |
| 507 | break; |
| 508 | case FeatureType::ETC2: |
| 509 | featureSupported = _textureCompressionEtc2; |
| 510 | break; |
| 511 | case FeatureType::S3TC: |
| 512 | #ifdef GL_EXT_texture_compression_s3tc |
| 513 | featureSupported = hasExtension("GL_EXT_texture_compression_s3tc"sv); |
| 514 | #endif |
| 515 | break; |
| 516 | case FeatureType::AMD_COMPRESSED_ATC: |
| 517 | featureSupported = hasExtension("GL_AMD_compressed_ATC_texture"sv); |
| 518 | break; |
| 519 | case FeatureType::PVRTC: |
| 520 | featureSupported = hasExtension("GL_IMG_texture_compression_pvrtc"sv); |
| 521 | break; |
| 522 | case FeatureType::IMG_FORMAT_BGRA8888: |
| 523 | featureSupported = hasExtension("GL_IMG_texture_format_BGRA8888"sv); |
| 524 | break; |
| 525 | case FeatureType::DISCARD_FRAMEBUFFER: |
| 526 | featureSupported = hasExtension("GL_EXT_discard_framebuffer"sv); |
| 527 | break; |
| 528 | case FeatureType::PACKED_DEPTH_STENCIL: |
| 529 | featureSupported = hasExtension("GL_OES_packed_depth_stencil"sv); |
| 530 | break; |
| 531 | case FeatureType::VAO: |
| 532 | #ifdef AX_PLATFORM_PC |
| 533 | featureSupported = hasExtension("vertex_array_object"sv); |
| 534 | #else |
| 535 | featureSupported = hasExtension("GL_OES_vertex_array_object"sv); |
| 536 | #endif |
| 537 | break; |
| 538 | case FeatureType::MAPBUFFER: |
| 539 | featureSupported = hasExtension("GL_OES_mapbuffer"sv); |
| 540 | break; |
| 541 | case FeatureType::DEPTH24: |
| 542 | featureSupported = hasExtension("GL_OES_depth24"sv); |
| 543 | break; |
| 544 | case FeatureType::ASTC: |
| 545 | #if AX_TARGET_PLATFORM != AX_PLATFORM_WASM |
| 546 | featureSupported = checkASTCRenderability(); |
| 547 | #else |
| 548 | // On WebAssembly platforms running Safari on iOS < 15, attempting to test for ASTC support |
| 549 | // via speculative ASTC texture uploads may cause uncatchable exceptions, leading to a |
| 550 | // "context lost" error. This occurs even if all GL errors are properly handled inside |
| 551 | // checkASTCRenderability(), making the approach unreliable on affected devices. |
| 552 | // see also: https://github.com/axmolengine/axmol/issues/2484 |
| 553 | featureSupported = _textureCompressionAstc; |
| 554 | #endif |
| 555 | break; |
| 556 | default: |
| 557 | break; |
no test coverage detected