Skip to content

Add option to initialize with existing wgpu instance/adapter/device/queue#5319

Merged
Wumpf merged 7 commits intoemilk:masterfrom
ArthurBrussee:custom-device
Oct 29, 2024
Merged

Add option to initialize with existing wgpu instance/adapter/device/queue#5319
Wumpf merged 7 commits intoemilk:masterfrom
ArthurBrussee:custom-device

Conversation

@ArthurBrussee
Copy link
Contributor

When mixing and matching eframe with other wgpu applications (https://github.com/tracel-ai/burn in my case), it can be helpful to use an existing wgpu setup to initialize eframe with. This PR changes the WpuConfiguration (in a non-backwards compat way :/), to either take some options how to create a wgpu setup, or an existing wgpu setup (consisting of an instance, adapter, device and queue).

  • I have followed the instructions in the PR template

@github-actions
Copy link

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

Copy link
Collaborator

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

Nice! I really like having this hook in there.
Comments are entirely about naming & docs, approach & structure looks good to me!

Comment on lines 291 to 292
/// * `WGPU_BACKEND`: `vulkan`, `dx11`, `dx12`, `metal`, `opengl`, `webgpu`
/// * `WGPU_POWER_PREF`: `low`, `high` or `none`
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice, thanks for documenting that! But it should point out that these are only used for picking the default, nothing else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved this closer to where they are actually used. Maybe they're a bit too hidden now, but idk!

@ArthurBrussee
Copy link
Contributor Author

Thanks for the speedy review :D Much better names now, definitely was a bit too quick as I adopted this from existing adapter selection code.

@Wumpf Wumpf self-requested a review October 29, 2024 16:10
Copy link
Collaborator

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

thanks again!

@Wumpf Wumpf merged commit 759a0b2 into emilk:master Oct 29, 2024
@Wumpf Wumpf changed the title Add option to initialize on existing wgpu setup Add option to initialize with existing wgpu instance/adapter/device/queue Oct 29, 2024
hacknus pushed a commit to hacknus/egui that referenced this pull request Oct 30, 2024
When mixing and matching eframe with other wgpu applications
(https://github.com/tracel-ai/burn in my case), it can be helpful to use
an existing wgpu setup to initialize eframe with. This PR changes the
WpuConfiguration (in a non-backwards compat way :/), to either take some
options how to create a wgpu setup, or an existing wgpu setup
(consisting of an instance, adapter, device and queue).

* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
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