pub struct CubeContext {
pub root: Rc<RefCell<Scope>>,
pub scope: Rc<RefCell<Scope>>,
pub local_allocator: Rc<dyn LocalAllocator>,
}
Fields§
§root: Rc<RefCell<Scope>>
§scope: Rc<RefCell<Scope>>
§local_allocator: Rc<dyn LocalAllocator>
Implementations§
Source§impl CubeContext
impl CubeContext
Sourcepub fn root(allocator: impl LocalAllocator + 'static) -> CubeContext
pub fn root(allocator: impl LocalAllocator + 'static) -> CubeContext
Create a new cube context, with a root scope A root scope is at the root of a compute shader Therefore there is one cube context per shader The allocator will define the strategy for creating local intermediates and mutable variables
pub fn register<O: Into<Operation>>(&mut self, op: O)
pub fn child(&mut self) -> CubeContext
pub fn into_scope(self) -> Scope
Sourcepub fn create_local_variable(&mut self, item: Item) -> ExpandElement
pub fn create_local_variable(&mut self, item: Item) -> ExpandElement
Create a new mutable local variable
Sourcepub fn create_local_binding(&mut self, item: Item) -> ExpandElement
pub fn create_local_binding(&mut self, item: Item) -> ExpandElement
Create a new immutable local binding
Sourcepub fn create_local_undeclared(&mut self, item: Item) -> ExpandElement
pub fn create_local_undeclared(&mut self, item: Item) -> ExpandElement
Create a new immutable local binding that must never be a reused variable, regardless of allocator
Sourcepub fn create_matrix(&mut self, matrix: Matrix) -> ExpandElement
pub fn create_matrix(&mut self, matrix: Matrix) -> ExpandElement
Create a new matrix element.
Sourcepub fn create_slice(&mut self, item: Item) -> ExpandElement
pub fn create_slice(&mut self, item: Item) -> ExpandElement
Create a new slice element.
pub fn create_local_array(&mut self, item: Item, size: u32) -> ExpandElement
pub fn create_const_array( &mut self, item: Item, data: Vec<Variable>, ) -> ExpandElement
Sourcepub fn input(&mut self, id: u16, item: Item) -> ExpandElement
pub fn input(&mut self, id: u16, item: Item) -> ExpandElement
Obtain the index-th input
Sourcepub fn output(&mut self, id: u16, item: Item) -> ExpandElement
pub fn output(&mut self, id: u16, item: Item) -> ExpandElement
Obtain the index-th output
Sourcepub fn scalar(&self, id: u16, elem: Elem) -> ExpandElement
pub fn scalar(&self, id: u16, elem: Elem) -> ExpandElement
Obtain the index-th scalar
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CubeContext
impl !RefUnwindSafe for CubeContext
impl !Send for CubeContext
impl !Sync for CubeContext
impl Unpin for CubeContext
impl !UnwindSafe for CubeContext
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