Path: blob/master/thirdparty/metal-cpp/Metal/MTL4ArgumentTable.hpp
21117 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTL4ArgumentTable.hpp3//4// Copyright 2020-2025 Apple Inc.5//6// Licensed under the Apache License, Version 2.0 (the "License");7// you may not use this file except in compliance with the License.8// You may obtain a copy of the License at9//10// http://www.apache.org/licenses/LICENSE-2.011//12// Unless required by applicable law or agreed to in writing, software13// distributed under the License is distributed on an "AS IS" BASIS,14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15// See the License for the specific language governing permissions and16// limitations under the License.17//18//-------------------------------------------------------------------------------------------------------------------------------------------------------------1920#pragma once2122#include "../Foundation/Foundation.hpp"23#include "MTLDefines.hpp"24#include "MTLGPUAddress.hpp"25#include "MTLHeaderBridge.hpp"26#include "MTLPrivate.hpp"27#include "MTLTypes.hpp"2829namespace MTL30{31class Device;32}3334namespace MTL435{36class ArgumentTableDescriptor : public NS::Copying<ArgumentTableDescriptor>37{38public:39static ArgumentTableDescriptor* alloc();4041ArgumentTableDescriptor* init();42bool initializeBindings() const;4344NS::String* label() const;4546NS::UInteger maxBufferBindCount() const;4748NS::UInteger maxSamplerStateBindCount() const;4950NS::UInteger maxTextureBindCount() const;5152void setInitializeBindings(bool initializeBindings);5354void setLabel(const NS::String* label);5556void setMaxBufferBindCount(NS::UInteger maxBufferBindCount);5758void setMaxSamplerStateBindCount(NS::UInteger maxSamplerStateBindCount);5960void setMaxTextureBindCount(NS::UInteger maxTextureBindCount);6162void setSupportAttributeStrides(bool supportAttributeStrides);63bool supportAttributeStrides() const;64};65class ArgumentTable : public NS::Referencing<ArgumentTable>66{67public:68MTL::Device* device() const;6970NS::String* label() const;7172void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex);73void setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex);7475void setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex);7677void setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex);7879void setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex);80};8182}83_MTL_INLINE MTL4::ArgumentTableDescriptor* MTL4::ArgumentTableDescriptor::alloc()84{85return NS::Object::alloc<MTL4::ArgumentTableDescriptor>(_MTL_PRIVATE_CLS(MTL4ArgumentTableDescriptor));86}8788_MTL_INLINE MTL4::ArgumentTableDescriptor* MTL4::ArgumentTableDescriptor::init()89{90return NS::Object::init<MTL4::ArgumentTableDescriptor>();91}9293_MTL_INLINE bool MTL4::ArgumentTableDescriptor::initializeBindings() const94{95return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(initializeBindings));96}9798_MTL_INLINE NS::String* MTL4::ArgumentTableDescriptor::label() const99{100return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));101}102103_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxBufferBindCount() const104{105return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxBufferBindCount));106}107108_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxSamplerStateBindCount() const109{110return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxSamplerStateBindCount));111}112113_MTL_INLINE NS::UInteger MTL4::ArgumentTableDescriptor::maxTextureBindCount() const114{115return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxTextureBindCount));116}117118_MTL_INLINE void MTL4::ArgumentTableDescriptor::setInitializeBindings(bool initializeBindings)119{120Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setInitializeBindings_), initializeBindings);121}122123_MTL_INLINE void MTL4::ArgumentTableDescriptor::setLabel(const NS::String* label)124{125Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);126}127128_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxBufferBindCount(NS::UInteger maxBufferBindCount)129{130Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxBufferBindCount_), maxBufferBindCount);131}132133_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxSamplerStateBindCount(NS::UInteger maxSamplerStateBindCount)134{135Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxSamplerStateBindCount_), maxSamplerStateBindCount);136}137138_MTL_INLINE void MTL4::ArgumentTableDescriptor::setMaxTextureBindCount(NS::UInteger maxTextureBindCount)139{140Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxTextureBindCount_), maxTextureBindCount);141}142143_MTL_INLINE void MTL4::ArgumentTableDescriptor::setSupportAttributeStrides(bool supportAttributeStrides)144{145Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSupportAttributeStrides_), supportAttributeStrides);146}147148_MTL_INLINE bool MTL4::ArgumentTableDescriptor::supportAttributeStrides() const149{150return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportAttributeStrides));151}152153_MTL_INLINE MTL::Device* MTL4::ArgumentTable::device() const154{155return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));156}157158_MTL_INLINE NS::String* MTL4::ArgumentTable::label() const159{160return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));161}162163_MTL_INLINE void MTL4::ArgumentTable::setAddress(MTL::GPUAddress gpuAddress, NS::UInteger bindingIndex)164{165Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAddress_atIndex_), gpuAddress, bindingIndex);166}167168_MTL_INLINE void MTL4::ArgumentTable::setAddress(MTL::GPUAddress gpuAddress, NS::UInteger stride, NS::UInteger bindingIndex)169{170Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setAddress_attributeStride_atIndex_), gpuAddress, stride, bindingIndex);171}172173_MTL_INLINE void MTL4::ArgumentTable::setResource(MTL::ResourceID resourceID, NS::UInteger bindingIndex)174{175Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setResource_atBufferIndex_), resourceID, bindingIndex);176}177178_MTL_INLINE void MTL4::ArgumentTable::setSamplerState(MTL::ResourceID resourceID, NS::UInteger bindingIndex)179{180Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setSamplerState_atIndex_), resourceID, bindingIndex);181}182183_MTL_INLINE void MTL4::ArgumentTable::setTexture(MTL::ResourceID resourceID, NS::UInteger bindingIndex)184{185Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setTexture_atIndex_), resourceID, bindingIndex);186}187188189