yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
v1.3.2
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Metal/MTLIndirectCommandBuffer.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 "MTLIndirectCommandBuffer.hpp" 30#include "MTLResource.hpp" 31 32namespace MTL 33{ 34_MTL_OPTIONS ( NS :: UInteger , IndirectCommandType ) { 35IndirectCommandTypeDraw = 1 , 36IndirectCommandTypeDrawIndexed = 2 , 37IndirectCommandTypeDrawPatches = 4 , 38IndirectCommandTypeDrawIndexedPatches = 8 , 39IndirectCommandTypeConcurrentDispatch = 32 , 40IndirectCommandTypeConcurrentDispatchThreads = 64 , 41} ; 42 43struct IndirectCommandBufferExecutionRange 44{ 45uint32_t location ; 46uint32_t length ; 47} _MTL_PACKED ; 48 49class IndirectCommandBufferDescriptor : public NS :: Copying < IndirectCommandBufferDescriptor > 50{ 51public : 52static class IndirectCommandBufferDescriptor * alloc () ; 53 54class IndirectCommandBufferDescriptor * init () ; 55 56MTL :: IndirectCommandType commandTypes () const ; 57void setCommandTypes ( MTL :: IndirectCommandType commandTypes ) ; 58 59bool inheritPipelineState () const ; 60void setInheritPipelineState ( bool inheritPipelineState ) ; 61 62bool inheritBuffers () const ; 63void setInheritBuffers ( bool inheritBuffers ) ; 64 65NS :: UInteger maxVertexBufferBindCount () const ; 66void setMaxVertexBufferBindCount ( NS :: UInteger maxVertexBufferBindCount ) ; 67 68NS :: UInteger maxFragmentBufferBindCount () const ; 69void setMaxFragmentBufferBindCount ( NS :: UInteger maxFragmentBufferBindCount ) ; 70 71NS :: UInteger maxKernelBufferBindCount () const ; 72void setMaxKernelBufferBindCount ( NS :: UInteger maxKernelBufferBindCount ) ; 73} ; 74 75class IndirectCommandBuffer : public NS :: Referencing < IndirectCommandBuffer , Resource > 76{ 77public : 78NS :: UInteger size () const ; 79 80void reset ( NS :: Range range ) ; 81 82class IndirectRenderCommand * indirectRenderCommand ( NS :: UInteger commandIndex ) ; 83 84class IndirectComputeCommand * indirectComputeCommand ( NS :: UInteger commandIndex ) ; 85} ; 86 87} 88 89// static method: alloc 90_MTL_INLINE MTL :: IndirectCommandBufferDescriptor * MTL :: IndirectCommandBufferDescriptor :: alloc () 91{ 92return NS :: Object :: alloc < MTL :: IndirectCommandBufferDescriptor > ( _MTL_PRIVATE_CLS ( MTLIndirectCommandBufferDescriptor )) ; 93} 94 95// method: init 96_MTL_INLINE MTL :: IndirectCommandBufferDescriptor * MTL :: IndirectCommandBufferDescriptor :: init () 97{ 98return NS :: Object :: init < MTL :: IndirectCommandBufferDescriptor > () ; 99} 100 101// property: commandTypes 102_MTL_INLINE MTL :: IndirectCommandType MTL :: IndirectCommandBufferDescriptor :: commandTypes () const 103{ 104return Object :: sendMessage < MTL :: IndirectCommandType > ( this , _MTL_PRIVATE_SEL ( commandTypes )) ; 105} 106 107_MTL_INLINE void MTL :: IndirectCommandBufferDescriptor :: setCommandTypes ( MTL :: IndirectCommandType commandTypes ) 108{ 109Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setCommandTypes_ ) , commandTypes ) ; 110} 111 112// property: inheritPipelineState 113_MTL_INLINE bool MTL :: IndirectCommandBufferDescriptor :: inheritPipelineState () const 114{ 115return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( inheritPipelineState )) ; 116} 117 118_MTL_INLINE void MTL :: IndirectCommandBufferDescriptor :: setInheritPipelineState ( bool inheritPipelineState ) 119{ 120Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setInheritPipelineState_ ) , inheritPipelineState ) ; 121} 122 123// property: inheritBuffers 124_MTL_INLINE bool MTL :: IndirectCommandBufferDescriptor :: inheritBuffers () const 125{ 126return Object :: sendMessage < bool > ( this , _MTL_PRIVATE_SEL ( inheritBuffers )) ; 127} 128 129_MTL_INLINE void MTL :: IndirectCommandBufferDescriptor :: setInheritBuffers ( bool inheritBuffers ) 130{ 131Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setInheritBuffers_ ) , inheritBuffers ) ; 132} 133 134// property: maxVertexBufferBindCount 135_MTL_INLINE NS :: UInteger MTL :: IndirectCommandBufferDescriptor :: maxVertexBufferBindCount () const 136{ 137return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( maxVertexBufferBindCount )) ; 138} 139 140_MTL_INLINE void MTL :: IndirectCommandBufferDescriptor :: setMaxVertexBufferBindCount ( NS :: UInteger maxVertexBufferBindCount ) 141{ 142Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setMaxVertexBufferBindCount_ ) , maxVertexBufferBindCount ) ; 143} 144 145// property: maxFragmentBufferBindCount 146_MTL_INLINE NS :: UInteger MTL :: IndirectCommandBufferDescriptor :: maxFragmentBufferBindCount () const 147{ 148return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( maxFragmentBufferBindCount )) ; 149} 150 151_MTL_INLINE void MTL :: IndirectCommandBufferDescriptor :: setMaxFragmentBufferBindCount ( NS :: UInteger maxFragmentBufferBindCount ) 152{ 153Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setMaxFragmentBufferBindCount_ ) , maxFragmentBufferBindCount ) ; 154} 155 156// property: maxKernelBufferBindCount 157_MTL_INLINE NS :: UInteger MTL :: IndirectCommandBufferDescriptor :: maxKernelBufferBindCount () const 158{ 159return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( maxKernelBufferBindCount )) ; 160} 161 162_MTL_INLINE void MTL :: IndirectCommandBufferDescriptor :: setMaxKernelBufferBindCount ( NS :: UInteger maxKernelBufferBindCount ) 163{ 164Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( setMaxKernelBufferBindCount_ ) , maxKernelBufferBindCount ) ; 165} 166 167// property: size 168_MTL_INLINE NS :: UInteger MTL :: IndirectCommandBuffer :: size () const 169{ 170return Object :: sendMessage < NS :: UInteger > ( this , _MTL_PRIVATE_SEL ( size )) ; 171} 172 173// method: resetWithRange: 174_MTL_INLINE void MTL :: IndirectCommandBuffer :: reset ( NS :: Range range ) 175{ 176Object :: sendMessage < void > ( this , _MTL_PRIVATE_SEL ( resetWithRange_ ) , range ) ; 177} 178 179// method: indirectRenderCommandAtIndex: 180_MTL_INLINE MTL :: IndirectRenderCommand * MTL :: IndirectCommandBuffer :: indirectRenderCommand ( NS :: UInteger commandIndex ) 181{ 182return Object :: sendMessage < MTL :: IndirectRenderCommand *> ( this , _MTL_PRIVATE_SEL ( indirectRenderCommandAtIndex_ ) , commandIndex ) ; 183} 184 185// method: indirectComputeCommandAtIndex: 186_MTL_INLINE MTL :: IndirectComputeCommand * MTL :: IndirectCommandBuffer :: indirectComputeCommand ( NS :: UInteger commandIndex ) 187{ 188return Object :: sendMessage < MTL :: IndirectComputeCommand *> ( this , _MTL_PRIVATE_SEL ( indirectComputeCommandAtIndex_ ) , commandIndex ) ; 189}