Contents

encodedLength

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

Declaration

var encodedLength: Int { get }

Discussion

After creating an MTLArgumentEncoder instance, use this value to create the MTLBuffer instance that represents 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