fix: feature gates
This commit is contained in:
parent
f6daee14ac
commit
b3b0ab1cd5
26 changed files with 176 additions and 101 deletions
|
|
@ -1,10 +1,6 @@
|
|||
//! Display rendering results on windows.
|
||||
pub mod compositor;
|
||||
#[cfg(all(
|
||||
unix,
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
#[cfg(wayland_platform)]
|
||||
mod wayland;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
mod x11;
|
||||
|
|
|
|||
|
|
@ -9,15 +9,10 @@ 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(wayland_platform)]
|
||||
use super::wayland::get_wayland_device_ids;
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
#[cfg(wayland_platform)]
|
||||
use super::x11::get_x11_device_ids;
|
||||
use std::future::Future;
|
||||
|
||||
/// A window graphics backend for iced powered by `wgpu`.
|
||||
pub struct Compositor {
|
||||
|
|
@ -64,11 +59,7 @@ impl Compositor {
|
|||
compatible_window: Option<W>,
|
||||
shell: Shell,
|
||||
) -> Result<Self, Error> {
|
||||
#[cfg(all(
|
||||
unix,
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
#[cfg(wayland_platform)]
|
||||
let ids = compatible_window.as_ref().and_then(|window| {
|
||||
get_wayland_device_ids(window)
|
||||
.or_else(|| get_x11_device_ids(window))
|
||||
|
|
@ -80,7 +71,7 @@ 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(wayland_platform)]
|
||||
if !matches!(ids, Some((0x10de, _)))
|
||||
&& std::env::var_os("__NV_PRIME_RENDER_OFFLOAD")
|
||||
.is_none_or(|var| var == "0")
|
||||
|
|
@ -140,11 +131,7 @@ impl Compositor {
|
|||
let mut adapter = None;
|
||||
#[cfg_attr(not(unix), allow(dead_code))]
|
||||
if std::env::var_os("WGPU_ADAPTER_NAME").is_none() {
|
||||
#[cfg(all(
|
||||
unix,
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
#[cfg(wayland_platform)]
|
||||
if let Some((vendor_id, device_id)) = ids {
|
||||
adapter = instance
|
||||
.enumerate_adapters(settings.backends)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::graphics::compositor::Window;
|
||||
use sctk::{
|
||||
use cctk::sctk::{
|
||||
dmabuf::{DmabufFeedback, DmabufHandler, DmabufState},
|
||||
registry::{ProvidesRegistryState, RegistryState},
|
||||
registry_handlers,
|
||||
|
|
@ -111,5 +111,5 @@ pub fn get_wayland_device_ids<W: Window>(window: &W) -> Option<(u16, u16)> {
|
|||
}
|
||||
}
|
||||
|
||||
sctk::delegate_dmabuf!(AppData);
|
||||
sctk::delegate_registry!(AppData);
|
||||
cctk::sctk::delegate_dmabuf!(AppData);
|
||||
cctk::sctk::delegate_registry!(AppData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue