An object that provides information about a field in a struct.


class MTLStructMember : NSObject


MTLStructMember is part of the reflection API that allows Metal framework code to query details about an argument of a Metal shading language function. A MTLStructMember object describes the data type of one field in a struct that is passed as a MTLFunction argument, which is represented by MTLArgument.

Don't create MTLStructMember objects directly. You obtain a MTLStructMember object from either the members property or the memberByName(_:) method of a MTLStructType object. The dataType property of the MTLStructMember object tells you what kind of data is stored in the member. Recursively drill down every struct member until you reach a data type that is neither a struct nor an array.


Describing the Struct Member

var name: String

The name of the struct member.

var dataType: MTLDataType

The data type of the struct member.

var offset: Int

The location of this member relative to the start of its struct, in bytes.

var argumentIndex: Int

The index in the argument table that corresponds to the struct member.

Obtaining Struct Member Details

func arrayType() -> MTLArrayType?

Provides a description of the underlying array when the struct member holds an array.

func structType() -> MTLStructType?

Provides a description of the underlying struct when the struct member holds a struct.

func pointerType() -> MTLPointerType?

Provides a description of the underlying pointer when the struct member holds a pointer.

func textureReferenceType() -> MTLTextureReferenceType?

Provides a description of the underlying texture when the struct member holds a texture.


Inherits From

Conforms To

See Also

Obtaining Information about Struct Members

var members: [MTLStructMember]

An array of objects that describe the fields in the struct.

func memberByName(String) -> MTLStructMember?

Provides a representation of a struct member.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software