Path: blob/master/thirdparty/metal-cpp/Metal/MTLCommandEncoder.hpp
21066 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTLCommandEncoder.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 Device;3031_MTL_OPTIONS(NS::UInteger, ResourceUsage) {32ResourceUsageRead = 1,33ResourceUsageWrite = 1 << 1,34ResourceUsageSample = 1 << 2,35};3637_MTL_OPTIONS(NS::UInteger, BarrierScope) {38BarrierScopeBuffers = 1,39BarrierScopeTextures = 1 << 1,40BarrierScopeRenderTargets = 1 << 2,41};4243_MTL_OPTIONS(NS::UInteger, Stages) {44StageVertex = 1,45StageFragment = 1 << 1,46StageTile = 1 << 2,47StageObject = 1 << 3,48StageMesh = 1 << 4,49StageResourceState = 1 << 26,50StageDispatch = 1 << 27,51StageBlit = 1 << 28,52StageAccelerationStructure = 1 << 29,53StageMachineLearning = 1 << 30,54StageAll = 9223372036854775807,55};5657class CommandEncoder : public NS::Referencing<CommandEncoder>58{59public:60void barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages);6162Device* device() const;6364void endEncoding();6566void insertDebugSignpost(const NS::String* string);6768NS::String* label() const;6970void popDebugGroup();7172void pushDebugGroup(const NS::String* string);7374void setLabel(const NS::String* label);75};7677}78_MTL_INLINE void MTL::CommandEncoder::barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages)79{80Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterQueueStages_beforeStages_), afterQueueStages, beforeStages);81}8283_MTL_INLINE MTL::Device* MTL::CommandEncoder::device() const84{85return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));86}8788_MTL_INLINE void MTL::CommandEncoder::endEncoding()89{90Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));91}9293_MTL_INLINE void MTL::CommandEncoder::insertDebugSignpost(const NS::String* string)94{95Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);96}9798_MTL_INLINE NS::String* MTL::CommandEncoder::label() const99{100return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));101}102103_MTL_INLINE void MTL::CommandEncoder::popDebugGroup()104{105Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));106}107108_MTL_INLINE void MTL::CommandEncoder::pushDebugGroup(const NS::String* string)109{110Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);111}112113_MTL_INLINE void MTL::CommandEncoder::setLabel(const NS::String* label)114{115Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);116}117118119