Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui_wgpu: Upgrade wgpu to fix Vulkan surface teardown (#65649)

Ben Brandt402675e8058b
diff --git a/Cargo.lock b/Cargo.lock
index 9fd1488d9a3..b3940cda6d0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1452,7 +1452,7 @@ dependencies = [
"log",
"num-rational",
"num-traits",
- "pastey",
+ "pastey 0.1.1",
"rayon",
"thiserror 2.0.17",
"v_frame",
@@ -2235,11 +2235,11 @@ dependencies = [
[[package]]
name = "bit-set"
-version = "0.9.1"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd"
+checksum = "56d87354e4229f54a44f7bf2435906a4656dba36026ab6eaca629a2c436a691c"
dependencies = [
- "bit-vec 0.9.1",
+ "bit-vec 0.10.1",
]
[[package]]
@@ -2250,9 +2250,9 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
[[package]]
name = "bit-vec"
-version = "0.9.1"
+version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"
+checksum = "5727b15fa97d4f4fee0a3b7c3d550ed0269f54329207b86388de918604e31269"
[[package]]
name = "bit_field"
@@ -2839,9 +2839,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
[[package]]
name = "cfg_aliases"
-version = "0.2.1"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
+checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
[[package]]
name = "chacha20"
@@ -7267,9 +7267,9 @@ dependencies = [
[[package]]
name = "glow"
-version = "0.17.0"
+version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5"
+checksum = "263218b0ba2b0715c3370fb04674f5f8aa331594b521c94ff0a8e4a8472d1386"
dependencies = [
"js-sys",
"slotmap",
@@ -7356,26 +7356,6 @@ dependencies = [
"windows 0.62.2",
]
-[[package]]
-name = "gpu-descriptor"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
-dependencies = [
- "bitflags 2.13.1",
- "gpu-descriptor-types",
- "hashbrown 0.15.5",
-]
-
-[[package]]
-name = "gpu-descriptor-types"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
-dependencies = [
- "bitflags 2.13.1",
-]
-
[[package]]
name = "gpui"
version = "0.2.2"
@@ -8114,12 +8094,6 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
-[[package]]
-name = "hexf-parse"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
-
[[package]]
name = "hkdf"
version = "0.12.4"
@@ -8182,7 +8156,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e815d50d9e411ba2690d730e6ec139c08260dddb756df315dbd16d01a587226"
dependencies = [
"memchr",
- "pastey",
+ "pastey 0.1.1",
"phf 0.13.1",
"phf_codegen",
"serde_json",
@@ -9199,13 +9173,12 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.97"
+version = "0.3.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1840c94c045fbcf8ba2812c95db44499f7c64910a912551aaaa541decebcacf"
+checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"
dependencies = [
"cfg-if",
"futures-util",
- "once_cell",
"wasm-bindgen",
]
@@ -10528,6 +10501,22 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b"
+[[package]]
+name = "macro_rules_attribute"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3ae8f6d608c795738406608304d30a2dfbdc8e58e44f7ba43236da5208ded3c"
+dependencies = [
+ "macro_rules_attribute-proc_macro",
+ "pastey 0.2.3",
+]
+
+[[package]]
+name = "macro_rules_attribute-proc_macro"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc04a4c58212d57930a24bf47d3fa87485264a3a054e9c10e042eb373573ad3c"
+
[[package]]
name = "malloc_buf"
version = "0.0.6"
@@ -11140,22 +11129,21 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
[[package]]
name = "naga"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"arrayvec",
- "bit-set 0.9.1",
+ "bit-set 0.11.1",
"bitflags 2.13.1",
"cfg-if",
"cfg_aliases",
"codespan-reporting",
"half",
- "hashbrown 0.16.1",
- "hexf-parse",
+ "hashbrown 0.17.1",
"indexmap 2.14.0",
"libm",
"log",
+ "naga-types",
"num-traits",
"once_cell",
"rustc-hash 1.1.0",
@@ -11164,6 +11152,17 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "naga-types"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
+dependencies = [
+ "hashbrown 0.17.1",
+ "indexmap 2.14.0",
+ "rustc-hash 1.1.0",
+ "thiserror 2.0.17",
+]
+
[[package]]
name = "nanoid"
version = "0.4.0"
@@ -11944,6 +11943,7 @@ dependencies = [
"bitflags 2.13.1",
"objc2 0.6.3",
"objc2-core-foundation",
+ "objc2-core-graphics",
"objc2-foundation 0.3.2",
"objc2-metal 0.3.2",
]
@@ -12583,6 +12583,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
+[[package]]
+name = "pastey"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4"
+
[[package]]
name = "path"
version = "0.1.0"
@@ -19789,9 +19795,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasm-bindgen"
-version = "0.2.120"
+version = "0.2.129"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df52b6d9b87e0c74c9edfa1eb2d9bf85e5d63515474513aa50fa181b3c4f5db1"
+checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
dependencies = [
"cfg-if",
"once_cell",
@@ -19802,19 +19808,20 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.70"
+version = "0.4.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af934872acec734c2d80e6617bbb5ff4f12b052dd8e6332b0817bce889516084"
+checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e"
dependencies = [
"js-sys",
+ "tokio",
"wasm-bindgen",
]
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.120"
+version = "0.2.129"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78b1041f495fb322e64aca85f5756b2172e35cd459376e67f2a6c9dffcedb103"
+checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -19822,22 +19829,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.120"
+version = "0.2.129"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9dcd0ff20416988a18ac686d4d4d0f6aae9ebf08a389ff5d29012b05af2a1b41"
+checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
dependencies = [
"bumpalo",
"proc-macro2",
"quote",
- "syn 2.0.117",
+ "syn 3.0.3",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.120"
+version = "0.2.129"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49757b3c82ebf16c57d69365a142940b384176c24df52a087fb748e2085359ea"
+checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
dependencies = [
"unicode-ident",
]
@@ -20412,9 +20419,9 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.97"
+version = "0.3.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eadbac71025cd7b0834f20d1fe8472e8495821b4e9801eb0a60bd1f19827602"
+checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -20533,9 +20540,8 @@ checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3"
[[package]]
name = "wgpu"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"arrayvec",
"bitflags 2.13.1",
@@ -20543,12 +20549,10 @@ dependencies = [
"cfg-if",
"cfg_aliases",
"document-features",
- "hashbrown 0.16.1",
+ "hashbrown 0.17.1",
"js-sys",
"log",
"naga",
- "parking_lot",
- "portable-atomic",
"profiling",
"raw-window-handle",
"smallvec",
@@ -20558,89 +20562,94 @@ dependencies = [
"web-sys",
"wgpu-core",
"wgpu-hal",
+ "wgpu-sync",
"wgpu-types",
]
[[package]]
name = "wgpu-core"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"arrayvec",
- "bit-set 0.9.1",
- "bit-vec 0.9.1",
+ "bit-set 0.11.1",
+ "bit-vec 0.10.1",
"bitflags 2.13.1",
"bytemuck",
"cfg_aliases",
"document-features",
- "hashbrown 0.16.1",
+ "hashbrown 0.17.1",
"indexmap 2.14.0",
"log",
"naga",
- "once_cell",
- "parking_lot",
- "portable-atomic",
+ "naga-types",
+ "num-traits",
"profiling",
"raw-window-handle",
"rustc-hash 1.1.0",
+ "scopeguard",
"smallvec",
"thiserror 2.0.17",
"wgpu-core-deps-apple",
"wgpu-core-deps-emscripten",
+ "wgpu-core-deps-linux-android-bsd",
"wgpu-core-deps-wasm",
- "wgpu-core-deps-windows-linux-android",
+ "wgpu-core-deps-windows",
"wgpu-hal",
"wgpu-naga-bridge",
+ "wgpu-sync",
"wgpu-types",
]
[[package]]
name = "wgpu-core-deps-apple"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"wgpu-hal",
]
[[package]]
name = "wgpu-core-deps-emscripten"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
+dependencies = [
+ "wgpu-hal",
+]
+
+[[package]]
+name = "wgpu-core-deps-linux-android-bsd"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"wgpu-hal",
]
[[package]]
name = "wgpu-core-deps-wasm"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af1fb1798be2a912497d4c224f72d39bb0cb34af50e8bcc29865bc339c943059"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"wgpu-hal",
]
[[package]]
-name = "wgpu-core-deps-windows-linux-android"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257"
+name = "wgpu-core-deps-windows"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"wgpu-hal",
]
[[package]]
name = "wgpu-hal"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"android_system_properties",
"arrayvec",
"ash",
- "bit-set 0.9.1",
+ "bit-set 0.11.1",
"bitflags 2.13.1",
"block2 0.6.2",
"bytemuck",
@@ -20649,36 +20658,35 @@ dependencies = [
"glow",
"glutin_wgl_sys",
"gpu-allocator",
- "gpu-descriptor",
- "hashbrown 0.16.1",
+ "hashbrown 0.17.1",
"js-sys",
"khronos-egl",
"libc",
"libloading",
"log",
"naga",
+ "naga-types",
"ndk-sys",
"objc2 0.6.3",
"objc2-core-foundation",
+ "objc2-core-graphics",
"objc2-foundation 0.3.2",
"objc2-metal 0.3.2",
"objc2-quartz-core 0.3.2",
- "once_cell",
- "ordered-float 5.5.0",
- "parking_lot",
- "portable-atomic",
- "portable-atomic-util",
+ "ordered-float 4.6.0",
"profiling",
"range-alloc",
"raw-window-handle",
"raw-window-metal",
"renderdoc-sys",
"smallvec",
+ "static_assertions",
"thiserror 2.0.17",
"wasm-bindgen",
"wayland-sys",
"web-sys",
"wgpu-naga-bridge",
+ "wgpu-sync",
"wgpu-types",
"windows 0.62.2",
"windows-core 0.62.2",
@@ -20687,25 +20695,39 @@ dependencies = [
[[package]]
name = "wgpu-naga-bridge"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"naga",
"wgpu-types",
]
+[[package]]
+name = "wgpu-sync"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
+dependencies = [
+ "cfg-if",
+ "lock_api",
+ "once_cell",
+ "parking_lot",
+ "portable-atomic",
+ "portable-atomic-util",
+]
+
[[package]]
name = "wgpu-types"
-version = "29.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5"
+version = "30.0.0"
+source = "git+https://github.com/gfx-rs/wgpu?rev=3b3506ea31154edc04de64debda0e780cba2639c#3b3506ea31154edc04de64debda0e780cba2639c"
dependencies = [
"bitflags 2.13.1",
"bytemuck",
"js-sys",
"log",
+ "macro_rules_attribute",
+ "naga-types",
"raw-window-handle",
+ "static_assertions",
"web-sys",
]
diff --git a/Cargo.toml b/Cargo.toml
index 3be8c8ae849..a2972f063ea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -981,7 +981,8 @@ web-sys = "0.3"
web-time = "1.1.0"
webpki-roots = "1.0.8"
webrtc-sys = "0.3.23"
-wgpu = { version = "29.0", default-features = false }
+# 30.0.1 lacks the Vulkan surface-drop panic fix: https://github.com/gfx-rs/wgpu/pull/10230.
+wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "3b3506ea31154edc04de64debda0e780cba2639c", default-features = false }
which = "8"
windows-core = "0.62"
windows-registry = "0.6.0"
diff --git a/crates/gpui_wgpu/Cargo.toml b/crates/gpui_wgpu/Cargo.toml
index 179b134e5ca..3ce9dcecc4a 100644
--- a/crates/gpui_wgpu/Cargo.toml
+++ b/crates/gpui_wgpu/Cargo.toml
@@ -42,7 +42,7 @@ gpui_util.workspace = true
font-kit = { workspace = true, optional = true }
[target.'cfg(any(target_os = "linux", target_os = "freebsd"))'.dependencies]
-wgpu = { workspace = true, features = ["std", "parking_lot", "metal", "gles", "vulkan", "wgsl", "webgpu"] }
+wgpu = { workspace = true, features = ["std", "metal", "gles", "vulkan", "wgsl", "webgpu"] }
[target.'cfg(not(any(target_os = "linux", target_os = "freebsd")))'.dependencies]
wgpu = { workspace = true, default-features = true }
@@ -55,7 +55,8 @@ wgpu = { workspace = true, features = ["webgl"] }
criterion.workspace = true
gpui = { workspace = true, features = ["bench-support"] }
image.workspace = true
-naga = { version = "29.0.4", features = ["wgsl-in"] }
+# Validate shaders with the same Naga revision that wgpu uses at runtime.
+naga = { git = "https://github.com/gfx-rs/wgpu", rev = "3b3506ea31154edc04de64debda0e780cba2639c", features = ["wgsl-in"] }
[[bench]]
name = "layout_line"
diff --git a/crates/gpui_wgpu/src/wgpu_atlas.rs b/crates/gpui_wgpu/src/wgpu_atlas.rs
index b541607ba38..b2a7bfeb490 100644
--- a/crates/gpui_wgpu/src/wgpu_atlas.rs
+++ b/crates/gpui_wgpu/src/wgpu_atlas.rs
@@ -412,6 +412,7 @@ mod tests {
power_preference: wgpu::PowerPreference::LowPower,
compatible_surface: None,
force_fallback_adapter: false,
+ apply_limit_buckets: false,
})
.await
.map_err(|error| anyhow::anyhow!("failed to request adapter: {error}"))?;
@@ -425,6 +426,7 @@ mod tests {
memory_hints: wgpu::MemoryHints::MemoryUsage,
trace: wgpu::Trace::Off,
experimental_features: wgpu::ExperimentalFeatures::disabled(),
+ default_queue: wgpu::QueueDescriptor::default(),
})
.await
.map_err(|error| anyhow::anyhow!("failed to request device: {error}"))?;
diff --git a/crates/gpui_wgpu/src/wgpu_context.rs b/crates/gpui_wgpu/src/wgpu_context.rs
index 4c55ef18e1a..16d451f0085 100644
--- a/crates/gpui_wgpu/src/wgpu_context.rs
+++ b/crates/gpui_wgpu/src/wgpu_context.rs
@@ -374,6 +374,7 @@ impl WgpuContext {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: Some(&surface),
force_fallback_adapter: false,
+ apply_limit_buckets: false,
})
.await
.map_err(|error| {
@@ -456,6 +457,7 @@ impl WgpuContext {
memory_hints: wgpu::MemoryHints::MemoryUsage,
trace: wgpu::Trace::Off,
experimental_features: wgpu::ExperimentalFeatures::disabled(),
+ default_queue: wgpu::QueueDescriptor::default(),
})
.await
.map_err(|e| anyhow::anyhow!("Failed to create wgpu device: {e}"))?;
@@ -658,6 +660,7 @@ impl WgpuContext {
let test_config = wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: caps.formats[0],
+ color_space: wgpu::SurfaceColorSpace::Auto,
width: 64,
height: 64,
present_mode: wgpu::PresentMode::Fifo,
diff --git a/crates/gpui_wgpu/src/wgpu_renderer.rs b/crates/gpui_wgpu/src/wgpu_renderer.rs
index ff4af7d26e1..a148a4ccfbe 100644
--- a/crates/gpui_wgpu/src/wgpu_renderer.rs
+++ b/crates/gpui_wgpu/src/wgpu_renderer.rs
@@ -388,7 +388,13 @@ impl WgpuRenderer {
.iter()
.find(|f| surface_caps.formats.contains(f))
.copied()
- .or_else(|| surface_caps.formats.iter().find(|f| !f.is_srgb()).copied())
+ .or_else(|| {
+ surface_caps
+ .formats
+ .iter()
+ .find(|format| !format.has_srgb_suffix())
+ .copied()
+ })
.or_else(|| surface_caps.formats.first().copied())
.ok_or_else(|| {
anyhow::anyhow!(
@@ -447,6 +453,7 @@ impl WgpuRenderer {
let surface_config = wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: surface_format,
+ color_space: wgpu::SurfaceColorSpace::Auto,
width: clamped_width.max(1),
height: clamped_height.max(1),
present_mode: config
@@ -1194,7 +1201,7 @@ impl WgpuRenderer {
return false;
}
- frame.present();
+ core.resources.queue.present(frame);
true
}
}
@@ -2485,7 +2492,7 @@ impl WgpuHeadlessRenderer {
.map_err(|error| anyhow::anyhow!("Failed to map headless readback buffer: {error}"))?;
self.check_gpu_errors()?;
- let mapped_data = readback_buffer.slice(..).get_mapped_range();
+ let mapped_data = readback_buffer.slice(..).get_mapped_range()?;
let pixel_capacity = usize::try_from(u64::from(bytes_per_row) * u64::from(height))
.map_err(|_| anyhow::anyhow!("Headless image size exceeds addressable memory"))?;
let mut pixels = Vec::with_capacity(pixel_capacity);