temp.bgfx.hpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. /*
  2. * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
  4. */
  5. /*
  6. *
  7. * AUTO GENERATED! DO NOT EDIT! ( source : $source )
  8. *
  9. */
  10. #ifndef BGFX_H_HEADER_GUARD
  11. #define BGFX_H_HEADER_GUARD
  12. #define BGFX_IDL_CPP 1
  13. #include <stdarg.h> // va_list
  14. #include <stdint.h> // uint32_t
  15. #include <stdlib.h> // NULL
  16. #include "defines.h"
  17. ///
  18. #define BGFX_HANDLE(_name) \
  19. struct _name { uint16_t idx; }; \
  20. inline bool isValid(_name _handle) { return bgfx::kInvalidHandle != _handle.idx; }
  21. #define BGFX_INVALID_HANDLE { bgfx::kInvalidHandle }
  22. namespace bx { struct AllocatorI; }
  23. /// BGFX
  24. namespace bgfx
  25. {
  26. struct CallbackI;
  27. $enums
  28. static const uint16_t kInvalidHandle = UINT16_MAX;
  29. /// View id.
  30. typedef uint16_t ViewId;
  31. $handles
  32. $structs
  33. /// Callback interface to implement application specific behavior.
  34. /// Cached items are currently used for OpenGL and Direct3D 12 binary
  35. /// shaders.
  36. ///
  37. /// @remarks
  38. /// 'fatal' and 'trace' callbacks can be called from any thread. Other
  39. /// callbacks are called from the render thread.
  40. ///
  41. /// @attention C99's equivalent binding is `bgfx_callback_interface_t`.
  42. ///
  43. struct CallbackI
  44. {
  45. virtual ~CallbackI() = 0;
  46. /// This callback is called on unrecoverable errors.
  47. /// It's not safe to continue (Excluding _code `Fatal::DebugCheck`),
  48. /// inform the user and terminate the application.
  49. ///
  50. /// @param[in] _filePath File path where fatal message was generated.
  51. /// @param[in] _line Line where fatal message was generated.
  52. /// @param[in] _code Fatal error code.
  53. /// @param[in] _str More information about error.
  54. ///
  55. /// @remarks
  56. /// Not thread safe and it can be called from any thread.
  57. ///
  58. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.fatal`.
  59. ///
  60. virtual void fatal(
  61. const char* _filePath
  62. , uint16_t _line
  63. , Fatal::Enum _code
  64. , const char* _str
  65. ) = 0;
  66. /// Print debug message.
  67. ///
  68. /// @param[in] _filePath File path where debug message was generated.
  69. /// @param[in] _line Line where debug message was generated.
  70. /// @param[in] _format `printf` style format.
  71. /// @param[in] _argList Variable arguments list initialized with
  72. /// `va_start`.
  73. ///
  74. /// @remarks
  75. /// Not thread safe and it can be called from any thread.
  76. ///
  77. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.trace_vargs`.
  78. ///
  79. virtual void traceVargs(
  80. const char* _filePath
  81. , uint16_t _line
  82. , const char* _format
  83. , va_list _argList
  84. ) = 0;
  85. /// Profiler region begin.
  86. ///
  87. /// @param[in] _name Region name, contains dynamic string.
  88. /// @param[in] _abgr Color of profiler region.
  89. /// @param[in] _filePath File path where `profilerBegin` was called.
  90. /// @param[in] _line Line where `profilerBegin` was called.
  91. ///
  92. /// @remarks
  93. /// Not thread safe and it can be called from any thread.
  94. ///
  95. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.profiler_begin`.
  96. ///
  97. virtual void profilerBegin(
  98. const char* _name
  99. , uint32_t _abgr
  100. , const char* _filePath
  101. , uint16_t _line
  102. ) = 0;
  103. /// Profiler region begin with string literal name.
  104. ///
  105. /// @param[in] _name Region name, contains string literal.
  106. /// @param[in] _abgr Color of profiler region.
  107. /// @param[in] _filePath File path where `profilerBeginLiteral` was called.
  108. /// @param[in] _line Line where `profilerBeginLiteral` was called.
  109. ///
  110. /// @remarks
  111. /// Not thread safe and it can be called from any thread.
  112. ///
  113. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.profiler_begin_literal`.
  114. ///
  115. virtual void profilerBeginLiteral(
  116. const char* _name
  117. , uint32_t _abgr
  118. , const char* _filePath
  119. , uint16_t _line
  120. ) = 0;
  121. /// Profiler region end.
  122. ///
  123. /// @remarks
  124. /// Not thread safe and it can be called from any thread.
  125. ///
  126. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.profiler_end`.
  127. ///
  128. virtual void profilerEnd() = 0;
  129. /// Returns the size of a cached item. Returns 0 if no cached item was
  130. /// found.
  131. ///
  132. /// @param[in] _id Cache id.
  133. /// @returns Number of bytes to read.
  134. ///
  135. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.cache_read_size`.
  136. ///
  137. virtual uint32_t cacheReadSize(uint64_t _id) = 0;
  138. /// Read cached item.
  139. ///
  140. /// @param[in] _id Cache id.
  141. /// @param[in] _data Buffer where to read data.
  142. /// @param[in] _size Size of data to read.
  143. ///
  144. /// @returns True if data is read.
  145. ///
  146. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.cache_read`.
  147. ///
  148. virtual bool cacheRead(uint64_t _id, void* _data, uint32_t _size) = 0;
  149. /// Write cached item.
  150. ///
  151. /// @param[in] _id Cache id.
  152. /// @param[in] _data Data to write.
  153. /// @param[in] _size Size of data to write.
  154. ///
  155. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.cache_write`.
  156. ///
  157. virtual void cacheWrite(uint64_t _id, const void* _data, uint32_t _size) = 0;
  158. /// Screenshot captured. Screenshot format is always 4-byte BGRA.
  159. ///
  160. /// @param[in] _filePath File path.
  161. /// @param[in] _width Image width.
  162. /// @param[in] _height Image height.
  163. /// @param[in] _pitch Number of bytes to skip between the start of
  164. /// each horizontal line of the image.
  165. /// @param[in] _data Image data.
  166. /// @param[in] _size Image size.
  167. /// @param[in] _yflip If true, image origin is bottom left.
  168. ///
  169. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.screen_shot`.
  170. ///
  171. virtual void screenShot(
  172. const char* _filePath
  173. , uint32_t _width
  174. , uint32_t _height
  175. , uint32_t _pitch
  176. , const void* _data
  177. , uint32_t _size
  178. , bool _yflip
  179. ) = 0;
  180. /// Called when a video capture begins.
  181. ///
  182. /// @param[in] _width Image width.
  183. /// @param[in] _height Image height.
  184. /// @param[in] _pitch Number of bytes to skip between the start of
  185. /// each horizontal line of the image.
  186. /// @param[in] _format Texture format. See: `TextureFormat::Enum`.
  187. /// @param[in] _yflip If true, image origin is bottom left.
  188. ///
  189. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.capture_begin`.
  190. ///
  191. virtual void captureBegin(
  192. uint32_t _width
  193. , uint32_t _height
  194. , uint32_t _pitch
  195. , TextureFormat::Enum _format
  196. , bool _yflip
  197. ) = 0;
  198. /// Called when a video capture ends.
  199. ///
  200. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.capture_end`.
  201. ///
  202. virtual void captureEnd() = 0;
  203. /// Captured frame.
  204. ///
  205. /// @param[in] _data Image data.
  206. /// @param[in] _size Image size.
  207. ///
  208. /// @attention C99's equivalent binding is `bgfx_callback_vtbl.capture_frame`.
  209. ///
  210. virtual void captureFrame(const void* _data, uint32_t _size) = 0;
  211. };
  212. inline CallbackI::~CallbackI()
  213. {
  214. }
  215. $funcptrs
  216. $cppdecl
  217. inline bool VertexLayout::has(Attrib::Enum _attrib) const { return UINT16_MAX != m_attributes[_attrib]; }
  218. inline uint16_t VertexLayout::getOffset(Attrib::Enum _attrib) const { return m_offset[_attrib]; }
  219. inline uint16_t VertexLayout::getStride() const { return m_stride; }
  220. inline uint32_t VertexLayout::getSize(uint32_t _num) const { return _num*m_stride; }
  221. } // namespace bgfx
  222. #endif // BGFX_H_HEADER_GUARD