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

Fix validation and errors in MemoryAllocator #2306

Merged
merged 3 commits into from
Aug 26, 2023

Conversation

marc0246
Copy link
Contributor

@marc0246 marc0246 commented Aug 26, 2023

This fixes some extremely strange validation left over from #1997, and some other panics.

Seeing as allocation of DeviceMemory is not on the hot path whatsoever, I don't understand why the allocator didn't just call the validated allocation function before, but rather panicking. This also made it harder to implement a custom memory allocator as there were both checked and unchecked versions of the methods for no reason. I also removed some nonsensical validation that didn't do anything to begin with, and the panic when picking a memory type fails was replaced by an error variant.

Changelog:

### Breaking changes
Changes to memory allocation:
- Merged `MemoryAllocator::allocate_from_type_unchecked` into `MemoryAllocator::allocate_from_type` and `MemoryAllocator::allocate_unchecked` into `MemoryAllocator::allocate`.
- Replaced `MemoryAllocator::allocate_dedicated_unchecked` with `MemoryAllocator::allocate_dedicated`.

Co-authored-by: Rua <ruawhitepaw@gmail.com>
@Rua
Copy link
Contributor

Rua commented Aug 26, 2023

Thanks!

@Rua Rua merged commit 0c714c1 into vulkano-rs:master Aug 26, 2023
@marc0246 marc0246 deleted the memory-allocator-validation branch August 26, 2023 09:26
Rua added a commit that referenced this pull request Aug 26, 2023
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
* Fix validation and errors in `MemoryAllocator`

* Doc tests

* Update vulkano/src/memory/allocator/mod.rs

Co-authored-by: Rua <ruawhitepaw@gmail.com>

---------

Co-authored-by: Rua <ruawhitepaw@gmail.com>
hakolao pushed a commit to hakolao/vulkano that referenced this pull request Feb 20, 2024
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