1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-13 07:22:52 +03:00

window: fallback to basic opengl context if extensions fail

8f1f1a65ea added support for probing
for opengl extensions, and I thought that I had the fallback covered
but it turned out that we were only falling back if one of the major
extensions wasn't present.

This commit adds a fallback for the case where things look ok at
first glance, but where they fail at runtime for whatever reason.

refs: https://github.com/wez/wezterm/issues/235
This commit is contained in:
Wez Furlong 2020-06-29 18:05:43 -07:00
parent 2c3f59b0e4
commit ab1e83c7eb

View File

@ -167,7 +167,18 @@ impl GlState {
log::trace!("opengl extensions: {:?}", extensions);
if has_extension(&extensions, "WGL_ARB_pixel_format") {
return Self::create_ext(wgl, extensions, hdc);
return match Self::create_ext(wgl, extensions, hdc) {
Ok(state) => Ok(state),
Err(err) => {
log::error!(
"failed to created extended OpenGL context \
({}), fall back to basic",
err
);
let wgl = WglWrapper::load()?;
Self::create_basic(wgl, window)
}
};
}
}
@ -283,7 +294,7 @@ impl GlState {
};
if rc.is_null() {
anyhow::bail!("failed to make context");
anyhow::bail!("CreateContextAttribsARB failed");
}
unsafe {