Recent

Author Topic: Convert MTLCaptureDescriptor interface to FPC  (Read 1269 times)

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 370
Convert MTLCaptureDescriptor interface to FPC
« on: July 16, 2020, 04:06:46 pm »
Can you help me convert Cocoa interface MTLCaptureDescriptor to FPC 3.2.0 code?

I use Metal framework from Ryan Joseph. But it doesn't include MTLCaptureDescriptor from macOS Catalina.
I attach 2 files: MTLCaptureDescriptor.inc (from Ryan) and MTLCaptureDescriptor.h from Xcode headers.

This code I need to convert:

Code: Pascal  [Select][+][-]
  1. /// The destination where you want the GPU trace to be captured to.
  2. typedef NS_ENUM(NSInteger, MTLCaptureDestination)
  3. {
  4.     /// Capture to Developer Tools (Xcode) and stop the execution after capturing.
  5.     MTLCaptureDestinationDeveloperTools = 1,
  6.     /// Capture to a GPU Trace document and continue execution after capturing.
  7.     MTLCaptureDestinationGPUTraceDocument,
  8. } API_AVAILABLE(macos(10.15), ios(13.0));
  9.  
  10. MTL_EXTERN API_AVAILABLE(macos(10.15), ios(13.0))
  11. @interface MTLCaptureDescriptor: NSObject <NSCopying>
  12. {
  13. @private
  14.     id _captureObject;
  15.     MTLCaptureDestination _destination;
  16.     NSURL *_outputURL;
  17. }
  18.  
  19. /**
  20.     @brief The object that is captured.
  21.  
  22.     Must be one of the following:
  23.  
  24.     MTLDevice captures all command queues of the device.
  25.  
  26.     MTLCommandQueue captures a single command queue.
  27.  
  28.     MTLCaptureScope captures between the next begin and end of the scope.
  29.  */
  30. @property (nonatomic, strong, nullable) id captureObject;
  31.  
  32. /// The destination you want the GPU trace to be captured to.
  33. @property (nonatomic, assign) MTLCaptureDestination destination;
  34.  
  35. /// URL the GPU Trace document will be captured to.
  36. /// Must be specified when destiation is MTLCaptureDestinationGPUTraceDocument.
  37. @property (nonatomic, copy, nullable) NSURL *outputURL;
  38.  
  39. @end
  40.  

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 370
Re: Convert MTLCaptureDescriptor interface to FPC
« Reply #1 on: July 16, 2020, 10:33:17 pm »
Use of MTLCaptureDescriptor allows to save GPU trace to a file and then check Metal performance in Xcode.

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 370
Re: Convert MTLCaptureDescriptor interface to FPC
« Reply #2 on: July 17, 2020, 09:14:56 am »
Once MTLCaptureDescriptor will be implemented on FPC, I'll publish the instruction how to use Metal debugger with Lazarus projects.

Ryan Joseph

  • Newbie
  • Posts: 4
Re: Convert MTLCaptureDescriptor interface to FPC
« Reply #3 on: July 18, 2020, 04:39:00 am »
I haven't parsed the headers since 10.10 and Objective-C added generics to their syntax so the parser needs some work before doing 10.15. Anyways, here is that one file at least in the meantime. Hopefully you can piece together what you need.

Igor Kokarev

  • Sr. Member
  • ****
  • Posts: 370
Re: Convert MTLCaptureDescriptor interface to FPC
« Reply #4 on: July 18, 2020, 09:17:58 am »
Hi Ryan,

Many thanks! Now I'll try to use MTLCaptureManager and I'll post about results later.

 

TinyPortal © 2005-2018