Traverse-Research / Traverse-Research/gpu-allocator

feature for supporting arena allocators

Open
#222 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
497
Forks
82
Avg merge
18d 17h
Merged PRs (30d)
1

Description

Worth pointing that this is mainly targeted towards the vulkan part of the crate.
I believe that arena al locators are pretty useful specially in graphics(vulkan) when accessing some per level resources.
right now this is kind of hard to with the current API, I have found some workarounds to achieve this style of resource acquisition but I think that it would be a good feature to give to the users of the crate.
first of all, i think that this should be a opt-in since I understand that not all persons have the need for this kind of functionality.
I was thinking of a method, that took Allocation and separated the memory part from a new struct that can be used for freeing the resource. at the same time I think that it would be useful for this functions to implement as well a unsafe_clone, since with arena style allocators resource counting is kind of redundant.

maybe even make the function that splits the Allocator into its parts a method on the Allocator

let my_allocation: Allocation = my_allocator.allocate(...)?; 
let (memory_part, freeing_part) = unsafe{my_allocator.defer_free(my_allocation)};
/*
memory_part can be safely binded to all kinds of resources. 
*/
my_allocator.free(freeing_part);
/*
memory_part shouldn't be accessed from here on out.  
*/

maybe some extra security could be further added in case that it is determined that it is needed.
I hope that this call the attention and get consider for a further addition to this excellent crate, and of course I would be more than pleased to help in any way.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Vulkan portion of the crate and read the existing Allocation and Allocator APIs. Clarify how an opt-in arena-allocation flow should separate the memory part from deferred freeing, including the proposed unsafe_clone behavior. Done means the API design and safety expectations are settled and the resulting resource lifecycle is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.