0.2.0-dev Download ZIP
96 lines ·3.6 KB Raw
| 1 | //------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 2 | // |
| 3 | // Metal/MTLVisibleFunctionTable.hpp |
| 4 | // |
| 5 | // Copyright 2020-2025 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 "../Foundation/Foundation.hpp" |
| 24 | #include "MTLDefines.hpp" |
| 25 | #include "MTLHeaderBridge.hpp" |
| 26 | #include "MTLPrivate.hpp" |
| 27 | #include "MTLResource.hpp" |
| 28 | #include "MTLTypes.hpp" |
| 29 | |
| 30 | namespace MTL |
| 31 | { |
| 32 | class FunctionHandle; |
| 33 | class VisibleFunctionTableDescriptor; |
| 34 | |
| 35 | class VisibleFunctionTableDescriptor : public NS::Copying<VisibleFunctionTableDescriptor> |
| 36 | { |
| 37 | public: |
| 38 | static VisibleFunctionTableDescriptor* alloc(); |
| 39 | |
| 40 | NS::UInteger functionCount() const; |
| 41 | |
| 42 | VisibleFunctionTableDescriptor* init(); |
| 43 | |
| 44 | void setFunctionCount(NS::UInteger functionCount); |
| 45 | |
| 46 | static VisibleFunctionTableDescriptor* visibleFunctionTableDescriptor(); |
| 47 | }; |
| 48 | class VisibleFunctionTable : public NS::Referencing<VisibleFunctionTable, Resource> |
| 49 | { |
| 50 | public: |
| 51 | ResourceID gpuResourceID() const; |
| 52 | |
| 53 | void setFunction(const MTL::FunctionHandle* function, NS::UInteger index); |
| 54 | void setFunctions(const MTL::FunctionHandle* const functions[], NS::Range range); |
| 55 | }; |
| 56 | |
| 57 | } |
| 58 | _MTL_INLINE MTL::VisibleFunctionTableDescriptor* MTL::VisibleFunctionTableDescriptor::alloc() |
| 59 | { |
| 60 | return NS::Object::alloc<MTL::VisibleFunctionTableDescriptor>(_MTL_PRIVATE_CLS(MTLVisibleFunctionTableDescriptor)); |
| 61 | } |
| 62 | |
| 63 | _MTL_INLINE NS::UInteger MTL::VisibleFunctionTableDescriptor::functionCount() const |
| 64 | { |
| 65 | return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(functionCount)); |
| 66 | } |
| 67 | |
| 68 | _MTL_INLINE MTL::VisibleFunctionTableDescriptor* MTL::VisibleFunctionTableDescriptor::init() |
| 69 | { |
| 70 | return NS::Object::init<MTL::VisibleFunctionTableDescriptor>(); |
| 71 | } |
| 72 | |
| 73 | _MTL_INLINE void MTL::VisibleFunctionTableDescriptor::setFunctionCount(NS::UInteger functionCount) |
| 74 | { |
| 75 | Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctionCount_), functionCount); |
| 76 | } |
| 77 | |
| 78 | _MTL_INLINE MTL::VisibleFunctionTableDescriptor* MTL::VisibleFunctionTableDescriptor::visibleFunctionTableDescriptor() |
| 79 | { |
| 80 | return Object::sendMessage<MTL::VisibleFunctionTableDescriptor*>(_MTL_PRIVATE_CLS(MTLVisibleFunctionTableDescriptor), _MTL_PRIVATE_SEL(visibleFunctionTableDescriptor)); |
| 81 | } |
| 82 | |
| 83 | _MTL_INLINE MTL::ResourceID MTL::VisibleFunctionTable::gpuResourceID() const |
| 84 | { |
| 85 | return Object::sendMessage<MTL::ResourceID>(this, _MTL_PRIVATE_SEL(gpuResourceID)); |
| 86 | } |
| 87 | |
| 88 | _MTL_INLINE void MTL::VisibleFunctionTable::setFunction(const MTL::FunctionHandle* function, NS::UInteger index) |
| 89 | { |
| 90 | Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunction_atIndex_), function, index); |
| 91 | } |
| 92 | |
| 93 | _MTL_INLINE void MTL::VisibleFunctionTable::setFunctions(const MTL::FunctionHandle* const functions[], NS::Range range) |
| 94 | { |
| 95 | Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setFunctions_withRange_), functions, range); |
| 96 | } |