Instance Property

encodedLength

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

Required.

Declaration

@property(readonly) NSUInteger encodedLength;

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

- setArgumentBuffer:offset:

Specifies the argument buffer that resources are encoded into.

Required.

- setArgumentBuffer:startOffset:arrayElement:

Specifies the argument buffer that resources are encoded into.

Required.