egl: fix broken egl check

This commit is contained in:
Victor Brekenfeld 2020-05-03 16:51:14 +02:00
parent b708f88da6
commit eaa3a0ca87
1 changed files with 7 additions and 6 deletions

View File

@ -150,7 +150,7 @@ impl<B: native::Backend, N: native::NativeDisplay<B>> EGLDisplay<B, N> {
}; };
info!(log, "EGL Extensions: {:?}", extensions); info!(log, "EGL Extensions: {:?}", extensions);
if egl_version >= (1, 2) { if egl_version <= (1, 2) {
return Err(Error::OpenGlesNotSupported(None)); return Err(Error::OpenGlesNotSupported(None));
} }
wrap_egl_call(|| unsafe { ffi::egl::BindAPI(ffi::egl::OPENGL_ES_API) }) wrap_egl_call(|| unsafe { ffi::egl::BindAPI(ffi::egl::OPENGL_ES_API) })
@ -485,16 +485,17 @@ impl EGLBufferReader {
buffer: WlBuffer, buffer: WlBuffer,
) -> ::std::result::Result<EGLImages, BufferAccessError> { ) -> ::std::result::Result<EGLImages, BufferAccessError> {
let mut format: i32 = 0; let mut format: i32 = 0;
wrap_egl_call(|| unsafe { if wrap_egl_call(|| unsafe {
ffi::egl::QueryWaylandBufferWL( ffi::egl::QueryWaylandBufferWL(
**self.display, **self.display,
buffer.as_ref().c_ptr() as _, buffer.as_ref().c_ptr() as _,
ffi::egl::EGL_TEXTURE_FORMAT, ffi::egl::EGL_TEXTURE_FORMAT,
&mut format, &mut format,
) )
}) }).map_err(|source| BufferAccessError::NotManaged(buffer.clone(), source))? == ffi::egl::FALSE {
.map_err(|source| BufferAccessError::NotManaged(buffer.clone(), source))?; return Err(BufferAccessError::NotManaged(buffer.clone(), EGLError::BadParameter));
}
let format = match format { let format = match format {
x if x == ffi::egl::TEXTURE_RGB as i32 => Format::RGB, x if x == ffi::egl::TEXTURE_RGB as i32 => Format::RGB,
x if x == ffi::egl::TEXTURE_RGBA as i32 => Format::RGBA, x if x == ffi::egl::TEXTURE_RGBA as i32 => Format::RGBA,
@ -502,7 +503,7 @@ impl EGLBufferReader {
ffi::egl::TEXTURE_Y_UV_WL => Format::Y_UV, ffi::egl::TEXTURE_Y_UV_WL => Format::Y_UV,
ffi::egl::TEXTURE_Y_U_V_WL => Format::Y_U_V, ffi::egl::TEXTURE_Y_U_V_WL => Format::Y_U_V,
ffi::egl::TEXTURE_Y_XUXV_WL => Format::Y_XUXV, ffi::egl::TEXTURE_Y_XUXV_WL => Format::Y_XUXV,
_ => panic!("EGL returned invalid texture type"), x => panic!("EGL returned invalid texture type: {}", x),
}; };
let mut width: i32 = 0; let mut width: i32 = 0;