File size: 4,941 Bytes
283ba4a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | //-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// Metal/MTL4CommandEncoder.hpp
//
// Copyright 2020-2025 Apple Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "../Foundation/Foundation.hpp"
#include "MTLCommandEncoder.hpp"
#include "MTLDefines.hpp"
#include "MTLHeaderBridge.hpp"
#include "MTLPrivate.hpp"
namespace MTL4
{
class CommandBuffer;
}
namespace MTL
{
class Fence;
}
namespace MTL4
{
_MTL_OPTIONS(NS::UInteger, VisibilityOptions) {
VisibilityOptionNone = 0,
VisibilityOptionDevice = 1,
VisibilityOptionResourceAlias = 1 << 1,
};
class CommandEncoder : public NS::Referencing<CommandEncoder>
{
public:
void barrierAfterEncoderStages(MTL::Stages afterEncoderStages, MTL::Stages beforeEncoderStages, MTL4::VisibilityOptions visibilityOptions);
void barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages, MTL4::VisibilityOptions visibilityOptions);
void barrierAfterStages(MTL::Stages afterStages, MTL::Stages beforeQueueStages, MTL4::VisibilityOptions visibilityOptions);
CommandBuffer* commandBuffer() const;
void endEncoding();
void insertDebugSignpost(const NS::String* string);
NS::String* label() const;
void popDebugGroup();
void pushDebugGroup(const NS::String* string);
void setLabel(const NS::String* label);
void updateFence(const MTL::Fence* fence, MTL::Stages afterEncoderStages);
void waitForFence(const MTL::Fence* fence, MTL::Stages beforeEncoderStages);
};
}
_MTL_INLINE void MTL4::CommandEncoder::barrierAfterEncoderStages(MTL::Stages afterEncoderStages, MTL::Stages beforeEncoderStages, MTL4::VisibilityOptions visibilityOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterEncoderStages_beforeEncoderStages_visibilityOptions_), afterEncoderStages, beforeEncoderStages, visibilityOptions);
}
_MTL_INLINE void MTL4::CommandEncoder::barrierAfterQueueStages(MTL::Stages afterQueueStages, MTL::Stages beforeStages, MTL4::VisibilityOptions visibilityOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterQueueStages_beforeStages_visibilityOptions_), afterQueueStages, beforeStages, visibilityOptions);
}
_MTL_INLINE void MTL4::CommandEncoder::barrierAfterStages(MTL::Stages afterStages, MTL::Stages beforeQueueStages, MTL4::VisibilityOptions visibilityOptions)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(barrierAfterStages_beforeQueueStages_visibilityOptions_), afterStages, beforeQueueStages, visibilityOptions);
}
_MTL_INLINE MTL4::CommandBuffer* MTL4::CommandEncoder::commandBuffer() const
{
return Object::sendMessage<MTL4::CommandBuffer*>(this, _MTL_PRIVATE_SEL(commandBuffer));
}
_MTL_INLINE void MTL4::CommandEncoder::endEncoding()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));
}
_MTL_INLINE void MTL4::CommandEncoder::insertDebugSignpost(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);
}
_MTL_INLINE NS::String* MTL4::CommandEncoder::label() const
{
return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
}
_MTL_INLINE void MTL4::CommandEncoder::popDebugGroup()
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
}
_MTL_INLINE void MTL4::CommandEncoder::pushDebugGroup(const NS::String* string)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
}
_MTL_INLINE void MTL4::CommandEncoder::setLabel(const NS::String* label)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
}
_MTL_INLINE void MTL4::CommandEncoder::updateFence(const MTL::Fence* fence, MTL::Stages afterEncoderStages)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(updateFence_afterEncoderStages_), fence, afterEncoderStages);
}
_MTL_INLINE void MTL4::CommandEncoder::waitForFence(const MTL::Fence* fence, MTL::Stages beforeEncoderStages)
{
Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(waitForFence_beforeEncoderStages_), fence, beforeEncoderStages);
}
|