Merge remote-tracking branch 'upstream/master' into yoda-wayland-only

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	wgpu/Cargo.toml
#	wgpu/src/window/compositor.rs
This commit is contained in:
Lionel DARNIS 2026-08-19 21:44:35 +02:00
commit d24bcd0272
36 changed files with 475 additions and 209 deletions

View file

@ -9,16 +9,10 @@ use crate::graphics::{self, Shell, Viewport};
use crate::settings::{self, Settings};
use crate::{Engine, Renderer};
#[cfg(all(
unix,
feature = "cctk",
not(target_os = "macos"),
not(target_os = "redox")
))]
#[cfg(wayland_platform)]
use super::wayland::get_wayland_device_ids;
#[cfg(all(unix, feature = "x11", not(target_os = "macos"), not(target_os = "redox")))]
use super::x11::get_x11_device_ids;
use std::future::Future;
/// A window graphics backend for iced powered by `wgpu`.
pub struct Compositor {
@ -65,12 +59,7 @@ impl Compositor {
compatible_window: Option<W>,
shell: Shell,
) -> Result<Self, Error> {
#[cfg(all(
unix,
feature = "cctk",
not(target_os = "macos"),
not(target_os = "redox")
))]
#[cfg(wayland_platform)]
let ids = compatible_window.as_ref().and_then(|window| {
let w = get_wayland_device_ids(window);
#[cfg(feature = "x11")]
@ -78,23 +67,13 @@ impl Compositor {
w
});
#[cfg(all(
unix,
not(feature = "cctk"),
not(target_os = "macos"),
not(target_os = "redox")
))]
let ids = compatible_window
.as_ref()
.and_then(|window| get_x11_device_ids(window));
// HACK:
// 1. If we specifically didn't select an nvidia gpu
// 2. and the user didn't specifically request an nvidia gpu
// 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")
@ -154,11 +133,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)