bgfx.bmx 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  1. ' Copyright (c) 2015-2018 Bruce A Henderson
  2. ' All rights reserved.
  3. '
  4. ' Redistribution and use in source and binary forms, with or without
  5. ' modification, are permitted provided that the following conditions are met:
  6. '
  7. ' * Redistributions of source code must retain the above copyright notice, this
  8. ' list of conditions and the following disclaimer.
  9. '
  10. ' * Redistributions in binary form must reproduce the above copyright notice,
  11. ' this list of conditions and the following disclaimer in the documentation
  12. ' and/or other materials provided with the distribution.
  13. '
  14. ' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  15. ' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. ' IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. ' DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  18. ' FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. ' DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  20. ' SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  21. ' CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  22. ' OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. ' OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. '
  25. SuperStrict
  26. Rem
  27. bbdoc:
  28. End Rem
  29. Module gfx.bgfx
  30. ModuleInfo "Version: 1.00"
  31. ModuleInfo "License: BSD"
  32. ModuleInfo "Copyright: BGFX - 2011-2018 Branimir Karadzic. All rights reserved"
  33. ModuleInfo "Copyright: Wrapper - 2015-2018 Bruce A Henderson"
  34. ModuleInfo "History: 1.00"
  35. ModuleInfo "History: Initial Release."
  36. ?linuxx86
  37. ModuleInfo "CC_OPTS: -mfpmath=sse -msse2 -std=c++14"
  38. ?linuxx64
  39. ModuleInfo "CC_OPTS: -mfpmath=sse -msse2 -std=c++14"
  40. ?macos
  41. ModuleInfo "CC_OPTS: -msse2"
  42. ?win32
  43. ModuleInfo "CC_OPTS: -mfpmath=sse -msse2 -std=c++14"
  44. ?raspberrypi
  45. ModuleInfo "CC_OPTS: -std=c++14"
  46. ?
  47. ModuleInfo "CC_OPTS: -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS"
  48. 'ModuleInfo "CC_OPTS: -DBGFX_CONFIG_DEBUG"
  49. Import brl.standardio
  50. Import "common.bmx"
  51. Rem
  52. bbdoc:
  53. End Rem
  54. Type TBGFX
  55. Function Init:Int(width:Int, height:Int, rendererType:Int = BGFX_RENDERER_TYPE_COUNT)
  56. Return bmx_bgfx_init(width, height, rendererType)
  57. End Function
  58. Rem
  59. bbdoc: Resets graphic settings and back-buffer size.
  60. about: This call doesn't actually change window size, it just resizes back-buffer. Windowing code has to change window size.
  61. End Rem
  62. Function Reset(width:Int, height:Int, flags:Int = BGFX_RESET_NONE, format:Int = BGFX_TEXTURE_FORMAT_COUNT)
  63. bmx_bgfx_reset(width, height, flags, format)
  64. End Function
  65. ' Rem
  66. ' bbdoc:
  67. ' End Rem
  68. ' Function Submit:Int(id:Short, depth:Int)
  69. ' Return bmx_bgfx_submit(id, depth)
  70. ' End Function
  71. Rem
  72. bbdoc: Advances to next frame.
  73. returns: Current frame number. This might be used in conjunction with double/multi buffering data outside the library and passing it to library via makeRef calls.
  74. about: When using multithreaded renderer, this call just swaps internal buffers, kicks render thread, and returns. In
  75. singlethreaded renderer this call does frame rendering.
  76. End Rem
  77. Function Frame:Int(capture:Int = False)
  78. Return bmx_bgfx_frame(capture)
  79. End Function
  80. Function SetDebug(debugFlags:Int)
  81. bmx_bgfx_set_debug(debugFlags)
  82. End Function
  83. Function DebugTextClear(attr:Byte = 0, small:Int = False)
  84. bmx_bgfx_dbg_text_clear(attr, small)
  85. End Function
  86. Function DebugTextPrint(x:Short, y:Short, attr:Byte, Text:String)
  87. bmx_bgfx_dbg_text_printf(x, y, attr, Text)
  88. End Function
  89. Function DebugTextImage(x:Short, y:Short, width:Short, height:Short, data:Byte Ptr, pitch:Short)
  90. bmx_bgfx_dbg_text_image(x, y, width, height, data, pitch)
  91. End Function
  92. Function GetRenderType:Int()
  93. ' TODO
  94. End Function
  95. Rem
  96. bbdoc: Returns renderer capabilities.
  97. End Rem
  98. Function GetCaps:TBGFXCaps()
  99. Return TBGFXCaps._Create(bmx_bgfx_get_caps())
  100. End Function
  101. Function GetStats:TBGFXStats()
  102. ' TODO
  103. End Function
  104. Function GetHMD:TBGFXHMD()
  105. ' TODO
  106. End Function
  107. Rem
  108. bbdoc: Sets view rectangle.
  109. about: Draw primitive outside view will be clipped.
  110. End Rem
  111. Function SetViewRect(id:Short, x:Int, y:Int, width:Int, height:Int)
  112. bmx_bgfx_set_view_rect(id, x, y, width, height)
  113. End Function
  114. Rem
  115. bbdoc: Sets view rectangle.
  116. about: Draw primitive outside view will be clipped.
  117. End Rem
  118. Function SetViewRectAuto(id:Short, x:Short, y:Short, ratio:Int)
  119. bmx_bgfx_set_view_rect_auto(id, x, y, ratio)
  120. End Function
  121. Rem
  122. bbdoc: Sets view clear flags with different clear color for each frame buffer texture.
  123. about: Must use SetClearColor to setup clear color palette. Use BGFX_CLEAR_NONE to remove any clear.
  124. End Rem
  125. Function SetViewClear(id:Short, flags:Short, rgba:Int = $000000ff, depth:Float = 1.0, stencil:Byte = 0)
  126. bmx_bgfx_set_view_clear(id, flags, rgba, depth, stencil)
  127. End Function
  128. Rem
  129. bbdoc: Sets view sorting mode.
  130. about: View mode must be set prior calling Submit for the view.
  131. End Rem
  132. Function SetViewClearMrt(id:Short, flags:Short, depth:Float, stencil:Byte, p0:Byte = $FF, p1:Byte = $FF, p2:Byte = $FF, p3:Byte = $FF, p4:Byte = $FF, p5:Byte = $FF, p6:Byte = $FF, p7:Byte = $FF)
  133. bmx_bgfx_set_view_clear_mrt(id, flags, depth, stencil, p0, p1, p2, p3, p4, p5, p6, p7)
  134. End Function
  135. Rem
  136. bbdoc:
  137. End Rem
  138. Function SetViewMode(id:Short, viewMode:Int)
  139. bmx_bgfx_set_view_mode(id, viewMode)
  140. End Function
  141. Rem
  142. bbdoc: Sets the view and projection matrices, all draw primitives in this view will use these matrices.
  143. End Rem
  144. Function SetViewTransform(id:Short, view:Byte Ptr, proj:Byte Ptr)
  145. bmx_bgfx_set_view_transform(id, view, proj)
  146. End Function
  147. Rem
  148. bbdoc: Posts submit view reordering.
  149. End Rem
  150. Function SetViewOrder(id:Short = 0, num:Short = $FFFF, order:Short Ptr = Null)
  151. bmx_bgfx_set_view_order(id, num, order)
  152. End Function
  153. Rem
  154. bbdoc: Sets view frame buffer.
  155. about: Not persistent after Reset() call.
  156. End Rem
  157. Function SetViewFrameBuffer(id:Short, frameBuffer:Short)
  158. bmx_bgfx_set_view_frame_buffer(id, frameBuffer)
  159. End Function
  160. Rem
  161. bbdoc: Sets view scissor.
  162. about: Draw primitive outside view will be clipped. When @x, @y, @width and @height are set to 0, scissor will be disabled.
  163. End Rem
  164. Function SetViewScissor(id:Short, x:Short, y:Short, width:Short, height:Short)
  165. bmx_bgfx_set_view_scissor(id, x, y, width, height)
  166. End Function
  167. Rem
  168. bbdoc: Sets clear color palette value.
  169. about:
  170. End Rem
  171. Function SetClearColor(index:Int, r:Int, g:Int, b:Int, a:Int)
  172. 'bmx_bgfx_set_clear_color(index, r, g, b, a)
  173. End Function
  174. Rem
  175. bbdoc: Shutdowns bgfx library.
  176. End Rem
  177. Function Shutdown()
  178. bmx_bgfx_shutdown()
  179. End Function
  180. End Type
  181. Rem
  182. bbdoc: A memory buffer.
  183. End Rem
  184. Type TBGFXMemory
  185. Field memPtr:Byte Ptr
  186. Rem
  187. bbdoc: Allocates buffer to pass to bgfx calls.
  188. about: Data will be freed inside bgfx.
  189. End Rem
  190. Function Alloc:TBGFXMemory(size:Int)
  191. Local this:TBGFXMemory = New TBGFXMemory
  192. this.memPtr = bgfx_alloc(size)
  193. Return this
  194. End Function
  195. Rem
  196. bbdoc: Allocates buffer and copy data into it.
  197. about: Data will be freed inside bgfx.
  198. End Rem
  199. Function Copy:TBGFXMemory(data:Byte Ptr, size:Int)
  200. Local this:TBGFXMemory = New TBGFXMemory
  201. this.memPtr = bgfx_copy(data, size)
  202. Return this
  203. End Function
  204. End Type
  205. Rem
  206. bbdoc: A static index buffer.
  207. End Rem
  208. Type TBGFXIndexBuffer
  209. Field bufferPtr:Byte Ptr
  210. Method Create:TBGFXIndexBuffer(mem:TBGFXMemory, flags:Int = BGFX_BUFFER_NONE)
  211. 'bufferPtr = bmx_bgfx_create_index_buffer(mem.memPtr, flags)
  212. Return Self
  213. End Method
  214. Method Destroy()
  215. If bufferPtr Then
  216. 'bmx_bgfx_destroy_index_buffer(bufferPtr)
  217. bufferPtr = Null
  218. End If
  219. End Method
  220. End Type
  221. Type TBGFXShader
  222. Field shaderHandle:Short
  223. Method Create:TBGFXShader(mem:TBGFXMemory)
  224. shaderHandle = bmx_bgfx_create_shader(mem.memPtr)
  225. Return Self
  226. End Method
  227. Method GetUniforms:Short(uniforms:Short Ptr, maximum:Short)
  228. Return bmx_bgfx_get_shader_uniforms(shaderHandle, uniforms, maximum)
  229. End Method
  230. Method SetName(name:String)
  231. bmx_bgfx_set_shader_name(shaderHandle, name)
  232. End Method
  233. Method Destroy()
  234. If shaderHandle Then
  235. bmx_bgfx_destroy_shader(shaderHandle)
  236. shaderHandle = Null
  237. End If
  238. End Method
  239. End Type
  240. Type TBGFXUniform
  241. Field uniformHandle:Short
  242. Field info:TBGFXUniformInfo
  243. Method Create:TBGFXUniform(name:String, uniformType:Int, num:Short)
  244. uniformHandle = bmx_bgfx_create_uniform(name, uniformType, num)
  245. Return Self
  246. End Method
  247. Method GetInfo:TBGFXUniformInfo()
  248. If Not info Then
  249. info = TBGFXUniformInfo._Create(uniformHandle)
  250. End If
  251. Return info
  252. End Method
  253. Method Destroy()
  254. If uniformHandle Then
  255. bmx_bgfx_destroy_uniform(uniformHandle)
  256. uniformHandle = 0
  257. End If
  258. End Method
  259. End Type
  260. Type TBGFXUniformInfo
  261. Field infoPtr:Byte Ptr
  262. Function _Create:TBGFXUniformInfo(uniform:Short)
  263. If uniform Then
  264. Local this:TBGFXUniformInfo = New TBGFXUniformInfo
  265. this.infoPtr = bmx_bgfx_get_uniform_info(uniform)
  266. Return this
  267. End If
  268. End Function
  269. Method Delete()
  270. If infoPtr Then
  271. bmx_bgfx_uniform_info_free(infoPtr)
  272. End If
  273. End Method
  274. End Type
  275. Type TBGFXProgram
  276. Field programHandle:Short
  277. Method Create:TBGFXProgram(vsh:TBGFXShader, fsh:TBGFXShader, destroyShaders:Int)
  278. programHandle = bmx_bgfx_create_program(vsh.shaderHandle, fsh.shaderHandle, destroyShaders)
  279. Return Self
  280. End Method
  281. Method ComputeProgram:TBGFXProgram(csh:TBGFXShader, destroyShaders:Int)
  282. programHandle = bmx_bgfx_create_compute_program(csh.shaderHandle, destroyShaders)
  283. Return Self
  284. End Method
  285. Method Destroy()
  286. If programHandle Then
  287. bmx_bgfx_destroy_program(programHandle)
  288. programHandle = 0
  289. End If
  290. End Method
  291. End Type
  292. Rem
  293. bbdoc:
  294. End Rem
  295. Type TBGFXTexture
  296. Field textureHandle:Short
  297. Rem
  298. bbdoc: Creates a texture from memory buffer.
  299. about:
  300. End Rem
  301. Method Create:TBGFXTexture(mem:TBGFXMemory, flags:Int, skip:Int, info:TBGFXTextureInfo = Null)
  302. If info Then
  303. textureHandle = bmx_bgfx_create_texture(mem.memPtr, flags, skip, info.infoPtr)
  304. Else
  305. textureHandle = bmx_bgfx_create_texture(mem.memPtr, flags, skip, Null)
  306. End If
  307. Return Self
  308. End Method
  309. Rem
  310. bbdoc:
  311. End Rem
  312. Method Create2D:TBGFXTexture(width:Short, height:Short, hasMips:Int, numLayers:Short, format:Short, flags:Int, mem:TBGFXMemory)
  313. textureHandle = bmx_bgfx_create_texture_2d(width, height, hasMips, numLayers, format, flags, mem.memPtr)
  314. Return Self
  315. End Method
  316. Method Create2DScaled:TBGFXTexture(ratio:Int, hasMips:Int, numLayers:Short, format:Short, flags:Int)
  317. textureHandle = bmx_bgfx_create_texture_2d_scaled(ratio, hasMips, numLayers, format, flags)
  318. Return Self
  319. End Method
  320. Rem
  321. bbdoc:
  322. End Rem
  323. Method Destroy()
  324. If textureHandle Then
  325. bmx_bgfx_destroy_texture(textureHandle)
  326. textureHandle = 0
  327. End If
  328. End Method
  329. Rem
  330. bbdoc: Validates texture parameters.
  331. returns: True if texture can be successfully created.
  332. End Rem
  333. Function IsValid:Int(depth:Short, cubeMap:Int, numLayers:Short, format:Short, flags:Int)
  334. Return bmx_bgfx_is_texture_valid(depth, cubeMap, numLayers, format, flags)
  335. End Function
  336. Rem
  337. bbdoc: Calculates amount of memory required for texture.
  338. End Rem
  339. Function CalcSize(info:TBGFXTextureInfo, width:Short, height:Short, depth:Short, cubeMap:Int, hasMips:Int, numLayers:Short, format:Short)
  340. bmx_bgfx_calc_texture_size(info.infoPtr, width, height, depth, cubeMap, hasMips, numLayers, format)
  341. End Function
  342. End Type
  343. Rem
  344. bbdoc:
  345. End Rem
  346. Type TBGFXTextureInfo
  347. Field infoPtr:Byte Ptr
  348. Method New()
  349. infoPtr = bmx_bgfx_texture_info_new()
  350. End Method
  351. Rem
  352. bbdoc:
  353. End Rem
  354. Method Format:Short()
  355. Return bmx_bgfx_texture_format(infoPtr)
  356. End Method
  357. Rem
  358. bbdoc:
  359. End Rem
  360. Method StorageSize:Int()
  361. Return bmx_bgfx_texture_storageSize(infoPtr)
  362. End Method
  363. Rem
  364. bbdoc:
  365. End Rem
  366. Method Width:Int()
  367. Return bmx_bgfx_texture_width(infoPtr)
  368. End Method
  369. Rem
  370. bbdoc:
  371. End Rem
  372. Method Height:Int()
  373. Return bmx_bgfx_texture_height(infoPtr)
  374. End Method
  375. Rem
  376. bbdoc:
  377. End Rem
  378. Method Depth:Int()
  379. Return bmx_bgfx_texture_depth(infoPtr)
  380. End Method
  381. Rem
  382. bbdoc:
  383. End Rem
  384. Method Mips:Int()
  385. Return bmx_bgfx_texture_mips(infoPtr)
  386. End Method
  387. Rem
  388. bbdoc:
  389. End Rem
  390. Method BitsPerPixel:Int()
  391. Return bmx_bgfx_texture_bitsperpixel(infoPtr)
  392. End Method
  393. Rem
  394. bbdoc:
  395. End Rem
  396. Method CubeMap:Int()
  397. Return bmx_bgfx_texture_cubemap(infoPtr)
  398. End Method
  399. Method Delete()
  400. If infoPtr Then
  401. bmx_bgfx_texture_info_free(infoPtr)
  402. infoPtr = Null
  403. End If
  404. End Method
  405. End Type
  406. Type TBGFXTransform
  407. Field transformPtr:Byte Ptr
  408. End Type
  409. Type TBGFXInstanceDataBuffer
  410. Field bufferPtr:Byte Ptr
  411. End Type
  412. Type TBGFXCaps
  413. Field capsPtr:Byte Ptr
  414. Field _limits:TBGFXCapsLimits
  415. Function _Create:TBGFXCaps(capsPtr:Byte Ptr)
  416. If capsPtr Then
  417. Local this:TBGFXCaps = New TBGFXCaps
  418. this.capsPtr = capsPtr
  419. Return this
  420. End If
  421. End Function
  422. Rem
  423. bbdoc: Renderer backend type.
  424. End Rem
  425. Method RenderType:Int()
  426. End Method
  427. Rem
  428. bbdoc: Supported functionality.
  429. End Rem
  430. Method Supported:Long()
  431. ' TODO use var ptr
  432. End Method
  433. Rem
  434. bbdoc: Selected GPU vendor PCI id.
  435. End Rem
  436. Method VendorId:Short()
  437. End Method
  438. Rem
  439. bbdoc: Selected GPU device id.
  440. End Rem
  441. Method DeviceId:Short()
  442. End Method
  443. Rem
  444. bbdoc: True when NDC depth is in [-1, 1] range, otherwise its [0, 1].
  445. End Rem
  446. Method HomogeneousDepth:Int()
  447. End Method
  448. Rem
  449. bbdoc: True when NDC origin is at bottom left.
  450. End Rem
  451. Method OriginBottomLeft:Int()
  452. End Method
  453. Rem
  454. bbdoc: Number of enumerated GPUs.
  455. End Rem
  456. Method NumGPUs:Byte()
  457. End Method
  458. Rem
  459. bbdoc: Enumerated GPUs.
  460. End Rem
  461. Method GPUCaps(index:Int, vendorId:Short Var, deviceId:Short Var)
  462. End Method
  463. Rem
  464. bbdoc: Capability limits.
  465. End Rem
  466. Method Limits:TBGFXCapsLimits()
  467. If Not _limits Then
  468. _limits = TBGFXCapsLimits._Create(bmx_bgfx_caps_limits(capsPtr))
  469. End If
  470. Return _limits
  471. End Method
  472. Rem
  473. bbdoc:
  474. End Rem
  475. Method Format:Int(index:Int)
  476. End Method
  477. End Type
  478. Type TBGFXCapsLimits
  479. Field limitsPtr:Byte Ptr
  480. Function _Create:TBGFXCapsLimits(limitsPtr:Byte Ptr)
  481. If limitsPtr Then
  482. Local this:TBGFXCapsLimits = New TBGFXCapsLimits
  483. this.limitsPtr = limitsPtr
  484. Return this
  485. End If
  486. End Function
  487. Rem
  488. bbdoc: Maximum number of draw calls.
  489. End Rem
  490. Method MaxDrawCalls:Int()
  491. Return bmx_bgfx_capslimits_maxDrawCalls(limitsPtr)
  492. End Method
  493. Rem
  494. bbdoc: Maximum number of blit calls.
  495. End Rem
  496. Method MaxBlits:Int()
  497. Return bmx_bgfx_capslimits_maxBlits(limitsPtr)
  498. End Method
  499. Rem
  500. bbdoc: Maximum texture size.
  501. End Rem
  502. Method MaxTextureSize:Int()
  503. Return bmx_bgfx_capslimits_maxTextureSize(limitsPtr)
  504. End Method
  505. Rem
  506. bbdoc: Maximum texture layers.
  507. End Rem
  508. Method MaxTextureLayers:Int()
  509. Return bmx_bgfx_capslimits_maxTextureLayers(limitsPtr)
  510. End Method
  511. Rem
  512. bbdoc: Maximum number of views.
  513. End Rem
  514. Method MaxViews:Int()
  515. Return bmx_bgfx_capslimits_maxViews(limitsPtr)
  516. End Method
  517. Rem
  518. bbdoc: Maximum number of frame buffer handles.
  519. End Rem
  520. Method MaxFrameBuffers:Int()
  521. Return bmx_bgfx_capslimits_maxFrameBuffers(limitsPtr)
  522. End Method
  523. Rem
  524. bbdoc: Maximum number of frame buffer attachments.
  525. End Rem
  526. Method MaxFBAttachments:Int()
  527. Return bmx_bgfx_capslimits_maxFBAttachments(limitsPtr)
  528. End Method
  529. Rem
  530. bbdoc: Maximum number of program handles.
  531. End Rem
  532. Method MaxPrograms:Int()
  533. Return bmx_bgfx_capslimits_maxPrograms(limitsPtr)
  534. End Method
  535. Rem
  536. bbdoc: Maximum number of shader handles.
  537. End Rem
  538. Method MaxShaders:Int()
  539. Return bmx_bgfx_capslimits_maxShaders(limitsPtr)
  540. End Method
  541. Rem
  542. bbdoc: Maximum number of texture handles.
  543. End Rem
  544. Method MaxTextures:Int()
  545. Return bmx_bgfx_capslimits_maxTextures(limitsPtr)
  546. End Method
  547. Rem
  548. bbdoc: Maximum number of texture samplers.
  549. End Rem
  550. Method MaxTextureSamplers:Int()
  551. Return bmx_bgfx_capslimits_maxTextureSamplers(limitsPtr)
  552. End Method
  553. Rem
  554. bbdoc: Maximum number of vertex format declarations.
  555. End Rem
  556. Method MaxVertexDecls:Int()
  557. Return bmx_bgfx_capslimits_maxVertexDecls(limitsPtr)
  558. End Method
  559. Rem
  560. bbdoc: Maximum number of vertex streams.
  561. End Rem
  562. Method MaxVertexStreams:Int()
  563. Return bmx_bgfx_capslimits_maxVertexStreams(limitsPtr)
  564. End Method
  565. Rem
  566. bbdoc: Maximum number of index buffer handles.
  567. End Rem
  568. Method MaxIndexBuffers:Int()
  569. Return bmx_bgfx_capslimits_maxIndexBuffers(limitsPtr)
  570. End Method
  571. Rem
  572. bbdoc: Maximum number of vertex buffer handles.
  573. End Rem
  574. Method MaxVertexBuffers:Int()
  575. Return bmx_bgfx_capslimits_maxVertexBuffers(limitsPtr)
  576. End Method
  577. Rem
  578. bbdoc: Maximum number of dynamic index buffer handles.
  579. End Rem
  580. Method MaxDynamicIndexBuffers:Int()
  581. Return bmx_bgfx_capslimits_maxDynamicIndexBuffers(limitsPtr)
  582. End Method
  583. Rem
  584. bbdoc: Maximum number of dynamic vertex buffer handles.
  585. End Rem
  586. Method MaxDynamicVertexBuffers:Int()
  587. Return bmx_bgfx_capslimits_maxDynamicVertexBuffers(limitsPtr)
  588. End Method
  589. Rem
  590. bbdoc: Maximum number of uniform handles.
  591. End Rem
  592. Method MaxUniforms:Int()
  593. Return bmx_bgfx_capslimits_maxUniforms(limitsPtr)
  594. End Method
  595. Rem
  596. bbdoc: Maximum number of occlusion query handles.
  597. End Rem
  598. Method MaxOcclusionQueries:Int()
  599. Return bmx_bgfx_capslimits_maxOcclusionQueries(limitsPtr)
  600. End Method
  601. Rem
  602. bbdoc: Maximum number of encoder threads.
  603. End Rem
  604. Method MaxEncoders:Int()
  605. Return bmx_bgfx_capslimits_maxEncoders(limitsPtr)
  606. End Method
  607. Rem
  608. bbdoc:
  609. End Rem
  610. Method TransientVbSize:Int()
  611. Return bmx_bgfx_capslimits_transientVbSize(limitsPtr)
  612. End Method
  613. Rem
  614. bbdoc:
  615. End Rem
  616. Method TransientIbSize:Int()
  617. Return bmx_bgfx_capslimits_transientIbSize(limitsPtr)
  618. End Method
  619. End Type
  620. Type TBGFXStats
  621. End Type
  622. Type TBGFXHMD
  623. End Type
  624. Type TBGFXRenderBase Abstract
  625. Method SetMarker(marker:String) Abstract
  626. Method SetState(state:Long, rgba:Int) Abstract
  627. Method SetCondition(occlusionQuery:Short, visible:Int) Abstract
  628. Method SetStencil(fstencil:Int, bstencil:Int = BGFX_STENCIL_NONE) Abstract
  629. Method SetScissor:Short(x:Short, y:Short, width:Short, height:Short) Abstract
  630. Method SetScissorCached(cache:Short = $FFFF) Abstract
  631. Method SetTransform:Int(matrix:Float Ptr, num:Short = 1) Abstract
  632. Method AllocTransform:Int(transform:TBGFXTransform, num:Short) Abstract
  633. Method SetTransformCached(cache:Int, num:Short) Abstract
  634. Method SetUniform(uniform:TBGFXUniform, value:Byte Ptr, num:Short = 1) Abstract
  635. Method SetIndexBuffer(indexBuffer:Short, firstIndex:Int, numIndices:Int) Abstract
  636. Method SetDynamicIndexBuffer(dynamicIndexBuffer:Short, firstIndex:Int, numIndices:Int) Abstract
  637. Method SetTransientIndexBuffer(transientIndexBuffer:Short, firstIndex:Int, numIndices:Int) Abstract
  638. Method SetVertexBuffer(stream:Byte, vertexBuffer:Short, startVertex:Int, numVertices:Int) Abstract
  639. Method SetDynamicVertexBuffer(stream:Byte, dynamicVertexBuffer:Short, startVertex:Int, numVertices:Int) Abstract
  640. Method SetTransientVertexBuffer(stream:Byte, transientVertexBuffer:Short, startVertex:Int, numVertices:Int) Abstract
  641. Method SetVertexCount(numVertices:Int) Abstract
  642. Method SetInstanceDataBuffer(idb:TBGFXInstanceDataBuffer, start:Int, num:Int) Abstract
  643. Method SetInstanceDataFromVertexBuffer(vertexBuffer:Short, startVertex:Int, num:Int) Abstract
  644. Method SetInstanceDataFromDynamicVertexBuffer(dynamicVertexBuffer:Short, startVertex:Int, num:Int) Abstract
  645. Method SetTexture(stage:Byte, uniform:TBGFXUniform, texture:Int, flags:Int) Abstract
  646. Method Touch(id:Short) Abstract
  647. Method Submit(id:Short, program:TBGFXProgram, depth:Int = 0, preserveState:Int = False) Abstract
  648. Method SubmitOcclusionQuery(id:Short, program:TBGFXProgram, occlusionQuery:Short, depth:Int = 0, preserveState:Int = False) Abstract
  649. Method SubmitIndirect(id:Short, program:TBGFXProgram, indirectBuffer:Short, start:Short, num:Short, depth:Int = 0, preserveState:Int = False) Abstract
  650. Method SetImage(stage:Byte, texture:Short, mip:Byte, access:Int, format:Int) Abstract
  651. Method SetComputeIndexBuffer(stage:Byte, indexBuffer:Short, access:Int) Abstract
  652. Method SetComputeVertexBuffer(stage:Byte, vertexBuffer:Short, access:Int) Abstract
  653. Method SetComputeDynamicIndexBuffer(stage:Byte, dynamicIndexBuffer:Short, access:Int) Abstract
  654. Method SetComputeDynamicVertexBuffer(stage:Byte, dynamicVertexBuffer:Short, access:Int) Abstract
  655. Method SetComputeIndirectBuffer(stage:Byte, indirectBuffer:Short, access:Int) Abstract
  656. Method Dispatch(id:Short, program:TBGFXProgram, numX:Int, numY:Int, numZ:Int, flags:Byte) Abstract
  657. Method DispatchIndirect(id:Short, program:TBGFXProgram, indirectBuffer:Short, start:Short, num:Short, flags:Byte) Abstract
  658. Method Discard() Abstract
  659. Method Blit(id:Short, dstTexture:Short, dstMip:Byte, dstX:Short, dstY:Short, dstZ:Short, srcTexture:Short, srcMip:Byte, srcX:Short, srcY:Short, srcZ:Short, width:Short, height:Short, depth:Short) Abstract
  660. End Type
  661. Type TBGFXRender Extends TBGFXRenderBase
  662. Function _create:TBGFXRender()
  663. Return New TBGFXRender
  664. End Function
  665. Rem
  666. bbdoc: Sets a debug marker.
  667. about: This allows you to group graphics calls together for easy browsing in graphics debugging tools.
  668. End Rem
  669. Method SetMarker(marker:String)
  670. bmx_bgfx_set_marker(marker)
  671. End Method
  672. Rem
  673. bbdoc: Sets render states for draw primitive.
  674. End Rem
  675. Method SetState(state:Long, rgba:Int)
  676. bmx_bgfx_set_state(state, rgba)
  677. End Method
  678. Rem
  679. bbdoc: Sets condition for rendering.
  680. End Rem
  681. Method SetCondition(occlusionQuery:Short, visible:Int)
  682. bmx_bgfx_set_condition(occlusionQuery, visible)
  683. End Method
  684. Rem
  685. bbdoc: Sets stencil test state.
  686. End Rem
  687. Method SetStencil(fstencil:Int, bstencil:Int = BGFX_STENCIL_NONE)
  688. bmx_bgfx_set_stencil(fstencil, bstencil)
  689. End Method
  690. Rem
  691. bbdoc: Sets scissor for draw primitive.
  692. returns: Scissor cache index.
  693. about: To scissor for all primitives in view see TBGFX.SetViewScissor
  694. End Rem
  695. Method SetScissor:Short(x:Short, y:Short, width:Short, height:Short)
  696. Return bmx_bgfx_set_scissor(x, y, width, height)
  697. End Method
  698. Rem
  699. bbdoc: Set scissor from cache for draw primitive.
  700. End Rem
  701. Method SetScissorCached(cache:Short = $FFFF)
  702. bmx_bgfx_set_scissor_cached(cache)
  703. End Method
  704. Rem
  705. bbdoc: Sets model matrix for draw primitive.
  706. returns: Index into matrix cache in case the same model matrix has to be used for other draw primitive call.
  707. about: If it is not called, model will be rendered with identity model matrix.
  708. End Rem
  709. Method SetTransform:Int(matrix:Float Ptr, num:Short = 1)
  710. Return bmx_bgfx_set_transform(matrix, num)
  711. End Method
  712. Rem
  713. bbdoc: Reserves @num matrices in internal matrix cache.
  714. returns: Index into matrix cache.
  715. End Rem
  716. Method AllocTransform:Int(transform:TBGFXTransform, num:Short)
  717. Return bmx_bgfx_alloc_transform(transform.transformPtr, num)
  718. End Method
  719. Rem
  720. bbdoc: Sets model matrix from matrix cache for draw primitive.
  721. End Rem
  722. Method SetTransformCached(cache:Int, num:Short)
  723. bmx_bgfx_set_transform_cached(cache, num)
  724. End Method
  725. Rem
  726. bbdoc: Sets shader uniform parameter for draw primitive.
  727. End Rem
  728. Method SetUniform(uniform:TBGFXUniform, value:Byte Ptr, num:Short = 1)
  729. bmx_bgfx_set_uniform(uniform.uniformHandle, value, num)
  730. End Method
  731. Rem
  732. bbdoc: Sets index buffer for draw primitive.
  733. End Rem
  734. Method SetIndexBuffer(indexBuffer:Short, firstIndex:Int, numIndices:Int)
  735. bmx_bgfx_set_index_buffer(indexBuffer, firstIndex, numIndices)
  736. End Method
  737. Rem
  738. bbdoc: Sets index buffer for draw primitive.
  739. End Rem
  740. Method SetDynamicIndexBuffer(dynamicIndexBuffer:Short, firstIndex:Int, numIndices:Int)
  741. bmx_bgfx_set_dynamic_index_buffer(dynamicIndexBuffer, firstIndex, numIndices)
  742. End Method
  743. Rem
  744. bbdoc: Sets index buffer for draw primitive.
  745. End Rem
  746. Method SetTransientIndexBuffer(transientIndexBuffer:Short, firstIndex:Int, numIndices:Int)
  747. bmx_bgfx_set_transient_index_buffer(transientIndexBuffer, firstIndex, numIndices)
  748. End Method
  749. Rem
  750. bbdoc: Sets vertex buffer for draw primitive.
  751. End Rem
  752. Method SetVertexBuffer(stream:Byte, vertexBuffer:Short, startVertex:Int, numVertices:Int)
  753. bmx_bgfx_set_vertex_buffer(stream, vertexBuffer, startVertex, numVertices)
  754. End Method
  755. Rem
  756. bbdoc: Sets vertex buffer for draw primitive.
  757. End Rem
  758. Method SetDynamicVertexBuffer(stream:Byte, dynamicVertexBuffer:Short, startVertex:Int, numVertices:Int)
  759. bmx_bgfx_set_dynamic_vertex_buffer(stream, dynamicVertexBuffer, startVertex, numVertices)
  760. End Method
  761. Rem
  762. bbdoc: Sets vertex buffer for draw primitive.
  763. End Rem
  764. Method SetTransientVertexBuffer(stream:Byte, transientVertexBuffer:Short, startVertex:Int, numVertices:Int)
  765. bmx_bgfx_set_transient_vertex_buffer(stream, transientVertexBuffer, startVertex, numVertices)
  766. End Method
  767. Rem
  768. bbdoc:
  769. End Rem
  770. Method SetVertexCount(numVertices:Int)
  771. bmx_bgfx_set_vertex_count(numVertices)
  772. End Method
  773. Rem
  774. bbdoc: Sets instance data buffer for draw primitive.
  775. End Rem
  776. Method SetInstanceDataBuffer(idb:TBGFXInstanceDataBuffer, start:Int, num:Int)
  777. bmx_bgfx_set_instance_data_buffer(idb.bufferPtr, start, num)
  778. End Method
  779. Rem
  780. bbdoc: Sets instance data buffer for draw primitive.
  781. End Rem
  782. Method SetInstanceDataFromVertexBuffer(vertexBuffer:Short, startVertex:Int, num:Int)
  783. bmx_bgfx_set_instance_data_from_vertex_buffer(vertexBuffer, startVertex, num)
  784. End Method
  785. Rem
  786. bbdoc: Sets instance data buffer for draw primitive.
  787. End Rem
  788. Method SetInstanceDataFromDynamicVertexBuffer(dynamicVertexBuffer:Short, startVertex:Int, num:Int)
  789. bmx_bgfx_set_instance_data_from_dynamic_vertex_buffer(dynamicVertexBuffer, startVertex, num)
  790. End Method
  791. Rem
  792. bbdoc: Set texture stage for draw primitive.
  793. End Rem
  794. Method SetTexture(stage:Byte, uniform:TBGFXUniform, texture:Int, flags:Int)
  795. bmx_bgfx_set_texture(stage, uniform.uniformHandle, texture, flags)
  796. End Method
  797. Rem
  798. bbdoc: Submit an empty primitive for rendering.
  799. about: Uniforms and draw state will be applied but no geometry will be submitted.
  800. These empty draw calls will sort before ordinary draw calls.
  801. End Rem
  802. Method Touch(id:Short)
  803. bmx_bgfx_touch(id)
  804. End Method
  805. Rem
  806. bbdoc: Submit primitive for rendering.
  807. End Rem
  808. Method Submit(id:Short, program:TBGFXProgram, depth:Int = 0, preserveState:Int = False)
  809. bmx_bgfx_submit(id, program.programHandle, depth, preserveState)
  810. End Method
  811. Rem
  812. bbdoc: Submit primitive with occlusion query for rendering.
  813. End Rem
  814. Method SubmitOcclusionQuery(id:Short, program:TBGFXProgram, occlusionQuery:Short, depth:Int = 0, preserveState:Int = False)
  815. bmx_bgfx_submit_occlusion_query(id, program.programHandle, occlusionQuery, depth, preserveState)
  816. End Method
  817. Rem
  818. bbdoc: Submits primitive for rendering with index and instance data info from indirect buffer.
  819. End Rem
  820. Method SubmitIndirect(id:Short, program:TBGFXProgram, indirectBuffer:Short, start:Short, num:Short, depth:Int = 0, preserveState:Int = False)
  821. bmx_bgfx_submit_indirect(id, program.programHandle, indirectBuffer, start, num, depth, preserveState)
  822. End Method
  823. Rem
  824. bbdoc: Sets compute image from texture.
  825. End Rem
  826. Method SetImage(stage:Byte, texture:Short, mip:Byte, access:Int, format:Int)
  827. bmx_bgfx_set_image(stage, texture, mip, access, format)
  828. End Method
  829. Rem
  830. bbdoc: Sets compute index buffer.
  831. End Rem
  832. Method SetComputeIndexBuffer(stage:Byte, indexBuffer:Short, access:Int)
  833. bmx_bgfx_set_compute_index_buffer(stage, indexBuffer, access)
  834. End Method
  835. Rem
  836. bbdoc: Sets compute vertex buffer.
  837. End Rem
  838. Method SetComputeVertexBuffer(stage:Byte, vertexBuffer:Short, access:Int)
  839. bmx_bgfx_set_compute_vertex_buffer(stage, vertexBuffer, access)
  840. End Method
  841. Rem
  842. bbdoc: Sets compute dynamic index buffer.
  843. End Rem
  844. Method SetComputeDynamicIndexBuffer(stage:Byte, dynamicIndexBuffer:Short, access:Int)
  845. bmx_bgfx_set_compute_dynamic_index_buffer(stage, dynamicIndexBuffer, access)
  846. End Method
  847. Rem
  848. bbdoc: Sets compute dynamic vertex buffer.
  849. End Rem
  850. Method SetComputeDynamicVertexBuffer(stage:Byte, dynamicVertexBuffer:Short, access:Int)
  851. bmx_bgfx_set_compute_dynamic_vertex_buffer(stage, dynamicVertexBuffer, access)
  852. End Method
  853. Rem
  854. bbdoc: Sets compute indirect buffer.
  855. End Rem
  856. Method SetComputeIndirectBuffer(stage:Byte, indirectBuffer:Short, access:Int)
  857. bmx_bgfx_set_compute_indirect_buffer(stage, indirectBuffer, access)
  858. End Method
  859. Rem
  860. bbdoc: Dispatches compute.
  861. End Rem
  862. Method Dispatch(id:Short, program:TBGFXProgram, numX:Int, numY:Int, numZ:Int, flags:Byte)
  863. bmx_bgfx_dispatch(id, program.programHandle, numX, numY, numZ, flags)
  864. End Method
  865. Rem
  866. bbdoc: Dispatches compute indirect.
  867. End Rem
  868. Method DispatchIndirect(id:Short, program:TBGFXProgram, indirectBuffer:Short, start:Short, num:Short, flags:Byte)
  869. bmx_bgfx_dispatch_indirect(id, program.programHandle, indirectBuffer, start, num, flags)
  870. End Method
  871. Rem
  872. bbdoc: Discards all previously set state for draw or compute call.
  873. End Rem
  874. Method Discard()
  875. bmx_bgfx_discard()
  876. End Method
  877. Rem
  878. bbdoc: Blits texture 2D region between two 2D textures.
  879. End Rem
  880. Method Blit(id:Short, dstTexture:Short, dstMip:Byte, dstX:Short, dstY:Short, dstZ:Short, srcTexture:Short, srcMip:Byte, srcX:Short, srcY:Short, srcZ:Short, width:Short, height:Short, depth:Short)
  881. bmx_bgfx_blit(id, dstTexture, dstMip, dstX, dstY, dstZ, srcTexture, srcMip, srcX, srcY, srcZ, width, height, depth)
  882. End Method
  883. End Type
  884. Rem
  885. bbdoc: API for multi-threaded submission.
  886. End Rem
  887. Type TBGFXEncoder Extends TBGFXRenderBase
  888. Field encoderPtr:Byte Ptr
  889. Function _create:TBGFXEncoder(encoderPtr:Byte Ptr)
  890. If encoderPtr Then
  891. Local this:TBGFXEncoder = New TBGFXEncoder
  892. this.encoderPtr = encoderPtr
  893. Return this
  894. End If
  895. End Function
  896. Rem
  897. bbdoc: Begins submitting draw calls from thread.
  898. End Rem
  899. Function BeginDraw:TBGFXEncoder()
  900. Return _create(bgfx_begin())
  901. End Function
  902. Rem
  903. bbdoc: Ends submitting draw calls from thread.
  904. End Rem
  905. Method EndDraw()
  906. bgfx_end(encoderPtr)
  907. End Method
  908. Rem
  909. bbdoc: Sets a debug marker.
  910. about: This allows you to group graphics calls together for easy browsing in graphics debugging tools.
  911. End Rem
  912. Method SetMarker(marker:String)
  913. bmx_bgfx_encoder_set_marker(encoderPtr, marker)
  914. End Method
  915. Rem
  916. bbdoc: Sets render states for draw primitive.
  917. End Rem
  918. Method SetState(state:Long, rgba:Int)
  919. bmx_bgfx_encoder_set_state(encoderPtr, state, rgba)
  920. End Method
  921. Rem
  922. bbdoc: Sets condition for rendering.
  923. End Rem
  924. Method SetCondition(occlusionQuery:Short, visible:Int)
  925. bmx_bgfx_encoder_set_condition(encoderPtr, occlusionQuery, visible)
  926. End Method
  927. Rem
  928. bbdoc: Sets stencil test state.
  929. End Rem
  930. Method SetStencil(fstencil:Int, bstencil:Int = BGFX_STENCIL_NONE)
  931. bmx_bgfx_encoder_set_stencil(encoderPtr, fstencil, bstencil)
  932. End Method
  933. Rem
  934. bbdoc: Sets scissor for draw primitive.
  935. returns: Scissor cache index.
  936. about: To scissor for all primitives in view see TBGFX.SetViewScissor
  937. End Rem
  938. Method SetScissor:Short(x:Short, y:Short, width:Short, height:Short)
  939. Return bmx_bgfx_encoder_set_scissor(encoderPtr, x, y, width, height)
  940. End Method
  941. Rem
  942. bbdoc: Set scissor from cache for draw primitive.
  943. End Rem
  944. Method SetScissorCached(cache:Short = $FFFF)
  945. bmx_bgfx_encoder_set_scissor_cached(encoderPtr, cache)
  946. End Method
  947. Rem
  948. bbdoc: Sets model matrix for draw primitive.
  949. returns: Index into matrix cache in case the same model matrix has to be used for other draw primitive call.
  950. about: If it is not called, model will be rendered with identity model matrix.
  951. End Rem
  952. Method SetTransform:Int(matrix:Float Ptr, num:Short = 1)
  953. Return bmx_bgfx_encoder_set_transform(encoderPtr, matrix, num)
  954. End Method
  955. Rem
  956. bbdoc: Reserves @num matrices in internal matrix cache.
  957. returns: Index into matrix cache.
  958. End Rem
  959. Method AllocTransform:Int(transform:TBGFXTransform, num:Short)
  960. Return bmx_bgfx_encoder_alloc_transform(encoderPtr, transform.transformPtr, num)
  961. End Method
  962. Rem
  963. bbdoc: Sets model matrix from matrix cache for draw primitive.
  964. End Rem
  965. Method SetTransformCached(cache:Int, num:Short)
  966. bmx_bgfx_encoder_set_transform_cached(encoderPtr, cache, num)
  967. End Method
  968. Rem
  969. bbdoc: Sets shader uniform parameter for draw primitive.
  970. End Rem
  971. Method SetUniform(uniform:TBGFXUniform, value:Byte Ptr, num:Short = 1)
  972. bmx_bgfx_encoder_set_uniform(encoderPtr, uniform.uniformHandle, value, num)
  973. End Method
  974. Rem
  975. bbdoc: Sets index buffer for draw primitive.
  976. End Rem
  977. Method SetIndexBuffer(indexBuffer:Short, firstIndex:Int, numIndices:Int)
  978. bmx_bgfx_encoder_set_index_buffer(encoderPtr, indexBuffer, firstIndex, numIndices)
  979. End Method
  980. Rem
  981. bbdoc: Sets index buffer for draw primitive.
  982. End Rem
  983. Method SetDynamicIndexBuffer(dynamicIndexBuffer:Short, firstIndex:Int, numIndices:Int)
  984. bmx_bgfx_encoder_set_dynamic_index_buffer(encoderPtr, dynamicIndexBuffer, firstIndex, numIndices)
  985. End Method
  986. Rem
  987. bbdoc: Sets index buffer for draw primitive.
  988. End Rem
  989. Method SetTransientIndexBuffer(transientIndexBuffer:Short, firstIndex:Int, numIndices:Int)
  990. bmx_bgfx_encoder_set_transient_index_buffer(encoderPtr, transientIndexBuffer, firstIndex, numIndices)
  991. End Method
  992. Rem
  993. bbdoc: Sets vertex buffer for draw primitive.
  994. End Rem
  995. Method SetVertexBuffer(stream:Byte, vertexBuffer:Short, startVertex:Int, numVertices:Int)
  996. bmx_bgfx_encoder_set_vertex_buffer(encoderPtr, stream, vertexBuffer, startVertex, numVertices)
  997. End Method
  998. Rem
  999. bbdoc: Sets vertex buffer for draw primitive.
  1000. End Rem
  1001. Method SetDynamicVertexBuffer(stream:Byte, dynamicVertexBuffer:Short, startVertex:Int, numVertices:Int)
  1002. bmx_bgfx_encoder_set_dynamic_vertex_buffer(encoderPtr, stream, dynamicVertexBuffer, startVertex, numVertices)
  1003. End Method
  1004. Rem
  1005. bbdoc: Sets vertex buffer for draw primitive.
  1006. End Rem
  1007. Method SetTransientVertexBuffer(stream:Byte, transientVertexBuffer:Short, startVertex:Int, numVertices:Int)
  1008. bmx_bgfx_encoder_set_transient_vertex_buffer(encoderPtr, stream, transientVertexBuffer, startVertex, numVertices)
  1009. End Method
  1010. Rem
  1011. bbdoc:
  1012. End Rem
  1013. Method SetVertexCount(numVertices:Int)
  1014. bmx_bgfx_encoder_set_vertex_count(encoderPtr, numVertices)
  1015. End Method
  1016. Rem
  1017. bbdoc: Sets instance data buffer for draw primitive.
  1018. End Rem
  1019. Method SetInstanceDataBuffer(idb:TBGFXInstanceDataBuffer, start:Int, num:Int)
  1020. bmx_bgfx_encoder_set_instance_data_buffer(encoderPtr, idb.bufferPtr, start, num)
  1021. End Method
  1022. Rem
  1023. bbdoc: Sets instance data buffer for draw primitive.
  1024. End Rem
  1025. Method SetInstanceDataFromVertexBuffer(vertexBuffer:Short, startVertex:Int, num:Int)
  1026. bmx_bgfx_encoder_set_instance_data_from_vertex_buffer(encoderPtr, vertexBuffer, startVertex, num)
  1027. End Method
  1028. Rem
  1029. bbdoc: Sets instance data buffer for draw primitive.
  1030. End Rem
  1031. Method SetInstanceDataFromDynamicVertexBuffer(dynamicVertexBuffer:Short, startVertex:Int, num:Int)
  1032. bmx_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(encoderPtr, dynamicVertexBuffer, startVertex, num)
  1033. End Method
  1034. Rem
  1035. bbdoc: Set texture stage for draw primitive.
  1036. End Rem
  1037. Method SetTexture(stage:Byte, uniform:TBGFXUniform, texture:Int, flags:Int)
  1038. bmx_bgfx_encoder_set_texture(encoderPtr, stage, uniform.uniformHandle, texture, flags)
  1039. End Method
  1040. Rem
  1041. bbdoc: Submit an empty primitive for rendering.
  1042. about: Uniforms and draw state will be applied but no geometry will be submitted.
  1043. These empty draw calls will sort before ordinary draw calls.
  1044. End Rem
  1045. Method Touch(id:Short)
  1046. bmx_bgfx_encoder_touch(encoderPtr, id)
  1047. End Method
  1048. Rem
  1049. bbdoc: Submit primitive for rendering.
  1050. End Rem
  1051. Method Submit(id:Short, program:TBGFXProgram, depth:Int = 0, preserveState:Int = False)
  1052. bmx_bgfx_encoder_submit(encoderPtr, id, program.programHandle, depth, preserveState)
  1053. End Method
  1054. Rem
  1055. bbdoc: Submit primitive with occlusion query for rendering.
  1056. End Rem
  1057. Method SubmitOcclusionQuery(id:Short, program:TBGFXProgram, occlusionQuery:Short, depth:Int = 0, preserveState:Int = False)
  1058. bmx_bgfx_encoder_submit_occlusion_query(encoderPtr, id, program.programHandle, occlusionQuery, depth, preserveState)
  1059. End Method
  1060. Rem
  1061. bbdoc: Submits primitive for rendering with index and instance data info from indirect buffer.
  1062. End Rem
  1063. Method SubmitIndirect(id:Short, program:TBGFXProgram, indirectBuffer:Short, start:Short, num:Short, depth:Int = 0, preserveState:Int = False)
  1064. bmx_bgfx_encoder_submit_indirect(encoderPtr, id, program.programHandle, indirectBuffer, start, num, depth, preserveState)
  1065. End Method
  1066. Rem
  1067. bbdoc: Sets compute image from texture.
  1068. End Rem
  1069. Method SetImage(stage:Byte, texture:Short, mip:Byte, access:Int, format:Int)
  1070. bmx_bgfx_encoder_set_image(encoderPtr, stage, texture, mip, access, format)
  1071. End Method
  1072. Rem
  1073. bbdoc: Sets compute index buffer.
  1074. End Rem
  1075. Method SetComputeIndexBuffer(stage:Byte, indexBuffer:Short, access:Int)
  1076. bmx_bgfx_encoder_set_compute_index_buffer(encoderPtr, stage, indexBuffer, access)
  1077. End Method
  1078. Rem
  1079. bbdoc: Sets compute vertex buffer.
  1080. End Rem
  1081. Method SetComputeVertexBuffer(stage:Byte, vertexBuffer:Short, access:Int)
  1082. bmx_bgfx_encoder_set_compute_vertex_buffer(encoderPtr, stage, vertexBuffer, access)
  1083. End Method
  1084. Rem
  1085. bbdoc: Sets compute dynamic index buffer.
  1086. End Rem
  1087. Method SetComputeDynamicIndexBuffer(stage:Byte, dynamicIndexBuffer:Short, access:Int)
  1088. bmx_bgfx_encoder_set_compute_dynamic_index_buffer(encoderPtr, stage, dynamicIndexBuffer, access)
  1089. End Method
  1090. Rem
  1091. bbdoc: Sets compute dynamic vertex buffer.
  1092. End Rem
  1093. Method SetComputeDynamicVertexBuffer(stage:Byte, dynamicVertexBuffer:Short, access:Int)
  1094. bmx_bgfx_encoder_set_compute_dynamic_vertex_buffer(encoderPtr, stage, dynamicVertexBuffer, access)
  1095. End Method
  1096. Rem
  1097. bbdoc: Sets compute indirect buffer.
  1098. End Rem
  1099. Method SetComputeIndirectBuffer(stage:Byte, indirectBuffer:Short, access:Int)
  1100. bmx_bgfx_encoder_set_compute_indirect_buffer(encoderPtr, stage, indirectBuffer, access)
  1101. End Method
  1102. Rem
  1103. bbdoc: Dispatches compute.
  1104. End Rem
  1105. Method Dispatch(id:Short, program:TBGFXProgram, numX:Int, numY:Int, numZ:Int, flags:Byte)
  1106. bmx_bgfx_encoder_dispatch(encoderPtr, id, program.programHandle, numX, numY, numZ, flags)
  1107. End Method
  1108. Rem
  1109. bbdoc: Dispatches compute indirect.
  1110. End Rem
  1111. Method DispatchIndirect(id:Short, program:TBGFXProgram, indirectBuffer:Short, start:Short, num:Short, flags:Byte)
  1112. bmx_bgfx_encoder_dispatch_indirect(encoderPtr, id, program.programHandle, indirectBuffer, start, num, flags)
  1113. End Method
  1114. Rem
  1115. bbdoc: Discards all previously set state for draw or compute call.
  1116. End Rem
  1117. Method Discard()
  1118. bmx_bgfx_encoder_discard(encoderPtr)
  1119. End Method
  1120. Rem
  1121. bbdoc: Blits texture 2D region between two 2D textures.
  1122. End Rem
  1123. Method Blit(id:Short, dstTexture:Short, dstMip:Byte, dstX:Short, dstY:Short, dstZ:Short, srcTexture:Short, srcMip:Byte, srcX:Short, srcY:Short, srcZ:Short, width:Short, height:Short, depth:Short)
  1124. bmx_bgfx_encoder_blit(encoderPtr, id, dstTexture, dstMip, dstX, dstY, dstZ, srcTexture, srcMip, srcX, srcY, srcZ, width, height, depth)
  1125. End Method
  1126. End Type