Dispatch.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace Veldrid.MetalBindings
  4. {
  5. public static unsafe class Dispatch
  6. {
  7. private const string LibdispatchLocation = @"/usr/lib/system/libdispatch.dylib";
  8. [DllImport(LibdispatchLocation)]
  9. public static extern DispatchQueue dispatch_get_global_queue(QualityOfServiceLevel identifier, ulong flags);
  10. [DllImport(LibdispatchLocation)]
  11. public static extern DispatchData dispatch_data_create(
  12. void* buffer,
  13. UIntPtr size,
  14. DispatchQueue queue,
  15. IntPtr destructorBlock);
  16. [DllImport(LibdispatchLocation)]
  17. public static extern void dispatch_release(IntPtr nativePtr);
  18. }
  19. public enum QualityOfServiceLevel : long
  20. {
  21. QOS_CLASS_USER_INTERACTIVE = 0x21,
  22. QOS_CLASS_USER_INITIATED = 0x19,
  23. QOS_CLASS_DEFAULT = 0x15,
  24. QOS_CLASS_UTILITY = 0x11,
  25. QOS_CLASS_BACKGROUND = 0x9,
  26. QOS_CLASS_UNSPECIFIED = 0,
  27. }
  28. public struct DispatchQueue
  29. {
  30. public readonly IntPtr NativePtr;
  31. }
  32. public struct DispatchData
  33. {
  34. public readonly IntPtr NativePtr;
  35. }
  36. }