yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
master
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Metal/MTLIndirectCommandEncoder.hpp 4// 5// Copyright 2020-2021 Apple Inc. 6// 7// Licensed under the Apache License, Version 2.0 (the "License"); 8// you may not use this file except in compliance with the License. 9// You may obtain a copy of the License at 10// 11// http://www.apache.org/licenses/LICENSE-2.0 12// 13// Unless required by applicable law or agreed to in writing, software 14// distributed under the License is distributed on an "AS IS" BASIS, 15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16// See the License for the specific language governing permissions and 17// limitations under the License. 18// 19//------------------------------------------------------------------------------------------------------------------------------------------------------------- 20 21#pragma once 22 23#include "MTLDefines.hpp" 24#include "MTLHeaderBridge.hpp" 25#include "MTLPrivate.hpp" 26 27#include <Foundation/Foundation.hpp> 28 29#include "MTLRenderCommandEncoder.hpp" 30#include "MTLStageInputOutputDescriptor.hpp" 31#include "MTLTypes.hpp" 32 33namespace MTL 34{ 35class IndirectRenderCommand : public NS :: Referencing < IndirectRenderCommand > 36{ 37public : 38void setRenderPipelineState ( const class RenderPipelineState * pipelineState ) ; 39 40void setVertexBuffer ( const class Buffer * buffer , NS :: UInteger offset , NS :: UInteger index ) ; 41 42void setFragmentBuffer ( const class Buffer * buffer , NS :: UInteger offset , NS :: UInteger index ) ; 43 44void drawPatches ( NS :: UInteger numberOfPatchControlPoints , NS :: UInteger patchStart , NS :: UInteger patchCount , const class Buffer * patchIndexBuffer , NS :: UInteger patchIndexBufferOffset , NS :: UInteger instanceCount , NS :: UInteger baseInstance , const class Buffer * buffer , NS :: UInteger offset , NS :: UInteger instanceStride ) ; 45 46void drawIndexedPatches ( NS :: UInteger numberOfPatchControlPoints , NS :: UInteger patchStart , NS :: UInteger patchCount , const class Buffer * patchIndexBuffer , NS :: UInteger patchIndexBufferOffset , const class Buffer * controlPointIndexBuffer , NS :: UInteger controlPointIndexBufferOffset , NS :: UInteger instanceCount , NS :: UInteger baseInstance , const class Buffer * buffer , NS :: UInteger offset , NS :: UInteger instanceStride ) ; 47 48void drawPrimitives ( MTL :: PrimitiveType primitiveType , NS :: UInteger vertexStart , NS :: UInteger vertexCount , NS :: UInteger instanceCount , NS :: UInteger baseInstance ) ; 49 50void drawIndexedPrimitives ( MTL :: PrimitiveType primitiveType , NS :: UInteger indexCount , MTL :: IndexType indexType , const class Buffer * indexBuffer , NS :: UInteger indexBufferOffset , NS :: UInteger instanceCount , NS :: Integer baseVertex , NS :: UInteger baseInstance ) ; 51 52void reset () ; 53} ; 54 55class IndirectComputeCommand : public NS :: Referencing < IndirectComputeCommand > 56{ 57public : 58void setComputePipelineState ( const class ComputePipelineState * pipelineState ) ; 59 60void setKernelBuffer ( const class Buffer * buffer , NS :: UInteger offset , NS :: UInteger index ) ; 61 62void concurrentDispatchThreadgroups ( MTL :: Size threadgroupsPerGrid , MTL :: Size threadsPerThreadgroup ) ; 63 64void concurrentDispatchThreads ( MTL :: Size threadsPerGrid , MTL :: Size threadsPerThreadgroup ) ; 65 66void setBarrier () ; 67 68void clearBarrier () ; 69 70void setImageblockWidth ( NS :: UInteger width , NS :: UInteger height ) ; 71 72void reset () ; 73 74void setThreadgroupMemoryLength ( NS :: UInteger length , NS :: UInteger index ) ; 75 76void setStageInRegion ( MTL :: Region region ) ; 77} ; 78 79} 80 81// method: setRenderPipelineState: 82_MTL_INLINE void MTL :: IndirectRenderCommand :: setRenderPipelineState ( const MTL :: RenderPipelineState * pipelineState ) 83{ 84Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setRenderPipelineState_ ) , pipelineState ) ; 85} 86 87// method: setVertexBuffer:offset:atIndex: 88_MTL_INLINE void MTL :: IndirectRenderCommand :: setVertexBuffer ( const MTL :: Buffer * buffer , NS :: UInteger offset , NS :: UInteger index ) 89{ 90Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setVertexBuffer_offset_atIndex_ ) , buffer , offset , index ) ; 91} 92 93// method: setFragmentBuffer:offset:atIndex: 94_MTL_INLINE void MTL :: IndirectRenderCommand :: setFragmentBuffer ( const MTL :: Buffer * buffer , NS :: UInteger offset , NS :: UInteger index ) 95{ 96Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setFragmentBuffer_offset_atIndex_ ) , buffer , offset , index ) ; 97} 98 99// method: drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride: 100_MTL_INLINE void MTL :: IndirectRenderCommand :: drawPatches ( NS :: UInteger numberOfPatchControlPoints , NS :: UInteger patchStart , NS :: UInteger patchCount , const MTL :: Buffer * patchIndexBuffer , NS :: UInteger patchIndexBufferOffset , NS :: UInteger instanceCount , NS :: UInteger baseInstance , const MTL :: Buffer * buffer , NS :: UInteger offset , NS :: UInteger instanceStride ) 101{ 102Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( drawPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride_ ) , numberOfPatchControlPoints , patchStart , patchCount , patchIndexBuffer , patchIndexBufferOffset , instanceCount , baseInstance , buffer , offset , instanceStride ) ; 103} 104 105// method: drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride: 106_MTL_INLINE void MTL :: IndirectRenderCommand :: drawIndexedPatches ( NS :: UInteger numberOfPatchControlPoints , NS :: UInteger patchStart , NS :: UInteger patchCount , const MTL :: Buffer * patchIndexBuffer , NS :: UInteger patchIndexBufferOffset , const MTL :: Buffer * controlPointIndexBuffer , NS :: UInteger controlPointIndexBufferOffset , NS :: UInteger instanceCount , NS :: UInteger baseInstance , const MTL :: Buffer * buffer , NS :: UInteger offset , NS :: UInteger instanceStride ) 107{ 108Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( drawIndexedPatches_patchStart_patchCount_patchIndexBuffer_patchIndexBufferOffset_controlPointIndexBuffer_controlPointIndexBufferOffset_instanceCount_baseInstance_tessellationFactorBuffer_tessellationFactorBufferOffset_tessellationFactorBufferInstanceStride_ ) , numberOfPatchControlPoints , patchStart , patchCount , patchIndexBuffer , patchIndexBufferOffset , controlPointIndexBuffer , controlPointIndexBufferOffset , instanceCount , baseInstance , buffer , offset , instanceStride ) ; 109} 110 111// method: drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance: 112_MTL_INLINE void MTL :: IndirectRenderCommand :: drawPrimitives ( MTL :: PrimitiveType primitiveType , NS :: UInteger vertexStart , NS :: UInteger vertexCount , NS :: UInteger instanceCount , NS :: UInteger baseInstance ) 113{ 114Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( drawPrimitives_vertexStart_vertexCount_instanceCount_baseInstance_ ) , primitiveType , vertexStart , vertexCount , instanceCount , baseInstance ) ; 115} 116 117// method: drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance: 118_MTL_INLINE void MTL :: IndirectRenderCommand :: drawIndexedPrimitives ( MTL :: PrimitiveType primitiveType , NS :: UInteger indexCount , MTL :: IndexType indexType , const MTL :: Buffer * indexBuffer , NS :: UInteger indexBufferOffset , NS :: UInteger instanceCount , NS :: Integer baseVertex , NS :: UInteger baseInstance ) 119{ 120Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( drawIndexedPrimitives_indexCount_indexType_indexBuffer_indexBufferOffset_instanceCount_baseVertex_baseInstance_ ) , primitiveType , indexCount , indexType , indexBuffer , indexBufferOffset , instanceCount , baseVertex , baseInstance ) ; 121} 122 123// method: reset 124_MTL_INLINE void MTL :: IndirectRenderCommand :: reset () 125{ 126Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( reset )) ; 127} 128 129// method: setComputePipelineState: 130_MTL_INLINE void MTL :: IndirectComputeCommand :: setComputePipelineState ( const MTL :: ComputePipelineState * pipelineState ) 131{ 132Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setComputePipelineState_ ) , pipelineState ) ; 133} 134 135// method: setKernelBuffer:offset:atIndex: 136_MTL_INLINE void MTL :: IndirectComputeCommand :: setKernelBuffer ( const MTL :: Buffer * buffer , NS :: UInteger offset , NS :: UInteger index ) 137{ 138Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setKernelBuffer_offset_atIndex_ ) , buffer , offset , index ) ; 139} 140 141// method: concurrentDispatchThreadgroups:threadsPerThreadgroup: 142_MTL_INLINE void MTL :: IndirectComputeCommand :: concurrentDispatchThreadgroups ( MTL :: Size threadgroupsPerGrid , MTL :: Size threadsPerThreadgroup ) 143{ 144Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( concurrentDispatchThreadgroups_threadsPerThreadgroup_ ) , threadgroupsPerGrid , threadsPerThreadgroup ) ; 145} 146 147// method: concurrentDispatchThreads:threadsPerThreadgroup: 148_MTL_INLINE void MTL :: IndirectComputeCommand :: concurrentDispatchThreads ( MTL :: Size threadsPerGrid , MTL :: Size threadsPerThreadgroup ) 149{ 150Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( concurrentDispatchThreads_threadsPerThreadgroup_ ) , threadsPerGrid , threadsPerThreadgroup ) ; 151} 152 153// method: setBarrier 154_MTL_INLINE void MTL :: IndirectComputeCommand :: setBarrier () 155{ 156Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setBarrier )) ; 157} 158 159// method: clearBarrier 160_MTL_INLINE void MTL :: IndirectComputeCommand :: clearBarrier () 161{ 162Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( clearBarrier )) ; 163} 164 165// method: setImageblockWidth:height: 166_MTL_INLINE void MTL :: IndirectComputeCommand :: setImageblockWidth ( NS :: UInteger width , NS :: UInteger height ) 167{ 168Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setImageblockWidth_height_ ) , width , height ) ; 169} 170 171// method: reset 172_MTL_INLINE void MTL :: IndirectComputeCommand :: reset () 173{ 174Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( reset )) ; 175} 176 177// method: setThreadgroupMemoryLength:atIndex: 178_MTL_INLINE void MTL :: IndirectComputeCommand :: setThreadgroupMemoryLength ( NS :: UInteger length , NS :: UInteger index ) 179{ 180Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setThreadgroupMemoryLength_atIndex_ ) , length , index ) ; 181} 182 183// method: setStageInRegion: 184_MTL_INLINE void MTL :: IndirectComputeCommand :: setStageInRegion ( MTL :: Region region ) 185{ 186Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setStageInRegion_ ) , region ) ; 187}