Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Central GpuReadback handling for re_viewer, experimental space view screenshots #1717

Merged
merged 10 commits into from Mar 29, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Mar 27, 2023

Screen.Recording.2023-03-27.at.15.27.07.mov

Created the embryo of handling readback data in a generalized & robust fashion across the viewer. Using this to implement screenshot functionality on 2d/3d space views - since it's limited to those & doesn't include egui rendered labels, I put this behind a feature flag.
Note that this is force-disabled on the Web.

Checklist

@Wumpf Wumpf added enhancement New feature or request 📺 re_viewer affects re_viewer itself labels Mar 27, 2023
@Wumpf Wumpf force-pushed the andreas/re_renderer/spaceview-screenshots branch from f7f6fc6 to e72f502 Compare March 27, 2023 16:13
@teh-cmc teh-cmc self-requested a review March 28, 2023 06:26
@teh-cmc
Copy link
Member

teh-cmc commented Mar 28, 2023

Can't run api_demo_rs anymore:

cargo r -p api_demo
   Compiling re_web_viewer_server v0.3.1 (/home/cmc/dev/rerun-io/rerun/crates/re_web_viewer_server)
   Compiling re_viewer v0.3.1 (/home/cmc/dev/rerun-io/rerun/crates/re_viewer)
error: failed to run custom build command for `re_web_viewer_server v0.3.1 (/home/cmc/dev/rerun-io/rerun/crates/re_web_viewer_server)`

Caused by:
  process didn't exit successfully: `/home/cmc/dev/rerun-io/rerun/target/debug/build/re_web_viewer_server-d699cc4c852e2d39/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=../../web_viewer/index.html
  cargo:rerun-if-changed=../../web_viewer/sw.js
  cargo:rerun-if-changed=/home/cmc/dev/rerun-io/rerun/crates/re_viewer/Cargo.toml
  cargo:rerun-if-changed=/home/cmc/dev/rerun-io/rerun/crates/re_viewer/build.rs
  [...]

  --- stderr
  Building web viewer wasm…
  We assume you've already run ./scripts/setup_web.sh
  Compiling rust to wasm in /home/cmc/dev/rerun-io/rerun/target_wasm…
  > "cargo" "build" "--package" "re_viewer" "--lib" "--target" "wasm32-unknown-unknown" "--target-dir" "/home/cmc/dev/rerun-io/rerun/target_wasm"
     Compiling re_viewer v0.3.1 (/home/cmc/dev/rerun-io/rerun/crates/re_viewer)
  error[E0433]: failed to resolve: could not find `Clipboard` in `misc`
     --> crates/re_viewer/src/ui/viewport.rs:576:22
      |
  576 |         crate::misc::Clipboard::with(|clipboard| {
      |                      ^^^^^^^^^ could not find `Clipboard` in `misc`
      |
  help: consider importing this struct
      |
  5   | use web_sys::Clipboard;
      |
  help: if you import `Clipboard`, refer to it directly
      |
  576 -         crate::misc::Clipboard::with(|clipboard| {
  576 +         Clipboard::with(|clipboard| {
      |

  For more information about this error, try `rustc --explain E0433`.
  error: could not compile `re_viewer` due to previous error
  thread 'main' panicked at 'Failed to build Wasm', crates/re_build_web_viewer/src/lib.rs:88:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@teh-cmc
Copy link
Member

teh-cmc commented Mar 28, 2023

Can confirm the screenshots are successfully taken and save to disk on Linux, both x11 and Wayland.

The copy-to-clipboard thing only works when using the x11 backend though; I think that's because we're trying to use the x11 clipboard APIs even when running on the Wayland backend:

[2023-03-28T06:44:38Z INFO  re_viewer::misc::clipboard] Image copied to clipboard
[2023-03-28T06:44:38Z INFO  re_viewer::ui::viewport] Saved screenshot to "/home/cmc/dev/rerun-io/rerun/Screenshot segdemo - 1.png" and copied to clipboard.
[2023-03-28T06:44:47Z WARN  arboard::platform::linux::x11] Could not hand the clipboard contents over to the clipboard manager. The request timed out.

Note the arboard::platform::linux::x11 above, even though I'm actually running through Wayland!

Copy link
Member

@teh-cmc teh-cmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pleasantly straightforward 👍

I personally wouldn't mind an extra option to disable saving to disk, I hate having stuff getting written to my disk 😬

@Wumpf
Copy link
Member Author

Wumpf commented Mar 28, 2023

strange, api demo compiles just fine for me!

@Wumpf
Copy link
Member Author

Wumpf commented Mar 28, 2023

ah I think you haven't been on the latest commit where I fixed web build?

@Wumpf
Copy link
Member Author

Wumpf commented Mar 28, 2023

image

Just for you @teh-cmc ;)

(yes the ui looks ugly, don't care atm, it's experimental anyways)

@Wumpf Wumpf merged commit f0c2fde into main Mar 29, 2023
17 checks passed
@Wumpf Wumpf deleted the andreas/re_renderer/spaceview-screenshots branch March 29, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants