pub struct TreeMemoryManager {
pub bind_group: BindGroup,
pub bind_group_layout: BindGroupLayout,
pub root_bind_group: BindGroup,
pub root_bind_group_layout: BindGroupLayout,
/* private fields */
}
Expand description
Manages multiple Sparse64Trees in a single GPU buffer.
Fields§
§bind_group: BindGroup
§bind_group_layout: BindGroupLayout
§root_bind_group: BindGroup
§root_bind_group_layout: BindGroupLayout
Implementations§
Source§impl TreeMemoryManager
impl TreeMemoryManager
Sourcepub fn new(device: &Device, max_trees: usize, tree_size: usize) -> Self
pub fn new(device: &Device, max_trees: usize, tree_size: usize) -> Self
Creates a new memory manager with a given capacity.
Sourcepub fn upload_tree(
&mut self,
queue: &Queue,
tree_id: u32,
tree_data: &[u8],
root_node_offset: u32,
)
pub fn upload_tree( &mut self, queue: &Queue, tree_id: u32, tree_data: &[u8], root_node_offset: u32, )
Allocates space for a new tree, uploads data, and stores the root node reference.
Sourcepub fn update_root_reference(
&self,
queue: &Queue,
tree_id: u32,
root_node_offset: u32,
)
pub fn update_root_reference( &self, queue: &Queue, tree_id: u32, root_node_offset: u32, )
Updates the root node reference for a specific tree.
Sourcepub fn remove_tree(&mut self, tree_id: u32)
pub fn remove_tree(&mut self, tree_id: u32)
Removes a tree from the GPU buffer, marking its slot as free.
Sourcepub fn get_buffer(&self) -> &Buffer
pub fn get_buffer(&self) -> &Buffer
Returns the buffer reference.
Sourcepub fn get_root_node_buffer(&self) -> &Buffer
pub fn get_root_node_buffer(&self) -> &Buffer
Returns the root node buffer reference.
Auto Trait Implementations§
impl Freeze for TreeMemoryManager
impl !RefUnwindSafe for TreeMemoryManager
impl Send for TreeMemoryManager
impl Sync for TreeMemoryManager
impl Unpin for TreeMemoryManager
impl !UnwindSafe for TreeMemoryManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more