component in the constructed matrix object. Providing more arguments than necessary results
in an error. Under-initializing a matrix constructor results in a compile-time error.
A matrix of type
T
with
n
columns and
m
rows can also be constructed from
n
vectors of type
T
with
m
components. The following examples are legal constructors:
float2x2(float2, float2);
float3x3(float3, float3, float3);
float3x2(float2, float2, float2);
A matrix of type
T
with
n
columns and
m
rows can also be constructed from
n * m
scalars of
type
T
. The following examples are legal constructors:
float2x2(float, float, float, float);
float3x2(float, float, float, float, float, float);
The following are examples of matrix constructors that are
not supported. A matrix cannot be
constructed from combinations of vectors and scalars.
//
not supported
float2x3(float2 a, float b, float2 c, float d);
2.4 Alignment of Data Types
The
alignas
alignment specifier can be used to specify the alignment requirement of a type or
an object. The
alignas
specifier may be applied to the declaration of a variable or a data
member of a struct or class. It may also be applied to the declaration of a struct, class, or
enumeration type.
The Metal compiler is responsible for aligning data items to the appropriate alignment as
required by the data type. For arguments to a graphics or kernel function declared to be a
pointer to a data type, the Metal compiler can assume that the pointee is always appropriately
aligned as required by the data type.
2.5 Atomic Data Types
Objects of atomic types are the only Metal shading language objects that are free from data
races. If one thread writes to an atomic object while another thread reads from it, the behavior is
well-defined.
For all versions of Metal, these atomic types are supported:
atomic_int
atomic_uint
For
ios-metal2.0
, these atomic types are also supported
2017-9-12 | Copyright © 2017 Apple Inc. All Rights Reserved.
Page of
22
174