MTLFunctionDescriptor.hpp
1 //------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 // 3 // Metal/MTLFunctionDescriptor.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 "MTLFunctionDescriptor.hpp" 30 31 namespace MTL 32 { 33 _MTL_OPTIONS(NS::UInteger, FunctionOptions) { 34 FunctionOptionNone = 0, 35 FunctionOptionCompileToBinary = 1, 36 FunctionOptionStoreFunctionInMetalScript = 2, 37 FunctionOptionStoreFunctionInMetalPipelinesScript = 2, 38 FunctionOptionFailOnBinaryArchiveMiss = 4, 39 }; 40 41 class FunctionDescriptor : public NS::Copying<FunctionDescriptor> 42 { 43 public: 44 static class FunctionDescriptor* alloc(); 45 46 class FunctionDescriptor* init(); 47 48 static class FunctionDescriptor* functionDescriptor(); 49 50 NS::String* name() const; 51 void setName(const NS::String* name); 52 53 NS::String* specializedName() const; 54 void setSpecializedName(const NS::String* specializedName); 55 56 class FunctionConstantValues* constantValues() const; 57 void setConstantValues(const class FunctionConstantValues* constantValues); 58 59 MTL::FunctionOptions options() const; 60 void setOptions(MTL::FunctionOptions options); 61 62 NS::Array* binaryArchives() const; 63 void setBinaryArchives(const NS::Array* binaryArchives); 64 }; 65 66 class IntersectionFunctionDescriptor : public NS::Copying<IntersectionFunctionDescriptor, MTL::FunctionDescriptor> 67 { 68 public: 69 static class IntersectionFunctionDescriptor* alloc(); 70 71 class IntersectionFunctionDescriptor* init(); 72 }; 73 74 } 75 76 // static method: alloc 77 _MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::alloc() 78 { 79 return NS::Object::alloc<MTL::FunctionDescriptor>(_MTL_PRIVATE_CLS(MTLFunctionDescriptor)); 80 } 81 82 // method: init 83 _MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::init() 84 { 85 return NS::Object::init<MTL::FunctionDescriptor>(); 86 } 87 88 // static method: functionDescriptor 89 _MTL_INLINE MTL::FunctionDescriptor* MTL::FunctionDescriptor::functionDescriptor() 90 { 91 return Object::sendMessage<MTL::FunctionDescriptor*>(_MTL_PRIVATE_CLS(MTLFunctionDescriptor), _MTL_PRIVATE_SEL(functionDescriptor)); 92 } 93 94 // property: name 95 _MTL_INLINE NS::String* MTL::FunctionDescriptor::name() const 96 { 97 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(name)); 98 } 99 100 _MTL_INLINE void MTL::FunctionDescriptor::setName(const NS::String* name) 101 { 102 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setName_), name); 103 } 104 105 // property: specializedName 106 _MTL_INLINE NS::String* MTL::FunctionDescriptor::specializedName() const 107 { 108 return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(specializedName)); 109 } 110 111 _MTL_INLINE void MTL::FunctionDescriptor::setSpecializedName(const NS::String* specializedName) 112 { 113 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSpecializedName_), specializedName); 114 } 115 116 // property: constantValues 117 _MTL_INLINE MTL::FunctionConstantValues* MTL::FunctionDescriptor::constantValues() const 118 { 119 return Object::sendMessage<MTL::FunctionConstantValues*>(this, _MTL_PRIVATE_SEL(constantValues)); 120 } 121 122 _MTL_INLINE void MTL::FunctionDescriptor::setConstantValues(const MTL::FunctionConstantValues* constantValues) 123 { 124 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setConstantValues_), constantValues); 125 } 126 127 // property: options 128 _MTL_INLINE MTL::FunctionOptions MTL::FunctionDescriptor::options() const 129 { 130 return Object::sendMessage<MTL::FunctionOptions>(this, _MTL_PRIVATE_SEL(options)); 131 } 132 133 _MTL_INLINE void MTL::FunctionDescriptor::setOptions(MTL::FunctionOptions options) 134 { 135 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOptions_), options); 136 } 137 138 // property: binaryArchives 139 _MTL_INLINE NS::Array* MTL::FunctionDescriptor::binaryArchives() const 140 { 141 return Object::sendMessage<NS::Array*>(this, _MTL_PRIVATE_SEL(binaryArchives)); 142 } 143 144 _MTL_INLINE void MTL::FunctionDescriptor::setBinaryArchives(const NS::Array* binaryArchives) 145 { 146 Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setBinaryArchives_), binaryArchives); 147 } 148 149 // static method: alloc 150 _MTL_INLINE MTL::IntersectionFunctionDescriptor* MTL::IntersectionFunctionDescriptor::alloc() 151 { 152 return NS::Object::alloc<MTL::IntersectionFunctionDescriptor>(_MTL_PRIVATE_CLS(MTLIntersectionFunctionDescriptor)); 153 } 154 155 // method: init 156 _MTL_INLINE MTL::IntersectionFunctionDescriptor* MTL::IntersectionFunctionDescriptor::init() 157 { 158 return NS::Object::init<MTL::IntersectionFunctionDescriptor>(); 159 }