MTLTextureDescriptor.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using static Veldrid.MetalBindings.ObjectiveCRuntime;
  3. namespace Veldrid.MetalBindings
  4. {
  5. public struct MTLTextureDescriptor
  6. {
  7. private static readonly ObjCClass s_class = new ObjCClass(nameof(MTLTextureDescriptor));
  8. public readonly IntPtr NativePtr;
  9. public static MTLTextureDescriptor New() => s_class.AllocInit<MTLTextureDescriptor>();
  10. public MTLTextureType textureType
  11. {
  12. get => (MTLTextureType)uint_objc_msgSend(NativePtr, sel_textureType);
  13. set => objc_msgSend(NativePtr, sel_setTextureType, (uint)value);
  14. }
  15. public MTLPixelFormat pixelFormat
  16. {
  17. get => (MTLPixelFormat)uint_objc_msgSend(NativePtr, Selectors.pixelFormat);
  18. set => objc_msgSend(NativePtr, Selectors.setPixelFormat, (uint)value);
  19. }
  20. public UIntPtr width
  21. {
  22. get => UIntPtr_objc_msgSend(NativePtr, sel_width);
  23. set => objc_msgSend(NativePtr, sel_setWidth, value);
  24. }
  25. public UIntPtr height
  26. {
  27. get => UIntPtr_objc_msgSend(NativePtr, sel_height);
  28. set => objc_msgSend(NativePtr, sel_setHeight, value);
  29. }
  30. public UIntPtr depth
  31. {
  32. get => UIntPtr_objc_msgSend(NativePtr, sel_depth);
  33. set => objc_msgSend(NativePtr, sel_setDepth, value);
  34. }
  35. public UIntPtr mipmapLevelCount
  36. {
  37. get => UIntPtr_objc_msgSend(NativePtr, sel_mipmapLevelCount);
  38. set => objc_msgSend(NativePtr, sel_setMipmapLevelCount, value);
  39. }
  40. public UIntPtr sampleCount
  41. {
  42. get => UIntPtr_objc_msgSend(NativePtr, sel_sampleCount);
  43. set => objc_msgSend(NativePtr, sel_setSampleCount, value);
  44. }
  45. public UIntPtr arrayLength
  46. {
  47. get => UIntPtr_objc_msgSend(NativePtr, sel_arrayLength);
  48. set => objc_msgSend(NativePtr, sel_setArrayLength, value);
  49. }
  50. public MTLResourceOptions resourceOptions
  51. {
  52. get => (MTLResourceOptions)uint_objc_msgSend(NativePtr, sel_resourceOptions);
  53. set => objc_msgSend(NativePtr, sel_setResourceOptions, (uint)value);
  54. }
  55. public MTLCPUCacheMode cpuCacheMode
  56. {
  57. get => (MTLCPUCacheMode)uint_objc_msgSend(NativePtr, sel_cpuCacheMode);
  58. set => objc_msgSend(NativePtr, sel_setCpuCacheMode, (uint)value);
  59. }
  60. public MTLStorageMode storageMode
  61. {
  62. get => (MTLStorageMode)uint_objc_msgSend(NativePtr, sel_storageMode);
  63. set => objc_msgSend(NativePtr, sel_setStorageMode, (uint)value);
  64. }
  65. public MTLTextureUsage textureUsage
  66. {
  67. get => (MTLTextureUsage)uint_objc_msgSend(NativePtr, sel_textureUsage);
  68. set => objc_msgSend(NativePtr, sel_setTextureUsage, (uint)value);
  69. }
  70. private static readonly Selector sel_textureType = "textureType";
  71. private static readonly Selector sel_setTextureType = "setTextureType:";
  72. private static readonly Selector sel_width = "width";
  73. private static readonly Selector sel_setWidth = "setWidth:";
  74. private static readonly Selector sel_height = "height";
  75. private static readonly Selector sel_setHeight = "setHeight:";
  76. private static readonly Selector sel_depth = "depth";
  77. private static readonly Selector sel_setDepth = "setDepth:";
  78. private static readonly Selector sel_mipmapLevelCount = "mipmapLevelCount";
  79. private static readonly Selector sel_setMipmapLevelCount = "setMipmapLevelCount:";
  80. private static readonly Selector sel_sampleCount = "sampleCount";
  81. private static readonly Selector sel_setSampleCount = "setSampleCount:";
  82. private static readonly Selector sel_arrayLength = "arrayLength";
  83. private static readonly Selector sel_setArrayLength = "setArrayLength:";
  84. private static readonly Selector sel_resourceOptions = "resourceOptions";
  85. private static readonly Selector sel_setResourceOptions = "setResourceOptions:";
  86. private static readonly Selector sel_cpuCacheMode = "cpuCacheMode";
  87. private static readonly Selector sel_setCpuCacheMode = "setCpuCacheMode:";
  88. private static readonly Selector sel_storageMode = "storageMode";
  89. private static readonly Selector sel_setStorageMode = "setStorageMode:";
  90. private static readonly Selector sel_textureUsage = "textureUsage";
  91. private static readonly Selector sel_setTextureUsage = "setTextureUsage:";
  92. }
  93. }