MTLPipeline.hpp
1 //------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 // 3 // Metal/MTLPipeline.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 "MTLPipeline.hpp" 30 31 namespace MTL 32 { 33 _MTL_ENUM(NS::UInteger, Mutability) { 34 MutabilityDefault = 0, 35 MutabilityMutable = 1, 36 MutabilityImmutable = 2, 37 }; 38 39 _MTL_ENUM(NS::Integer, ShaderValidation) { 40 ShaderValidationDefault = 0, 41 ShaderValidationEnabled = 1, 42 ShaderValidationDisabled = 2, 43 }; 44 45 class PipelineBufferDescriptor : public NS::Copying<PipelineBufferDescriptor> 46 { 47 public: 48 static class PipelineBufferDescriptor* alloc(); 49 50 class PipelineBufferDescriptor* init(); 51 52 MTL::Mutability mutability() const; 53 void setMutability(MTL::Mutability mutability); 54 }; 55 56 class PipelineBufferDescriptorArray : public NS::Referencing<PipelineBufferDescriptorArray> 57 { 58 public: 59 static class PipelineBufferDescriptorArray* alloc(); 60 61 class PipelineBufferDescriptorArray* init(); 62 63 class PipelineBufferDescriptor* object(NS::UInteger bufferIndex); 64 65 void setObject(const class PipelineBufferDescriptor* buffer, NS::UInteger bufferIndex); 66 }; 67 68 } 69 70 // static method: alloc 71 _MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptor::alloc() 72 { 73 return NS::Object::alloc<MTL::PipelineBufferDescriptor>(_MTL_PRIVATE_CLS(MTLPipelineBufferDescriptor)); 74 } 75 76 // method: init 77 _MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptor::init() 78 { 79 return NS::Object::init<MTL::PipelineBufferDescriptor>(); 80 } 81 82 // property: mutability 83 _MTL_INLINE MTL::Mutability MTL::PipelineBufferDescriptor::mutability() const 84 { 85 return Object::sendMessage<MTL::Mutability>(this, _MTL_PRIVATE_SEL(mutability)); 86 } 87 88 _MTL_INLINE void MTL::PipelineBufferDescriptor::setMutability(MTL::Mutability mutability) 89 { 90 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMutability_), mutability); 91 } 92 93 // static method: alloc 94 _MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::PipelineBufferDescriptorArray::alloc() 95 { 96 return NS::Object::alloc<MTL::PipelineBufferDescriptorArray>(_MTL_PRIVATE_CLS(MTLPipelineBufferDescriptorArray)); 97 } 98 99 // method: init 100 _MTL_INLINE MTL::PipelineBufferDescriptorArray* MTL::PipelineBufferDescriptorArray::init() 101 { 102 return NS::Object::init<MTL::PipelineBufferDescriptorArray>(); 103 } 104 105 // method: objectAtIndexedSubscript: 106 _MTL_INLINE MTL::PipelineBufferDescriptor* MTL::PipelineBufferDescriptorArray::object(NS::UInteger bufferIndex) 107 { 108 return Object::sendMessage<MTL::PipelineBufferDescriptor*>(this, _MTL_PRIVATE_SEL(objectAtIndexedSubscript_), bufferIndex); 109 } 110 111 // method: setObject:atIndexedSubscript: 112 _MTL_INLINE void MTL::PipelineBufferDescriptorArray::setObject(const MTL::PipelineBufferDescriptor* buffer, NS::UInteger bufferIndex) 113 { 114 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setObject_atIndexedSubscript_), buffer, bufferIndex); 115 }