Path: blob/master/thirdparty/metal-cpp/Metal/MTL4CommandAllocator.hpp
21082 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTL4CommandAllocator.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 "MTLHeaderBridge.hpp"25#include "MTLPrivate.hpp"26#include <cstdint>2728namespace MTL29{30class Device;31}3233namespace MTL434{3536class CommandAllocatorDescriptor : public NS::Copying<CommandAllocatorDescriptor>37{38public:39static CommandAllocatorDescriptor* alloc();4041CommandAllocatorDescriptor* init();4243NS::String* label() const;44void setLabel(const NS::String* label);45};4647class CommandAllocator : public NS::Referencing<CommandAllocator>48{49public:50uint64_t allocatedSize();5152MTL::Device* device() const;5354NS::String* label() const;5556void reset();57};5859}6061_MTL_INLINE MTL4::CommandAllocatorDescriptor* MTL4::CommandAllocatorDescriptor::alloc()62{63return NS::Object::alloc<MTL4::CommandAllocatorDescriptor>(_MTL_PRIVATE_CLS(MTL4CommandAllocatorDescriptor));64}6566_MTL_INLINE MTL4::CommandAllocatorDescriptor* MTL4::CommandAllocatorDescriptor::init()67{68return NS::Object::init<MTL4::CommandAllocatorDescriptor>();69}7071_MTL_INLINE NS::String* MTL4::CommandAllocatorDescriptor::label() const72{73return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));74}7576_MTL_INLINE void MTL4::CommandAllocatorDescriptor::setLabel(const NS::String* label)77{78Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);79}8081_MTL_INLINE uint64_t MTL4::CommandAllocator::allocatedSize()82{83return Object::sendMessage<uint64_t>(this, _MTL_PRIVATE_SEL(allocatedSize));84}8586_MTL_INLINE MTL::Device* MTL4::CommandAllocator::device() const87{88return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));89}9091_MTL_INLINE NS::String* MTL4::CommandAllocator::label() const92{93return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));94}9596_MTL_INLINE void MTL4::CommandAllocator::reset()97{98Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(reset));99}100101102