Skip to content

Commit

Permalink
Update to latest egui (#7418)
Browse files Browse the repository at this point in the history
### What
Uses the latest egui containing this gem:
* emilk/egui#5059

So far `request_discard` (running a second pass) is only used in these
situations:
* For when a `Grid` first shows up
* When an egui_table first shows up
* When asked to auto-size an `egui_table` row

Of course, running a second pass has some costs. Luckily, we already
execute our most expensive stuff (the viewport) last, and so we can
easily early-out from things like point cloud upload/rendering, as shown
in this puffin-capture of a frame with two passes in it:


![image](https://github.com/user-attachments/assets/8fecdc38-191e-4396-afaf-61abaa06437d)

NOTE: this flamegraph is of a DEBUG build - the point is not the
relative times, but that `pass 0` becomes very cheap, if the
`request_discard` is called from one of the non-viewport panels (e.g.
the selection panel).

There might still be cases where we do expensive stuff twice, e.g. if
something calls `request_discard` in a space view tooltip.

If we come to regret this, we can disable all second passes by setting
`egui::Options::max_passes` to `1`.

### Checklist
* [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 the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7418?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7418?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7418)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
  • Loading branch information
emilk authored Sep 16, 2024
1 parent f53fbd1 commit c9e4319
Show file tree
Hide file tree
Showing 18 changed files with 175 additions and 165 deletions.
52 changes: 31 additions & 21 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30"
[[package]]
name = "ecolor"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"bytemuck",
"emath",
Expand All @@ -1787,7 +1787,7 @@ dependencies = [
[[package]]
name = "eframe"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"ahash",
"bytemuck",
Expand Down Expand Up @@ -1824,7 +1824,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"accesskit",
"ahash",
Expand All @@ -1841,7 +1841,7 @@ dependencies = [
[[package]]
name = "egui-wgpu"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"ahash",
"bytemuck",
Expand All @@ -1860,7 +1860,7 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"accesskit_winit",
"ahash",
Expand All @@ -1879,30 +1879,28 @@ dependencies = [
[[package]]
name = "egui_commonmark"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe88871b75bd43c52a2b44ce5b53160506e7976e239112c56728496d019cc60d"
source = "git+https://github.com/rerun-io/egui_commonmark?rev=7a9dc755bfa351a3796274cb8ca87129b051c084#7a9dc755bfa351a3796274cb8ca87129b051c084"
dependencies = [
"egui",
"egui_commonmark_backend",
"egui_extras",
"pulldown-cmark 0.11.0",
"pulldown-cmark 0.12.1",
]

[[package]]
name = "egui_commonmark_backend"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "148edd9546feba319b16d5a5e551cda46095031ec1e6665e5871eef9ee692967"
source = "git+https://github.com/rerun-io/egui_commonmark?rev=7a9dc755bfa351a3796274cb8ca87129b051c084#7a9dc755bfa351a3796274cb8ca87129b051c084"
dependencies = [
"egui",
"egui_extras",
"pulldown-cmark 0.11.0",
"pulldown-cmark 0.12.1",
]

[[package]]
name = "egui_extras"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"ahash",
"egui",
Expand All @@ -1918,13 +1916,13 @@ dependencies = [
[[package]]
name = "egui_glow"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"ahash",
"bytemuck",
"egui",
"egui-winit",
"glow",
"glow 0.14.0",
"log",
"memoffset 0.9.0",
"puffin",
Expand All @@ -1947,7 +1945,7 @@ dependencies = [
[[package]]
name = "egui_table"
version = "0.28.1"
source = "git+https://github.com/rerun-io/egui_table.git?rev=0f594701d528c4a9553521cb941de1886549dc70#0f594701d528c4a9553521cb941de1886549dc70"
source = "git+https://github.com/rerun-io/egui_table.git?rev=c76473b244f03a7c67fbbbff9def6fc86c1ca4ea#c76473b244f03a7c67fbbbff9def6fc86c1ca4ea"
dependencies = [
"egui",
"serde",
Expand Down Expand Up @@ -1991,7 +1989,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "emath"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"bytemuck",
"serde",
Expand Down Expand Up @@ -2092,7 +2090,7 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"
dependencies = [
"ab_glyph",
"ahash",
Expand All @@ -2111,7 +2109,7 @@ dependencies = [
[[package]]
name = "epaint_default_fonts"
version = "0.28.1"
source = "git+https://github.com/emilk/egui.git?rev=6b7f4312373a301a4cdf7d99a0d546acd34bcd66#6b7f4312373a301a4cdf7d99a0d546acd34bcd66"
source = "git+https://github.com/emilk/egui.git?rev=66076101e12eee01dec374285521b0bed4ecc40a#66076101e12eee01dec374285521b0bed4ecc40a"

[[package]]
name = "equivalent"
Expand Down Expand Up @@ -2550,6 +2548,18 @@ dependencies = [
"web-sys",
]

[[package]]
name = "glow"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f865cbd94bd355b89611211e49508da98a1fce0ad755c1e8448fb96711b24528"
dependencies = [
"js-sys",
"slotmap",
"wasm-bindgen",
"web-sys",
]

[[package]]
name = "gltf"
version = "1.4.1"
Expand Down Expand Up @@ -4515,9 +4525,9 @@ dependencies = [

[[package]]
name = "pulldown-cmark"
version = "0.11.0"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8746739f11d39ce5ad5c2520a9b75285310dbfe78c541ccf832d38615765aec0"
checksum = "666f0f59e259aea2d72e6012290c09877a780935cc3c18b1ceded41f3890d59c"
dependencies = [
"bitflags 2.6.0",
"memchr",
Expand Down Expand Up @@ -7981,7 +7991,7 @@ dependencies = [
"block",
"cfg_aliases 0.1.1",
"core-graphics-types",
"glow",
"glow 0.13.1",
"glutin_wgl_sys",
"gpu-alloc",
"gpu-allocator",
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,12 @@ missing_errors_doc = "allow"
# 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 = "6b7f4312373a301a4cdf7d99a0d546acd34bcd66" } # egui master 2024-09-06
eframe = { git = "https://github.com/emilk/egui.git", rev = "6b7f4312373a301a4cdf7d99a0d546acd34bcd66" } # egui master 2024-09-06
egui = { git = "https://github.com/emilk/egui.git", rev = "6b7f4312373a301a4cdf7d99a0d546acd34bcd66" } # egui master 2024-09-06
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "6b7f4312373a301a4cdf7d99a0d546acd34bcd66" } # egui master 2024-09-06
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "6b7f4312373a301a4cdf7d99a0d546acd34bcd66" } # egui master 2024-09-06
emath = { git = "https://github.com/emilk/egui.git", rev = "6b7f4312373a301a4cdf7d99a0d546acd34bcd66" } # egui master 2024-09-06
ecolor = { git = "https://github.com/emilk/egui.git", rev = "66076101e12eee01dec374285521b0bed4ecc40a" } # egui master 2024-09-06
eframe = { git = "https://github.com/emilk/egui.git", rev = "66076101e12eee01dec374285521b0bed4ecc40a" } # egui master 2024-09-06
egui = { git = "https://github.com/emilk/egui.git", rev = "66076101e12eee01dec374285521b0bed4ecc40a" } # egui master 2024-09-06
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "66076101e12eee01dec374285521b0bed4ecc40a" } # egui master 2024-09-06
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "66076101e12eee01dec374285521b0bed4ecc40a" } # egui master 2024-09-06
emath = { git = "https://github.com/emilk/egui.git", rev = "66076101e12eee01dec374285521b0bed4ecc40a" } # egui master 2024-09-06

# Useful while developing:
# ecolor = { path = "../../egui/crates/ecolor" }
Expand All @@ -535,7 +535,7 @@ emath = { git = "https://github.com/emilk/egui.git", rev = "6b7f4312373a301a4cdf
egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "b2f5e232524deed983bcad01c05f27d0e8b89d98" } # https://github.com/rerun-io/egui_tiles/pull/78 2024-08-28
# egui_tiles = { path = "../egui_tiles" }

# egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark", rev = "63d5c8933445b9ea9088c4a50b71f4ede1f3c247" } # https://github.com/lampsitter/egui_commonmark/pull/51
egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark", rev = "7a9dc755bfa351a3796274cb8ca87129b051c084" } # https://github.com/lampsitter/egui_commonmark/pull/65

# commit on `rerun-io/mp4` `main` branch
# https://github.com/rerun-io/mp4/commit/ef529032547d7f97161e95c58bd76856cb116349
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ fn edit_view_enum_impl<EnumT: re_types_core::reflection::Enum>(
});

combobox_response.response = combobox_response.response.on_hover_ui(|ui| {
ui.markdown_ui(
ui.id().with(prev_selected_value),
prev_selected_value.docstring_md(),
);
ui.markdown_ui(prev_selected_value.docstring_md());
});

response_with_changes_of_inner(combobox_response)
Expand All @@ -59,6 +56,6 @@ fn variant_ui<EnumT: re_types_core::reflection::Enum>(
) -> egui::Response {
ui.selectable_value(current_value, variant, variant.to_string())
.on_hover_ui(|ui| {
ui.markdown_ui(ui.id().with(variant), variant.docstring_md());
ui.markdown_ui(variant.docstring_md());
})
}
4 changes: 2 additions & 2 deletions crates/viewer/re_data_ui/src/component_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ impl DataUi for ComponentName {
.map(|info| info.docstring_md)
{
if ui_layout.is_selection_panel() {
ui.markdown_ui(egui::Id::new((self, "full")), markdown);
ui.markdown_ui(markdown);
} else if let Some(first_line) = markdown.lines().next() {
ui.markdown_ui(egui::Id::new((self, "first_line")), first_line);
ui.markdown_ui(first_line);
}
}

Expand Down
6 changes: 1 addition & 5 deletions crates/viewer/re_space_view/src/view_property_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ fn view_property_ui_impl(
ui,
field.component_name,
reflection.display_name,
name,
field,
&blueprint_path,
component_results.component_row_id(&field.component_name),
Expand All @@ -90,7 +89,6 @@ fn view_property_ui_impl(
ui,
field.component_name,
display_name,
name,
field,
&blueprint_path,
component_results.component_row_id(&field.component_name),
Expand Down Expand Up @@ -119,7 +117,6 @@ fn view_property_component_ui(
ui: &mut egui::Ui,
component_name: ComponentName,
root_item_display_name: &str,
archetype_name: ArchetypeName,
field: &ArchetypeFieldReflection,
blueprint_path: &re_log_types::EntityPath,
row_id: Option<RowId>,
Expand Down Expand Up @@ -173,8 +170,7 @@ fn view_property_component_ui(
};

list_item_response.on_hover_ui(|ui| {
let id = egui::Id::new((archetype_name, field.display_name));
ui.markdown_ui(id, field.docstring_md);
ui.markdown_ui(field.docstring_md);
});
}

Expand Down
2 changes: 1 addition & 1 deletion crates/viewer/re_space_view_dataframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ re_viewport_blueprint.workspace = true

anyhow.workspace = true
egui_extras.workspace = true
egui_table = { git = "https://github.com/rerun-io/egui_table.git", rev = "0f594701d528c4a9553521cb941de1886549dc70" } # main as of 2024-09-09
egui_table = { git = "https://github.com/rerun-io/egui_table.git", rev = "c76473b244f03a7c67fbbbff9def6fc86c1ca4ea" } # main as of 2024-09-13
egui.workspace = true
itertools.workspace = true
thiserror.workspace = true
5 changes: 4 additions & 1 deletion crates/viewer/re_space_view_dataframe/src/dataframe_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ impl DataframeTableDelegate<'_> {
}

impl<'a> egui_table::TableDelegate for DataframeTableDelegate<'a> {
fn default_row_height(&self) -> f32 {
re_ui::DesignTokens::table_line_height()
}

fn prepare(&mut self, info: &egui_table::PrefetchInfo) {
re_tracing::profile_function!();

Expand Down Expand Up @@ -337,7 +341,6 @@ fn dataframe_ui_impl(ctx: &ViewerContext<'_>, ui: &mut egui::Ui, query_handle: &
egui_table::HeaderRow::new(re_ui::DesignTokens::table_header_height()),
])
.num_rows(num_rows)
.row_height(re_ui::DesignTokens::table_line_height())
.show(ui, &mut table_delegate);
});
}
Expand Down
5 changes: 1 addition & 4 deletions crates/viewer/re_space_view_spatial/src/view_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,7 @@ impl SpaceViewClass for SpatialSpaceView3D {
"Scene up is unspecified".to_owned()
};
ui.label(up_description).on_hover_ui(|ui| {
ui.markdown_ui(
egui::Id::new("view_coordinates_tooltip"),
"Set with `rerun.ViewCoordinates`.",
);
ui.markdown_ui("Set with `rerun.ViewCoordinates`.");
});

if let Some(eye) = &state.state_3d.view_eye {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Displays text from a text component, as raw text or markdown."
.or_insert(egui::FontId::proportional(32.0))
.size = 24.0;

egui_commonmark::CommonMarkViewer::new("markdown_viewer")
egui_commonmark::CommonMarkViewer::new()
.max_image_width(Some(ui.available_width().floor() as _))
.show(ui, &mut state.commonmark_cache, body);
return;
Expand Down
Loading

0 comments on commit c9e4319

Please sign in to comment.