void GLContext::InitFeatures() { for (size_t i = 0; i < GLFeature::EnumMax; i++) { GLFeature::Enum feature = GLFeature::Enum(i); if (IsFeatureIsPartOfProfileVersion(feature, mProfile, mVersion)) { mAvailableFeatures[feature] = true; continue; } mAvailableFeatures[feature] = false; const FeatureInfo& featureInfo = GetFeatureInfo(feature); for (size_t j = 0; true; j++) { MOZ_ASSERT(j < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small"); if (featureInfo.mExtensions[j] == GLContext::Extensions_End) { break; } if (IsExtensionSupported(featureInfo.mExtensions[j])) { mAvailableFeatures[feature] = true; break; } } } }
bool GLContext::IsFeatureProvidedByCoreSymbols(GLFeature feature) { if (IsFeaturePartOfProfileVersion(feature, mProfile, mVersion)) return true; if (IsExtensionSupported(GetFeatureInfo(feature).mARBExtensionWithoutARBSuffix)) return true; return false; }
void GLContext::InitFeatures() { for (size_t featureId = 0; featureId < size_t(GLFeature::EnumMax); featureId++) { GLFeature feature = GLFeature(featureId); if (IsFeaturePartOfProfileVersion(feature, mProfile, mVersion)) { mAvailableFeatures[featureId] = true; continue; } mAvailableFeatures[featureId] = false; const FeatureInfo& featureInfo = GetFeatureInfo(feature); if (IsExtensionSupported(featureInfo.mARBExtensionWithoutARBSuffix)) { mAvailableFeatures[featureId] = true; continue; } for (size_t j = 0; true; j++) { MOZ_ASSERT(j < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small"); if (featureInfo.mExtensions[j] == GLContext::Extensions_End) break; if (IsExtensionSupported(featureInfo.mExtensions[j])) { mAvailableFeatures[featureId] = true; break; } } } if (ShouldDumpExts()) { for (size_t featureId = 0; featureId < size_t(GLFeature::EnumMax); featureId++) { GLFeature feature = GLFeature(featureId); printf_stderr("[%s] Feature::%s\n", IsSupported(feature) ? "enabled" : "disabled", GetFeatureName(feature)); } } if (WorkAroundDriverBugs()) { #ifdef XP_MACOSX // MacOSX 10.6 reports to support EXT_framebuffer_sRGB and EXT_texture_sRGB but // fails to convert from sRGB to linear when reading from an sRGB texture attached // to an FBO. (bug 843668) if (!nsCocoaFeatures::OnLionOrLater()) MarkUnsupported(GLFeature::sRGB_framebuffer); #endif // XP_MACOSX } }
static inline uint32_t ProfileVersionForFeature(GLFeature feature, ContextProfile profile) { MOZ_ASSERT(profile != ContextProfile::Unknown, "GLContext::ProfileVersionForFeature : unknown <profile>"); const FeatureInfo& featureInfo = GetFeatureInfo(feature); if (profile == ContextProfile::OpenGLES) return (uint32_t)featureInfo.mOpenGLESVersion; return (uint32_t)featureInfo.mOpenGLVersion; }
void GLContext::InitFeatures() { for (size_t feature_index = 0; feature_index < size_t(GLFeature::EnumMax); feature_index++) { GLFeature feature = GLFeature(feature_index); if (IsFeaturePartOfProfileVersion(feature, mProfile, mVersion)) { mAvailableFeatures[feature_index] = true; continue; } mAvailableFeatures[feature_index] = false; const FeatureInfo& featureInfo = GetFeatureInfo(feature); if (IsExtensionSupported(featureInfo.mARBExtensionWithoutARBSuffix)) { mAvailableFeatures[feature_index] = true; continue; } for (size_t j = 0; true; j++) { MOZ_ASSERT(j < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small"); if (featureInfo.mExtensions[j] == GLContext::Extensions_End) { break; } if (IsExtensionSupported(featureInfo.mExtensions[j])) { mAvailableFeatures[feature_index] = true; break; } } } // Bug 843668: Work around limitation of the feature system. // For sRGB support under OpenGL to match OpenGL ES spec, check for both // EXT_texture_sRGB and EXT_framebuffer_sRGB is required. const bool aresRGBExtensionsAvailable = IsExtensionSupported(EXT_texture_sRGB) && (IsExtensionSupported(ARB_framebuffer_sRGB) || IsExtensionSupported(EXT_framebuffer_sRGB)); mAvailableFeatures[size_t(GLFeature::sRGB)] = aresRGBExtensionsAvailable && CanReadSRGBFromFBOTexture(this); }
void GLContext::MarkUnsupported(GLFeature feature) { mAvailableFeatures[size_t(feature)] = false; const FeatureInfo& featureInfo = GetFeatureInfo(feature); for (size_t i = 0; true; i++) { MOZ_ASSERT(i < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small"); if (featureInfo.mExtensions[i] == GLContext::Extensions_End) break; MarkExtensionUnsupported(featureInfo.mExtensions[i]); } MOZ_ASSERT(!IsSupported(feature), "GLContext::MarkUnsupported has failed!"); NS_WARNING(nsPrintfCString("%s marked as unsupported", GetFeatureName(feature)).get()); }
const char* GLContext::GetFeatureName(GLFeature feature) { return GetFeatureInfo(feature).mName; }