GPUObject.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // GPUObject.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// Base class for GPU resources.
  21. /// </summary>
  22. public unsafe partial class GPUObject
  23. {
  24. unsafe partial void OnGPUObjectCreated ();
  25. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  26. internal static extern IntPtr GPUObject_GPUObject (IntPtr graphics);
  27. [Preserve]
  28. public GPUObject (Graphics graphics)
  29. {
  30. Runtime.Validate (typeof(GPUObject));
  31. handle = GPUObject_GPUObject ((object)graphics == null ? IntPtr.Zero : graphics.Handle);
  32. OnGPUObjectCreated ();
  33. }
  34. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  35. internal static extern void GPUObject_OnDeviceLost (IntPtr handle);
  36. /// <summary>
  37. /// Mark the GPU resource destroyed on graphics context destruction.
  38. /// </summary>
  39. public void OnDeviceLost ()
  40. {
  41. Runtime.ValidateObject (this);
  42. GPUObject_OnDeviceLost (handle);
  43. }
  44. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  45. internal static extern void GPUObject_OnDeviceReset (IntPtr handle);
  46. /// <summary>
  47. /// Recreate the GPU resource and restore data if applicable.
  48. /// </summary>
  49. public void OnDeviceReset ()
  50. {
  51. Runtime.ValidateObject (this);
  52. GPUObject_OnDeviceReset (handle);
  53. }
  54. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  55. internal static extern void GPUObject_Release (IntPtr handle);
  56. /// <summary>
  57. /// Unconditionally release the GPU resource.
  58. /// </summary>
  59. public void Release ()
  60. {
  61. Runtime.ValidateObject (this);
  62. GPUObject_Release (handle);
  63. }
  64. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  65. internal static extern void GPUObject_ClearDataLost (IntPtr handle);
  66. /// <summary>
  67. /// Clear the data lost flag.
  68. /// </summary>
  69. public void ClearDataLost ()
  70. {
  71. Runtime.ValidateObject (this);
  72. GPUObject_ClearDataLost (handle);
  73. }
  74. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  75. internal static extern IntPtr GPUObject_GetGraphics (IntPtr handle);
  76. /// <summary>
  77. /// Return the graphics subsystem associated with this GPU object.
  78. /// </summary>
  79. private Graphics GetGraphics ()
  80. {
  81. Runtime.ValidateObject (this);
  82. return Runtime.LookupObject<Graphics> (GPUObject_GetGraphics (handle));
  83. }
  84. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  85. internal static extern IntPtr GPUObject_GetGPUObject (IntPtr handle);
  86. /// <summary>
  87. /// Return the object pointer. Applicable only on Direct3D.
  88. /// </summary>
  89. public IntPtr GetGPUObject ()
  90. {
  91. Runtime.ValidateObject (this);
  92. return GPUObject_GetGPUObject (handle);
  93. }
  94. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  95. internal static extern uint GPUObject_GetGPUObjectName (IntPtr handle);
  96. /// <summary>
  97. /// Return the object name. Applicable only on OpenGL.
  98. /// </summary>
  99. private uint GetGPUObjectName ()
  100. {
  101. Runtime.ValidateObject (this);
  102. return GPUObject_GetGPUObjectName (handle);
  103. }
  104. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  105. internal static extern bool GPUObject_IsDataLost (IntPtr handle);
  106. /// <summary>
  107. /// Return whether data is lost due to context loss.
  108. /// </summary>
  109. private bool IsDataLost ()
  110. {
  111. Runtime.ValidateObject (this);
  112. return GPUObject_IsDataLost (handle);
  113. }
  114. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  115. internal static extern bool GPUObject_HasPendingData (IntPtr handle);
  116. /// <summary>
  117. /// Return whether has pending data assigned while graphics context was lost.
  118. /// </summary>
  119. public bool HasPendingData ()
  120. {
  121. Runtime.ValidateObject (this);
  122. return GPUObject_HasPendingData (handle);
  123. }
  124. /// <summary>
  125. /// Return the graphics subsystem associated with this GPU object.
  126. /// </summary>
  127. public Graphics Graphics {
  128. get {
  129. return GetGraphics ();
  130. }
  131. }
  132. /// <summary>
  133. /// Return the object name. Applicable only on OpenGL.
  134. /// </summary>
  135. public uint GPUObjectName {
  136. get {
  137. return GetGPUObjectName ();
  138. }
  139. }
  140. /// <summary>
  141. /// Return whether data is lost due to context loss.
  142. /// </summary>
  143. public bool DataLost {
  144. get {
  145. return IsDataLost ();
  146. }
  147. }
  148. }
  149. }