/ include / Metal / MTLCommandEncoder.hpp
MTLCommandEncoder.hpp
  1  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
  2  //
  3  // Metal/MTLCommandEncoder.hpp
  4  //
  5  // Copyright 2020-2024 Apple Inc.
  6  //
  7  // Licensed under the Apache License, Version 2.0 (the "License");
  8  // you may not use this file except in compliance with the License.
  9  // You may obtain a copy of the License at
 10  //
 11  //     http://www.apache.org/licenses/LICENSE-2.0
 12  //
 13  // Unless required by applicable law or agreed to in writing, software
 14  // distributed under the License is distributed on an "AS IS" BASIS,
 15  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 16  // See the License for the specific language governing permissions and
 17  // limitations under the License.
 18  //
 19  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
 20  
 21  #pragma once
 22  
 23  #include "MTLDefines.hpp"
 24  #include "MTLHeaderBridge.hpp"
 25  #include "MTLPrivate.hpp"
 26  
 27  #include <Foundation/Foundation.hpp>
 28  
 29  namespace MTL
 30  {
 31  _MTL_OPTIONS(NS::UInteger, ResourceUsage) {
 32      ResourceUsageRead = 1,
 33      ResourceUsageWrite = 2,
 34      ResourceUsageSample = 4,
 35  };
 36  
 37  _MTL_OPTIONS(NS::UInteger, BarrierScope) {
 38      BarrierScopeBuffers = 1,
 39      BarrierScopeTextures = 2,
 40      BarrierScopeRenderTargets = 4,
 41  };
 42  
 43  class CommandEncoder : public NS::Referencing<CommandEncoder>
 44  {
 45  public:
 46      class Device* device() const;
 47  
 48      NS::String*   label() const;
 49      void          setLabel(const NS::String* label);
 50  
 51      void          endEncoding();
 52  
 53      void          insertDebugSignpost(const NS::String* string);
 54  
 55      void          pushDebugGroup(const NS::String* string);
 56  
 57      void          popDebugGroup();
 58  };
 59  
 60  }
 61  
 62  // property: device
 63  _MTL_INLINE MTL::Device* MTL::CommandEncoder::device() const
 64  {
 65      return Object::sendMessage<MTL::Device*>(this, _MTL_PRIVATE_SEL(device));
 66  }
 67  
 68  // property: label
 69  _MTL_INLINE NS::String* MTL::CommandEncoder::label() const
 70  {
 71      return Object::sendMessage<NS::String*>(this, _MTL_PRIVATE_SEL(label));
 72  }
 73  
 74  _MTL_INLINE void MTL::CommandEncoder::setLabel(const NS::String* label)
 75  {
 76      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setLabel_), label);
 77  }
 78  
 79  // method: endEncoding
 80  _MTL_INLINE void MTL::CommandEncoder::endEncoding()
 81  {
 82      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(endEncoding));
 83  }
 84  
 85  // method: insertDebugSignpost:
 86  _MTL_INLINE void MTL::CommandEncoder::insertDebugSignpost(const NS::String* string)
 87  {
 88      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(insertDebugSignpost_), string);
 89  }
 90  
 91  // method: pushDebugGroup:
 92  _MTL_INLINE void MTL::CommandEncoder::pushDebugGroup(const NS::String* string)
 93  {
 94      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(pushDebugGroup_), string);
 95  }
 96  
 97  // method: popDebugGroup
 98  _MTL_INLINE void MTL::CommandEncoder::popDebugGroup()
 99  {
100      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(popDebugGroup));
101  }