Use per-adapter limits for device creation; bump wgpu to 29.0.3
Query each adapter's actual limits via adapter.limits() instead of the conservative downlevel_defaults(), and drop the redundant surface reconfigure on Suboptimal (the texture is still valid to present).
This commit is contained in:
+9
-13
@@ -139,17 +139,16 @@ impl GpuContext {
|
||||
anyhow::bail!("no wgpu adapters found");
|
||||
}
|
||||
|
||||
let device_desc = wgpu::DeviceDescriptor {
|
||||
label: Some("gpupaper"),
|
||||
required_features: wgpu::Features::empty(),
|
||||
required_limits: wgpu::Limits::downlevel_defaults(),
|
||||
memory_hints: wgpu::MemoryHints::default(),
|
||||
experimental_features: Default::default(),
|
||||
trace: Default::default(),
|
||||
};
|
||||
|
||||
let mut selected: Option<(wgpu::Adapter, wgpu::Device, wgpu::Queue)> = None;
|
||||
for adapter in &candidates {
|
||||
let device_desc = wgpu::DeviceDescriptor {
|
||||
label: Some("gpupaper"),
|
||||
required_features: wgpu::Features::empty(),
|
||||
required_limits: adapter.limits(),
|
||||
memory_hints: wgpu::MemoryHints::default(),
|
||||
experimental_features: Default::default(),
|
||||
trace: Default::default(),
|
||||
};
|
||||
let outcome = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||
pollster::block_on(adapter.request_device(&device_desc))
|
||||
}));
|
||||
@@ -415,10 +414,7 @@ impl SurfaceRenderer {
|
||||
|
||||
let surface_texture = match self.surface.get_current_texture() {
|
||||
wgpu::CurrentSurfaceTexture::Success(t) => t,
|
||||
wgpu::CurrentSurfaceTexture::Suboptimal(t) => {
|
||||
self.surface.configure(&gpu.device, &self.surface_config);
|
||||
t
|
||||
}
|
||||
wgpu::CurrentSurfaceTexture::Suboptimal(t) => t,
|
||||
wgpu::CurrentSurfaceTexture::Lost | wgpu::CurrentSurfaceTexture::Outdated => {
|
||||
self.surface.configure(&gpu.device, &self.surface_config);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user