egl: differenciate display creation failures

This commit is contained in:
Victor Brekenfeld 2020-05-18 20:23:08 +02:00
parent 73447bd668
commit d3a60e03c9
2 changed files with 9 additions and 3 deletions

View File

@ -97,8 +97,11 @@ impl<B: native::Backend, N: native::NativeDisplay<B>> EGLDisplay<B, N> {
|e: &str| dp_extensions.iter().any(|s| s == e), |e: &str| dp_extensions.iter().any(|s| s == e),
log.clone(), log.clone(),
) )
.map_err(Error::DisplayNotSupported)? .map_err(Error::DisplayCreationError)?
}; };
if display == ffi::egl::NO_DISPLAY {
return Err(Error::DisplayNotSupported);
}
let egl_version = { let egl_version = {
let mut major: MaybeUninit<ffi::egl::types::EGLint> = MaybeUninit::uninit(); let mut major: MaybeUninit<ffi::egl::types::EGLint> = MaybeUninit::uninit();

View File

@ -15,9 +15,12 @@ pub enum Error {
/// Backend does not match the context type /// Backend does not match the context type
#[error("The expected backend '{0:?}' does not match the runtime")] #[error("The expected backend '{0:?}' does not match the runtime")]
NonMatchingBackend(&'static str), NonMatchingBackend(&'static str),
/// Display creation failed
#[error("Display creation failed with error: {0:}")]
DisplayCreationError(#[source] EGLError),
/// Unable to obtain a valid EGL Display /// Unable to obtain a valid EGL Display
#[error("Unable to obtain a valid EGL Display. Err: {0:}")] #[error("Unable to obtain a valid EGL Display.")]
DisplayNotSupported(#[source] EGLError), DisplayNotSupported,
/// `eglInitialize` returned an error /// `eglInitialize` returned an error
#[error("Failed to initialize EGL. Err: {0:}")] #[error("Failed to initialize EGL. Err: {0:}")]
InitFailed(#[source] EGLError), InitFailed(#[source] EGLError),