Browse Source

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)
pull/3548/head
Andreas Reich 1 year ago
committed by GitHub
parent
commit
cd46691423
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 113
      Cargo.lock
  2. 4
      Cargo.toml
  3. 10
      crates/eframe/src/web/web_painter_wgpu.rs
  4. 12
      crates/egui-wgpu/src/winit.rs
  5. 2
      crates/egui/Cargo.toml
  6. 3
      deny.toml

113
Cargo.lock

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

4
Cargo.toml

@ -37,4 +37,6 @@ opt-level = 2
[workspace.dependencies]
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"] }

10
crates/eframe/src/web/web_painter_wgpu.rs

@ -77,7 +77,7 @@ impl WebPainterWgpu {
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: options.wgpu_options.supported_backends,
dx12_shader_compiler: Default::default(),
..Default::default()
});
let canvas = super::canvas_element_or_die(canvas_id);
@ -237,7 +237,7 @@ impl WebPainter for WebPainterWgpu {
b: clear_color[2] 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| {
@ -245,12 +245,16 @@ impl WebPainter for WebPainterWgpu {
view,
depth_ops: Some(wgpu::Operations {
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,
}
}),
label: Some("egui_render"),
occlusion_query_set: None,
timestamp_writes: None,
});
renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor);

12
crates/egui-wgpu/src/winit.rs

@ -107,7 +107,7 @@ impl Painter {
) -> Self {
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: configuration.supported_backends,
dx12_shader_compiler: Default::default(),
..Default::default()
});
Self {
@ -528,6 +528,7 @@ impl Painter {
});
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("egui_render"),
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
view,
resolve_target,
@ -538,7 +539,7 @@ impl Painter {
b: clear_color[2] 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| {
@ -546,12 +547,15 @@ impl Painter {
view,
depth_ops: Some(wgpu::Operations {
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,
}
}),
label: Some("egui_render"),
timestamp_writes: None,
occlusion_query_set: None,
});
renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor);

2
crates/egui/Cargo.toml

@ -78,7 +78,7 @@ unity = ["epaint/unity"]
[dependencies]
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
"std",
] }

3
deny.toml

@ -47,6 +47,9 @@ skip = [
{ name = "windows_x86_64_msvc" }, # old version via glutin
{ name = "windows-sys" }, # old version via glutin
{ 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 = [
{ name = "criterion" }, # dev-dependency

Loading…
Cancel
Save