MTLCommandQueue.hpp
1 //------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 // 3 // Metal/MTLCommandQueue.hpp 4 // 5 // Copyright 2020-2024 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 namespace MTL 30 { 31 class CommandQueue : public NS::Referencing<CommandQueue> 32 { 33 public: 34 NS::String* label() const; 35 void setLabel(const NS::String* label); 36 37 class Device* device() const; 38 39 class CommandBuffer* commandBuffer(); 40 41 class CommandBuffer* commandBuffer(const class CommandBufferDescriptor* descriptor); 42 43 class CommandBuffer* commandBufferWithUnretainedReferences(); 44 45 void insertDebugCaptureBoundary(); 46 47 void addResidencySet(const class ResidencySet* residencySet); 48 49 void addResidencySets(const class ResidencySet* const residencySets[], NS::UInteger count); 50 51 void removeResidencySet(const class ResidencySet* residencySet); 52 53 void removeResidencySets(const class ResidencySet* const residencySets[], NS::UInteger count); 54 }; 55 56 class CommandQueueDescriptor : public NS::Copying<CommandQueueDescriptor> 57 { 58 public: 59 static class CommandQueueDescriptor* alloc(); 60 61 class CommandQueueDescriptor* init(); 62 63 NS::UInteger maxCommandBufferCount() const; 64 void setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount); 65 66 class LogState* logState() const; 67 void setLogState(const class LogState* logState); 68 }; 69 70 } 71 72 // property: label 73 _MTL_INLINE NS::String* MTL::CommandQueue::label() const 74 { 75 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label)); 76 } 77 78 _MTL_INLINE void MTL::CommandQueue::setLabel(const NS::String* label) 79 { 80 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label); 81 } 82 83 // property: device 84 _MTL_INLINE MTL::Device* MTL::CommandQueue::device() const 85 { 86 return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device)); 87 } 88 89 // method: commandBuffer 90 _MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer() 91 { 92 return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer)); 93 } 94 95 // method: commandBufferWithDescriptor: 96 _MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer(const MTL::CommandBufferDescriptor* descriptor) 97 { 98 return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithDescriptor_), descriptor); 99 } 100 101 // method: commandBufferWithUnretainedReferences 102 _MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBufferWithUnretainedReferences() 103 { 104 return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences)); 105 } 106 107 // method: insertDebugCaptureBoundary 108 _MTL_INLINE void MTL::CommandQueue::insertDebugCaptureBoundary() 109 { 110 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugCaptureBoundary)); 111 } 112 113 // method: addResidencySet: 114 _MTL_INLINE void MTL::CommandQueue::addResidencySet(const MTL::ResidencySet* residencySet) 115 { 116 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySet_), residencySet); 117 } 118 119 // method: addResidencySets:count: 120 _MTL_INLINE void MTL::CommandQueue::addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count) 121 { 122 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySets_count_), residencySets, count); 123 } 124 125 // method: removeResidencySet: 126 _MTL_INLINE void MTL::CommandQueue::removeResidencySet(const MTL::ResidencySet* residencySet) 127 { 128 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySet_), residencySet); 129 } 130 131 // method: removeResidencySets:count: 132 _MTL_INLINE void MTL::CommandQueue::removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count) 133 { 134 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySets_count_), residencySets, count); 135 } 136 137 // static method: alloc 138 _MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::alloc() 139 { 140 return NS::Object::alloc<MTL::CommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTLCommandQueueDescriptor)); 141 } 142 143 // method: init 144 _MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::init() 145 { 146 return NS::Object::init<MTL::CommandQueueDescriptor>(); 147 } 148 149 // property: maxCommandBufferCount 150 _MTL_INLINE NS::UInteger MTL::CommandQueueDescriptor::maxCommandBufferCount() const 151 { 152 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandBufferCount)); 153 } 154 155 _MTL_INLINE void MTL::CommandQueueDescriptor::setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount) 156 { 157 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandBufferCount_), maxCommandBufferCount); 158 } 159 160 // property: logState 161 _MTL_INLINE MTL::LogState* MTL::CommandQueueDescriptor::logState() const 162 { 163 return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState)); 164 } 165 166 _MTL_INLINE void MTL::CommandQueueDescriptor::setLogState(const MTL::LogState* logState) 167 { 168 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState); 169 }