Skip to content

Commit

Permalink
Avoid a hang on linux by always create the renderer, even when we hav…
Browse files Browse the repository at this point in the history
…e no store_view (#5724)

### What
- Mitigates: #5283

All this does is re-orders the calls so that we always create a renderer
and call begin_frame / before_submit even if the case where we have no
StoreView.

In theory this uses a few more resources when skipping the welcome
screen, but practically in almost all cases this is only for a few
frames until log-data starts arriving.

### 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 newly built examples:
[app.rerun.io](https://app.rerun.io/pr/5724/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5724/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/5724/index.html?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)!

- [PR Build Summary](https://build.rerun.io/pr/5724)
- [Docs
preview](https://rerun.io/preview/9043a05f182790ade51cc78f6b979b5327d98617/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/9043a05f182790ade51cc78f6b979b5327d98617/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
  • Loading branch information
jleibs authored Mar 29, 2024
1 parent b64d55f commit a547820
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,19 +847,23 @@ impl App {

self.egui_debug_panel_ui(ui);

if let Some(store_view) = store_context {
let entity_db = store_view.recording;

// TODO(andreas): store the re_renderer somewhere else.
let egui_renderer = {
let render_state = frame.wgpu_render_state().unwrap();
&mut render_state.renderer.write()
};
if let Some(render_ctx) = egui_renderer
.callback_resources
.get_mut::<re_renderer::RenderContext>()
{
render_ctx.begin_frame();
// TODO(andreas): store the re_renderer somewhere else.
let egui_renderer = {
let render_state = frame.wgpu_render_state().unwrap();
&mut render_state.renderer.write()
};

if let Some(render_ctx) = egui_renderer
.callback_resources
.get_mut::<re_renderer::RenderContext>()
{
// TODO(#5283): There's no great reason to do this if we have no store-view and
// subsequently won't actually be rendering anything. However, doing this here
// avoids a hang on linux. Consider moving this back inside the below `if let`.
// once the upstream issues that fix the hang properly have been resolved.
render_ctx.begin_frame();
if let Some(store_view) = store_context {
let entity_db = store_view.recording;

self.state.show(
app_blueprint,
Expand All @@ -873,15 +877,8 @@ impl App {
&self.rx,
&self.command_sender,
);

render_ctx.before_submit();
}
} else {
// There's nothing to show.
// We get here when
// A) there is nothing loaded
// B) we decided not to show the welcome screen, presumably because data is expected at any time now.
// The user can see the connection status in the top bar.
render_ctx.before_submit();
}
});
}
Expand Down

0 comments on commit a547820

Please sign in to comment.