Class MPSVector

  • All Implemented Interfaces:
    NSObject
    Direct Known Subclasses:
    MPSTemporaryVector

    public class MPSVector
    extends NSObject
    MPSVector [@dependency] This depends on Metal.framework A MPSVector object describes a 1-dimensional array of data and provides storage for its values. Some MPSMatrixKernel objects operate on MPSVector objects for convenience.
    • Constructor Detail

      • MPSVector

        protected MPSVector​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • data

        public MTLBuffer data()
        [@property] data An MTLBuffer to store the data.
      • dataType

        public int dataType()
        [@property] dataType The type of the MPSVector data.
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • device

        public MTLDevice device()
        [@property] device The device on which the MPSVector will be used.
      • hash_static

        public static long hash_static()
      • initWithBufferDescriptor

        public MPSVector initWithBufferDescriptor​(MTLBuffer buffer,
                                                  MPSVectorDescriptor descriptor)
        Initialize a MPSVector object with a MTLBuffer. This function returns a MPSVector object which uses the supplied MTLBuffer. The length, number of vectors, and stride between vectors are specified by the MPSVectorDescriptor object. The provided MTLBuffer must have enough storage to hold (descriptor.vectors-1) * descriptor.vectorBytes + descriptor.length * (element size) bytes.
        Parameters:
        buffer - The MTLBuffer object which contains the data to use for the MPSVector. May not be NULL.
        descriptor - The MPSVectorDescriptor. May not be NULL.
        Returns:
        A valid MPSVector object or nil, if failure.
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • length

        public long length()
        [@property] length The number of elements in the vector.
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • vectorBytes

        public long vectorBytes()
        [@property] vectorBytes The stride, in bytes, between corresponding elements of consecutive vectors.
      • vectors

        public long vectors()
        [@property] vectors The number of vectors in the MPSVector.
      • version_static

        public static long version_static()
      • initWithBufferOffsetDescriptor

        public MPSVector initWithBufferOffsetDescriptor​(MTLBuffer buffer,
                                                        long offset,
                                                        MPSVectorDescriptor descriptor)
        Initialize a MPSVector object with a MTLBuffer and an offset.
        Parameters:
        buffer - The MTLBuffer containing the data.
        offset - The offset, in bytes, into the buffer at which data begins.
        descriptor - The MPSVectorDescriptor.
      • initWithDeviceDescriptor

        public MPSVector initWithDeviceDescriptor​(MTLDevice device,
                                                  MPSVectorDescriptor descriptor)
        Initialize a lazily backed MPSVector object with a descriptor The vector object will be created, but the storage to hold the vector data will only be allocated when it is needed, typically when the data property is invoked. In conjunction with -resourceSize, this will allow you to estimate storage needs without actually creating the backing store for the vector.
        Parameters:
        device - The device with which it will be used
        descriptor - The shape and style of the matrix
        Returns:
        A valid MPSVector object or nil
      • offset

        public long offset()
        [@property] offset Byte-offset to the buffer where the vector data begins - see @ref initWithBuffer: offset: descriptor: .
      • resourceSize

        public long resourceSize()
        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 MPSVector instantiation and MTLBuffer is not included. It only measures the size of the allocation used to hold the vector data in the buffer. This value is subject to change between different devices and operating systems. Except when -initWithBuffer:descriptor: is used, most MPSVectors 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 MPSMatrix 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 MPSMatrix is created with -initWithBuffer:descriptor:. In such cases, 0 will be returned.
      • synchronizeOnCommandBuffer

        public void synchronizeOnCommandBuffer​(MTLCommandBuffer commandBuffer)
        Flush the underlying MTLBuffer from the device's caches, and invalidate any CPU caches if needed. This will call [id synchronizeResource: ] on the vector'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:
        commandBuffer - The commandbuffer on which to synchronize