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

Extend WgpuSetup, make egui_kittest wgpu setup configurable & prefer software rasterizers for testing #5506

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Wumpf
Copy link
Collaborator

@Wumpf Wumpf commented Dec 20, 2024

See lengthy title! :)
The main addition to WgpuSetup is the ability to use manually select an adapter out of enumerate_adapters on native. This allows for maximum flexibility while still being able to check against for surface compatibility! (which is in contrast to WgpuSetup::Existing which is pretty much as flexible but can't know about the surface).

egui_kittest now uses WgpuSetup so it has all the same flexibility in configuration. But it uses a different default which will prefer software rasterizers.
-> At first I thought request_adapter's force_fallback_adapter is what I needed here, but this forcing functionality isn't all that great since it will fail if there's no software rasterizer around (which is unfortunately the regular state of things on Mac). Since it also doesn't have any effect on WebGPU (unlike power preference!), I removed it again from WgpuSetup as it doesn't seem to be all that useful in general to me 🤷

There's some more fairly aggressive Arc'ing going on here since it made my life a lil bit easier and I figured those will all go away anyways once

is landed and released :)

TODO:

  • remove force_fallback again
  • green ci
  • use this in Rerun to make sure I'm not missing something

Copy link

Preview available at https://egui-pr-preview.github.io/pr/5506-configurable-test-renderer
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@lucasmerlin
Copy link
Collaborator

I refactored how the snapshots are rendered in #5539, introducing a new TestRenderer trait and a WgpuTestRenderer.
The renderer can now be initialized when the Harness is created, meaning we can now create a Harness from an eframe::App, tell it to create a wgpu renderer. Then custom rendering relying on eframe::Frame::wgpu_render_state and PaintCallback will just work ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants