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:
1 parent
2c3f59b0e4
commit
ab1e83c7eb
1 file changed
+13
-2
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user