Skip to content

Commit

Permalink
Update egui and eframe (#2184)
Browse files Browse the repository at this point in the history
* Update to latest egui and eframe, to test it before the next release

* Better control where the rerun app state is persisted

* Fix typo

* Update puffin

* Update zstd
  • Loading branch information
emilk authored May 23, 2023
1 parent f9b9cb2 commit 622b73a
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 42 deletions.
48 changes: 25 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ parking_lot = "0.12"
polars-core = "0.29"
polars-lazy = "0.29"
polars-ops = "0.29"
puffin = "0.14"
puffin = "0.15"
rayon = "1.7"
rfd = { version = "0.11.3", default_features = false, features = [
"xdg-portal",
Expand Down Expand Up @@ -127,13 +127,13 @@ debug = true
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

# TODO(andreas/emilk): Update to a stable egui version
# wgpu 0.16 support, device configuration dependent on adapter, some additions to help egui_tiles, egui::Modifiers::contains, better error reporting for web, wasm-bindgen update
ecolor = { git = "https://github.com/emilk/egui", rev = "856afc8" }
eframe = { git = "https://github.com/emilk/egui", rev = "856afc8" }
egui = { git = "https://github.com/emilk/egui", rev = "856afc8" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "856afc8" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "856afc8" }
emath = { git = "https://github.com/emilk/egui", rev = "856afc8" }
# wgpu 0.16 support, device configuration dependent on adapter, some additions to help egui_tiles, egui::Modifiers::contains, better error reporting for web, wasm-bindgen update, `NativeOptions::app_id`
ecolor = { git = "https://github.com/emilk/egui", rev = "bb252e2" }
eframe = { git = "https://github.com/emilk/egui", rev = "bb252e2" }
egui = { git = "https://github.com/emilk/egui", rev = "bb252e2" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "bb252e2" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "bb252e2" }
emath = { git = "https://github.com/emilk/egui", rev = "bb252e2" }

# TODO(andreas): Either work around this issue in wgpu-egui (never discard command buffers) or wait for wgpu patch release.
# Fix for command buffer dropping crash https://github.com/gfx-rs/wgpu/pull/3726
Expand Down
2 changes: 1 addition & 1 deletion crates/re_log_encoding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ rmp-serde = { version = "1", optional = true }
# Native dependencies:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
puffin.workspace = true
zstd = { version = "0.11.0", optional = true } # native only
zstd = { version = "0.12.0", optional = true } # native only

# Web dependencies:
[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
2 changes: 2 additions & 0 deletions crates/re_ui/examples/re_ui_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ fn main() -> eframe::Result<()> {
re_log::setup_native_logging();

let native_options = eframe::NativeOptions {
app_id: Some("re_ui_example".to_owned()),

initial_window_size: Some([1200.0, 800.0].into()),
follow_system_theme: false,
default_theme: eframe::Theme::Dark,
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ wgpu.workspace = true

# native dependencies:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
puffin_http = "0.11"
puffin_http = "0.12"
puffin.workspace = true

[target.'cfg(any(target_os = "macos"))'.dependencies]
Expand Down
3 changes: 0 additions & 3 deletions crates/re_viewer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ impl AppEnvironment {

// ---------------------------------------------------------------------------

#[allow(dead_code)]
const APPLICATION_NAME: &str = "Rerun Viewer";

pub(crate) fn wgpu_options() -> egui_wgpu::WgpuConfiguration {
egui_wgpu::WgpuConfiguration {
// When running wgpu on native debug builds, we want some extra control over how
Expand Down
8 changes: 5 additions & 3 deletions crates/re_viewer/src/native.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use re_log_types::LogMsg;

use crate::APPLICATION_NAME;

type AppCreator =
Box<dyn FnOnce(&eframe::CreationContext<'_>, re_ui::ReUi) -> Box<dyn eframe::App>>;

// NOTE: the name of this function is hard-coded in `crates/rerun/src/crash_handler.rs`!
pub fn run_native_app(app_creator: AppCreator) -> eframe::Result<()> {
let native_options = eframe::NativeOptions {
// Controls where on disk the app state is persisted.
app_id: Some("rerun".to_owned()),

initial_window_size: Some([1600.0, 1200.0].into()),
min_window_size: Some([320.0, 450.0].into()), // Should be high enough to fit the rerun menu

Expand All @@ -32,8 +33,9 @@ pub fn run_native_app(app_creator: AppCreator) -> eframe::Result<()> {
..Default::default()
};

let window_title = "Rerun Viewer";
eframe::run_native(
APPLICATION_NAME,
window_title,
native_options,
Box::new(move |cc| {
let re_ui = crate::customize_eframe(cc);
Expand Down
9 changes: 6 additions & 3 deletions crates/rerun/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ struct Args {
/// Whether the Rerun Viewer should persist the state of the viewer to disk.
///
/// When persisted, the state will be stored at the following locations:
/// - Linux: /home/UserName/.local/share/rerunviewer
/// - macOS: /Users/UserName/Library/Application Support/rerunviewer
/// - Windows: C:\Users\UserName\AppData\Roaming\rerunviewer
///
/// - Linux: /home/UserName/.local/share/rerun
///
/// - macOS: /Users/UserName/Library/Application Support/rerun
///
/// - Windows: C:\Users\UserName\AppData\Roaming\rerun
#[clap(long, default_value_t = true)]
persist_state: bool,

Expand Down

0 comments on commit 622b73a

Please sign in to comment.