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

WGPU PaintCallback Fixes #1704

Merged
merged 3 commits into from
Jun 2, 2022
Merged

Conversation

zicklag
Copy link
Contributor

@zicklag zicklag commented Jun 1, 2022

Makes a couple of fixes to the WGPU paint callback implementation:

  • Makes the egui textures public. Similar to the glow backend, this lets you access textures allocated by EGUI for custom rendering.
  • Fixes a subtle but crucial bug: depending on the relative order of egui meshes and paint callbacks being rendered, some of the last rendered items would just be skipped in apparently random ways.

egui-wgpu/src/renderer.rs Outdated Show resolved Hide resolved
@zicklag zicklag force-pushed the wgpu-paint-callback-bug-fix branch from 6160a95 to 6927448 Compare June 2, 2022 15:56
@emilk
Copy link
Owner

emilk commented Jun 2, 2022

There are suddenly a bunch of warning when running cargo check 🤔

@zicklag
Copy link
Contributor Author

zicklag commented Jun 2, 2022

Wow, I'll look at that. It must have to do with making all those functions pub(crate). 🤔

@zicklag
Copy link
Contributor Author

zicklag commented Jun 2, 2022

Ah, it doesn't happen with cargo check --features wgpu, but I haven't figured out why it's doing that with just plain cargo check yet.

@zicklag
Copy link
Contributor Author

zicklag commented Jun 2, 2022

Oh, I figured it out, it's that all those pub(crate) functions are only used by the winit feature. So we'd have to add a cfg(feature = "winit") to all those functions to make them go away. You see any problem with that?

Edit: Oh, unless those functions should be public so they can be used without winit. I guess that was the original point.

So we just need to keep all those functions public, then.

This allows paint callbacks to access textures allocated by egui, and
also hides the functions on the `RenderPass` that users should not need
to call.
Depending on the order custom paint callbacks were rendered, some of the
egui meshes would previously not be rendered at all in a seemingly random
fashion.
@zicklag zicklag force-pushed the wgpu-paint-callback-bug-fix branch from 38d61ab to ba56e4d Compare June 2, 2022 19:38
@zicklag
Copy link
Contributor Author

zicklag commented Jun 2, 2022

OK, fixed the warnings by making all those pub(crate) functions pub again.

Copy link
Owner

@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.

awesome, thanks!

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

Successfully merging this pull request may close these issues.

2 participants