Skip to content

Commit cd46691

Browse files
authored
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)
1 parent 6ba356d commit cd46691

File tree

6 files changed

+110
-34
lines changed

6 files changed

+110
-34
lines changed

Cargo.lock

+88-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ opt-level = 2
3737

3838
[workspace.dependencies]
3939
thiserror = "1.0.37"
40-
wgpu = "0.17.0"
40+
wgpu = "0.18.0"
41+
# Use this to build wgpu with WebGL support on the Web *instead* of using WebGPU.
42+
#wgpu = { version = "0.18.0", features = ["webgl"] }

crates/eframe/src/web/web_painter_wgpu.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl WebPainterWgpu {
7777

7878
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
7979
backends: options.wgpu_options.supported_backends,
80-
dx12_shader_compiler: Default::default(),
80+
..Default::default()
8181
});
8282

8383
let canvas = super::canvas_element_or_die(canvas_id);
@@ -237,20 +237,24 @@ impl WebPainter for WebPainterWgpu {
237237
b: clear_color[2] as f64,
238238
a: clear_color[3] as f64,
239239
}),
240-
store: true,
240+
store: wgpu::StoreOp::Store,
241241
},
242242
})],
243243
depth_stencil_attachment: self.depth_texture_view.as_ref().map(|view| {
244244
wgpu::RenderPassDepthStencilAttachment {
245245
view,
246246
depth_ops: Some(wgpu::Operations {
247247
load: wgpu::LoadOp::Clear(1.0),
248-
store: false,
248+
// It is very unlikely that the depth buffer is needed after egui finished rendering
249+
// so no need to store it. (this can improve performance on tiling GPUs like mobile chips or Apple Silicon)
250+
store: wgpu::StoreOp::Discard,
249251
}),
250252
stencil_ops: None,
251253
}
252254
}),
253255
label: Some("egui_render"),
256+
occlusion_query_set: None,
257+
timestamp_writes: None,
254258
});
255259

256260
renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor);

crates/egui-wgpu/src/winit.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl Painter {
107107
) -> Self {
108108
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
109109
backends: configuration.supported_backends,
110-
dx12_shader_compiler: Default::default(),
110+
..Default::default()
111111
});
112112

113113
Self {
@@ -528,6 +528,7 @@ impl Painter {
528528
});
529529

530530
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
531+
label: Some("egui_render"),
531532
color_attachments: &[Some(wgpu::RenderPassColorAttachment {
532533
view,
533534
resolve_target,
@@ -538,20 +539,23 @@ impl Painter {
538539
b: clear_color[2] as f64,
539540
a: clear_color[3] as f64,
540541
}),
541-
store: true,
542+
store: wgpu::StoreOp::Store,
542543
},
543544
})],
544545
depth_stencil_attachment: self.depth_texture_view.as_ref().map(|view| {
545546
wgpu::RenderPassDepthStencilAttachment {
546547
view,
547548
depth_ops: Some(wgpu::Operations {
548549
load: wgpu::LoadOp::Clear(1.0),
549-
store: true,
550+
// It is very unlikely that the depth buffer is needed after egui finished rendering
551+
// so no need to store it. (this can improve performance on tiling GPUs like mobile chips or Apple Silicon)
552+
store: wgpu::StoreOp::Discard,
550553
}),
551554
stencil_ops: None,
552555
}
553556
}),
554-
label: Some("egui_render"),
557+
timestamp_writes: None,
558+
occlusion_query_set: None,
555559
});
556560

557561
renderer.render(&mut render_pass, clipped_primitives, &screen_descriptor);

crates/egui/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ unity = ["epaint/unity"]
7878
[dependencies]
7979
epaint = { version = "0.23.0", path = "../epaint", default-features = false }
8080

81-
ahash = { version = "0.8.1", default-features = false, features = [
81+
ahash = { version = "0.8.6", default-features = false, features = [
8282
"no-rng", # we don't need DOS-protection, so we let users opt-in to it instead
8383
"std",
8484
] }

deny.toml

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

0 commit comments

Comments
 (0)