MTLComputePass.hpp
1 //------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 // 3 // Metal/MTLComputePass.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 #include "MTLCommandBuffer.hpp" 30 31 namespace MTL 32 { 33 class ComputePassSampleBufferAttachmentDescriptor : public NS::Copying<ComputePassSampleBufferAttachmentDescriptor> 34 { 35 public: 36 static class ComputePassSampleBufferAttachmentDescriptor* alloc(); 37 38 class ComputePassSampleBufferAttachmentDescriptor* init(); 39 40 class CounterSampleBuffer* sampleBuffer() const; 41 void setSampleBuffer(const class CounterSampleBuffer* sampleBuffer); 42 43 NS::UInteger startOfEncoderSampleIndex() const; 44 void setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex); 45 46 NS::UInteger endOfEncoderSampleIndex() const; 47 void setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex); 48 }; 49 50 class ComputePassSampleBufferAttachmentDescriptorArray : public NS::Referencing<ComputePassSampleBufferAttachmentDescriptorArray> 51 { 52 public: 53 static class ComputePassSampleBufferAttachmentDescriptorArray* alloc(); 54 55 class ComputePassSampleBufferAttachmentDescriptorArray* init(); 56 57 class ComputePassSampleBufferAttachmentDescriptor* object(NS::UInteger attachmentIndex); 58 59 void setObject(const class ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex); 60 }; 61 62 class ComputePassDescriptor : public NS::Copying<ComputePassDescriptor> 63 { 64 public: 65 static class ComputePassDescriptor* alloc(); 66 67 class ComputePassDescriptor* init(); 68 69 static class ComputePassDescriptor* computePassDescriptor(); 70 71 MTL::DispatchType dispatchType() const; 72 void setDispatchType(MTL::DispatchType dispatchType); 73 74 class ComputePassSampleBufferAttachmentDescriptorArray* sampleBufferAttachments() const; 75 }; 76 77 } 78 79 // static method: alloc 80 _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::alloc() 81 { 82 return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptor)); 83 } 84 85 // method: init 86 _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptor::init() 87 { 88 return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptor>(); 89 } 90 91 // property: sampleBuffer 92 _MTL_INLINE MTL::CounterSampleBuffer* MTL::ComputePassSampleBufferAttachmentDescriptor::sampleBuffer() const 93 { 94 return Object::sendMessage<MTL::CounterSampleBuffer*>(this, _MTL_PRIVATE_SEL(sampleBuffer)); 95 } 96 97 _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setSampleBuffer(const MTL::CounterSampleBuffer* sampleBuffer) 98 { 99 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSampleBuffer_), sampleBuffer); 100 } 101 102 // property: startOfEncoderSampleIndex 103 _MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::startOfEncoderSampleIndex() const 104 { 105 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(startOfEncoderSampleIndex)); 106 } 107 108 _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setStartOfEncoderSampleIndex(NS::UInteger startOfEncoderSampleIndex) 109 { 110 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setStartOfEncoderSampleIndex_), startOfEncoderSampleIndex); 111 } 112 113 // property: endOfEncoderSampleIndex 114 _MTL_INLINE NS::UInteger MTL::ComputePassSampleBufferAttachmentDescriptor::endOfEncoderSampleIndex() const 115 { 116 return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(endOfEncoderSampleIndex)); 117 } 118 119 _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptor::setEndOfEncoderSampleIndex(NS::UInteger endOfEncoderSampleIndex) 120 { 121 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setEndOfEncoderSampleIndex_), endOfEncoderSampleIndex); 122 } 123 124 // static method: alloc 125 _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::alloc() 126 { 127 return NS::Object::alloc<MTL::ComputePassSampleBufferAttachmentDescriptorArray>(_MTL_PRIVATE_CLS(MTLComputePassSampleBufferAttachmentDescriptorArray)); 128 } 129 130 // method: init 131 _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassSampleBufferAttachmentDescriptorArray::init() 132 { 133 return NS::Object::init<MTL::ComputePassSampleBufferAttachmentDescriptorArray>(); 134 } 135 136 // method: objectAtIndexedSubscript: 137 _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptor* MTL::ComputePassSampleBufferAttachmentDescriptorArray::object(NS::UInteger attachmentIndex) 138 { 139 return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), attachmentIndex); 140 } 141 142 // method: setObject:atIndexedSubscript: 143 _MTL_INLINE void MTL::ComputePassSampleBufferAttachmentDescriptorArray::setObject(const MTL::ComputePassSampleBufferAttachmentDescriptor* attachment, NS::UInteger attachmentIndex) 144 { 145 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), attachment, attachmentIndex); 146 } 147 148 // static method: alloc 149 _MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::alloc() 150 { 151 return NS::Object::alloc<MTL::ComputePassDescriptor>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor)); 152 } 153 154 // method: init 155 _MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::init() 156 { 157 return NS::Object::init<MTL::ComputePassDescriptor>(); 158 } 159 160 // static method: computePassDescriptor 161 _MTL_INLINE MTL::ComputePassDescriptor* MTL::ComputePassDescriptor::computePassDescriptor() 162 { 163 return Object::sendMessage<MTL::ComputePassDescriptor*>(_MTL_PRIVATE_CLS(MTLComputePassDescriptor), _MTL_PRIVATE_SEL(computePassDescriptor)); 164 } 165 166 // property: dispatchType 167 _MTL_INLINE MTL::DispatchType MTL::ComputePassDescriptor::dispatchType() const 168 { 169 return Object::sendMessage<MTL::DispatchType>(this, _MTL_PRIVATE_SEL(dispatchType)); 170 } 171 172 _MTL_INLINE void MTL::ComputePassDescriptor::setDispatchType(MTL::DispatchType dispatchType) 173 { 174 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDispatchType_), dispatchType); 175 } 176 177 // property: sampleBufferAttachments 178 _MTL_INLINE MTL::ComputePassSampleBufferAttachmentDescriptorArray* MTL::ComputePassDescriptor::sampleBufferAttachments() const 179 { 180 return Object::sendMessage<MTL::ComputePassSampleBufferAttachmentDescriptorArray*>(this, _MTL_PRIVATE_SEL(sampleBufferAttachments)); 181 }