-
Notifications
You must be signed in to change notification settings - Fork 18
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
AshMemoryDevice could avoid unsafe code during construction #63
Comments
I'm wouldn't like passing multilevel references everywhere. |
if I understand it correctly, the reason there's the wrapper type impl crate::MemoryDevice<vk::DeviceMemory> for ash::Device{
//...
} and use the so I wonder? is there any plan for furture work toward this direction? PS: to be honest, I feel it a little inconvenient having to write with the current implementations, I would suggest to make it more ergonomic to use , for instance, if we change the signature to: pub unsafe fn cleanup<MD: MemoryDevice<M>>(&mut self, device: impl AsRef<MD>); and besides // just a plain `ash::Device`, no need to manually wrap it
let device: ash::Device;
//...
// need this in scope so the so type inference could resolve
// or, explictly specify the type argument without import into scope
use gpu_alloc_ash::AshMemoryDevice
allocator.cleanup(&device);
allocator.cleanup::<gpu_alloc_ash::AshMemoryDevice>(&device); |
The reason to have separate crates is flexibility in version updates. |
API ergonomics suggestions and PRs are welcome |
right, that makes perfect sense
ok, I think I can make a PR. it should be trivial to impelement, and I believe it should not break old code. |
#65 is created. |
At the moment the following is done:
This works but requires what I feel is unnecessary unsafe code.
I imagine we could change AshMemoryDevice to the following if we use a lifetime:
The text was updated successfully, but these errors were encountered: