Returns an argument value defined by the provided array of
color values. When passed to an MSL function it will convert
to a `device const half4 *ptr, int count` pair of
parameters.
Returns an argument value defined by the provided array of
floating point numbers. When passed to an MSL function it
will convert to a `device const float *ptr, int count` pair
of parameters.
get · iOS 17.0+
boundingRect
TypeScript
static get boundingRect(): Shader_Argument
Swift declaration
static var boundingRect: Shader.Argument { get }
Returns an argument value representing the bounding rect of
the shape or view that the shader is attached to, as
`float4(x, y, width, height)`. This value is undefined for
shaders that do not have a natural bounding rect (e.g.
filter effects drawn into `GraphicsContext`).
static · iOS 17.0+
data
TypeScript
static data(data: ArrayBuffer): Shader_Argument
Swift declaration
static func data(_ data: Data) -> Shader.Argument
Returns an argument value defined by the provided data
value. When passed to an MSL function it will convert to a
`device const void *ptr, int size_in_bytes` pair of
parameters.
Returns an argument value representing `color`. When passed
to a MSL function it will convert to a `half4` value, as a
premultiplied color in the target color space.
static · iOS 17.0+
float
TypeScript
static float(x: number): Shader_Argument
Swift declaration
@export(implementation) static func float<T>(_ x: T) -> Shader.Argument where T : BinaryFloatingPoint
Returns an argument value representing the MSL value
`float(x)`.
Returns an argument value defined by the provided image.
When passed to an MSL function it will convert to a
`texture2d<half>` value. Currently only one image parameter
is supported per `Shader` instance.
static · iOS 17.0+
float2
TypeScript
static float2(size: { width: number; height: number }): Shader_Argument