Reintroduce backend selection through ICED_BACKEND env var

This commit is contained in:
Héctor Ramón Jiménez 2024-03-24 08:04:28 +01:00
parent 441e9237cd
commit 4f5b63f1f4
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 196 additions and 83 deletions

View file

@ -20,6 +20,18 @@ pub trait Compositor: Sized {
fn new<W: Window + Clone>(
settings: Settings,
compatible_window: W,
) -> impl Future<Output = Result<Self, Error>> {
Self::with_backend(settings, compatible_window, None)
}
/// Creates a new [`Compositor`] with a backend preference.
///
/// If the backend does not match the preference, it will return
/// [`Error::GraphicsAdapterNotFound`].
fn with_backend<W: Window + Clone>(
_settings: Settings,
_compatible_window: W,
_backend: Option<&str>,
) -> impl Future<Output = Result<Self, Error>>;
/// Creates a [`Self::Renderer`] for the [`Compositor`].
@ -130,9 +142,10 @@ impl Compositor for () {
type Renderer = ();
type Surface = ();
async fn new<W: Window + Clone>(
async fn with_backend<W: Window + Clone>(
_settings: Settings,
_compatible_window: W,
_preffered_backend: Option<&str>,
) -> Result<Self, Error> {
Ok(())
}