egl: do not fail if desired swap interval cannot be selected
This commit is contained in:
parent
e8926da56c
commit
eb1dc5de4f
|
@ -253,11 +253,17 @@ impl<B: native::Backend, N: native::NativeDisplay<B>> EGLDisplay<B, N> {
|
||||||
config_ids.set_len(num_configs as usize);
|
config_ids.set_len(num_configs as usize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Deeper swap intervals might have some uses
|
if config_ids.is_empty() {
|
||||||
|
return Err(Error::NoAvailablePixelFormat);
|
||||||
|
}
|
||||||
|
|
||||||
let desired_swap_interval = if attributes.vsync { 1 } else { 0 };
|
let desired_swap_interval = if attributes.vsync { 1 } else { 0 };
|
||||||
|
|
||||||
let config_ids = config_ids
|
// try to select a config with the desired_swap_interval
|
||||||
.into_iter()
|
// (but don't fail, as the margin might be very small on some cards and most configs are fine)
|
||||||
|
let config_id = config_ids
|
||||||
|
.iter()
|
||||||
|
.copied()
|
||||||
.map(|config| unsafe {
|
.map(|config| unsafe {
|
||||||
let mut min_swap_interval = 0;
|
let mut min_swap_interval = 0;
|
||||||
wrap_egl_call(|| {
|
wrap_egl_call(|| {
|
||||||
|
@ -293,14 +299,8 @@ impl<B: native::Backend, N: native::NativeDisplay<B>> EGLDisplay<B, N> {
|
||||||
.map_err(Error::ConfigFailed)?
|
.map_err(Error::ConfigFailed)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flatten()
|
.flatten()
|
||||||
.collect::<Vec<_>>();
|
.next()
|
||||||
|
.unwrap_or_else(|| config_ids[0]);
|
||||||
if config_ids.is_empty() {
|
|
||||||
return Err(Error::NoAvailablePixelFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Improve config selection
|
|
||||||
let config_id = config_ids[0];
|
|
||||||
|
|
||||||
// analyzing each config
|
// analyzing each config
|
||||||
macro_rules! attrib {
|
macro_rules! attrib {
|
||||||
|
|
Loading…
Reference in New Issue