chore: cleanup platform specific code
This commit is contained in:
parent
a11b828280
commit
3b7f0bec0e
18 changed files with 109 additions and 101 deletions
|
|
@ -1,6 +1,11 @@
|
|||
//! Display rendering results on windows.
|
||||
pub mod compositor;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
mod wayland;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
mod x11;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,12 @@ use crate::graphics::{self, Shell, Viewport};
|
|||
use crate::settings::{self, Settings};
|
||||
use crate::{Engine, Renderer};
|
||||
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
use super::wayland::get_wayland_device_ids;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
use super::x11::get_x11_device_ids;
|
||||
|
|
@ -60,7 +65,12 @@ impl Compositor {
|
|||
compatible_window: Option<W>,
|
||||
shell: Shell,
|
||||
) -> Result<Self, Error> {
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
let ids = compatible_window.as_ref().and_then(|window| {
|
||||
get_wayland_device_ids(window)
|
||||
.or_else(|| get_x11_device_ids(window))
|
||||
|
|
@ -72,7 +82,12 @@ impl Compositor {
|
|||
// 3. and the user didn't set an adapter name,
|
||||
// 4. and the user didn't request the high power pref
|
||||
// => don't load the nvidia icd, as it might power on the gpu in hybrid setups causing severe delays
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
if !matches!(ids, Some((0x10de, _)))
|
||||
&& std::env::var_os("__NV_PRIME_RENDER_OFFLOAD")
|
||||
.is_none_or(|var| var == "0")
|
||||
|
|
@ -133,6 +148,7 @@ impl Compositor {
|
|||
if std::env::var_os("WGPU_ADAPTER_NAME").is_none() {
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ use cctk::sctk::{
|
|||
};
|
||||
use raw_window_handle::{RawDisplayHandle, WaylandDisplayHandle};
|
||||
use wayland_client::{
|
||||
backend::Backend, globals::registry_queue_init, protocol::wl_buffer,
|
||||
Connection, QueueHandle,
|
||||
Connection, QueueHandle, backend::Backend, globals::registry_queue_init,
|
||||
protocol::wl_buffer,
|
||||
};
|
||||
use wayland_protocols::wp::linux_dmabuf::zv1::client::{
|
||||
zwp_linux_buffer_params_v1, zwp_linux_dmabuf_feedback_v1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue