Path: blob/master/thirdparty/metal-cpp/Metal/MTL4CommandEncoder.hpp
21088 views
//-------------------------------------------------------------------------------------------------------------------------------------------------------------1//2// Metal/MTL4CommandEncoder.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 "MTLCommandEncoder.hpp"24#include "MTLDefines.hpp"25#include "MTLHeaderBridge.hpp"26#include "MTLPrivate.hpp"2728namespace MTL429{30class CommandBuffer;31}3233namespace MTL34{35class Fence;36}3738namespace MTL439{40_MTL_OPTIONS(NS::UInteger, VisibilityOptions) {41VisibilityOptionNone = 0,42VisibilityOptionDevice = 1,43VisibilityOptionResourceAlias = 1 << 1,44};4546class CommandEncoder : public NS::Referencing<CommandEncoder>47{48public:49void barrierAfterEncoderStages(MTL::Stages afterEncoderStages, MTL::Stages beforeEncoderStages, MTL4::VisibilityOptions visibilityOptions);5051void barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages, MTL4::VisibilityOptions visibilityOptions);5253void barrierAfterStages(MTL::Stages afterStages, MTL::Stages beforeQueueStages, MTL4::VisibilityOptions visibilityOptions);5455CommandBuffer* commandBuffer() const;5657void endEncoding();5859void insertDebugSignpost(const NS::String* string);6061NS::String* label() const;6263void popDebugGroup();6465void pushDebugGroup(const NS::String* string);6667void setLabel(const NS::String* label);6869void updateFence(const MTL::Fence* fence, MTL::Stages afterEncoderStages);7071void waitForFence(const MTL::Fence* fence, MTL::Stages beforeEncoderStages);72};7374}75_MTL_INLINE void MTL4::CommandEncoder::barrierAfterEncoderStages(MTL::Stages afterEncoderStages, MTL::Stages beforeEncoderStages, MTL4::VisibilityOptions visibilityOptions)76{77Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterEncoderStages_beforeEncoderStages_visibilityOptions_), afterEncoderStages, beforeEncoderStages, visibilityOptions);78}7980_MTL_INLINE void MTL4::CommandEncoder::barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages, MTL4::VisibilityOptions visibilityOptions)81{82Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterQueueStages_beforeStages_visibilityOptions_), afterQueueStages, beforeStages, visibilityOptions);83}8485_MTL_INLINE void MTL4::CommandEncoder::barrierAfterStages(MTL::Stages afterStages, MTL::Stages beforeQueueStages, MTL4::VisibilityOptions visibilityOptions)86{87Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterStages_beforeQueueStages_visibilityOptions_), afterStages, beforeQueueStages, visibilityOptions);88}8990_MTL_INLINE MTL4::CommandBuffer* MTL4::CommandEncoder::commandBuffer() const91{92return Object::sendMessage<MTL4::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));93}9495_MTL_INLINE void MTL4::CommandEncoder::endEncoding()96{97Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));98}99100_MTL_INLINE void MTL4::CommandEncoder::insertDebugSignpost(const NS::String* string)101{102Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);103}104105_MTL_INLINE NS::String* MTL4::CommandEncoder::label() const106{107return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));108}109110_MTL_INLINE void MTL4::CommandEncoder::popDebugGroup()111{112Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));113}114115_MTL_INLINE void MTL4::CommandEncoder::pushDebugGroup(const NS::String* string)116{117Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);118}119120_MTL_INLINE void MTL4::CommandEncoder::setLabel(const NS::String* label)121{122Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);123}124125_MTL_INLINE void MTL4::CommandEncoder::updateFence(const MTL::Fence* fence, MTL::Stages afterEncoderStages)126{127Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_afterEncoderStages_), fence, afterEncoderStages);128}129130_MTL_INLINE void MTL4::CommandEncoder::waitForFence(const MTL::Fence* fence, MTL::Stages beforeEncoderStages)131{132Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_beforeEncoderStages_), fence, beforeEncoderStages);133}134135136