Instance Property

encodedLength

The number of bytes required to store the encoded resources of an argument buffer.

Required.

Declaration

var encodedLength: Int { get }

Discussion

After creating a MTLArgumentEncoder object, use this value to create the MTLBuffer object that represents an argument buffer.

Listing 1

Creating an argument buffer

id <MTLArgumentEncoder> encoder = [_function newArgumentEncoderWithBufferIndex:0];
id <MTLBuffer> buffer = [_device newBufferWithLength:encoder.encodedLength options:_options];
[encoder setArgumentBuffer:buffer offset:0];

See Also

Creating an Argument Buffer

func setArgumentBuffer(MTLBuffer?, offset: Int)

Specifies the argument buffer that resources are encoded into.

Required.

func setArgumentBuffer(MTLBuffer?, startOffset: Int, arrayElement: Int)

Specifies the argument buffer that resources are encoded into.

Required.