Skip to content

Commit

Permalink
Update egui and wgpu (#4111)
Browse files Browse the repository at this point in the history
### What

* Fixes #3973
* Depends on emilk/egui#3505

### Test Matrix
Make sure to click through a few examples to cover at least points,
lines and meshes. (Arkit is a good one!)

* [ ] Test window-related stuff on Linux:
  * [ ] check that resizing the window works
  * [ ] that the icon shows
  * [ ] that file->open works
  * [ ] that the DPI is sane and persisted on restart
  * [ ] Look for any other weird regressions


* [x] Mac
    * [x] native
    * [x] WebGL Firefox
    * [x] WebGL Chrome
    * [x] WebGL Safari
    * [x] (optional) WebGPU Chrome
* [x] Linux
    * [x] native
    * [x] WebGL Firefox
    * [x] WebGL Chrome
* [x] Windows
    * [x] native
    * [x] WebGL Firefox
    * [x] WebGL Chrome
    * [x] WebGL Edge
    * [ ] (optional) WebGPU Chrome
* [x] Merge egui PR

### Checklist
* [x] emilk/egui#3505 has been merged
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/4111) (if
applicable)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4111)
- [Docs
preview](https://rerun.io/preview/73199e5727c18529cdbd2dd3956af17204403f96/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/73199e5727c18529cdbd2dd3956af17204403f96/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Antoine Beyeler <antoine@rerun.io>
  • Loading branch information
3 people authored Dec 1, 2023
1 parent 6f4d2d4 commit 68b68b6
Show file tree
Hide file tree
Showing 32 changed files with 826 additions and 508 deletions.
802 changes: 568 additions & 234 deletions Cargo.lock

Large diffs are not rendered by default.

70 changes: 45 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,28 @@ re_web_viewer_server = { path = "crates/re_web_viewer_server", version = "=0.12.
re_ws_comms = { path = "crates/re_ws_comms", version = "=0.12.0-alpha.1", default-features = false }
rerun = { path = "crates/rerun", version = "=0.12.0-alpha.1", default-features = false }

# egui-crates:
ecolor = "0.24.1"
eframe = { version = "0.24.1", default-features = false, features = [
"accesskit",
"default_fonts",
"puffin",
"wayland",
"x11",
] }
egui = { version = "0.24.1", features = [
"callstack",
"extra_debug_asserts",
"log",
"puffin",
] }
egui_commonmark = { version = "0.10", default-features = false }
egui_extras = { version = "0.24.1", features = ["http", "image", "puffin"] }
egui_plot = "0.24.1"
egui_tiles = "0.4"
egui-wgpu = "0.24.1"
emath = "0.24.1"

# All of our direct external dependencies should be found here:
ahash = "0.8"
anyhow = "1.0"
Expand All @@ -94,27 +116,7 @@ criterion = "0.5"
crossbeam = "0.8"
directories-next = "2"
document-features = "0.2"
ecolor = "0.23.0"
eframe = { version = "0.23.0", default-features = false, features = [
"accesskit",
"default_fonts",
"puffin",
"wayland",
"x11",
] }
egui = { version = "0.23.0", features = [
"callstack",
"extra_debug_asserts",
"log",
"puffin",
] }
egui_commonmark = { version = "0.9.2", default-features = false }
egui_extras = { version = "0.23.0", features = ["http", "image", "puffin"] }
egui_plot = "0.23.0"
egui_tiles = "0.3.1"
egui-wgpu = "0.23.0"
ehttp = "0.3.1"
emath = "0.23.0"
enumset = "1.0.12"
env_logger = "0.10"
epaint = "0.23.0"
Expand All @@ -132,6 +134,7 @@ infer = "0.15" # infer MIME type by checking the magic number signature
itertools = "0.11"
js-sys = "0.3"
lazy_static = "1.4"
lz4_flex = "0.11"
log = "0.4"
log-once = "0.4"
macaw = "0.18"
Expand All @@ -156,8 +159,8 @@ polars-lazy = "0.29"
polars-ops = "0.29"
poll-promise = "0.3"
pollster = "0.3"
puffin = "0.16"
puffin_http = "0.13"
puffin = "0.18"
puffin_http = "0.15"
rand = { version = "0.8", default-features = false }
rayon = "1.7"
rfd = { version = "0.12", default_features = false, features = ["xdg-portal"] }
Expand Down Expand Up @@ -192,16 +195,16 @@ unindent = "0.1"
uuid = "1.1"
vec1 = "1.8"
walkdir = "2.0"
wasm-bindgen = "0.2.87"
wasm-bindgen = "0.2.89"
wasm-bindgen-futures = "0.4.33"
web-sys = "0.3.61"
web-time = "0.2.0"
webbrowser = "0.8"
winit = "0.28.7"
# TODO(andreas): Try to get rid of `fragile-send-sync-non-atomic-wasm`. This requires re_renderer being aware of single-thread restriction on resources.
# See also https://gpuweb.github.io/gpuweb/explainer/#multithreading-transfer (unsolved part of the Spec as of writing!)
wgpu = { version = "0.17.0", features = ["fragile-send-sync-non-atomic-wasm"] }
wgpu-core = "0.17.0"
wgpu = { version = "0.18.0", features = ["fragile-send-sync-non-atomic-wasm"] }
wgpu-core = "0.18.0"
xshell = "0.2"
zip = { version = "0.6", default-features = false }
zune-core = "0.2"
Expand Down Expand Up @@ -232,3 +235,20 @@ debug = true
# If that is not possible, patch to a branch that has a PR open on the upstream repo.
# As a last resport, patch with a commit to our own repository.
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

# ecolor = { git = "https://github.com/emilk/egui.git", rev = "a2b15b23ad26f077e229d492cd1571d97217d570" } # egui master 2023-11-23
# eframe = { git = "https://github.com/emilk/egui.git", rev = "a2b15b23ad26f077e229d492cd1571d97217d570" } # egui master 2023-11-23
# egui = { git = "https://github.com/emilk/egui.git", rev = "a2b15b23ad26f077e229d492cd1571d97217d570" } # egui master 2023-11-23
# egui_extras = { git = "https://github.com/emilk/egui.git", rev = "a2b15b23ad26f077e229d492cd1571d97217d570" } # egui master 2023-11-23
# egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "a2b15b23ad26f077e229d492cd1571d97217d570" } # egui master 2023-11-23
# emath = { git = "https://github.com/emilk/egui.git", rev = "a2b15b23ad26f077e229d492cd1571d97217d570" } # egui master 2023-11-23
# epaint = { git = "https://github.com/emilk/egui.git", rev = "a2b15b23ad26f077e229d492cd1571d97217d570" } # egui master 2023-11-23

# Useful while developing:
# ecolor = { path = "../../egui/crates/ecolor" }
# eframe = { path = "../../egui/crates/eframe" }
# egui = { path = "../../egui/crates/egui" }
# egui_extras = { path = "../../egui/crates/egui_extras" }
# egui-wgpu = { path = "../../egui/crates/egui-wgpu" }
# emath = { path = "../../egui/crates/emath" }
# epaint = { path = "../../egui/crates/epaint" }
2 changes: 1 addition & 1 deletion crates/re_build_web_viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ re_error.workspace = true

anyhow.workspace = true
cargo_metadata = "0.15"
wasm-bindgen-cli-support = "0.2.87"
wasm-bindgen-cli-support = "0.2.89"
12 changes: 6 additions & 6 deletions crates/re_log_encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ thiserror.workspace = true
web-time.workspace = true

# Optional external dependencies:
lz4_flex = { workspace = true, optional = true }
rmp-serde = { workspace = true, optional = true }
lz4_flex = { version = "0.10", optional = true }

# Web dependencies:
[target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = "0.3"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
web-sys = { version = "0.3.52", features = ["Window"] }
js-sys.workspace = true
wasm-bindgen.workspace = true
wasm-bindgen-futures.workspace = true
web-sys = { workspace = true, features = ["Window"] }

[dev-dependencies]
re_types = { workspace = true, features = ["datagen", "serde"] }

criterion = "0.5"
criterion.workspace = true
mimalloc.workspace = true
serde_test.workspace = true

Expand Down
6 changes: 5 additions & 1 deletion crates/re_renderer/examples/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ impl<E: Example + 'static> Application<E> {
let size = window.inner_size();
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: supported_backends(),
flags: wgpu::InstanceFlags::default(),
dx12_shader_compiler: wgpu::Dx12Compiler::Fxc,
gles_minor_version: wgpu::Gles3MinorVersion::Automatic,
});
#[allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
let surface = unsafe { instance.create_surface(&window) }.unwrap();
Expand Down Expand Up @@ -282,10 +284,12 @@ impl<E: Example + 'static> Application<E> {
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),
store: true,
store: wgpu::StoreOp::Store,
},
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});

for draw_result in &draw_results {
Expand Down
12 changes: 9 additions & 3 deletions crates/re_renderer/src/draw_phases/outlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,19 @@ impl OutlineMaskProcessor {
resolve_target: None, // We're going to do a manual resolve.
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
store: true,
store: wgpu::StoreOp::Store,
},
})],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: &self.mask_depth.default_view,
depth_ops: Some(wgpu::Operations {
load: ViewBuilder::DEFAULT_DEPTH_CLEAR,
store: false,
store: wgpu::StoreOp::Discard,
}),
stencil_ops: None,
}),
timestamp_writes: None,
occlusion_query_set: None,
})
}

Expand All @@ -377,7 +379,7 @@ impl OutlineMaskProcessor {

let ops = wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT), // Clear is the closest to "don't care"
store: true,
store: wgpu::StoreOp::Store,
};

// Initialize the jump flooding into voronoi texture 0 by looking at the mask texture.
Expand All @@ -390,6 +392,8 @@ impl OutlineMaskProcessor {
ops,
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});

let render_pipeline_init =
Expand All @@ -412,6 +416,8 @@ impl OutlineMaskProcessor {
ops,
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});

jumpflooding_step.set_pipeline(render_pipeline_step);
Expand Down
10 changes: 7 additions & 3 deletions crates/re_renderer/src/draw_phases/picking_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,19 @@ impl PickingLayerProcessor {
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
store: true, // Store for readback!
store: wgpu::StoreOp::Store, // Store for readback!
},
})],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: &self.picking_depth_target.default_view,
depth_ops: Some(wgpu::Operations {
load: ViewBuilder::DEFAULT_DEPTH_CLEAR,
store: true, // Store for readback!
store: wgpu::StoreOp::Store, // Store for readback!
}),
stencil_ops: None,
}),
timestamp_writes: None,
occlusion_query_set: None,
});

pass.set_bind_group(0, &self.bind_group_0, &[]);
Expand Down Expand Up @@ -590,10 +592,12 @@ impl DepthReadbackWorkaround {
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
store: true, // Store for readback!
store: wgpu::StoreOp::Store, // Store for readback!
},
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});

let pipeline = pools.render_pipelines.get_resource(self.render_pipeline)?;
Expand Down
4 changes: 3 additions & 1 deletion crates/re_renderer/src/draw_phases/screenshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ impl ScreenshotProcessor {
resolve_target: None,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::TRANSPARENT),
store: true,
store: wgpu::StoreOp::Store,
},
})],
depth_stencil_attachment: None,
timestamp_writes: None,
occlusion_query_set: None,
});

pass
Expand Down
6 changes: 4 additions & 2 deletions crates/re_renderer/src/view_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,17 +556,19 @@ impl ViewBuilder {
}),
// Don't care about the result, it's going to be resolved to the resolve target.
// This can have be much better perf, especially on tiler gpus.
store: false,
store: wgpu::StoreOp::Discard,
},
})],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: &setup.depth_buffer.default_view,
depth_ops: Some(wgpu::Operations {
load: Self::DEFAULT_DEPTH_CLEAR,
store: false,
store: wgpu::StoreOp::Discard,
}),
stencil_ops: None,
}),
timestamp_writes: None,
occlusion_query_set: None,
});

pass.set_bind_group(0, &setup.bind_group_0, &[]);
Expand Down
10 changes: 3 additions & 7 deletions crates/re_space_view_bar_chart/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,9 @@ impl SpaceViewClass for BarChartSpaceView {
let zoom_both_axis = !ui.input(|i| i.modifiers.contains(controls::ASPECT_SCROLL_MODIFIER));

ui.scope(|ui| {
let mut plot =
Plot::new("bar_chart_plot")
.clamp_grid(true)
.allow_zoom(egui_plot::AxisBools {
x: true,
y: zoom_both_axis,
});
let mut plot = Plot::new("bar_chart_plot")
.clamp_grid(true)
.allow_zoom([true, zoom_both_axis]);

if *root_entity_properties.show_legend {
plot = plot.legend(Legend {
Expand Down
7 changes: 3 additions & 4 deletions crates/re_space_view_spatial/src/eye.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ impl OrbitEye {
return; // e.g. we're typing in a TextField
}

let os = egui_ctx.os();

let requires_repaint = egui_ctx.input(|input| {
let dt = input.stable_dt.at_most(0.1);

Expand All @@ -390,10 +392,7 @@ impl OrbitEye {
} else {
1.0
})
* (if input
.modifiers
.contains(RuntimeModifiers::slow_down(&egui_ctx.os()))
{
* (if input.modifiers.contains(RuntimeModifiers::slow_down(&os)) {
0.1
} else {
1.0
Expand Down
5 changes: 1 addition & 4 deletions crates/re_space_view_time_series/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@ impl SpaceViewClass for TimeSeriesSpaceView {

let time_zone_for_timestamps = ctx.app_options.time_zone_for_timestamps;
let mut plot = Plot::new(plot_id_src)
.allow_zoom(egui_plot::AxisBools {
x: true,
y: zoom_both_axis,
})
.allow_zoom([true, zoom_both_axis])
.x_axis_formatter(move |time, _, _| {
format_time(
time_type,
Expand Down
4 changes: 2 additions & 2 deletions crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl TimePanel {
ui.visuals().widgets.noninteractive.bg_stroke,
);

ui.spacing_mut().scroll_bar_outer_margin = 4.0; // needed, because we have no panel margin on the right side.
ui.spacing_mut().scroll.bar_outer_margin = 4.0; // needed, because we have no panel margin on the right side.

// Add extra margin on the left which was intentionally missing on the controls.
let mut streams_frame = egui::Frame::default();
Expand Down Expand Up @@ -238,7 +238,7 @@ impl TimePanel {
let time_bg_x_range = Rangef::new(time_x_left, ui.max_rect().right());
let time_fg_x_range = {
// Painting to the right of the scroll bar (if any) looks bad:
let right = ui.max_rect().right() - ui.spacing_mut().scroll_bar_outer_margin;
let right = ui.max_rect().right() - ui.spacing_mut().scroll.bar_outer_margin;
debug_assert!(time_x_left < right);
Rangef::new(time_x_left, right)
};
Expand Down
8 changes: 1 addition & 7 deletions crates/re_ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ all-features = true


[features]
default = ["eframe"]

eframe = ["dep:eframe"]

default = []

[dependencies]
egui_extras.workspace = true
Expand All @@ -37,9 +34,6 @@ strum.workspace = true
strum_macros.workspace = true
sublime_fuzzy.workspace = true

## Optional dependencies:
eframe = { workspace = true, optional = true, default-features = false }

[dev-dependencies]
eframe = { workspace = true, default-features = false, features = ["wgpu"] }
egui_tiles.workspace = true
Expand Down
Loading

0 comments on commit 68b68b6

Please sign in to comment.