Information about an argument of a graphics or compute function.


class MTLArgument : NSObject


A MTLArgument object describes a single argument to a Metal function. Your app uses the MTLArgument properties to read details about a function argument as it was defined in the Metal Shading Language. You can determine the argument’s data type, access restrictions, and its associated resource type. For buffer, texture, and threadgroup memory arguments, additional properties can be read to determine more details about the argument.

Your app does not create a MTLArgument object directly. Creating a MTLRenderPipelineState or MTLComputePipelineState object can generate a reflection object (MTLRenderPipelineReflection or MTLComputePipelineReflection) that contains MTLArgument objects.


Describing the Argument

var name: String

The name of the argument.

var isActive: Bool

A Boolean that indicates whether the compiled function uses the argument.

var index: Int

The index in the argument table that corresponds to the function argument.

var type: MTLArgumentType

The argument’s resource type.

var access: MTLArgumentAccess

The argument's read and/or write access.

Describing a Buffer Argument

var bufferAlignment: Int

The required byte alignment in memory for the buffer data.

var bufferDataSize: Int

The size, in bytes, of the buffer data.

var bufferDataType: MTLDataType

The data type of the buffer data.

var bufferStructType: MTLStructType?

A description of the structure data of a buffer argument.

var bufferPointerType: MTLPointerType?

A description of the pointer to a buffer argument.

Describing a Texture Argument

var textureDataType: MTLDataType

The data type of a texture argument.

var textureType: MTLTextureType

The texture type of a texture argument.

var isDepthTexture: Bool

A Boolean value that indicates whether the texture is a depth texture.

Describing an Array Argument

var arrayLength: Int

The number of elements, if the argument is an array.

Describing a Threadgroup Memory Argument

var threadgroupMemoryAlignment: Int

The required byte alignment in memory for the threadgroup data.

var threadgroupMemoryDataSize: Int

The size, in bytes, of the threadgroup data.

Releasing the Reflection Object

typealias MTLAutoreleasedArgument

A convenience type alias for an autoreleased MTLArgument object.


Inherits From

Conforms To

See Also

Function Argument Information

struct MTLPipelineOption

The compilation options that determine which argument information to provide.

class MTLComputePipelineReflection

Information about the arguments of a compute function.

class MTLRenderPipelineReflection

Information about the arguments of a graphics function.

class MTLType

A description of a data type.

class MTLStructType

A description of a structure.

class MTLArrayType

A description of an array.

class MTLPointerType

A description of a pointer.

class MTLTextureReferenceType

A description of a texture.

enum MTLDataType

Data types for function arguments.

enum MTLArgumentType

The resource type associated with an argument of a function.

enum MTLArgumentAccess

Function access restrictions to argument data in the shading language code.