/ include / Metal / MTLCaptureManager.hpp
MTLCaptureManager.hpp
  1  //-------------------------------------------------------------------------------------------------------------------------------------------------------------
  2  //
  3  // Metal/MTLCaptureManager.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  #include "MTLCaptureManager.hpp"
 30  
 31  namespace MTL
 32  {
 33  _MTL_ENUM(NS::Integer, CaptureError) {
 34      CaptureErrorNotSupported = 1,
 35      CaptureErrorAlreadyCapturing = 2,
 36      CaptureErrorInvalidDescriptor = 3,
 37  };
 38  
 39  _MTL_ENUM(NS::Integer, CaptureDestination) {
 40      CaptureDestinationDeveloperTools = 1,
 41      CaptureDestinationGPUTraceDocument = 2,
 42  };
 43  
 44  class CaptureDescriptor : public NS::Copying<CaptureDescriptor>
 45  {
 46  public:
 47      static class CaptureDescriptor* alloc();
 48  
 49      class CaptureDescriptor*        init();
 50  
 51      id                              captureObject() const;
 52      void                            setCaptureObject(id captureObject);
 53  
 54      MTL::CaptureDestination         destination() const;
 55      void                            setDestination(MTL::CaptureDestination destination);
 56  
 57      NS::URL*                        outputURL() const;
 58      void                            setOutputURL(const NS::URL* outputURL);
 59  };
 60  
 61  class CaptureManager : public NS::Referencing<CaptureManager>
 62  {
 63  public:
 64      static class CaptureManager* alloc();
 65  
 66      static class CaptureManager* sharedCaptureManager();
 67  
 68      MTL::CaptureManager*         init();
 69  
 70      class CaptureScope*          newCaptureScope(const class Device* device);
 71  
 72      class CaptureScope*          newCaptureScope(const class CommandQueue* commandQueue);
 73  
 74      bool                         supportsDestination(MTL::CaptureDestination destination);
 75  
 76      bool                         startCapture(const class CaptureDescriptor* descriptor, NS::Error** error);
 77  
 78      void                         startCapture(const class Device* device);
 79  
 80      void                         startCapture(const class CommandQueue* commandQueue);
 81  
 82      void                         startCapture(const class CaptureScope* captureScope);
 83  
 84      void                         stopCapture();
 85  
 86      class CaptureScope*          defaultCaptureScope() const;
 87      void                         setDefaultCaptureScope(const class CaptureScope* defaultCaptureScope);
 88  
 89      bool                         isCapturing() const;
 90  };
 91  
 92  }
 93  
 94  // static method: alloc
 95  _MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::alloc()
 96  {
 97      return NS::Object::alloc<MTL::CaptureDescriptor>(_MTL_PRIVATE_CLS(MTLCaptureDescriptor));
 98  }
 99  
100  // method: init
101  _MTL_INLINE MTL::CaptureDescriptor* MTL::CaptureDescriptor::init()
102  {
103      return NS::Object::init<MTL::CaptureDescriptor>();
104  }
105  
106  // property: captureObject
107  _MTL_INLINE id MTL::CaptureDescriptor::captureObject() const
108  {
109      return Object::sendMessage<id>(this, _MTL_PRIVATE_SEL(captureObject));
110  }
111  
112  _MTL_INLINE void MTL::CaptureDescriptor::setCaptureObject(id captureObject)
113  {
114      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setCaptureObject_), captureObject);
115  }
116  
117  // property: destination
118  _MTL_INLINE MTL::CaptureDestination MTL::CaptureDescriptor::destination() const
119  {
120      return Object::sendMessage<MTL::CaptureDestination>(this, _MTL_PRIVATE_SEL(destination));
121  }
122  
123  _MTL_INLINE void MTL::CaptureDescriptor::setDestination(MTL::CaptureDestination destination)
124  {
125      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDestination_), destination);
126  }
127  
128  // property: outputURL
129  _MTL_INLINE NS::URL* MTL::CaptureDescriptor::outputURL() const
130  {
131      return Object::sendMessage<NS::URL*>(this, _MTL_PRIVATE_SEL(outputURL));
132  }
133  
134  _MTL_INLINE void MTL::CaptureDescriptor::setOutputURL(const NS::URL* outputURL)
135  {
136      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setOutputURL_), outputURL);
137  }
138  
139  // static method: alloc
140  _MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::alloc()
141  {
142      return NS::Object::alloc<MTL::CaptureManager>(_MTL_PRIVATE_CLS(MTLCaptureManager));
143  }
144  
145  // static method: sharedCaptureManager
146  _MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::sharedCaptureManager()
147  {
148      return Object::sendMessage<MTL::CaptureManager*>(_MTL_PRIVATE_CLS(MTLCaptureManager), _MTL_PRIVATE_SEL(sharedCaptureManager));
149  }
150  
151  // method: init
152  _MTL_INLINE MTL::CaptureManager* MTL::CaptureManager::init()
153  {
154      return NS::Object::init<MTL::CaptureManager>();
155  }
156  
157  // method: newCaptureScopeWithDevice:
158  _MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::Device* device)
159  {
160      return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithDevice_), device);
161  }
162  
163  // method: newCaptureScopeWithCommandQueue:
164  _MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::newCaptureScope(const MTL::CommandQueue* commandQueue)
165  {
166      return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(newCaptureScopeWithCommandQueue_), commandQueue);
167  }
168  
169  // method: supportsDestination:
170  _MTL_INLINE bool MTL::CaptureManager::supportsDestination(MTL::CaptureDestination destination)
171  {
172      return Object::sendMessageSafe<bool>(this, _MTL_PRIVATE_SEL(supportsDestination_), destination);
173  }
174  
175  // method: startCaptureWithDescriptor:error:
176  _MTL_INLINE bool MTL::CaptureManager::startCapture(const MTL::CaptureDescriptor* descriptor, NS::Error** error)
177  {
178      return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(startCaptureWithDescriptor_error_), descriptor, error);
179  }
180  
181  // method: startCaptureWithDevice:
182  _MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::Device* device)
183  {
184      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithDevice_), device);
185  }
186  
187  // method: startCaptureWithCommandQueue:
188  _MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CommandQueue* commandQueue)
189  {
190      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithCommandQueue_), commandQueue);
191  }
192  
193  // method: startCaptureWithScope:
194  _MTL_INLINE void MTL::CaptureManager::startCapture(const MTL::CaptureScope* captureScope)
195  {
196      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(startCaptureWithScope_), captureScope);
197  }
198  
199  // method: stopCapture
200  _MTL_INLINE void MTL::CaptureManager::stopCapture()
201  {
202      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(stopCapture));
203  }
204  
205  // property: defaultCaptureScope
206  _MTL_INLINE MTL::CaptureScope* MTL::CaptureManager::defaultCaptureScope() const
207  {
208      return Object::sendMessage<MTL::CaptureScope*>(this, _MTL_PRIVATE_SEL(defaultCaptureScope));
209  }
210  
211  _MTL_INLINE void MTL::CaptureManager::setDefaultCaptureScope(const MTL::CaptureScope* defaultCaptureScope)
212  {
213      Object::sendMessage<void>(this, _MTL_PRIVATE_SEL(setDefaultCaptureScope_), defaultCaptureScope);
214  }
215  
216  // property: isCapturing
217  _MTL_INLINE bool MTL::CaptureManager::isCapturing() const
218  {
219      return Object::sendMessage<bool>(this, _MTL_PRIVATE_SEL(isCapturing));
220  }