pub struct CubeContext {
pub root: Rc<RefCell<Scope>>,
pub scope: Rc<RefCell<Scope>>,
pub debug_enabled: bool,
pub typemap: Rc<RefCell<HashMap<TypeId, Elem>>>,
}
Fields§
§root: Rc<RefCell<Scope>>
§scope: Rc<RefCell<Scope>>
§debug_enabled: bool
§typemap: Rc<RefCell<HashMap<TypeId, Elem>>>
Implementations§
Source§impl CubeContext
impl CubeContext
Sourcepub fn root() -> CubeContext
pub fn root() -> 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<Instruction>>(&mut self, op: O)
Sourcepub fn resolve_elem<T: 'static>(&self) -> Option<Elem>
pub fn resolve_elem<T: 'static>(&self) -> Option<Elem>
Resolve the element type of the given generic type.
Sourcepub fn register_elem<T: 'static>(&mut self, elem: Elem)
pub fn register_elem<T: 'static>(&mut self, elem: Elem)
Register the element type for the given generic type.
pub fn child(&mut self) -> CubeContext
pub fn into_scope(self) -> Scope
Sourcepub fn create_local_mut(&mut self, item: Item) -> ExpandElement
pub fn create_local_mut(&mut self, item: Item) -> ExpandElement
Create a new mutable local variable.
Sourcepub fn create_local(&mut self, item: Item) -> ExpandElement
pub fn create_local(&mut self, item: Item) -> ExpandElement
Create a new immutable local variable.
Sourcepub fn create_local_restricted(&mut self, item: Item) -> ExpandElement
pub fn create_local_restricted(&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: Id, item: Item) -> ExpandElement
pub fn input(&mut self, id: Id, item: Item) -> ExpandElement
Obtain the index-th input
Sourcepub fn output(&mut self, id: Id, item: Item) -> ExpandElement
pub fn output(&mut self, id: Id, item: Item) -> ExpandElement
Obtain the index-th output
Sourcepub fn scalar(&self, id: Id, elem: Elem) -> ExpandElement
pub fn scalar(&self, id: Id, 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