pub struct FunctionConstantValues(/* private fields */);Expand description
Constant values for specializing a function.
C++ equivalent: MTL::FunctionConstantValues
Function constant values allow you to specialize a function at runtime by providing values for function constants defined in shader code.
Implementations§
Source§impl FunctionConstantValues
impl FunctionConstantValues
Sourcepub fn alloc() -> Option<Self>
pub fn alloc() -> Option<Self>
Allocate a new function constant values object.
C++ equivalent: static FunctionConstantValues* alloc()
Sourcepub fn init(&self) -> Option<Self>
pub fn init(&self) -> Option<Self>
Initialize an allocated function constant values object.
C++ equivalent: FunctionConstantValues* init()
Sourcepub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self>
Create from a raw pointer.
§Safety
The pointer must be a valid Metal function constant values object.
Sourcepub unsafe fn set_constant_value_at_index(
&self,
value: *const c_void,
data_type: DataType,
index: UInteger,
)
pub unsafe fn set_constant_value_at_index( &self, value: *const c_void, data_type: DataType, index: UInteger, )
Set a constant value by index.
C++ equivalent: void setConstantValue(const void*, DataType, NS::UInteger)
§Safety
The value pointer must be valid and point to data of the correct type.
Sourcepub unsafe fn set_constant_value_with_name(
&self,
value: *const c_void,
data_type: DataType,
name: &str,
)
pub unsafe fn set_constant_value_with_name( &self, value: *const c_void, data_type: DataType, name: &str, )
Set a constant value by name.
C++ equivalent: void setConstantValue(const void*, DataType, const NS::String*)
§Safety
The value pointer must be valid and point to data of the correct type.
Sourcepub unsafe fn set_constant_values(
&self,
values: *const c_void,
data_type: DataType,
location: UInteger,
length: UInteger,
)
pub unsafe fn set_constant_values( &self, values: *const c_void, data_type: DataType, location: UInteger, length: UInteger, )
Set multiple constant values in a range.
C++ equivalent: void setConstantValues(const void*, DataType, NS::Range)
§Safety
The values pointer must be valid and point to an array of data of the correct type.
Sourcepub fn set_bool_at_index(&self, value: bool, index: UInteger)
pub fn set_bool_at_index(&self, value: bool, index: UInteger)
Set a boolean constant value by index.
Sourcepub fn set_int_at_index(&self, value: i32, index: UInteger)
pub fn set_int_at_index(&self, value: i32, index: UInteger)
Set an integer constant value by index.
Sourcepub fn set_uint_at_index(&self, value: u32, index: UInteger)
pub fn set_uint_at_index(&self, value: u32, index: UInteger)
Set an unsigned integer constant value by index.
Sourcepub fn set_float_at_index(&self, value: f32, index: UInteger)
pub fn set_float_at_index(&self, value: f32, index: UInteger)
Set a float constant value by index.