MTLRenderPipelineColorAttachmentDescriptor.cs 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using static Veldrid.MetalBindings.ObjectiveCRuntime;
  4. namespace Veldrid.MetalBindings
  5. {
  6. [StructLayout(LayoutKind.Sequential)]
  7. public struct MTLRenderPipelineColorAttachmentDescriptor
  8. {
  9. public readonly IntPtr NativePtr;
  10. public MTLRenderPipelineColorAttachmentDescriptor(IntPtr ptr) => NativePtr = ptr;
  11. public MTLPixelFormat pixelFormat
  12. {
  13. get => (MTLPixelFormat)uint_objc_msgSend(NativePtr, Selectors.pixelFormat);
  14. set => objc_msgSend(NativePtr, Selectors.setPixelFormat, (uint)value);
  15. }
  16. public MTLColorWriteMask writeMask
  17. {
  18. get => (MTLColorWriteMask)uint_objc_msgSend(NativePtr, sel_writeMask);
  19. set => objc_msgSend(NativePtr, sel_setWriteMask, (uint)value);
  20. }
  21. public Bool8 blendingEnabled
  22. {
  23. get => bool8_objc_msgSend(NativePtr, sel_isBlendingEnabled);
  24. set => objc_msgSend(NativePtr, sel_setBlendingEnabled, value);
  25. }
  26. public MTLBlendOperation alphaBlendOperation
  27. {
  28. get => (MTLBlendOperation)uint_objc_msgSend(NativePtr, sel_alphaBlendOperation);
  29. set => objc_msgSend(NativePtr, sel_setAlphaBlendOperation, (uint)value);
  30. }
  31. public MTLBlendOperation rgbBlendOperation
  32. {
  33. get => (MTLBlendOperation)uint_objc_msgSend(NativePtr, sel_rgbBlendOperation);
  34. set => objc_msgSend(NativePtr, sel_setRGBBlendOperation, (uint)value);
  35. }
  36. public MTLBlendFactor destinationAlphaBlendFactor
  37. {
  38. get => (MTLBlendFactor)uint_objc_msgSend(NativePtr, sel_destinationAlphaBlendFactor);
  39. set => objc_msgSend(NativePtr, sel_setDestinationAlphaBlendFactor, (uint)value);
  40. }
  41. public MTLBlendFactor destinationRGBBlendFactor
  42. {
  43. get => (MTLBlendFactor)uint_objc_msgSend(NativePtr, sel_destinationRGBBlendFactor);
  44. set => objc_msgSend(NativePtr, sel_setDestinationRGBBlendFactor, (uint)value);
  45. }
  46. public MTLBlendFactor sourceAlphaBlendFactor
  47. {
  48. get => (MTLBlendFactor)uint_objc_msgSend(NativePtr, sel_sourceAlphaBlendFactor);
  49. set => objc_msgSend(NativePtr, sel_setSourceAlphaBlendFactor, (uint)value);
  50. }
  51. public MTLBlendFactor sourceRGBBlendFactor
  52. {
  53. get => (MTLBlendFactor)uint_objc_msgSend(NativePtr, sel_sourceRGBBlendFactor);
  54. set => objc_msgSend(NativePtr, sel_setSourceRGBBlendFactor, (uint)value);
  55. }
  56. private static readonly Selector sel_isBlendingEnabled = "isBlendingEnabled";
  57. private static readonly Selector sel_setBlendingEnabled = "setBlendingEnabled:";
  58. private static readonly Selector sel_writeMask = "writeMask";
  59. private static readonly Selector sel_setWriteMask = "setWriteMask:";
  60. private static readonly Selector sel_alphaBlendOperation = "alphaBlendOperation";
  61. private static readonly Selector sel_setAlphaBlendOperation = "setAlphaBlendOperation:";
  62. private static readonly Selector sel_rgbBlendOperation = "rgbBlendOperation";
  63. private static readonly Selector sel_setRGBBlendOperation = "setRgbBlendOperation:";
  64. private static readonly Selector sel_destinationAlphaBlendFactor = "destinationAlphaBlendFactor";
  65. private static readonly Selector sel_setDestinationAlphaBlendFactor = "setDestinationAlphaBlendFactor:";
  66. private static readonly Selector sel_destinationRGBBlendFactor = "destinationRGBBlendFactor";
  67. private static readonly Selector sel_setDestinationRGBBlendFactor = "setDestinationRGBBlendFactor:";
  68. private static readonly Selector sel_sourceAlphaBlendFactor = "sourceAlphaBlendFactor";
  69. private static readonly Selector sel_setSourceAlphaBlendFactor = "setSourceAlphaBlendFactor:";
  70. private static readonly Selector sel_sourceRGBBlendFactor = "sourceRGBBlendFactor";
  71. private static readonly Selector sel_setSourceRGBBlendFactor = "setSourceRGBBlendFactor:";
  72. }
  73. }