graphics: Move PixelFormat out of gl module
This commit is contained in:
parent
079ad953a4
commit
9a82de6fae
|
@ -7,7 +7,10 @@ use super::error::*;
|
||||||
use backend::drm::{Device, Surface};
|
use backend::drm::{Device, Surface};
|
||||||
use backend::egl::native::{Backend, NativeDisplay, NativeSurface};
|
use backend::egl::native::{Backend, NativeDisplay, NativeSurface};
|
||||||
use backend::egl::{EGLContext, EGLSurface};
|
use backend::egl::{EGLContext, EGLSurface};
|
||||||
use backend::graphics::gl::{GLGraphicsBackend, PixelFormat};
|
#[cfg(feature = "renderer_gl")]
|
||||||
|
use backend::graphics::gl::GLGraphicsBackend;
|
||||||
|
#[cfg(feature = "renderer_gl")]
|
||||||
|
use backend::graphics::PixelFormat;
|
||||||
use backend::graphics::{CursorBackend, SwapBuffersError};
|
use backend::graphics::{CursorBackend, SwapBuffersError};
|
||||||
|
|
||||||
pub struct EglSurface<
|
pub struct EglSurface<
|
||||||
|
@ -91,6 +94,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "renderer_gl")]
|
||||||
impl<B: Backend<Surface = <D as Device>::Surface> + 'static, D: Device + NativeDisplay<B> + 'static>
|
impl<B: Backend<Surface = <D as Device>::Surface> + 'static, D: Device + NativeDisplay<B> + 'static>
|
||||||
GLGraphicsBackend for EglSurface<B, D>
|
GLGraphicsBackend for EglSurface<B, D>
|
||||||
where
|
where
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//! EGL context related structs
|
//! EGL context related structs
|
||||||
|
|
||||||
use super::{error::*, ffi, native, EGLSurface};
|
use super::{error::*, ffi, native, EGLSurface};
|
||||||
use backend::graphics::gl::PixelFormat;
|
use backend::graphics::PixelFormat;
|
||||||
use nix::libc::{c_int, c_void};
|
use nix::libc::{c_int, c_void};
|
||||||
use slog;
|
use slog;
|
||||||
use std::{
|
use std::{
|
||||||
|
|
|
@ -337,6 +337,7 @@ impl EGLDisplay {
|
||||||
context: &EGLContext<B, N>,
|
context: &EGLContext<B, N>,
|
||||||
display: *mut wl_display,
|
display: *mut wl_display,
|
||||||
) -> EGLDisplay {
|
) -> EGLDisplay {
|
||||||
|
#[cfg(feature = "renderer_gl")]
|
||||||
let gl = gl_ffi::Gles2::load_with(|s| unsafe { context.get_proc_address(s) as *const _ });
|
let gl = gl_ffi::Gles2::load_with(|s| unsafe { context.get_proc_address(s) as *const _ });
|
||||||
|
|
||||||
EGLDisplay {
|
EGLDisplay {
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/// Describes the pixel format of a framebuffer
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub struct PixelFormat {
|
||||||
|
/// is the format hardware accelerated
|
||||||
|
pub hardware_accelerated: bool,
|
||||||
|
/// number of bits used for colors
|
||||||
|
pub color_bits: u8,
|
||||||
|
/// number of bits used for alpha channel
|
||||||
|
pub alpha_bits: u8,
|
||||||
|
/// number of bits used for depth channel
|
||||||
|
pub depth_bits: u8,
|
||||||
|
/// number of bits used for stencil buffer
|
||||||
|
pub stencil_bits: u8,
|
||||||
|
/// is stereoscopy enabled
|
||||||
|
pub stereoscopy: bool,
|
||||||
|
/// is double buffering enabled
|
||||||
|
pub double_buffer: bool,
|
||||||
|
/// number of samples used for multisampling if enabled
|
||||||
|
pub multisampling: Option<u16>,
|
||||||
|
/// is srgb enabled
|
||||||
|
pub srgb: bool,
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
use nix::libc::c_void;
|
use nix::libc::c_void;
|
||||||
|
|
||||||
use super::SwapBuffersError;
|
use super::{SwapBuffersError, PixelFormat};
|
||||||
|
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(clippy))]
|
#[cfg_attr(feature = "cargo-clippy", allow(clippy))]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
|
@ -10,29 +10,6 @@ pub(crate) mod ffi {
|
||||||
|
|
||||||
pub use self::ffi::Gles2;
|
pub use self::ffi::Gles2;
|
||||||
|
|
||||||
/// Describes the pixel format of the main framebuffer
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
||||||
pub struct PixelFormat {
|
|
||||||
/// is the format hardware accelerated
|
|
||||||
pub hardware_accelerated: bool,
|
|
||||||
/// number of bits used for colors
|
|
||||||
pub color_bits: u8,
|
|
||||||
/// number of bits used for alpha channel
|
|
||||||
pub alpha_bits: u8,
|
|
||||||
/// number of bits used for depth channel
|
|
||||||
pub depth_bits: u8,
|
|
||||||
/// number of bits used for stencil buffer
|
|
||||||
pub stencil_bits: u8,
|
|
||||||
/// is stereoscopy enabled
|
|
||||||
pub stereoscopy: bool,
|
|
||||||
/// is double buffering enabled
|
|
||||||
pub double_buffer: bool,
|
|
||||||
/// number of samples used for multisampling if enabled
|
|
||||||
pub multisampling: Option<u16>,
|
|
||||||
/// is srgb enabled
|
|
||||||
pub srgb: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Trait that describes objects that have an OpenGL context
|
/// Trait that describes objects that have an OpenGL context
|
||||||
/// and can be used to render upon
|
/// and can be used to render upon
|
||||||
pub trait GLGraphicsBackend {
|
pub trait GLGraphicsBackend {
|
||||||
|
|
|
@ -8,6 +8,9 @@ pub use self::errors::*;
|
||||||
mod cursor;
|
mod cursor;
|
||||||
pub use self::cursor::*;
|
pub use self::cursor::*;
|
||||||
|
|
||||||
|
mod format;
|
||||||
|
pub use self::format::*;
|
||||||
|
|
||||||
#[cfg(feature = "renderer_gl")]
|
#[cfg(feature = "renderer_gl")]
|
||||||
pub mod gl;
|
pub mod gl;
|
||||||
#[cfg(feature = "renderer_glium")]
|
#[cfg(feature = "renderer_glium")]
|
||||||
|
|
|
@ -6,8 +6,8 @@ use backend::{
|
||||||
EGLDisplay, EGLGraphicsBackend, EGLSurface,
|
EGLDisplay, EGLGraphicsBackend, EGLSurface,
|
||||||
},
|
},
|
||||||
graphics::{
|
graphics::{
|
||||||
gl::{GLGraphicsBackend, PixelFormat},
|
gl::GLGraphicsBackend,
|
||||||
CursorBackend, SwapBuffersError,
|
CursorBackend, SwapBuffersError, PixelFormat,
|
||||||
},
|
},
|
||||||
input::{
|
input::{
|
||||||
Axis, AxisSource, Event as BackendEvent, InputBackend, InputHandler, KeyState, KeyboardKeyEvent,
|
Axis, AxisSource, Event as BackendEvent, InputBackend, InputHandler, KeyState, KeyboardKeyEvent,
|
||||||
|
|
Loading…
Reference in New Issue