Struct CubeContext

Source
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

Source

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

Source

pub fn register<O: Into<Instruction>>(&mut self, op: O)

Source

pub fn resolve_elem<T: 'static>(&self) -> Option<Elem>

Resolve the element type of the given generic type.

Source

pub fn register_elem<T: 'static>(&mut self, elem: Elem)

Register the element type for the given generic type.

Source

pub fn child(&mut self) -> CubeContext

Source

pub fn into_scope(self) -> Scope

Source

pub fn create_local_mut(&mut self, item: Item) -> ExpandElement

Create a new mutable local variable.

Source

pub fn create_local(&mut self, item: Item) -> ExpandElement

Create a new immutable local variable.

Source

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

Source

pub fn create_matrix(&mut self, matrix: Matrix) -> ExpandElement

Create a new matrix element.

Source

pub fn create_slice(&mut self, item: Item) -> ExpandElement

Create a new slice element.

Source

pub fn create_shared(&mut self, item: Item, size: u32) -> ExpandElement

Source

pub fn create_local_array(&mut self, item: Item, size: u32) -> ExpandElement

Source

pub fn create_const_array( &mut self, item: Item, data: Vec<Variable>, ) -> ExpandElement

Source

pub fn input(&mut self, id: Id, item: Item) -> ExpandElement

Obtain the index-th input

Source

pub fn output(&mut self, id: Id, item: Item) -> ExpandElement

Obtain the index-th output

Source

pub fn scalar(&self, id: Id, elem: Elem) -> ExpandElement

Obtain the index-th scalar

Trait Implementations§

Source§

impl Default for CubeContext

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V