Updated to latest wgpu (0.18.0) (#3505)

Tested on M1 Mac:
* native
* webgl, firefox
* webgpu, chrome

all looking normal


Updated minor ahash version because 0.8.1 got yanked. Added some deny
exceptions for now - we'll have to update winit soon to resolve glow
related cargo deny errors (not a big issue though since we don't expect
wgpu and glow backends to be used at the same time)
This commit is contained in:
Andreas Reich 2023-11-11 21:58:32 +01:00 committed by GitHub
parent 6ba356d3d8
commit cd46691423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 110 additions and 34 deletions

113
Cargo.lock generated
View File

@ -1020,7 +1020,7 @@ dependencies = [
"eframe", "eframe",
"egui_glow", "egui_glow",
"env_logger", "env_logger",
"glow", "glow 0.12.3",
] ]
[[package]] [[package]]
@ -1227,7 +1227,7 @@ dependencies = [
"egui-wgpu", "egui-wgpu",
"egui-winit", "egui-winit",
"egui_glow", "egui_glow",
"glow", "glow 0.12.3",
"glutin", "glutin",
"glutin-winit", "glutin-winit",
"image", "image",
@ -1366,7 +1366,7 @@ dependencies = [
"document-features", "document-features",
"egui", "egui",
"egui-winit", "egui-winit",
"glow", "glow 0.12.3",
"glutin", "glutin",
"glutin-winit", "glutin-winit",
"log", "log",
@ -1613,6 +1613,18 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
[[package]]
name = "flume"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181"
dependencies = [
"futures-core",
"futures-sink",
"nanorand",
"spin 0.9.8",
]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
@ -1782,8 +1794,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"js-sys",
"libc", "libc",
"wasi", "wasi",
"wasm-bindgen",
] ]
[[package]] [[package]]
@ -1844,6 +1858,18 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "glow"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "886c2a30b160c4c6fec8f987430c26b526b7988ca71f664e6a699ddf6f9601e4"
dependencies = [
"js-sys",
"slotmap",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "glutin" name = "glutin"
version = "0.30.10" version = "0.30.10"
@ -1857,7 +1883,7 @@ dependencies = [
"dispatch", "dispatch",
"glutin_egl_sys", "glutin_egl_sys",
"glutin_glx_sys", "glutin_glx_sys",
"glutin_wgl_sys", "glutin_wgl_sys 0.4.0",
"libloading 0.7.4", "libloading 0.7.4",
"objc2", "objc2",
"once_cell", "once_cell",
@ -1908,6 +1934,15 @@ dependencies = [
"gl_generator", "gl_generator",
] ]
[[package]]
name = "glutin_wgl_sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead"
dependencies = [
"gl_generator",
]
[[package]] [[package]]
name = "gobject-sys" name = "gobject-sys"
version = "0.16.3" version = "0.16.3"
@ -1940,15 +1975,16 @@ dependencies = [
[[package]] [[package]]
name = "gpu-allocator" name = "gpu-allocator"
version = "0.22.0" version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" checksum = "40fe17c8a05d60c38c0a4e5a3c802f2f1ceb66b76c67d96ffb34bef0475a7fad"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"log", "log",
"presser",
"thiserror", "thiserror",
"winapi", "winapi",
"windows 0.44.0", "windows 0.51.1",
] ]
[[package]] [[package]]
@ -2294,12 +2330,12 @@ dependencies = [
[[package]] [[package]]
name = "khronos-egl" name = "khronos-egl"
version = "4.1.0" version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
dependencies = [ dependencies = [
"libc", "libc",
"libloading 0.7.4", "libloading 0.8.0",
"pkg-config", "pkg-config",
] ]
@ -2455,9 +2491,9 @@ dependencies = [
[[package]] [[package]]
name = "metal" name = "metal"
version = "0.26.0" version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "623b5e6cefd76e58f774bd3cc0c6f5c7615c58c03a97815245a25c3c9bdee318" checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25"
dependencies = [ dependencies = [
"bitflags 2.4.0", "bitflags 2.4.0",
"block", "block",
@ -2520,15 +2556,15 @@ dependencies = [
[[package]] [[package]]
name = "naga" name = "naga"
version = "0.13.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ceaaa4eedaece7e4ec08c55c640ba03dbb73fb812a6570a59bcf1930d0f70e" checksum = "61d829abac9f5230a85d8cc83ec0879b4c09790208ae25b5ea031ef84562e071"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"bitflags 2.4.0", "bitflags 2.4.0",
"codespan-reporting", "codespan-reporting",
"hexf-parse", "hexf-parse",
"indexmap 1.9.3", "indexmap 2.0.0",
"log", "log",
"num-traits", "num-traits",
"rustc-hash", "rustc-hash",
@ -2538,6 +2574,15 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "nanorand"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"
dependencies = [
"getrandom",
]
[[package]] [[package]]
name = "ndk" name = "ndk"
version = "0.7.0" version = "0.7.0"
@ -2985,6 +3030,12 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "presser"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
[[package]] [[package]]
name = "prettyplease" name = "prettyplease"
version = "0.2.15" version = "0.2.15"
@ -3246,7 +3297,7 @@ dependencies = [
"cc", "cc",
"libc", "libc",
"once_cell", "once_cell",
"spin", "spin 0.5.2",
"untrusted", "untrusted",
"web-sys", "web-sys",
"winapi", "winapi",
@ -3605,6 +3656,15 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
dependencies = [
"lock_api",
]
[[package]] [[package]]
name = "spirv" name = "spirv"
version = "0.2.0+1.5.4" version = "0.2.0+1.5.4"
@ -4306,12 +4366,13 @@ checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc"
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7472f3b69449a8ae073f6ec41d05b6f846902d92a6c45313c50cb25857b736ce" checksum = "30e7d227c9f961f2061c26f4cb0fbd4df0ef37e056edd0931783599d6c94ef24"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"cfg-if", "cfg-if",
"flume",
"js-sys", "js-sys",
"log", "log",
"naga", "naga",
@ -4330,9 +4391,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecf7454d9386f602f7399225c92dd2fbdcde52c519bc8fb0bd6fbeb388075dc2" checksum = "837e02ddcdc6d4a9b56ba4598f7fd4202a7699ab03f6ef4dcdebfad2c966aea6"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
@ -4353,9 +4414,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6654a13885a17f475e8324efb46dc6986d7aaaa98353330f8de2077b153d0101" checksum = "1e30b9a8155c83868e82a8c5d3ce899de6c3961d2ef595de8fc168a1677fc2d8"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec", "arrayvec",
@ -4365,7 +4426,8 @@ dependencies = [
"block", "block",
"core-graphics-types", "core-graphics-types",
"d3d12", "d3d12",
"glow", "glow 0.13.0",
"glutin_wgl_sys 0.5.0",
"gpu-alloc", "gpu-alloc",
"gpu-allocator", "gpu-allocator",
"gpu-descriptor", "gpu-descriptor",
@ -4378,6 +4440,7 @@ dependencies = [
"metal", "metal",
"naga", "naga",
"objc", "objc",
"once_cell",
"parking_lot", "parking_lot",
"profiling", "profiling",
"range-alloc", "range-alloc",
@ -4394,9 +4457,9 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee64d7398d0c2f9ca48922c902ef69c42d000c759f3db41e355f4a570b052b67" checksum = "0d5ed5f0edf0de351fe311c53304986315ce866f394a2e6df0c4b3c70774bcdd"
dependencies = [ dependencies = [
"bitflags 2.4.0", "bitflags 2.4.0",
"js-sys", "js-sys",

View File

@ -37,4 +37,6 @@ opt-level = 2
[workspace.dependencies] [workspace.dependencies]
thiserror = "1.0.37" thiserror = "1.0.37"
wgpu = "0.17.0" wgpu = "0.18.0"
# Use this to build wgpu with WebGL support on the Web *instead* of using WebGPU.
#wgpu = { version = "0.18.0", features = ["webgl"] }

View File

@ -77,7 +77,7 @@ impl WebPainterWgpu {
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: options.wgpu_options.supported_backends, backends: options.wgpu_options.supported_backends,
dx12_shader_compiler: Default::default(), ..Default::default()
}); });
let canvas = super::canvas_element_or_die(canvas_id); let canvas = super::canvas_element_or_die(canvas_id);
@ -237,7 +237,7 @@ impl WebPainter for WebPainterWgpu {
b: clear_color[2] as f64, b: clear_color[2] as f64,
a: clear_color[3] as f64, a: clear_color[3] as f64,
}), }),
store: true, store: wgpu::StoreOp::Store,
}, },
})], })],
depth_stencil_attachment: self.depth_texture_view.as_ref().map(|view| { depth_stencil_attachment: self.depth_texture_view.as_ref().map(|view| {
@ -245,12 +245,16 @@ impl WebPainter for WebPainterWgpu {
view, view,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0), load: wgpu::LoadOp::Clear(1.0),
store: false, // It is very unlikely that the depth buffer is needed after egui finished rendering
// so no need to store it. (this can improve performance on tiling GPUs like mobile chips or Apple Silicon)
store: wgpu::StoreOp::Discard,
}), }),
stencil_ops: None, stencil_ops: None,
} }
}), }),
label: Some("egui_render"), label: Some("egui_render"),
occlusion_query_set: None,
timestamp_writes: None,
}); });
renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor); renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor);

View File

@ -107,7 +107,7 @@ impl Painter {
) -> Self { ) -> Self {
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: configuration.supported_backends, backends: configuration.supported_backends,
dx12_shader_compiler: Default::default(), ..Default::default()
}); });
Self { Self {
@ -528,6 +528,7 @@ impl Painter {
}); });
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("egui_render"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment { color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view, view,
resolve_target, resolve_target,
@ -538,7 +539,7 @@ impl Painter {
b: clear_color[2] as f64, b: clear_color[2] as f64,
a: clear_color[3] as f64, a: clear_color[3] as f64,
}), }),
store: true, store: wgpu::StoreOp::Store,
}, },
})], })],
depth_stencil_attachment: self.depth_texture_view.as_ref().map(|view| { depth_stencil_attachment: self.depth_texture_view.as_ref().map(|view| {
@ -546,12 +547,15 @@ impl Painter {
view, view,
depth_ops: Some(wgpu::Operations { depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(1.0), load: wgpu::LoadOp::Clear(1.0),
store: true, // It is very unlikely that the depth buffer is needed after egui finished rendering
// so no need to store it. (this can improve performance on tiling GPUs like mobile chips or Apple Silicon)
store: wgpu::StoreOp::Discard,
}), }),
stencil_ops: None, stencil_ops: None,
} }
}), }),
label: Some("egui_render"), timestamp_writes: None,
occlusion_query_set: None,
}); });
renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor); renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor);

View File

@ -78,7 +78,7 @@ unity = ["epaint/unity"]
[dependencies] [dependencies]
epaint = { version = "0.23.0", path = "../epaint", default-features = false } epaint = { version = "0.23.0", path = "../epaint", default-features = false }
ahash = { version = "0.8.1", default-features = false, features = [ ahash = { version = "0.8.6", default-features = false, features = [
"no-rng", # we don't need DOS-protection, so we let users opt-in to it instead "no-rng", # we don't need DOS-protection, so we let users opt-in to it instead
"std", "std",
] } ] }

View File

@ -47,6 +47,9 @@ skip = [
{ name = "windows_x86_64_msvc" }, # old version via glutin { name = "windows_x86_64_msvc" }, # old version via glutin
{ name = "windows-sys" }, # old version via glutin { name = "windows-sys" }, # old version via glutin
{ name = "windows" }, # old version via accesskit { name = "windows" }, # old version via accesskit
{ name = "spin" }, # old version via ring through rusttls and other libraries, newer for wgpu.
{ name = "glow" }, # TODO(@wumpf): Old version use for glow backend right now, newer for wgpu. Updating this trickles out to updating winit.
{ name = "glutin_wgl_sys" }, # TODO(@wumpf): As above
] ]
skip-tree = [ skip-tree = [
{ name = "criterion" }, # dev-dependency { name = "criterion" }, # dev-dependency