Bug 1339256 - Double-check robustness. - r=daoshengmu

MozReview-Commit-ID: 20csUTf7q6e
This commit is contained in:
Jeff Gilbert 2017-03-07 14:10:09 -08:00
Родитель 0e274f58a3
Коммит 0846c32c64
2 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -1009,6 +1009,11 @@ GLContext::InitWithPrefixImpl(const char* prefix, bool trygl)
////////////////
const auto err = mSymbols.fGetError();
MOZ_RELEASE_ASSERT(!err);
if (err)
return false;
LoadMoreSymbols(prefix, trygl);
////////////////////////////////////////////////////////////////////////////
@ -1145,6 +1150,14 @@ GLContext::LoadMoreSymbols(const char* prefix, bool trygl)
return fnLoadForFeature(list, feature);
};
if (IsSupported(GLFeature::robustness)) {
const auto resetStrategy = GetIntAs<GLuint>(LOCAL_GL_RESET_NOTIFICATION_STRATEGY);
if (resetStrategy != LOCAL_GL_LOSE_CONTEXT_ON_RESET) {
MOZ_ASSERT(resetStrategy == LOCAL_GL_NO_RESET_NOTIFICATION);
NS_WARNING("Robustness supported, but not active!");
MarkUnsupported(GLFeature::robustness);
}
}
if (IsSupported(GLFeature::robustness)) {
const SymLoadStruct symbols[] = {
{ (PRFuncPtr*) &mSymbols.fGetGraphicsResetStatus, { "GetGraphicsResetStatus",
@ -1154,7 +1167,13 @@ GLContext::LoadMoreSymbols(const char* prefix, bool trygl)
nullptr } },
END_SYMBOLS
};
fnLoadForFeature(symbols, GLFeature::sync);
if (fnLoadForFeature(symbols, GLFeature::robustness)) {
const auto status = mSymbols.fGetGraphicsResetStatus();
MOZ_ALWAYS_TRUE(!status);
const auto err = mSymbols.fGetError();
MOZ_ALWAYS_TRUE(!err);
}
}
if (IsSupported(GLFeature::sync)) {

Просмотреть файл

@ -81,7 +81,9 @@
// Others
#define LOCAL_EGL_PRESERVED_RESOURCES 0x3030
#define LOCAL_EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
#define LOCAL_GL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define LOCAL_GL_RESET_NOTIFICATION_STRATEGY 0x8256
#define LOCAL_GL_LOSE_CONTEXT_ON_RESET 0x8252
#define LOCAL_GL_NO_RESET_NOTIFICATION 0x8261
#define LOCAL_GL_CONTEXT_LOST 0x9242
#define LOCAL_GL_CONTEXT_FLAGS_ARB 0x2094
#define LOCAL_GL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001