Package apple.metalperformanceshaders
Class MPSMatrix
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.metalperformanceshaders.MPSMatrix
-
- All Implemented Interfaces:
NSObject
- Direct Known Subclasses:
MPSTemporaryMatrix
public class MPSMatrix extends NSObject
MPSMatrix [@dependency] 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMPSMatrix(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static MPSMatrixalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()longcolumns()[@property] columns The number of columns in a matrix in the MPSMatrix.MTLBufferdata()[@property] data An MTLBuffer to store the data.intdataType()[@property] dataType The type of the MPSMatrix data.static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()MTLDevicedevice()[@property] device The device on which the MPSMatrix will be used.static longhash_static()MPSMatrixinit()MPSMatrixinitWithBufferDescriptor(MTLBuffer buffer, MPSMatrixDescriptor descriptor)Initialize a MPSMatrix object with a MTLBuffer.MPSMatrixinitWithBufferOffsetDescriptor(MTLBuffer buffer, long offset, MPSMatrixDescriptor descriptor)Initialize a MPSMatrix object with a MTLBuffer at a given offset.MPSMatrixinitWithDeviceDescriptor(MTLDevice device, MPSMatrixDescriptor descriptor)Initialize a MPSMatrix object with a descriptor.static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)longmatrices()[@property] matrices The number of matrices in the MPSMatrix.longmatrixBytes()[@property] matrixBytes The stride, in bytes, between corresponding elements of consecutive matrices.static java.lang.Objectnew_objc()longoffset()[@property] offset Byte-offset to the buffer where the matrix data begins - see @ref initWithBuffer: offset: descriptor: .static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)longresourceSize()Get the number of bytes used to allocate underyling MTLResources This is the size of the backing store of underlying MTLResources.longrowBytes()[@property] rowBytes The stride, in bytes, between corresponding elements of consecutive rows.longrows()[@property] rows The number of rows in a matrix in the MPSMatrix.static voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()voidsynchronizeOnCommandBuffer(MTLCommandBuffer commandBuffer)Flush the underlying MTLBuffer from the device's caches, and invalidate any CPU caches if needed.static longversion_static()-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static MPSMatrix alloc()
-
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()
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
hash_static
public static long hash_static()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
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)
-
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()
-
version_static
public static long version_static()
-
columns
public long columns()
[@property] columns The number of columns in a matrix in the MPSMatrix.
-
data
public MTLBuffer data()
[@property] data An MTLBuffer to store the data.
-
dataType
public int dataType()
[@property] dataType The type of the MPSMatrix data.
-
device
public MTLDevice device()
[@property] device The device on which the MPSMatrix will be used.
-
initWithBufferDescriptor
public MPSMatrix initWithBufferDescriptor(MTLBuffer buffer, MPSMatrixDescriptor descriptor)
Initialize a MPSMatrix object with a MTLBuffer. 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.- Parameters:
buffer- The MTLBuffer object which contains the data to use for the MPSMatrix. May not be NULL.descriptor- The MPSMatrixDescriptor. May not be NULL.- Returns:
- A valid MPSMatrix object or nil, if failure.
-
rowBytes
public long rowBytes()
[@property] rowBytes The stride, in bytes, between corresponding elements of consecutive rows.
-
rows
public long rows()
[@property] rows The number of rows in a matrix in the MPSMatrix.
-
matrices
public long matrices()
[@property] matrices The number of matrices in the MPSMatrix.
-
matrixBytes
public long matrixBytes()
[@property] matrixBytes The stride, in bytes, between corresponding elements of consecutive matrices.
-
initWithBufferOffsetDescriptor
public MPSMatrix initWithBufferOffsetDescriptor(MTLBuffer buffer, long offset, MPSMatrixDescriptor descriptor)
Initialize a MPSMatrix object with a MTLBuffer at a given offset.- Parameters:
buffer- The MTLBuffer object which contains the data to use for the MPSMatrix. May not be NULL.offset- The offset, in bytes, into the buffer at which the data begins.descriptor- The MPSMatrixDescriptor describing the shape of the matrix.
-
initWithDeviceDescriptor
public MPSMatrix initWithDeviceDescriptor(MTLDevice device, MPSMatrixDescriptor descriptor)
Initialize a MPSMatrix object with a descriptor. Allocate the buffer. The matrix object will be created, but the storage to hold the matrix 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 matrix.- Parameters:
device- The device with which it will be useddescriptor- The shape and style of the matrix- Returns:
- A valid MPSMatrix object or nil
-
offset
public long offset()
[@property] offset Byte-offset to the buffer where the matrix 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 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.
-
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 [idsynchronizeResource: ] 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:
commandBuffer- The commandbuffer on which to synchronize
-
-