render: implement a vulkan renderer
This commit is contained in:
parent
4ba8550da8
commit
cf332e8436
66 changed files with 4287 additions and 239 deletions
|
|
@ -15,7 +15,7 @@ use {
|
|||
timer::Timer,
|
||||
video::{
|
||||
connector_type::{ConnectorType, CON_UNKNOWN},
|
||||
Connector, DrmDevice, Mode,
|
||||
Connector, DrmDevice, GfxApi, Mode,
|
||||
},
|
||||
Axis, Direction, ModifiedKeySym, PciId, Workspace,
|
||||
},
|
||||
|
|
@ -506,6 +506,10 @@ impl Client {
|
|||
self.send(&ClientMessage::MakeRenderDevice { device });
|
||||
}
|
||||
|
||||
pub fn set_gfx_api(&self, device: Option<DrmDevice>, api: GfxApi) {
|
||||
self.send(&ClientMessage::SetGfxApi { device, api });
|
||||
}
|
||||
|
||||
pub fn connector_connected(&self, connector: Connector) -> bool {
|
||||
let res = self.send_with_response(&ClientMessage::ConnectorConnected { connector });
|
||||
get_response!(res, false, ConnectorConnected { connected });
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use {
|
|||
logging::LogLevel,
|
||||
theme::{colors::Colorable, sized::Resizable, Color},
|
||||
timer::Timer,
|
||||
video::{connector_type::ConnectorType, Connector, DrmDevice},
|
||||
video::{connector_type::ConnectorType, Connector, DrmDevice, GfxApi},
|
||||
Axis, Direction, PciId, Workspace,
|
||||
},
|
||||
bincode::{BorrowDecode, Decode, Encode},
|
||||
|
|
@ -334,6 +334,10 @@ pub enum ClientMessage<'a> {
|
|||
device: InputDevice,
|
||||
enabled: bool,
|
||||
},
|
||||
SetGfxApi {
|
||||
device: Option<DrmDevice>,
|
||||
api: GfxApi,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
|
|||
|
|
@ -362,4 +362,30 @@ impl DrmDevice {
|
|||
pub fn make_render_device(self) {
|
||||
get!().make_render_device(self);
|
||||
}
|
||||
|
||||
/// Sets the preferred graphics API for this device.
|
||||
///
|
||||
/// If the API cannot be used, the compositor will try other APIs.
|
||||
pub fn set_gfx_api(self, gfx_api: GfxApi) {
|
||||
get!().set_gfx_api(Some(self), gfx_api);
|
||||
}
|
||||
}
|
||||
|
||||
/// A graphics API.
|
||||
#[non_exhaustive]
|
||||
#[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
pub enum GfxApi {
|
||||
OpenGl,
|
||||
Vulkan,
|
||||
}
|
||||
|
||||
/// Sets the default graphics API.
|
||||
///
|
||||
/// If the API cannot be used, the compositor will try other APIs.
|
||||
///
|
||||
/// This setting can be overwritten per-device with [DrmDevice::set_gfx_api].
|
||||
///
|
||||
/// This call has no effect on devices that have already been initialized.
|
||||
pub fn set_gfx_api(gfx_api: GfxApi) {
|
||||
get!().set_gfx_api(None, gfx_api);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue