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

Memory allocator impl #2289

Merged
merged 3 commits into from
Aug 16, 2023
Merged

Memory allocator impl #2289

merged 3 commits into from
Aug 16, 2023

Conversation

vE5li
Copy link
Contributor

@vE5li vE5li commented Aug 16, 2023

This aims to fix some problems with usability when creating a custom memory allocator. Simple scenario is creating a struct wrapping a MemoryAllocator

pub struct FooAllocator(StandardMemoryAllocator);

unsafe impl MemoryAllocator for FooAllocator { /* ... */ }

When trying to create a SubbufferAllocator using an Arc<FooAllocator> it will not compile, because MemoryAllocator is only implemented for Arc<GenericMemoryAllocator<S>>. With these changes MemoryAllocator will be implemented for any Arc<T> where T: MemoryAllocator, making custom allocators easier to use.

While I was at it I also added the same blanket implementation for the CommandBufferAllocator.

@marc0246
Copy link
Contributor

Thanks! Could you please give DescriptorSetAllocator the same treatment?

@vE5li
Copy link
Contributor Author

vE5li commented Aug 16, 2023

Oh, I was actually looking for that impl earlier but couldn't find it. I'll be right on it 👍

@marc0246
Copy link
Contributor

Awesome, thanks!

@marc0246 marc0246 merged commit 54d20c0 into vulkano-rs:master Aug 16, 2023
3 checks passed
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
* Make the impl of Arc for MemoryAllocator more generic

* Make the impl of Arc for CommandBufferAllocator more generic

* Make the impl of Arc for DescriptorSetAllocator more generic
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