зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1751816 - Improve error handling in GLContextEGL::CreateCompatibleSurface. r=jgilbert
Rather than just crashing, if we return a nullptr in CreateCompatibleSurface, then we will just cause a context loss for WebGL instances. This would be better for beta/release than just crashing the content process on the user. So that we can get a sense of what errors are causing this, we should record it to the critical log. This will still crash on nightly as well so we should get the reports. Differential Revision: https://phabricator.services.mozilla.com/D136825
This commit is contained in:
Родитель
f347afc373
Коммит
9769b476b0
|
@ -999,29 +999,14 @@ already_AddRefed<GLContext> GLContextProviderEGL::CreateForCompositorWidget(
|
||||||
|
|
||||||
EGLSurface GLContextEGL::CreateCompatibleSurface(void* aWindow) const {
|
EGLSurface GLContextEGL::CreateCompatibleSurface(void* aWindow) const {
|
||||||
MOZ_ASSERT(aWindow);
|
MOZ_ASSERT(aWindow);
|
||||||
if (mConfig == EGL_NO_CONFIG) {
|
MOZ_RELEASE_ASSERT(mConfig != EGL_NO_CONFIG);
|
||||||
MOZ_CRASH("GFX: Failed with invalid EGLConfig 2!");
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto fnCreate = [&](const bool useGles) -> EGLSurface {
|
// NOTE: aWindow is an ANativeWindow
|
||||||
// NOTE: aWindow is an ANativeWindow
|
EGLSurface surface = mEgl->fCreateWindowSurface(
|
||||||
auto config = mConfig;
|
mConfig, reinterpret_cast<EGLNativeWindowType>(aWindow), nullptr);
|
||||||
if (!config && !CreateConfigScreen(*mEgl, &config,
|
|
||||||
/* aEnableDepthBuffer */ false,
|
|
||||||
/* useGles */ useGles)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mEgl->fCreateWindowSurface(
|
|
||||||
config, reinterpret_cast<EGLNativeWindowType>(aWindow), 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
auto surface = fnCreate(false);
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
surface = fnCreate(true);
|
gfxCriticalError() << "CreateCompatibleSurface failed: "
|
||||||
}
|
<< hexa(GetError());
|
||||||
if (!surface) {
|
|
||||||
MOZ_CRASH("GFX: Failed to create EGLSurface 2!");
|
|
||||||
}
|
}
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче