Path: blob/master/thirdparty/metal-cpp/Metal/MTLCommandQueue.hpp
21082 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTLCommandQueue.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"2627namespace MTL28{29class CommandBuffer;30class CommandBufferDescriptor;31class CommandQueueDescriptor;32class Device;33class LogState;34class ResidencySet;3536class CommandQueue : public NS::Referencing<CommandQueue>37{38public:39void addResidencySet(const MTL::ResidencySet* residencySet);40void addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);4142CommandBuffer* commandBuffer();43CommandBuffer* commandBuffer(const MTL::CommandBufferDescriptor* descriptor);44CommandBuffer* commandBufferWithUnretainedReferences();4546Device* device() const;4748void insertDebugCaptureBoundary();4950NS::String* label() const;5152void removeResidencySet(const MTL::ResidencySet* residencySet);53void removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count);5455void setLabel(const NS::String* label);56};57class CommandQueueDescriptor : public NS::Copying<CommandQueueDescriptor>58{59public:60static CommandQueueDescriptor* alloc();6162CommandQueueDescriptor* init();6364LogState* logState() const;6566NS::UInteger maxCommandBufferCount() const;6768void setLogState(const MTL::LogState* logState);6970void setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount);71};7273}74_MTL_INLINE void MTL::CommandQueue::addResidencySet(const MTL::ResidencySet* residencySet)75{76Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySet_), residencySet);77}7879_MTL_INLINE void MTL::CommandQueue::addResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)80{81Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(addResidencySets_count_), residencySets, count);82}8384_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer()85{86return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));87}8889_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBuffer(const MTL::CommandBufferDescriptor* descriptor)90{91return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithDescriptor_), descriptor);92}9394_MTL_INLINE MTL::CommandBuffer* MTL::CommandQueue::commandBufferWithUnretainedReferences()95{96return Object::sendMessage<MTL::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBufferWithUnretainedReferences));97}9899_MTL_INLINE MTL::Device* MTL::CommandQueue::device() const100{101return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));102}103104_MTL_INLINE void MTL::CommandQueue::insertDebugCaptureBoundary()105{106Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugCaptureBoundary));107}108109_MTL_INLINE NS::String* MTL::CommandQueue::label() const110{111return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));112}113114_MTL_INLINE void MTL::CommandQueue::removeResidencySet(const MTL::ResidencySet* residencySet)115{116Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySet_), residencySet);117}118119_MTL_INLINE void MTL::CommandQueue::removeResidencySets(const MTL::ResidencySet* const residencySets[], NS::UInteger count)120{121Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(removeResidencySets_count_), residencySets, count);122}123124_MTL_INLINE void MTL::CommandQueue::setLabel(const NS::String* label)125{126Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);127}128129_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::alloc()130{131return NS::Object::alloc<MTL::CommandQueueDescriptor>(_MTL_PRIVATE_CLS(MTLCommandQueueDescriptor));132}133134_MTL_INLINE MTL::CommandQueueDescriptor* MTL::CommandQueueDescriptor::init()135{136return NS::Object::init<MTL::CommandQueueDescriptor>();137}138139_MTL_INLINE MTL::LogState* MTL::CommandQueueDescriptor::logState() const140{141return Object::sendMessage<MTL::LogState*>(this, _MTL_PRIVATE_SEL(logState));142}143144_MTL_INLINE NS::UInteger MTL::CommandQueueDescriptor::maxCommandBufferCount() const145{146return Object::sendMessage<NS::UInteger>(this, _MTL_PRIVATE_SEL(maxCommandBufferCount));147}148149_MTL_INLINE void MTL::CommandQueueDescriptor::setLogState(const MTL::LogState* logState)150{151Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLogState_), logState);152}153154_MTL_INLINE void MTL::CommandQueueDescriptor::setMaxCommandBufferCount(NS::UInteger maxCommandBufferCount)155{156Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setMaxCommandBufferCount_), maxCommandBufferCount);157}158159160