egl: Allow displays to specify surface_type
This commit is contained in:
parent
726624cbd8
commit
4647141770
|
@ -180,6 +180,7 @@ impl<B: native::Backend, N: native::NativeDisplay<B>> EGLDisplay<B, N> {
|
|||
) -> Result<(PixelFormat, ffi::egl::types::EGLConfig), Error> {
|
||||
let descriptor = {
|
||||
let mut out: Vec<c_int> = Vec::with_capacity(37);
|
||||
let surface_type = self.native.borrow().surface_type();
|
||||
|
||||
if self.egl_version >= (1, 2) {
|
||||
trace!(self.logger, "Setting COLOR_BUFFER_TYPE to RGB_BUFFER");
|
||||
|
@ -187,12 +188,12 @@ impl<B: native::Backend, N: native::NativeDisplay<B>> EGLDisplay<B, N> {
|
|||
out.push(ffi::egl::RGB_BUFFER as c_int);
|
||||
}
|
||||
|
||||
trace!(self.logger, "Setting SURFACE_TYPE to WINDOW");
|
||||
trace!(self.logger, "Setting SURFACE_TYPE to {}", surface_type);
|
||||
|
||||
out.push(ffi::egl::SURFACE_TYPE as c_int);
|
||||
// TODO: Some versions of Mesa report a BAD_ATTRIBUTE error
|
||||
// if we ask for PBUFFER_BIT as well as WINDOW_BIT
|
||||
out.push((ffi::egl::WINDOW_BIT) as c_int);
|
||||
out.push(surface_type);
|
||||
|
||||
match attributes.version {
|
||||
Some((3, _)) => {
|
||||
|
|
|
@ -133,6 +133,10 @@ pub unsafe trait NativeDisplay<B: Backend> {
|
|||
fn attributes(&self) -> Vec<ffi::EGLint> {
|
||||
vec![ffi::egl::NONE as ffi::EGLint]
|
||||
}
|
||||
/// Type of surfaces created
|
||||
fn surface_type(&self) -> ffi::EGLint {
|
||||
ffi::egl::WINDOW_BIT as ffi::EGLint
|
||||
}
|
||||
/// Create a surface
|
||||
fn create_surface(&mut self, args: Self::Arguments) -> Result<B::Surface, Self::Error>;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue