From 97db1f6e14ad9bb6c7bb7c18db66872e38608577 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Fri, 27 Feb 2026 14:36:31 -0700 Subject: [PATCH] Dynamically detect surface size limits on WGPU (#50340) (cherry-pick to preview) (#50348) Cherry-pick of #50340 to the preview branch (v0.226.x). The original PR changed `wgpu::Limits::downlevel_defaults()` to include `.using_resolution(adapter.limits()).using_alignment(adapter.limits())` to dynamically detect surface size limits. This cherry-pick required conflict resolution because the preview branch has a different code structure: - Preview uses a synchronous `create_device` function with `smol::block_on` - Preview doesn't have the WASM-related code paths - Preview used `wgpu::Limits::default()` instead of `wgpu::Limits::downlevel_defaults()` The change was adapted to apply the fix (`downlevel_defaults()` + `.using_resolution()` + `.using_alignment()`) to the preview branch's code structure. Release Notes: - N/A Co-authored-by: John Tur --- crates/gpui_wgpu/src/wgpu_context.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/crates/gpui_wgpu/src/wgpu_context.rs b/crates/gpui_wgpu/src/wgpu_context.rs index 96fbdddaaaf0aa5da2f77030ab30ddbd8d7197d5..3a1171239a5725dd3084c27a7e624b8bc1d351c1 100644 --- a/crates/gpui_wgpu/src/wgpu_context.rs +++ b/crates/gpui_wgpu/src/wgpu_context.rs @@ -99,14 +99,18 @@ impl WgpuContext { ); } - let (device, queue) = smol::block_on(adapter.request_device(&wgpu::DeviceDescriptor { - label: Some("gpui_device"), - required_features, - required_limits: wgpu::Limits::default(), - memory_hints: wgpu::MemoryHints::MemoryUsage, - trace: wgpu::Trace::Off, - experimental_features: wgpu::ExperimentalFeatures::disabled(), - })) + let (device, queue) = smol::block_on( + adapter.request_device(&wgpu::DeviceDescriptor { + label: Some("gpui_device"), + required_features, + required_limits: wgpu::Limits::downlevel_defaults() + .using_resolution(adapter.limits()) + .using_alignment(adapter.limits()), + memory_hints: wgpu::MemoryHints::MemoryUsage, + trace: wgpu::Trace::Off, + experimental_features: wgpu::ExperimentalFeatures::disabled(), + }), + ) .map_err(|e| anyhow::anyhow!("Failed to create wgpu device: {e}"))?; Ok((device, queue, dual_source_blending_available))