pub struct MetalFunction {
pub name: String,
pub stage: MetalStage,
pub params: Vec<MetalParam>,
pub return_type: MetalType,
pub body: Vec<MetalStmt>,
pub is_inline: bool,
}Expand description
A Metal shader function (vertex / fragment / kernel / mesh / device).
Fields§
§name: StringFunction name
stage: MetalStageShader stage
params: Vec<MetalParam>Parameter list
return_type: MetalTypeReturn type
body: Vec<MetalStmt>Function body
is_inline: boolWhether the function is inline
Implementations§
Source§impl MetalFunction
impl MetalFunction
Sourcepub fn new(
name: impl Into<String>,
stage: MetalStage,
return_type: MetalType,
) -> Self
pub fn new( name: impl Into<String>, stage: MetalStage, return_type: MetalType, ) -> Self
Create a new function with the given stage.
Sourcepub fn kernel(name: impl Into<String>) -> Self
pub fn kernel(name: impl Into<String>) -> Self
Create a compute (kernel) function returning void.
Sourcepub fn fragment(name: impl Into<String>, return_type: MetalType) -> Self
pub fn fragment(name: impl Into<String>, return_type: MetalType) -> Self
Create a fragment shader.
Sourcepub fn device_fn(name: impl Into<String>, return_type: MetalType) -> Self
pub fn device_fn(name: impl Into<String>, return_type: MetalType) -> Self
Create a device helper function.
Sourcepub fn with_inline(self) -> Self
pub fn with_inline(self) -> Self
Mark as inline.
Sourcepub fn add_param(self, p: MetalParam) -> Self
pub fn add_param(self, p: MetalParam) -> Self
Append a parameter.
Trait Implementations§
Source§impl Clone for MetalFunction
impl Clone for MetalFunction
Source§fn clone(&self) -> MetalFunction
fn clone(&self) -> MetalFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MetalFunction
impl Debug for MetalFunction
Source§impl PartialEq for MetalFunction
impl PartialEq for MetalFunction
impl StructuralPartialEq for MetalFunction
Auto Trait Implementations§
impl Freeze for MetalFunction
impl RefUnwindSafe for MetalFunction
impl Send for MetalFunction
impl Sync for MetalFunction
impl Unpin for MetalFunction
impl UnsafeUnpin for MetalFunction
impl UnwindSafe for MetalFunction
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