MPSMatrix(3) | MetalPerformanceShaders.framework | MPSMatrix(3) |
MPSMatrix
#import <MPSMatrixTypes.h>
Inherits NSObject.
Inherited by MPSTemporaryMatrix.
(nonnull instancetype) - initWithBuffer:descriptor:
(nonnull instancetype) - initWithDevice:descriptor:
(nonnull instancetype) - init
(void) - synchronizeOnCommandBuffer:
(NSUInteger) - resourceSize
id< MTLDevice > device
NSUInteger rows
NSUInteger columns
NSUInteger matrices
MPSDataType dataType
NSUInteger rowBytes
NSUInteger matrixBytes
id< MTLBuffer > data
This depends on Metal.framework
A MPSMatrix object describes a set of 2-dimensional arrays of data and provides storage for its values. MPSMatrix objects serve as inputs and outputs of MPSMatrixKernel objects.
Implementation note: A MPSMatrix object maintains its internal storage using a MTLBuffer object and thus the same rules for maintaining coherency of a MTLBuffer's data between CPU memory and GPU memory apply to a MPSMatrix. An MPSMatrix object's data refers to an array of matrices. Data is assumed to be ordered by matrix first, followed by row, followed by column.
For example, index [i,j] of the k'th matrix of an MPSMatrix is located at byte offset: k * matrixBytes + i * rowBytes + j * sizeof(dataType)
Where matrixBytes is a multiple of rowBytes at least equal to rows * rowBytes.
Initialize a MPSMatrix object with a MTLBuffer.
Parameters:
Returns:
This function returns a MPSMatrix object which uses the supplied MTLBuffer. The dimensions and stride of the matrix are specified by the MPSMatrixDescriptor object.
The provided MTLBuffer must have enough storage to hold
(descriptor.matrices-1) * descriptor.matrixBytes + (descriptor.rows-1) * descriptor.rowBytes +
descriptor.columns * (element size) bytes.
Reimplemented in MPSTemporaryMatrix.
Initialize a MPSMatrix object with a descriptor. Allocate the buffer.
Parameters:
Returns:
Get the number of bytes used to allocate underyling MTLResources This is the size of the backing store of underlying MTLResources. It does not include all storage used by the object, for example the storage used to hold the MPSMatrix instantiation and MTLBuffer is not included. It only measures the size of the allocation used to hold the matrix data in the buffer. This value is subject to change between different devices and operating systems.
Except when -initWithBuffer:descriptor: is used, most MPSMatrixes are allocated without a backing store. The backing store is allocated lazily when it is needed, typically when the .texture property is called. Consequently, in most cases, it should be inexpensive to make a MPSImage to see how much memory it will need, and release it if it is too large.
This method may fail in certain circumstances, such as when the MPSImage is created with -initWithTexture:featureChannels:. In such cases, 0 will be returned.
Flush the underlying MTLBuffer from the device's caches, and invalidate any CPU caches if needed. This will call [id <MTLBlitEncoder> synchronizeResource: ] on the matrix's MTLBuffer, if any. This is necessary for all MTLStorageModeManaged resources. For other resources, including temporary resources (these are all MTLStorageModePrivate), and buffers that have not yet been allocated, nothing is done. It is more efficient to use this method than to attempt to do this yourself with the data property.
Parameters:
The number of columns in a matrix in the MPSMatrix.
An MTLBuffer to store the data.
The type of the MPSMatrix data.
The device on which the MPSMatrix will be used.
The number of matrices in the MPSMatrix.
The stride, in bytes, between corresponding elements of consecutive matrices.
The stride, in bytes, between corresponding elements of consecutive rows.
The number of rows in a matrix in the MPSMatrix.
Generated automatically by Doxygen for MetalPerformanceShaders.framework from the source code.
Mon Jul 9 2018 | Version MetalPerformanceShaders-119.3 |