@@ -755,7 +755,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
755755 isOcclusionQuerySupported = validContext && osg::isGLExtensionSupported (contextID, " GL_NV_occlusion_query" );
756756 isARBOcclusionQuerySupported = validContext && (OSG_GL3_FEATURES || osg::isGLExtensionSupported (contextID, " GL_ARB_occlusion_query" ));
757757
758- isTimerQuerySupported = validContext && osg::isGLExtensionSupported (contextID, " GL_EXT_timer_query" );
758+ isTimerQuerySupported = validContext && ( osg::isGLExtensionSupported (contextID, " GL_EXT_timer_query" ) || osg::isGLExtensionSupported (contextID, " GL_EXT_disjoint_timer_query " ) );
759759 isARBTimerQuerySupported = validContext && osg::isGLExtensionSupported (contextID, " GL_ARB_timer_query" );
760760
761761
@@ -790,19 +790,19 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
790790 setGLExtensionFuncPtr (glGetOcclusionQueryiv, " glGetOcclusionQueryiv" ," glGetOcclusionQueryivNV" , validContext);
791791 setGLExtensionFuncPtr (glGetOcclusionQueryuiv, " glGetOcclusionQueryuiv" ," glGetOcclusionQueryuivNV" , validContext);
792792
793- setGLExtensionFuncPtr (glGenQueries, " glGenQueries" , " glGenQueriesARB" , validContext);
794- setGLExtensionFuncPtr (glDeleteQueries, " glDeleteQueries" , " glDeleteQueriesARB" , validContext);
795- setGLExtensionFuncPtr (glIsQuery, " glIsQuery" , " glIsQueryARB" , validContext);
796- setGLExtensionFuncPtr (glBeginQuery, " glBeginQuery" , " glBeginQueryARB" , validContext);
797- setGLExtensionFuncPtr (glEndQuery, " glEndQuery" , " glEndQueryARB" , validContext);
793+ setGLExtensionFuncPtr (glGenQueries, " glGenQueries" , " glGenQueriesARB" , " glGenQueriesEXT " , validContext);
794+ setGLExtensionFuncPtr (glDeleteQueries, " glDeleteQueries" , " glDeleteQueriesARB" , " glDeleteQueriesEXT " , validContext);
795+ setGLExtensionFuncPtr (glIsQuery, " glIsQuery" , " glIsQueryARB" , " glIsQueryEXT " , validContext);
796+ setGLExtensionFuncPtr (glBeginQuery, " glBeginQuery" , " glBeginQueryARB" , " glBeginQueryEXT " , validContext);
797+ setGLExtensionFuncPtr (glEndQuery, " glEndQuery" , " glEndQueryARB" , " glEndQueryEXT " , validContext);
798798 setGLExtensionFuncPtr (glBeginQueryIndexed, " glBeginQueryIndexed" , " glBeginQueryIndexedARB" , validContext);
799799 setGLExtensionFuncPtr (glEndQueryIndexed, " glEndQueryIndexed" , " glEndQueryIndexedARB" , validContext);
800- setGLExtensionFuncPtr (glGetQueryiv, " glGetQueryiv" , " glGetQueryivARB" , validContext);
801- setGLExtensionFuncPtr (glGetQueryObjectiv, " glGetQueryObjectiv" ," glGetQueryObjectivARB" , validContext);
802- setGLExtensionFuncPtr (glGetQueryObjectuiv, " glGetQueryObjectuiv" ," glGetQueryObjectuivARB" , validContext);
803- setGLExtensionFuncPtr (glGetQueryObjectui64v, " glGetQueryObjectui64v" ," glGetQueryObjectui64vEXT" , validContext);
804- setGLExtensionFuncPtr (glQueryCounter, " glQueryCounter" , validContext);
805- setGLExtensionFuncPtr (glGetInteger64v, " glGetInteger64v" , validContext);
800+ setGLExtensionFuncPtr (glGetQueryiv, " glGetQueryiv" , " glGetQueryivARB" , " glGetQueryivEXT " , validContext);
801+ setGLExtensionFuncPtr (glGetQueryObjectiv, " glGetQueryObjectiv" ," glGetQueryObjectivARB" , " glGetQueryObjectivEXT " , validContext);
802+ setGLExtensionFuncPtr (glGetQueryObjectuiv, " glGetQueryObjectuiv" ," glGetQueryObjectuivARB" , " glGetQueryObjectuivEXT " , validContext);
803+ setGLExtensionFuncPtr (glGetQueryObjectui64v, " glGetQueryObjectui64v" ," glGetQueryObjectui64vEXT" , " glGetQueryObjectui64vEXT " , validContext);
804+ setGLExtensionFuncPtr (glQueryCounter, " glQueryCounter" , " glQueryCounterEXT " , validContext);
805+ setGLExtensionFuncPtr (glGetInteger64v, " glGetInteger64v" , " glGetInteger64vEXT " , validContext);
806806
807807
808808 // SampleMaski functionality
@@ -859,13 +859,26 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
859859 isTextureFilterAnisotropicSupported = validContext && isGLExtensionSupported (contextID," GL_EXT_texture_filter_anisotropic" );
860860 isTextureSwizzleSupported = validContext && isGLExtensionSupported (contextID," GL_ARB_texture_swizzle" );
861861 isTextureCompressionARBSupported = validContext && (builtInSupport || isGLExtensionOrVersionSupported (contextID," GL_ARB_texture_compression" , 1 .3f ));
862- isTextureCompressionS3TCSupported = validContext && (isGLExtensionSupported (contextID," GL_EXT_texture_compression_s3tc" ) || isGLExtensionSupported (contextID, " GL_S3_s3tc" ));
863- isTextureCompressionPVRTC2BPPSupported = validContext && isGLExtensionSupported (contextID," GL_IMG_texture_compression_pvrtc" );
862+ isTextureCompressionS3TCSupported = validContext && (isGLExtensionSupported (contextID," GL_EXT_texture_compression_s3tc" ) ||
863+ isGLExtensionSupported (contextID, " GL_S3_s3tc" ) ||
864+ isGLExtensionSupported (contextID, " WEBGL_compressed_texture_s3tc" ) ||
865+ isGLExtensionSupported (contextID, " MOZ_WEBGL_compressed_texture_s3tc" ) ||
866+ isGLExtensionSupported (contextID, " WEBKIT_WEBGL_compressed_texture_s3tc" ) ||
867+ isGLExtensionSupported (contextID, " WEBGL_compressed_texture_s3tc_srgb" ) /* TODO: separate flag */ );
868+ isTextureCompressionPVRTC2BPPSupported = validContext && (isGLExtensionSupported (contextID," GL_IMG_texture_compression_pvrtc" ) ||
869+ isGLExtensionSupported (contextID, " WEBGL_compressed_texture_pvrtc" ));
864870 isTextureCompressionPVRTC4BPPSupported = isTextureCompressionPVRTC2BPPSupported;// covered by same extension
865- isTextureCompressionETCSupported = validContext && isGLExtensionSupported (contextID," GL_OES_compressed_ETC1_RGB8_texture" );
866- isTextureCompressionETC2Supported = validContext && isGLExtensionSupported (contextID," GL_ARB_ES3_compatibility" );
871+ isTextureCompressionETCSupported = validContext && (isGLExtensionSupported (contextID, " GL_OES_compressed_ETC1_RGB8_texture" ) ||
872+ isGLExtensionSupported (contextID, " WEBGL_compressed_texture_etc1" ));
873+ isTextureCompressionETC2Supported = validContext && (isGLExtensionSupported (contextID," GL_ARB_ES3_compatibility" ) ||
874+ isGLExtensionSupported (contextID, " WEBGL_compressed_texture_etc" ));
867875 isTextureCompressionRGTCSupported = validContext && isGLExtensionSupported (contextID," GL_EXT_texture_compression_rgtc" );
868- isTextureCompressionPVRTCSupported = validContext && isGLExtensionSupported (contextID," GL_IMG_texture_compression_pvrtc" );
876+ isTextureCompressionPVRTCSupported = isTextureCompressionPVRTC2BPPSupported;// covered by same extension
877+
878+ isTextureCompressionASTCSupported = validContext && (isGLExtensionSupported (contextID, " GL_KHR_texture_compression_astc_hdr" ) ||
879+ isGLExtensionSupported (contextID, " GL_KHR_texture_compression_astc_ldr" ) ||
880+ isGLExtensionSupported (contextID, " GL_OES_texture_compression_astc" ) ||
881+ isGLExtensionSupported (contextID, " WEBGL_compressed_texture_astc" ));
869882
870883 isTextureMirroredRepeatSupported = validContext &&
871884 (builtInSupport ||
@@ -907,18 +920,22 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
907920 {
908921 maxTextureSize = osg_max_size;
909922 }
923+
924+ #if defined(__EMSCRIPTEN__)
925+ isTextureMaxLevelSupported = (glVersion >= 3 .0f ); // WebGL 2.0 (OpenGL ES 3.0)
926+ isTextureLODBiasSupported = (glVersion >= 3 .0f ) || isGLExtensionSupported (contextID, " GL_EXT_texture_lod_bias" );
927+ #else
910928 isTextureMaxLevelSupported = (glVersion >= 1 .2f );
929+ isTextureLODBiasSupported = (glVersion >= 1 .2f ) || isGLExtensionSupported (contextID, " GL_EXT_texture_lod_bias" );
930+ #endif
911931
912932 isTextureStorageEnabled = validContext && ((glVersion >= 4 .2f ) || isGLExtensionSupported (contextID, " GL_ARB_texture_storage" ));
913933
914934 if (isTextureStorageEnabled)
915935 {
916936 std::string value;
917- if (getEnvVar (" OSG_GL_TEXTURE_STORAGE" , value))
918- {
919- if (value==" OFF" || value==" DISABLE" ) isTextureStorageEnabled = false ;
920- else isTextureStorageEnabled = true ;
921- }
937+ if (getEnvVar (" OSG_GL_TEXTURE_STORAGE" , value) && (value == " OFF" || value == " DISABLE" ))
938+ isTextureStorageEnabled = false ;
922939 }
923940
924941 setGLExtensionFuncPtr (glTexStorage1D," glTexStorage1D" ," glTexStorage1DARB" , validContext);
0 commit comments