Bug 1427088 - Don't rely on glGetStringi just because it exists. - r=daoshengmu

MozReview-Commit-ID: Gmf6phqDOTK
This commit is contained in:
Jeff Gilbert 2018-01-08 12:35:04 -08:00
parent 87bb85b91b
commit 93dcf044db

View File

@ -1656,28 +1656,31 @@ GLContext::InitExtensions()
std::vector<nsCString> driverExtensionList;
if (mSymbols.fGetStringi) {
GLuint count = 0;
GetUIntegerv(LOCAL_GL_NUM_EXTENSIONS, &count);
for (GLuint i = 0; i < count; i++) {
// This is UTF-8.
const char* rawExt = (const char*)fGetStringi(LOCAL_GL_EXTENSIONS, i);
[&]() {
if (mSymbols.fGetStringi) {
GLuint count = 0;
if (GetPotentialInteger(LOCAL_GL_NUM_EXTENSIONS, (GLint*)&count)) {
for (GLuint i = 0; i < count; i++) {
// This is UTF-8.
const char* rawExt = (const char*)fGetStringi(LOCAL_GL_EXTENSIONS, i);
// We CANNOT use nsDependentCString here, because the spec doesn't guarantee
// that the pointers returned are different, only that their contents are.
// On Flame, each of these index string queries returns the same address.
driverExtensionList.push_back(nsCString(rawExt));
// We CANNOT use nsDependentCString here, because the spec doesn't guarantee
// that the pointers returned are different, only that their contents are.
// On Flame, each of these index string queries returns the same address.
driverExtensionList.push_back(nsCString(rawExt));
}
return;
}
}
} else {
MOZ_ALWAYS_TRUE(!fGetError());
const char* rawExts = (const char*)fGetString(LOCAL_GL_EXTENSIONS);
MOZ_ALWAYS_TRUE(!fGetError());
const char* rawExts = (const char*)fGetString(LOCAL_GL_EXTENSIONS);
if (rawExts) {
nsDependentCString exts(rawExts);
SplitByChar(exts, ' ', &driverExtensionList);
}
}
}();
const auto err = fGetError();
MOZ_ALWAYS_TRUE(!err);
const bool shouldDumpExts = ShouldDumpExts();
if (shouldDumpExts) {