-
Notifications
You must be signed in to change notification settings - Fork 74
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
egui 0.16 #51
egui 0.16 #51
Conversation
Def not the best way to do this (it's really easy to step on your own feet). Anyone have any ideas? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a casual onlooker. Included some thoughts below!
src/lib.rs
Outdated
// ------- | ||
|
||
/// Creates a texture at a certain user texture location | ||
pub fn set_texture(&mut self, id: u64, image: epi::Image) -> egui::TextureId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the id
be selected for the caller? It's an internal implementation detail. The actual id allocated is already included in the return value, which should be good enough? I can't think of any cases where I would want to specify the id when creating a texture.
src/lib.rs
Outdated
/// Frees a user location | ||
pub fn free_texture(&mut self, id: u64) { | ||
self.user_textures.remove(&id); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also remove this and just offer the other free_...
method.
src/lib.rs
Outdated
} | ||
} | ||
} | ||
// | ||
// impl epi::TextureAllocator for Mutex<RenderPass> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And delete all this commented code.
Thank you for your PR. This PR seem to implement more than just adding support for egui 0.16. Please rebase you changes and only add only the changes that are needed for the current feature set. For example: I'm not sure why you arced the I also fell that the trait for The cleanup suggestions by parasyte also seem valid. |
My understanding is that the I don't know if changing texture allocation is necessary, here. But if I read that PR right, the high-level API appears to be in
This is what I would suggest looking to for inspiration. |
I also have a discussion here, but my big problem is that TextureAllocator is now by shared reference, which makes it impractical for the
Yeah, it is... I did it so that
I was basically following https://github.com/emilk/egui/pull/999/files#diff-23f23e44bac11e24b5797a2fa0734dbcd65b21830492cde1ad030e2314e76e7f and here the
Not really, I moved what So action items:
|
If that's the only problem, you can use a type that offers interior mutability. It should also be mentioned that this crate doesn't use |
I tried that, but it got real nasty, as this crate returns a reference to the bind groups it holds internally, but you reasonably can't send a reference through a lock, the lock doesn't live long enough... (and bind groups aren't Clone, so no go there). |
That's a pretty important use (to me), as it was what made |
Does this mean handling |
Got it. I'll be honest, I haven't really dug into the issue or tried to work through it in practice. But then again #52 proposes to remove the
Yes, but I'm not sure you need to use In light of that, I don't think there is a need for |
I just pushed a version that support egui 0.16 to crates.io. If something is missing, please open another issue / PR. |
Basically copied egui_glium's Painter for the new 0.16 API, as TextureAllocator no longer provides a mutable self.
Right now it doesn't nicely extract
epi::backend::TexAllocationData
from anepi::Frame
nor does it handle it, which could be something to add.