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

Enable re_renderer for all tests using the TestContext if graphics adapter is present #8606

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Jan 7, 2025

The viewer test harness now tries to create a wgpu adapter (only once via a Lazy) in order to re-use this in an re_renderer context. As a consequence screenshot tests can now use egui elements that bottom out in re_renderer drawing (i.e. in ViewBuilder).

For the moment the adapter creation is allowed to fail, meaning that if we're on a ci machine without any graphics adapter at all, we can still continue as before with render context == None.

  • pass main ci
  • What's the performance before/after for component tests?

Performance:

Timing reports for cargo test -p re_component_ui (as reported by test runner) on Windows:

  • on this branch
    • first run after checkout: 2.34s
    • next two successive rounds: 2.30s, 2.12s
  • on main with snapshots enabled (commenting out the still remaining mac-only guard):
    • first run after checkout: 31.86s
    • next two successive rounds: 26.70s, 28.61s
  • on main without snapshots:
    • first run after checkout: 0.43s
    • next two successive rounds: 0.42s, 0.44s

Next steps:

@Wumpf Wumpf added 🔨 testing testing and benchmarks exclude from changelog PRs with this won't show up in CHANGELOG.md labels Jan 7, 2025
@Wumpf
Copy link
Member Author

Wumpf commented Jan 7, 2025

@rerun-bot full-check

Copy link

github-actions bot commented Jan 7, 2025

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link Manifest
cc7df52 https://rerun.io/viewer/pr/8606 +nightly +main

Note: This comment is updated whenever you push a commit.

Copy link

github-actions bot commented Jan 7, 2025

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12656489804

@Wumpf
Copy link
Member Author

Wumpf commented Jan 7, 2025

@rerun-bot full-check

Copy link

github-actions bot commented Jan 7, 2025

@Wumpf
Copy link
Member Author

Wumpf commented Jan 7, 2025

note to self: expecting this to fail since the PR as is requires graphics adapter creation to be always successful and we don't do anything towards that. But I want to see how it fails exactly and then remedy it (essentially solving #8245)

@Wumpf
Copy link
Member Author

Wumpf commented Jan 8, 2025

decided to take this more step by step: for the moment this does not enforce the wgpu adapter and by extension the re_renderer context to be present

@Wumpf Wumpf changed the title Enable re_renderer for all tests using the TestContext Enable re_renderer for all tests using the TestContext if graphics adapter is present Jan 8, 2025
@Wumpf
Copy link
Member Author

Wumpf commented Jan 8, 2025

@rerun-bot full-check

Copy link

github-actions bot commented Jan 8, 2025

Started a full build: https://github.com/rerun-io/rerun/actions/runs/12670527402

@Wumpf Wumpf marked this pull request as ready for review January 8, 2025 13:01
{ name = "pulldown-cmark" }, # Build-dependency via `ply-rs` (!). TODO(emilk): use a better crate for .ply parsing
{ name = "redox_syscall" }, # Plenty of versions in the wild
{ name = "pollster" }, # rfd is still on 0.3
{ name = "accesskit_consumer" }, # Duplicate as when used as dev dependency - eframe & egui_kittest are on different versions.
Copy link
Member Author

Choose a reason for hiding this comment

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

this line is new, nothing else changed

@emilk emilk self-requested a review January 9, 2025 09:34
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

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

Lovely!

But I think it would be great if we got a panic if we forget to call setup_kittest_for_rendering when re_renderer is needed

Copy link
Member

Choose a reason for hiding this comment

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

Random thought: currently we silently opt-out when ViewerContext::render_ctx is None.
Maybe we should panic instead in debug builds?

That way we can run tests that don't require the render_ctx by setting it to None, but will not accidentally forget to set it for tests that do need it (like the colormap). i.e., forgetting to call setup_kittest_for_rendering will be a hard error.

Copy link
Member Author

Choose a reason for hiding this comment

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

we're soooo close to having this be a thing of the past 😄
let's hold on for a bit


let compatible_surface = None;
let depth_format = None;
let msaa_samples = 1;
Copy link
Member

Choose a reason for hiding this comment

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

Don't we have 4 in the real app?

Copy link
Member Author

Choose a reason for hiding this comment

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

re_renderer's individual views (managed each by a ViewBuilder) have, but egui's final target doesn't - re_Renderer resolves and copies into egui in ViewBuilder::composite
leaving a comment about this since this is quite the mental gymnastic!

}
}
}

fn create_egui_renderstate() -> Option<egui_wgpu::RenderState> {
Copy link
Member

Choose a reason for hiding this comment

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

it would be helpful with a docstring explaining why this could return None

Copy link
Member Author

Choose a reason for hiding this comment

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

on its way out, but will do anyways just in case I can't finish my thread of work

@Wumpf
Copy link
Member Author

Wumpf commented Jan 9, 2025

But I think it would be great if we got a panic if we forget to call setup_kittest_for_rendering when re_renderer is needed

good idea, I look into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md 🔨 testing testing and benchmarks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants