public interface MTLComputeCommandEncoder extends MTLCommandEncoder
A command encoder that writes data parallel compute commands.
| Modifier and Type | Method and Description |
|---|---|
void |
dispatchThreadgroupsThreadsPerThreadgroup(MTLSize threadgroupsPerGrid,
MTLSize threadsPerThreadgroup)
dispatchThreadgroups:threadsPerThreadgroup:
|
void |
dispatchThreadgroupsWithIndirectBufferIndirectBufferOffsetThreadsPerThreadgroup(MTLBuffer indirectBuffer,
long indirectBufferOffset,
MTLSize threadsPerThreadgroup)
dispatchThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerThreadgroup:
|
void |
dispatchThreadsThreadsPerThreadgroup(MTLSize threadsPerGrid,
MTLSize threadsPerThreadgroup)
dispatchThreads:threadsPerThreadgroup:
|
long |
dispatchType()
[@property] dispatchType
|
void |
executeCommandsInBufferIndirectBufferIndirectBufferOffset(MTLIndirectCommandBuffer indirectCommandbuffer,
MTLBuffer indirectRangeBuffer,
long indirectBufferOffset)
executeCommandsInBuffer:indirectBuffer:indirectBufferOffset:
|
void |
executeCommandsInBufferWithRange(MTLIndirectCommandBuffer indirectCommandBuffer,
NSRange executionRange)
executeCommandsInBuffer:withRange:
|
void |
memoryBarrierWithResourcesCount(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> resources,
long count)
memoryBarrierWithResources
|
void |
memoryBarrierWithScope(long scope)
memoryBarrierWithScope
|
void |
sampleCountersInBufferAtSampleIndexWithBarrier(MTLCounterSampleBuffer sampleBuffer,
long sampleIndex,
boolean barrier)
sampleCountersInBuffer:atSampleIndex:withBarrier:
|
void |
setAccelerationStructureAtBufferIndex(MTLAccelerationStructure accelerationStructure,
long bufferIndex)
setAccelerationStructure:atBufferIndex:
|
void |
setBufferOffsetAtIndex(long offset,
long index)
setBufferOffset:atIndex:
|
void |
setBufferOffsetAtIndex(MTLBuffer buffer,
long offset,
long index)
setBuffer:offset:atIndex:
|
void |
setBuffersOffsetsWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> buffers,
org.moe.natj.general.ptr.ConstNUIntPtr offsets,
NSRange range)
setBuffers:offsets:withRange:
|
void |
setBytesLengthAtIndex(org.moe.natj.general.ptr.ConstVoidPtr bytes,
long length,
long index)
setBytes:length:atIndex:
|
void |
setComputePipelineState(MTLComputePipelineState state)
setComputePipelineState:
|
void |
setImageblockWidthHeight(long width,
long height)
setImageblockWidth:height:
|
void |
setIntersectionFunctionTableAtBufferIndex(MTLIntersectionFunctionTable intersectionFunctionTable,
long bufferIndex)
setIntersectionFunctionTable:atBufferIndex:
|
void |
setIntersectionFunctionTablesWithBufferRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> intersectionFunctionTables,
NSRange range)
setIntersectionFunctionTables:withBufferRange:
|
void |
setSamplerStateAtIndex(MTLSamplerState sampler,
long index)
setSamplerState:atIndex:
|
void |
setSamplerStateLodMinClampLodMaxClampAtIndex(MTLSamplerState sampler,
float lodMinClamp,
float lodMaxClamp,
long index)
setSamplerState:lodMinClamp:lodMaxClamp:atIndex:
|
void |
setSamplerStatesLodMinClampsLodMaxClampsWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> samplers,
org.moe.natj.general.ptr.ConstFloatPtr lodMinClamps,
org.moe.natj.general.ptr.ConstFloatPtr lodMaxClamps,
NSRange range)
setSamplers:lodMinClamps:lodMaxClamps:withRange:
|
void |
setSamplerStatesWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> samplers,
NSRange range)
setSamplers:withRange:
|
void |
setStageInRegion(MTLRegion region)
setStageInRegion:region:
|
void |
setStageInRegionWithIndirectBufferIndirectBufferOffset(MTLBuffer indirectBuffer,
long indirectBufferOffset)
setStageInRegionWithIndirectBuffer:indirectBufferOffset:
|
void |
setTextureAtIndex(MTLTexture texture,
long index)
setTexture:atIndex:
|
void |
setTexturesWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> textures,
NSRange range)
setTextures:withRange:
|
void |
setThreadgroupMemoryLengthAtIndex(long length,
long index)
setThreadgroupMemoryLength:atIndex:
|
void |
setVisibleFunctionTableAtBufferIndex(MTLVisibleFunctionTable visibleFunctionTable,
long bufferIndex)
setVisibleFunctionTable:atBufferIndex:
|
void |
setVisibleFunctionTablesWithBufferRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> visibleFunctionTables,
NSRange range)
setVisibleFunctionTables:withBufferRange:
|
void |
updateFence(MTLFence fence)
updateFence:
|
void |
useHeap(MTLHeap heap)
useHeap:
|
void |
useHeapsCount(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> heaps,
long count)
useHeaps:count:
|
void |
useResourcesCountUsage(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> resources,
long count,
long usage)
useResources:count:usage:
|
void |
useResourceUsage(MTLResource resource,
long usage)
useResource:usage:
|
void |
waitForFence(MTLFence fence)
waitForFence:
|
device, endEncoding, insertDebugSignpost, label, popDebugGroup, pushDebugGroup, setLabelvoid dispatchThreadgroupsThreadsPerThreadgroup(MTLSize threadgroupsPerGrid, MTLSize threadsPerThreadgroup)
Enqueue a compute function dispatch as a multiple of the threadgroup size.
void dispatchThreadgroupsWithIndirectBufferIndirectBufferOffsetThreadsPerThreadgroup(MTLBuffer indirectBuffer, long indirectBufferOffset, MTLSize threadsPerThreadgroup)
Enqueue a compute function dispatch using an indirect buffer for threadgroupsPerGrid see MTLDispatchThreadgroupsIndirectArguments.
indirectBuffer - A buffer object that the device will read dispatchThreadgroups arguments from, see MTLDispatchThreadgroupsIndirectArguments.indirectBufferOffset - Byte offset within @a indirectBuffer to read arguments from. @a indirectBufferOffset must be a multiple of 4.void setBufferOffsetAtIndex(MTLBuffer buffer, long offset, long index)
Set a global buffer for all compute kernels at the given bind point index.
void setBufferOffsetAtIndex(long offset,
long index)
Set the offset within the current global buffer for all compute kernels at the given bind point index.
void setBuffersOffsetsWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> buffers,
org.moe.natj.general.ptr.ConstNUIntPtr offsets,
NSRange range)
Set an array of global buffers for all compute kernels with the given bind point range.
void setBytesLengthAtIndex(org.moe.natj.general.ptr.ConstVoidPtr bytes,
long length,
long index)
Set the data (by copy) for a given buffer binding point. This will remove any existing MTLBuffer from the binding point.
void setComputePipelineState(MTLComputePipelineState state)
Set the compute pipeline state that will be used.
void setSamplerStateAtIndex(MTLSamplerState sampler, long index)
Set a global sampler for all compute kernels at the given bind point index.
void setSamplerStateLodMinClampLodMaxClampAtIndex(MTLSamplerState sampler, float lodMinClamp, float lodMaxClamp, long index)
Set a global sampler for all compute kernels at the given bind point index.
void setSamplerStatesLodMinClampsLodMaxClampsWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> samplers,
org.moe.natj.general.ptr.ConstFloatPtr lodMinClamps,
org.moe.natj.general.ptr.ConstFloatPtr lodMaxClamps,
NSRange range)
Set an array of global samplers for all compute kernels with the given bind point range.
void setSamplerStatesWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> samplers,
NSRange range)
Set an array of global samplers for all compute kernels with the given bind point range.
void setStageInRegion(MTLRegion region)
Set the region of the stage_in attributes to apply the compute kernel.
void setTextureAtIndex(MTLTexture texture, long index)
Set a global texture for all compute kernels at the given bind point index.
void setTexturesWithRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> textures,
NSRange range)
Set an array of global textures for all compute kernels with the given bind point range.
void setThreadgroupMemoryLengthAtIndex(long length,
long index)
Set the threadgroup memory byte length at the binding point specified by the index. This applies to all compute kernels.
void updateFence(MTLFence fence)
Update the fence to capture all GPU work so far enqueued by this encoder.
The fence is updated at kernel submission to maintain global order and prevent deadlock. Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
void waitForFence(MTLFence fence)
Prevent further GPU work until the fence is reached.
The fence is evaluated at kernel submision to maintain global order and prevent deadlock. Drivers may delay fence updates until the end of the encoder. Drivers may also wait on fences at the beginning of an encoder. It is therefore illegal to wait on a fence after it has been updated in the same encoder.
void dispatchThreadsThreadsPerThreadgroup(MTLSize threadsPerGrid, MTLSize threadsPerThreadgroup)
Enqueue a compute function dispatch using an arbitrarily-sized grid.
threadsPerGrid does not have to be a multiple of the threadGroup size
void setImageblockWidthHeight(long width,
long height)
Set imageblock sizes.
void useHeap(MTLHeap heap)
Declare that the resources allocated from a heap may be accessed as readonly by the render pass through an argument buffer
For tracked MTLHeaps, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources allocated from the heap through an argument buffer. This method may cause all of the color attachments allocated from the heap to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage. [@warning] Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
void useHeapsCount(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> heaps,
long count)
Declare that the resources allocated from an array of heaps may be accessed as readonly by the render pass through an argument buffer
For tracked MTLHeaps, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources allocated from the heaps through an argument buffer. This method may cause all of the color attachments allocated from the heaps to become decompressed. Therefore, it is recommended that the useResource:usage: or useResources:count:usage: methods be used for color attachments instead, with a minimal (i.e. read-only) usage. [@warning] Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
void useResourceUsage(MTLResource resource, long usage)
Declare that a resource may be accessed by the command encoder through an argument buffer
For tracked MTLResources, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resource through an argument buffer. [@warning] Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
void useResourcesCountUsage(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> resources,
long count,
long usage)
Declare that an array of resources may be accessed through an argument buffer by the command encoder
For tracked MTL Resources, this method protects against data hazards. This method must be called before encoding any dispatch commands which may access the resources through an argument buffer. [@warning] Prior to iOS 13, macOS 10.15, this method does not protect against data hazards. If you are deploying to older versions of macOS or iOS, use fences to ensure data hazards are resolved.
long dispatchType()
The dispatch type of the compute command encoder.
void executeCommandsInBufferIndirectBufferIndirectBufferOffset(MTLIndirectCommandBuffer indirectCommandbuffer, MTLBuffer indirectRangeBuffer, long indirectBufferOffset)
Execute commands in the buffer within the range specified by the indirect range buffer.
The same indirect command buffer may be executed any number of times within the same encoder.
indirectRangeBuffer - An indirect buffer from which the device reads the execution range parameter, as laid out in the MTLIndirectCommandBufferExecutionRange structure.indirectBufferOffset - The byte offset within indirectBuffer where the execution range parameter is located. Must be a multiple of 4 bytes.void executeCommandsInBufferWithRange(MTLIndirectCommandBuffer indirectCommandBuffer, NSRange executionRange)
Execute commands in the buffer within the range specified.
The same indirect command buffer may be executed any number of times within the same encoder.
void memoryBarrierWithResourcesCount(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> resources,
long count)
Encodes a barrier between currently dispatched kernels in a concurrent compute command encoder and any subsequent ones on an array of resources.
This API ensures that all dispatches in the encoder have completed execution and side effects on the specified resources are visible to subsequent dispatches in that encoder. Calling barrier on a serial encoder is allowed, but ignored.
void memoryBarrierWithScope(long scope)
Encodes a barrier between currently dispatched kernels in a concurrent compute command encoder and any subsequent ones on a specified resource group
This API ensures that all dispatches in the encoder have completed execution and their side effects are visible to subsequent dispatches in that encoder. Calling barrier on a serial encoder is allowed, but ignored.
void setStageInRegionWithIndirectBufferIndirectBufferOffset(MTLBuffer indirectBuffer, long indirectBufferOffset)
sets the stage in region indirectly for the following indirect dispatch calls.
indirectBuffer - A buffer object that the device will read the stageIn region arguments from, see MTLStageInRegionIndirectArguments.indirectBufferOffset - Byte offset within indirectBuffer to read arguments from. indirectBufferOffset must be a multiple of 4.void sampleCountersInBufferAtSampleIndexWithBarrier(MTLCounterSampleBuffer sampleBuffer, long sampleIndex, boolean barrier)
Sample hardware counters at this point in the compute encoder and store the counter sample into the sample buffer at the specified index.
On devices where MTLCounterSamplingPointAtDispatchBoundary is unsupported, this method is not available and will generate an error if called.
sampleBuffer - The sample buffer to sample intosampleIndex - The index into the counter buffer to write the samplebarrier - Insert a barrier before taking the sample. Passing
YES will ensure that all work encoded before this operation in the encoder is
complete but does not isolate the work with respect to other encoders. Passing
NO will allow the sample to be taken concurrently with other operations in this
encoder.
In general, passing YES will lead to more repeatable counter results but
may negatively impact performance. Passing NO will generally be higher performance
but counter results may not be repeatable.void setAccelerationStructureAtBufferIndex(MTLAccelerationStructure accelerationStructure, long bufferIndex)
Set a global raytracing acceleration structure for all compute kernels at the given buffer bind point index.
void setIntersectionFunctionTableAtBufferIndex(MTLIntersectionFunctionTable intersectionFunctionTable, long bufferIndex)
Set a visible function table at the given buffer index
void setIntersectionFunctionTablesWithBufferRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> intersectionFunctionTables,
NSRange range)
Set visible function tables at the given buffer index range
void setVisibleFunctionTableAtBufferIndex(MTLVisibleFunctionTable visibleFunctionTable, long bufferIndex)
Set a visible function table at the given buffer index
void setVisibleFunctionTablesWithBufferRange(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> visibleFunctionTables,
NSRange range)
Set visible function tables at the given buffer index range