Merge pull request #1354 from iced-rs/fix/wgpu-modern-limits
Try `Limits::default` in `iced_wgpu` before `downlevel_defaults`
This commit is contained in:
commit
1830a21a76
1 changed files with 26 additions and 18 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::{Backend, Color, Error, Renderer, Settings, Viewport};
|
use crate::{Backend, Color, Error, Renderer, Settings, Viewport};
|
||||||
|
|
||||||
|
use futures::stream::{self, StreamExt};
|
||||||
use futures::task::SpawnExt;
|
use futures::task::SpawnExt;
|
||||||
|
|
||||||
use iced_graphics::compositor;
|
use iced_graphics::compositor;
|
||||||
use iced_native::futures;
|
use iced_native::futures;
|
||||||
use raw_window_handle::HasRawWindowHandle;
|
use raw_window_handle::HasRawWindowHandle;
|
||||||
|
|
@ -66,28 +68,34 @@ impl Compositor {
|
||||||
log::info!("Selected format: {:?}", format);
|
log::info!("Selected format: {:?}", format);
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
let limits = wgpu::Limits::downlevel_webgl2_defaults()
|
let limits = [wgpu::Limits::downlevel_webgl2_defaults()
|
||||||
.using_resolution(adapter.limits());
|
.using_resolution(adapter.limits())];
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
let limits = wgpu::Limits::downlevel_defaults();
|
let limits =
|
||||||
|
[wgpu::Limits::default(), wgpu::Limits::downlevel_defaults()];
|
||||||
|
|
||||||
let (device, queue) = adapter
|
let limits = limits.into_iter().map(|limits| wgpu::Limits {
|
||||||
.request_device(
|
max_bind_groups: 2,
|
||||||
&wgpu::DeviceDescriptor {
|
..limits
|
||||||
label: Some(
|
});
|
||||||
"iced_wgpu::window::compositor device descriptor",
|
|
||||||
),
|
let (device, queue) = stream::iter(limits)
|
||||||
features: wgpu::Features::empty(),
|
.filter_map(|limits| async {
|
||||||
limits: wgpu::Limits {
|
adapter.request_device(
|
||||||
max_bind_groups: 2,
|
&wgpu::DeviceDescriptor {
|
||||||
..limits
|
label: Some(
|
||||||
|
"iced_wgpu::window::compositor device descriptor",
|
||||||
|
),
|
||||||
|
features: wgpu::Features::empty(),
|
||||||
|
limits,
|
||||||
},
|
},
|
||||||
},
|
None,
|
||||||
None,
|
).await.ok()
|
||||||
)
|
})
|
||||||
.await
|
.boxed()
|
||||||
.ok()?;
|
.next()
|
||||||
|
.await?;
|
||||||
|
|
||||||
let staging_belt = wgpu::util::StagingBelt::new(Self::CHUNK_SIZE);
|
let staging_belt = wgpu::util::StagingBelt::new(Self::CHUNK_SIZE);
|
||||||
let local_pool = futures::executor::LocalPool::new();
|
let local_pool = futures::executor::LocalPool::new();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue