1 /* 2 * 3 * AUTO GENERATED! DO NOT EDIT! 4 * 5 */ 6 7 module bindbc.bgfx.funcs; 8 9 private import bindbc.bgfx.types; 10 11 extern(C) @nogc nothrow: 12 13 version(BindBgfx_Static) 14 { 15 /** 16 * Init attachment. 17 * Params: 18 * _handle = Render target texture handle. 19 * _access = Access. See `Access::Enum`. 20 * _layer = Cubemap side or depth layer/slice. 21 * _mip = Mip level. 22 * _resolve = Resolve flags. See: `BGFX_RESOLVE_*` 23 */ 24 void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _mip, byte _resolve); 25 26 /** 27 * Start VertexLayout. 28 */ 29 bgfx_vertex_layout_t* bgfx_vertex_layout_begin(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType); 30 31 /** 32 * Add attribute to VertexLayout. 33 * Remarks: Must be called between begin/end. 34 * Params: 35 * _attrib = Attribute semantics. See: `bgfx::Attrib` 36 * _num = Number of elements 1, 2, 3 or 4. 37 * _type = Element type. 38 * _normalized = When using fixed point AttribType (f.e. Uint8) 39 * value will be normalized for vertex shader usage. When normalized 40 * is set to true, AttribType::Uint8 value in range 0-255 will be 41 * in range 0.0-1.0 in vertex shader. 42 * _asInt = Packaging rule for vertexPack, vertexUnpack, and 43 * vertexConvert for AttribType::Uint8 and AttribType::Int16. 44 * Unpacking code must be implemented inside vertex shader. 45 */ 46 bgfx_vertex_layout_t* bgfx_vertex_layout_add(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, byte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); 47 48 /** 49 * Decode attribute. 50 * Params: 51 * _attrib = Attribute semantics. See: `bgfx::Attrib` 52 * _num = Number of elements. 53 * _type = Element type. 54 * _normalized = Attribute is normalized. 55 * _asInt = Attribute is packed as int. 56 */ 57 void bgfx_vertex_layout_decode(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, byte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt); 58 59 /** 60 * Returns true if VertexLayout contains attribute. 61 * Params: 62 * _attrib = Attribute semantics. See: `bgfx::Attrib` 63 */ 64 bool bgfx_vertex_layout_has(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib); 65 66 /** 67 * Skip `_num` bytes in vertex stream. 68 */ 69 bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _this, byte _num); 70 71 /** 72 * End VertexLayout. 73 */ 74 void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this); 75 76 /** 77 * Pack vertex attribute into vertex stream format. 78 * Params: 79 * _input = Value to be packed into vertex stream. 80 * _inputNormalized = `true` if input value is already normalized. 81 * _attr = Attribute to pack. 82 * _layout = Vertex stream layout. 83 * _data = Destination vertex stream where data will be packed. 84 * _index = Vertex index that will be modified. 85 */ 86 void bgfx_vertex_pack(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index); 87 88 /** 89 * Unpack vertex attribute from vertex stream format. 90 * Params: 91 * _output = Result of unpacking. 92 * _attr = Attribute to unpack. 93 * _layout = Vertex stream layout. 94 * _data = Source vertex stream from where data will be unpacked. 95 * _index = Vertex index that will be unpacked. 96 */ 97 void bgfx_vertex_unpack(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index); 98 99 /** 100 * Converts vertex stream data from one vertex stream format to another. 101 * Params: 102 * _dstLayout = Destination vertex stream layout. 103 * _dstData = Destination vertex stream. 104 * _srcLayout = Source vertex stream layout. 105 * _srcData = Source vertex stream data. 106 * _num = Number of vertices to convert from source to destination. 107 */ 108 void bgfx_vertex_convert(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num); 109 110 /** 111 * Weld vertices. 112 * Params: 113 * _output = Welded vertices remapping table. The size of buffer 114 * must be the same as number of vertices. 115 * _layout = Vertex stream layout. 116 * _data = Vertex stream. 117 * _num = Number of vertices in vertex stream. 118 * _epsilon = Error tolerance for vertex position comparison. 119 */ 120 ushort bgfx_weld_vertices(ushort* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, ushort _num, float _epsilon); 121 122 /** 123 * Convert index buffer for use with different primitive topologies. 124 * Params: 125 * _conversion = Conversion type, see `TopologyConvert::Enum`. 126 * _dst = Destination index buffer. If this argument is NULL 127 * function will return number of indices after conversion. 128 * _dstSize = Destination index buffer in bytes. It must be 129 * large enough to contain output indices. If destination size is 130 * insufficient index buffer will be truncated. 131 * _indices = Source indices. 132 * _numIndices = Number of input indices. 133 * _index32 = Set to `true` if input indices are 32-bit. 134 */ 135 uint bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32); 136 137 /** 138 * Sort indices. 139 * Params: 140 * _sort = Sort order, see `TopologySort::Enum`. 141 * _dst = Destination index buffer. 142 * _dstSize = Destination index buffer in bytes. It must be 143 * large enough to contain output indices. If destination size is 144 * insufficient index buffer will be truncated. 145 * _dir = Direction (vector must be normalized). 146 * _pos = Position. 147 * _vertices = Pointer to first vertex represented as 148 * float x, y, z. Must contain at least number of vertices 149 * referencende by index buffer. 150 * _stride = Vertex stride. 151 * _indices = Source indices. 152 * _numIndices = Number of input indices. 153 * _index32 = Set to `true` if input indices are 32-bit. 154 */ 155 void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32); 156 157 /** 158 * Returns supported backend API renderers. 159 * Params: 160 * _max = Maximum number of elements in _enum array. 161 * _enum = Array where supported renderers will be written. 162 */ 163 byte bgfx_get_supported_renderers(byte _max, bgfx_renderer_type_t* _enum); 164 165 /** 166 * Returns name of renderer. 167 * Params: 168 * _type = Renderer backend type. See: `bgfx::RendererType` 169 */ 170 const(char)* bgfx_get_renderer_name(bgfx_renderer_type_t _type); 171 172 void bgfx_init_ctor(bgfx_init_t* _init); 173 174 /** 175 * Initialize bgfx library. 176 * Params: 177 * _init = Initialization parameters. See: `bgfx::Init` for more info. 178 */ 179 bool bgfx_init(const(bgfx_init_t)* _init); 180 181 /** 182 * Shutdown bgfx library. 183 */ 184 void bgfx_shutdown(); 185 186 /** 187 * Reset graphic settings and back-buffer size. 188 * Attention: This call doesn't actually change window size, it just 189 * resizes back-buffer. Windowing code has to change window size. 190 * Params: 191 * _width = Back-buffer width. 192 * _height = Back-buffer height. 193 * _flags = See: `BGFX_RESET_*` for more info. 194 * - `BGFX_RESET_NONE` - No reset flags. 195 * - `BGFX_RESET_FULLSCREEN` - Not supported yet. 196 * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA. 197 * - `BGFX_RESET_VSYNC` - Enable V-Sync. 198 * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy. 199 * - `BGFX_RESET_CAPTURE` - Begin screen capture. 200 * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU. 201 * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip 202 * occurs. Default behavior is that flip occurs before rendering new 203 * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. 204 * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB backbuffer. 205 * _format = Texture format. See: `TextureFormat::Enum`. 206 */ 207 void bgfx_reset(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format); 208 209 /** 210 * Advance to next frame. When using multithreaded renderer, this call 211 * just swaps internal buffers, kicks render thread, and returns. In 212 * singlethreaded renderer this call does frame rendering. 213 * Params: 214 * _capture = Capture frame with graphics debugger. 215 */ 216 uint bgfx_frame(bool _capture); 217 218 /** 219 * Returns current renderer backend API type. 220 * Remarks: 221 * Library must be initialized. 222 */ 223 bgfx_renderer_type_t bgfx_get_renderer_type(); 224 225 /** 226 * Returns renderer capabilities. 227 * Remarks: 228 * Library must be initialized. 229 */ 230 const(bgfx_caps_t)* bgfx_get_caps(); 231 232 /** 233 * Returns performance counters. 234 * Attention: Pointer returned is valid until `bgfx::frame` is called. 235 */ 236 const(bgfx_stats_t)* bgfx_get_stats(); 237 238 /** 239 * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. 240 * Params: 241 * _size = Size to allocate. 242 */ 243 const(bgfx_memory_t)* bgfx_alloc(uint _size); 244 245 /** 246 * Allocate buffer and copy data into it. Data will be freed inside bgfx. 247 * Params: 248 * _data = Pointer to data to be copied. 249 * _size = Size of data to be copied. 250 */ 251 const(bgfx_memory_t)* bgfx_copy(const(void)* _data, uint _size); 252 253 /** 254 * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call 255 * doesn't allocate memory for data. It just copies the _data pointer. You 256 * can pass `ReleaseFn` function pointer to release this memory after it's 257 * consumed, otherwise you must make sure _data is available for at least 2 258 * `bgfx::frame` calls. `ReleaseFn` function must be able to be called 259 * from any thread. 260 * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. 261 * Params: 262 * _data = Pointer to data. 263 * _size = Size of data. 264 */ 265 const(bgfx_memory_t)* bgfx_make_ref(const(void)* _data, uint _size); 266 267 /** 268 * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call 269 * doesn't allocate memory for data. It just copies the _data pointer. You 270 * can pass `ReleaseFn` function pointer to release this memory after it's 271 * consumed, otherwise you must make sure _data is available for at least 2 272 * `bgfx::frame` calls. `ReleaseFn` function must be able to be called 273 * from any thread. 274 * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. 275 * Params: 276 * _data = Pointer to data. 277 * _size = Size of data. 278 * _releaseFn = Callback function to release memory after use. 279 * _userData = User data to be passed to callback function. 280 */ 281 const(bgfx_memory_t)* bgfx_make_ref_release(const(void)* _data, uint _size, void* _releaseFn, void* _userData); 282 283 /** 284 * Set debug flags. 285 * Params: 286 * _debug = Available flags: 287 * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set 288 * all rendering calls will be skipped. This is useful when profiling 289 * to quickly assess potential bottlenecks between CPU and GPU. 290 * - `BGFX_DEBUG_PROFILER` - Enable profiler. 291 * - `BGFX_DEBUG_STATS` - Display internal statistics. 292 * - `BGFX_DEBUG_TEXT` - Display debug text. 293 * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering 294 * primitives will be rendered as lines. 295 */ 296 void bgfx_set_debug(uint _debug); 297 298 /** 299 * Clear internal debug text buffer. 300 * Params: 301 * _attr = Background color. 302 * _small = Default 8x16 or 8x8 font. 303 */ 304 void bgfx_dbg_text_clear(byte _attr, bool _small); 305 306 /** 307 * Print formatted data to internal debug text character-buffer (VGA-compatible text mode). 308 * Params: 309 * _x = Position x from the left corner of the window. 310 * _y = Position y from the top corner of the window. 311 * _attr = Color palette. Where top 4-bits represent index of background, and bottom 312 * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). 313 * _format = `printf` style format. 314 */ 315 void bgfx_dbg_text_printf(ushort _x, ushort _y, byte _attr, const(char)* _format, ... ); 316 317 /** 318 * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode). 319 * Params: 320 * _x = Position x from the left corner of the window. 321 * _y = Position y from the top corner of the window. 322 * _attr = Color palette. Where top 4-bits represent index of background, and bottom 323 * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). 324 * _format = `printf` style format. 325 * _argList = Variable arguments list for format string. 326 */ 327 void bgfx_dbg_text_vprintf(ushort _x, ushort _y, byte _attr, const(char)* _format, va_list _argList); 328 329 /** 330 * Draw image into internal debug text buffer. 331 * Params: 332 * _x = Position x from the left corner of the window. 333 * _y = Position y from the top corner of the window. 334 * _width = Image width. 335 * _height = Image height. 336 * _data = Raw image data (character/attribute raw encoding). 337 * _pitch = Image pitch in bytes. 338 */ 339 void bgfx_dbg_text_image(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch); 340 341 /** 342 * Create static index buffer. 343 * Params: 344 * _mem = Index buffer data. 345 * _flags = Buffer creation flags. 346 * - `BGFX_BUFFER_NONE` - No flags. 347 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 348 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 349 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 350 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 351 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 352 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 353 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 354 * buffers. 355 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 356 * index buffers. 357 */ 358 bgfx_index_buffer_handle_t bgfx_create_index_buffer(const(bgfx_memory_t)* _mem, ushort _flags); 359 360 /** 361 * Set static index buffer debug name. 362 * Params: 363 * _handle = Static index buffer handle. 364 * _name = Static index buffer name. 365 * _len = Static index buffer name length (if length is INT32_MAX, it's expected 366 * that _name is zero terminated string. 367 */ 368 void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len); 369 370 /** 371 * Destroy static index buffer. 372 * Params: 373 * _handle = Static index buffer handle. 374 */ 375 void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle); 376 377 /** 378 * Create vertex layout. 379 * Params: 380 * _layout = Vertex layout. 381 */ 382 bgfx_vertex_layout_handle_t bgfx_create_vertex_layout(const(bgfx_vertex_layout_t)* _layout); 383 384 /** 385 * Destroy vertex layout. 386 * Params: 387 * _layoutHandle = Vertex layout handle. 388 */ 389 void bgfx_destroy_vertex_layout(bgfx_vertex_layout_handle_t _layoutHandle); 390 391 /** 392 * Create static vertex buffer. 393 * Params: 394 * _mem = Vertex buffer data. 395 * _layout = Vertex layout. 396 * _flags = Buffer creation flags. 397 * - `BGFX_BUFFER_NONE` - No flags. 398 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 399 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 400 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 401 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 402 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 403 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 404 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. 405 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. 406 */ 407 bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); 408 409 /** 410 * Set static vertex buffer debug name. 411 * Params: 412 * _handle = Static vertex buffer handle. 413 * _name = Static vertex buffer name. 414 * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected 415 * that _name is zero terminated string. 416 */ 417 void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len); 418 419 /** 420 * Destroy static vertex buffer. 421 * Params: 422 * _handle = Static vertex buffer handle. 423 */ 424 void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle); 425 426 /** 427 * Create empty dynamic index buffer. 428 * Params: 429 * _num = Number of indices. 430 * _flags = Buffer creation flags. 431 * - `BGFX_BUFFER_NONE` - No flags. 432 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 433 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 434 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 435 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 436 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 437 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 438 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 439 * buffers. 440 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 441 * index buffers. 442 */ 443 bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint _num, ushort _flags); 444 445 /** 446 * Create dynamic index buffer and initialized it. 447 * Params: 448 * _mem = Index buffer data. 449 * _flags = Buffer creation flags. 450 * - `BGFX_BUFFER_NONE` - No flags. 451 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 452 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 453 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 454 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 455 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 456 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 457 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 458 * buffers. 459 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 460 * index buffers. 461 */ 462 bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const(bgfx_memory_t)* _mem, ushort _flags); 463 464 /** 465 * Update dynamic index buffer. 466 * Params: 467 * _handle = Dynamic index buffer handle. 468 * _startIndex = Start index. 469 * _mem = Index buffer data. 470 */ 471 void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem); 472 473 /** 474 * Destroy dynamic index buffer. 475 * Params: 476 * _handle = Dynamic index buffer handle. 477 */ 478 void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle); 479 480 /** 481 * Create empty dynamic vertex buffer. 482 * Params: 483 * _num = Number of vertices. 484 * _layout = Vertex layout. 485 * _flags = Buffer creation flags. 486 * - `BGFX_BUFFER_NONE` - No flags. 487 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 488 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 489 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 490 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 491 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 492 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 493 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 494 * buffers. 495 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 496 * index buffers. 497 */ 498 bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags); 499 500 /** 501 * Create dynamic vertex buffer and initialize it. 502 * Params: 503 * _mem = Vertex buffer data. 504 * _layout = Vertex layout. 505 * _flags = Buffer creation flags. 506 * - `BGFX_BUFFER_NONE` - No flags. 507 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 508 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 509 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 510 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 511 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 512 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 513 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 514 * buffers. 515 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 516 * index buffers. 517 */ 518 bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); 519 520 /** 521 * Update dynamic vertex buffer. 522 * Params: 523 * _handle = Dynamic vertex buffer handle. 524 * _startVertex = Start vertex. 525 * _mem = Vertex buffer data. 526 */ 527 void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem); 528 529 /** 530 * Destroy dynamic vertex buffer. 531 * Params: 532 * _handle = Dynamic vertex buffer handle. 533 */ 534 void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle); 535 536 /** 537 * Returns number of requested or maximum available indices. 538 * Params: 539 * _num = Number of required indices. 540 */ 541 uint bgfx_get_avail_transient_index_buffer(uint _num); 542 543 /** 544 * Returns number of requested or maximum available vertices. 545 * Params: 546 * _num = Number of required vertices. 547 * _layout = Vertex layout. 548 */ 549 uint bgfx_get_avail_transient_vertex_buffer(uint _num, const(bgfx_vertex_layout_t)* _layout); 550 551 /** 552 * Returns number of requested or maximum available instance buffer slots. 553 * Params: 554 * _num = Number of required instances. 555 * _stride = Stride per instance. 556 */ 557 uint bgfx_get_avail_instance_data_buffer(uint _num, ushort _stride); 558 559 /** 560 * Allocate transient index buffer. 561 * Remarks: 562 * Only 16-bit index buffer is supported. 563 * Params: 564 * _tib = TransientIndexBuffer structure is filled and is valid 565 * for the duration of frame, and it can be reused for multiple draw 566 * calls. 567 * _num = Number of indices to allocate. 568 */ 569 void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint _num); 570 571 /** 572 * Allocate transient vertex buffer. 573 * Params: 574 * _tvb = TransientVertexBuffer structure is filled and is valid 575 * for the duration of frame, and it can be reused for multiple draw 576 * calls. 577 * _num = Number of vertices to allocate. 578 * _layout = Vertex layout. 579 */ 580 void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout); 581 582 /** 583 * Check for required space and allocate transient vertex and index 584 * buffers. If both space requirements are satisfied function returns 585 * true. 586 * Remarks: 587 * Only 16-bit index buffer is supported. 588 * Params: 589 * _tvb = TransientVertexBuffer structure is filled and is valid 590 * for the duration of frame, and it can be reused for multiple draw 591 * calls. 592 * _layout = Vertex layout. 593 * _numVertices = Number of vertices to allocate. 594 * _tib = TransientIndexBuffer structure is filled and is valid 595 * for the duration of frame, and it can be reused for multiple draw 596 * calls. 597 * _numIndices = Number of indices to allocate. 598 */ 599 bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices); 600 601 /** 602 * Allocate instance data buffer. 603 * Params: 604 * _idb = InstanceDataBuffer structure is filled and is valid 605 * for duration of frame, and it can be reused for multiple draw 606 * calls. 607 * _num = Number of instances. 608 * _stride = Instance stride. Must be multiple of 16. 609 */ 610 void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride); 611 612 /** 613 * Create draw indirect buffer. 614 * Params: 615 * _num = Number of indirect calls. 616 */ 617 bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint _num); 618 619 /** 620 * Destroy draw indirect buffer. 621 * Params: 622 * _handle = Indirect buffer handle. 623 */ 624 void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle); 625 626 /** 627 * Create shader from memory buffer. 628 * Params: 629 * _mem = Shader binary. 630 */ 631 bgfx_shader_handle_t bgfx_create_shader(const(bgfx_memory_t)* _mem); 632 633 /** 634 * Returns the number of uniforms and uniform handles used inside a shader. 635 * Remarks: 636 * Only non-predefined uniforms are returned. 637 * Params: 638 * _handle = Shader handle. 639 * _uniforms = UniformHandle array where data will be stored. 640 * _max = Maximum capacity of array. 641 */ 642 ushort bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max); 643 644 /** 645 * Set shader debug name. 646 * Params: 647 * _handle = Shader handle. 648 * _name = Shader name. 649 * _len = Shader name length (if length is INT32_MAX, it's expected 650 * that _name is zero terminated string). 651 */ 652 void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const(char)* _name, int _len); 653 654 /** 655 * Destroy shader. 656 * Remarks: Once a shader program is created with _handle, 657 * it is safe to destroy that shader. 658 * Params: 659 * _handle = Shader handle. 660 */ 661 void bgfx_destroy_shader(bgfx_shader_handle_t _handle); 662 663 /** 664 * Create program with vertex and fragment shaders. 665 * Params: 666 * _vsh = Vertex shader. 667 * _fsh = Fragment shader. 668 * _destroyShaders = If true, shaders will be destroyed when program is destroyed. 669 */ 670 bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders); 671 672 /** 673 * Create program with compute shader. 674 * Params: 675 * _csh = Compute shader. 676 * _destroyShaders = If true, shaders will be destroyed when program is destroyed. 677 */ 678 bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders); 679 680 /** 681 * Destroy program. 682 * Params: 683 * _handle = Program handle. 684 */ 685 void bgfx_destroy_program(bgfx_program_handle_t _handle); 686 687 /** 688 * Validate texture parameters. 689 * Params: 690 * _depth = Depth dimension of volume texture. 691 * _cubeMap = Indicates that texture contains cubemap. 692 * _numLayers = Number of layers in texture array. 693 * _format = Texture format. See: `TextureFormat::Enum`. 694 * _flags = Texture flags. See `BGFX_TEXTURE_*`. 695 */ 696 bool bgfx_is_texture_valid(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); 697 698 /** 699 * Calculate amount of memory required for texture. 700 * Params: 701 * _info = Resulting texture info structure. See: `TextureInfo`. 702 * _width = Width. 703 * _height = Height. 704 * _depth = Depth dimension of volume texture. 705 * _cubeMap = Indicates that texture contains cubemap. 706 * _hasMips = Indicates that texture contains full mip-map chain. 707 * _numLayers = Number of layers in texture array. 708 * _format = Texture format. See: `TextureFormat::Enum`. 709 */ 710 void bgfx_calc_texture_size(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format); 711 712 /** 713 * Create texture from memory buffer. 714 * Params: 715 * _mem = DDS, KTX or PVR texture binary data. 716 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 717 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 718 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 719 * mode. 720 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 721 * sampling. 722 * _skip = Skip top level mips when parsing texture. 723 * _info = When non-`NULL` is specified it returns parsed texture information. 724 */ 725 bgfx_texture_handle_t bgfx_create_texture(const(bgfx_memory_t)* _mem, ulong _flags, byte _skip, bgfx_texture_info_t* _info); 726 727 /** 728 * Create 2D texture. 729 * Params: 730 * _width = Width. 731 * _height = Height. 732 * _hasMips = Indicates that texture contains full mip-map chain. 733 * _numLayers = Number of layers in texture array. Must be 1 if caps 734 * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. 735 * _format = Texture format. See: `TextureFormat::Enum`. 736 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 737 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 738 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 739 * mode. 740 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 741 * sampling. 742 * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If 743 * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 744 * 1, expected memory layout is texture and all mips together for each array element. 745 */ 746 bgfx_texture_handle_t bgfx_create_texture_2d(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); 747 748 /** 749 * Create texture with size based on backbuffer ratio. Texture will maintain ratio 750 * if back buffer resolution changes. 751 * Params: 752 * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`. 753 * _hasMips = Indicates that texture contains full mip-map chain. 754 * _numLayers = Number of layers in texture array. Must be 1 if caps 755 * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. 756 * _format = Texture format. See: `TextureFormat::Enum`. 757 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 758 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 759 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 760 * mode. 761 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 762 * sampling. 763 */ 764 bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); 765 766 /** 767 * Create 3D texture. 768 * Params: 769 * _width = Width. 770 * _height = Height. 771 * _depth = Depth. 772 * _hasMips = Indicates that texture contains full mip-map chain. 773 * _format = Texture format. See: `TextureFormat::Enum`. 774 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 775 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 776 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 777 * mode. 778 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 779 * sampling. 780 * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If 781 * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 782 * 1, expected memory layout is texture and all mips together for each array element. 783 */ 784 bgfx_texture_handle_t bgfx_create_texture_3d(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); 785 786 /** 787 * Create Cube texture. 788 * Params: 789 * _size = Cube side size. 790 * _hasMips = Indicates that texture contains full mip-map chain. 791 * _numLayers = Number of layers in texture array. Must be 1 if caps 792 * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. 793 * _format = Texture format. See: `TextureFormat::Enum`. 794 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 795 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 796 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 797 * mode. 798 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 799 * sampling. 800 * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If 801 * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 802 * 1, expected memory layout is texture and all mips together for each array element. 803 */ 804 bgfx_texture_handle_t bgfx_create_texture_cube(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); 805 806 /** 807 * Update 2D texture. 808 * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info. 809 * Params: 810 * _handle = Texture handle. 811 * _layer = Layer in texture array. 812 * _mip = Mip level. 813 * _x = X offset in texture. 814 * _y = Y offset in texture. 815 * _width = Width of texture block. 816 * _height = Height of texture block. 817 * _mem = Texture update data. 818 * _pitch = Pitch of input image (bytes). When _pitch is set to 819 * UINT16_MAX, it will be calculated internally based on _width. 820 */ 821 void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, ushort _layer, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); 822 823 /** 824 * Update 3D texture. 825 * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info. 826 * Params: 827 * _handle = Texture handle. 828 * _mip = Mip level. 829 * _x = X offset in texture. 830 * _y = Y offset in texture. 831 * _z = Z offset in texture. 832 * _width = Width of texture block. 833 * _height = Height of texture block. 834 * _depth = Depth of texture block. 835 * _mem = Texture update data. 836 */ 837 void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, byte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem); 838 839 /** 840 * Update Cube texture. 841 * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info. 842 * Params: 843 * _handle = Texture handle. 844 * _layer = Layer in texture array. 845 * _side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`, 846 * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. 847 * +----------+ 848 * |-z 2| 849 * | ^ +y | 850 * | | | Unfolded cube: 851 * | +---->+x | 852 * +----------+----------+----------+----------+ 853 * |+y 1|+y 4|+y 0|+y 5| 854 * | ^ -x | ^ +z | ^ +x | ^ -z | 855 * | | | | | | | | | 856 * | +---->+z | +---->+x | +---->-z | +---->-x | 857 * +----------+----------+----------+----------+ 858 * |+z 3| 859 * | ^ -y | 860 * | | | 861 * | +---->+x | 862 * +----------+ 863 * _mip = Mip level. 864 * _x = X offset in texture. 865 * _y = Y offset in texture. 866 * _width = Width of texture block. 867 * _height = Height of texture block. 868 * _mem = Texture update data. 869 * _pitch = Pitch of input image (bytes). When _pitch is set to 870 * UINT16_MAX, it will be calculated internally based on _width. 871 */ 872 void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, ushort _layer, byte _side, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); 873 874 /** 875 * Read back texture content. 876 * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag. 877 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. 878 * Params: 879 * _handle = Texture handle. 880 * _data = Destination buffer. 881 * _mip = Mip level. 882 */ 883 uint bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, byte _mip); 884 885 /** 886 * Set texture debug name. 887 * Params: 888 * _handle = Texture handle. 889 * _name = Texture name. 890 * _len = Texture name length (if length is INT32_MAX, it's expected 891 * that _name is zero terminated string. 892 */ 893 void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const(char)* _name, int _len); 894 895 /** 896 * Returns texture direct access pointer. 897 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature 898 * is available on GPUs that have unified memory architecture (UMA) support. 899 * Params: 900 * _handle = Texture handle. 901 */ 902 void* bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle); 903 904 /** 905 * Destroy texture. 906 * Params: 907 * _handle = Texture handle. 908 */ 909 void bgfx_destroy_texture(bgfx_texture_handle_t _handle); 910 911 /** 912 * Create frame buffer (simple). 913 * Params: 914 * _width = Texture width. 915 * _height = Texture height. 916 * _format = Texture format. See: `TextureFormat::Enum`. 917 * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 918 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 919 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 920 * mode. 921 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 922 * sampling. 923 */ 924 bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags); 925 926 /** 927 * Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio 928 * if back buffer resolution changes. 929 * Params: 930 * _ratio = Frame buffer size in respect to back-buffer size. See: 931 * `BackbufferRatio::Enum`. 932 * _format = Texture format. See: `TextureFormat::Enum`. 933 * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 934 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 935 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 936 * mode. 937 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 938 * sampling. 939 */ 940 bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags); 941 942 /** 943 * Create MRT frame buffer from texture handles (simple). 944 * Params: 945 * _num = Number of texture handles. 946 * _handles = Texture attachments. 947 * _destroyTexture = If true, textures will be destroyed when 948 * frame buffer is destroyed. 949 */ 950 bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(byte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture); 951 952 /** 953 * Create MRT frame buffer from texture handles with specific layer and 954 * mip level. 955 * Params: 956 * _num = Number of attachements. 957 * _attachment = Attachment texture info. See: `bgfx::Attachment`. 958 * _destroyTexture = If true, textures will be destroyed when 959 * frame buffer is destroyed. 960 */ 961 bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(byte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture); 962 963 /** 964 * Create frame buffer for multiple window rendering. 965 * Remarks: 966 * Frame buffer cannot be used for sampling. 967 * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`. 968 * Params: 969 * _nwh = OS' target native window handle. 970 * _width = Window back buffer width. 971 * _height = Window back buffer height. 972 * _format = Window back buffer color format. 973 * _depthFormat = Window back buffer depth format. 974 */ 975 bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat); 976 977 /** 978 * Set frame buffer debug name. 979 * Params: 980 * _handle = Frame buffer handle. 981 * _name = Frame buffer name. 982 * _len = Frame buffer name length (if length is INT32_MAX, it's expected 983 * that _name is zero terminated string. 984 */ 985 void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len); 986 987 /** 988 * Obtain texture handle of frame buffer attachment. 989 * Params: 990 * _handle = Frame buffer handle. 991 */ 992 bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _handle, byte _attachment); 993 994 /** 995 * Destroy frame buffer. 996 * Params: 997 * _handle = Frame buffer handle. 998 */ 999 void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle); 1000 1001 /** 1002 * Create shader uniform parameter. 1003 * Remarks: 1004 * 1. Uniform names are unique. It's valid to call `bgfx::createUniform` 1005 * multiple times with the same uniform name. The library will always 1006 * return the same handle, but the handle reference count will be 1007 * incremented. This means that the same number of `bgfx::destroyUniform` 1008 * must be called to properly destroy the uniform. 1009 * 2. Predefined uniforms (declared in `bgfx_shader.sh`): 1010 * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current 1011 * view, in pixels. 1012 * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse 1013 * width and height 1014 * - `u_view mat4` - view matrix 1015 * - `u_invView mat4` - inverted view matrix 1016 * - `u_proj mat4` - projection matrix 1017 * - `u_invProj mat4` - inverted projection matrix 1018 * - `u_viewProj mat4` - concatenated view projection matrix 1019 * - `u_invViewProj mat4` - concatenated inverted view projection matrix 1020 * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices. 1021 * - `u_modelView mat4` - concatenated model view matrix, only first 1022 * model matrix from array is used. 1023 * - `u_modelViewProj mat4` - concatenated model view projection matrix. 1024 * - `u_alphaRef float` - alpha reference value for alpha test. 1025 * Params: 1026 * _name = Uniform name in shader. 1027 * _type = Type of uniform (See: `bgfx::UniformType`). 1028 * _num = Number of elements in array. 1029 */ 1030 bgfx_uniform_handle_t bgfx_create_uniform(const(char)* _name, bgfx_uniform_type_t _type, ushort _num); 1031 1032 /** 1033 * Retrieve uniform info. 1034 * Params: 1035 * _handle = Handle to uniform object. 1036 * _info = Uniform info. 1037 */ 1038 void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info); 1039 1040 /** 1041 * Destroy shader uniform parameter. 1042 * Params: 1043 * _handle = Handle to uniform object. 1044 */ 1045 void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle); 1046 1047 /** 1048 * Create occlusion query. 1049 */ 1050 bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(); 1051 1052 /** 1053 * Retrieve occlusion query result from previous frame. 1054 * Params: 1055 * _handle = Handle to occlusion query object. 1056 * _result = Number of pixels that passed test. This argument 1057 * can be `NULL` if result of occlusion query is not needed. 1058 */ 1059 bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int* _result); 1060 1061 /** 1062 * Destroy occlusion query. 1063 * Params: 1064 * _handle = Handle to occlusion query object. 1065 */ 1066 void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle); 1067 1068 /** 1069 * Set palette color value. 1070 * Params: 1071 * _index = Index into palette. 1072 * _rgba = RGBA floating point values. 1073 */ 1074 void bgfx_set_palette_color(byte _index, const float[4] _rgba); 1075 1076 /** 1077 * Set palette color value. 1078 * Params: 1079 * _index = Index into palette. 1080 * _rgba = Packed 32-bit RGBA value. 1081 */ 1082 void bgfx_set_palette_color_rgba8(byte _index, uint _rgba); 1083 1084 /** 1085 * Set view name. 1086 * Remarks: 1087 * This is debug only feature. 1088 * In graphics debugger view name will appear as: 1089 * "nnnc <view name>" 1090 * ^ ^ ^ 1091 * | +--- compute (C) 1092 * +------ view id 1093 * Params: 1094 * _id = View id. 1095 * _name = View name. 1096 */ 1097 void bgfx_set_view_name(bgfx_view_id_t _id, const(char)* _name); 1098 1099 /** 1100 * Set view rectangle. Draw primitive outside view will be clipped. 1101 * Params: 1102 * _id = View id. 1103 * _x = Position x from the left corner of the window. 1104 * _y = Position y from the top corner of the window. 1105 * _width = Width of view port region. 1106 * _height = Height of view port region. 1107 */ 1108 void bgfx_set_view_rect(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); 1109 1110 /** 1111 * Set view rectangle. Draw primitive outside view will be clipped. 1112 * Params: 1113 * _id = View id. 1114 * _x = Position x from the left corner of the window. 1115 * _y = Position y from the top corner of the window. 1116 * _ratio = Width and height will be set in respect to back-buffer size. 1117 * See: `BackbufferRatio::Enum`. 1118 */ 1119 void bgfx_set_view_rect_ratio(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio); 1120 1121 /** 1122 * Set view scissor. Draw primitive outside view will be clipped. When 1123 * _x, _y, _width and _height are set to 0, scissor will be disabled. 1124 * Params: 1125 * _id = View id. 1126 * _x = Position x from the left corner of the window. 1127 * _y = Position y from the top corner of the window. 1128 * _width = Width of view scissor region. 1129 * _height = Height of view scissor region. 1130 */ 1131 void bgfx_set_view_scissor(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); 1132 1133 /** 1134 * Set view clear flags. 1135 * Params: 1136 * _id = View id. 1137 * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear 1138 * operation. See: `BGFX_CLEAR_*`. 1139 * _rgba = Color clear value. 1140 * _depth = Depth clear value. 1141 * _stencil = Stencil clear value. 1142 */ 1143 void bgfx_set_view_clear(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, byte _stencil); 1144 1145 /** 1146 * Set view clear flags with different clear color for each 1147 * frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color 1148 * palette. 1149 * Params: 1150 * _id = View id. 1151 * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear 1152 * operation. See: `BGFX_CLEAR_*`. 1153 * _depth = Depth clear value. 1154 * _stencil = Stencil clear value. 1155 * _c0 = Palette index for frame buffer attachment 0. 1156 * _c1 = Palette index for frame buffer attachment 1. 1157 * _c2 = Palette index for frame buffer attachment 2. 1158 * _c3 = Palette index for frame buffer attachment 3. 1159 * _c4 = Palette index for frame buffer attachment 4. 1160 * _c5 = Palette index for frame buffer attachment 5. 1161 * _c6 = Palette index for frame buffer attachment 6. 1162 * _c7 = Palette index for frame buffer attachment 7. 1163 */ 1164 void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, ushort _flags, float _depth, byte _stencil, byte _c0, byte _c1, byte _c2, byte _c3, byte _c4, byte _c5, byte _c6, byte _c7); 1165 1166 /** 1167 * Set view sorting mode. 1168 * Remarks: 1169 * View mode must be set prior calling `bgfx::submit` for the view. 1170 * Params: 1171 * _id = View id. 1172 * _mode = View sort mode. See `ViewMode::Enum`. 1173 */ 1174 void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode); 1175 1176 /** 1177 * Set view frame buffer. 1178 * Remarks: 1179 * Not persistent after `bgfx::reset` call. 1180 * Params: 1181 * _id = View id. 1182 * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as 1183 * frame buffer handle will draw primitives from this view into 1184 * default back buffer. 1185 */ 1186 void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle); 1187 1188 /** 1189 * Set view view and projection matrices, all draw primitives in this 1190 * view will use these matrices. 1191 * Params: 1192 * _id = View id. 1193 * _view = View matrix. 1194 * _proj = Projection matrix. 1195 */ 1196 void bgfx_set_view_transform(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj); 1197 1198 /** 1199 * Post submit view reordering. 1200 * Params: 1201 * _id = First view id. 1202 * _num = Number of views to remap. 1203 * _order = View remap id table. Passing `NULL` will reset view ids 1204 * to default state. 1205 */ 1206 void bgfx_set_view_order(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order); 1207 1208 /** 1209 * Begin submitting draw calls from thread. 1210 * Params: 1211 * _forThread = Explicitly request an encoder for a worker thread. 1212 */ 1213 bgfx_encoder_t* bgfx_encoder_begin(bool _forThread); 1214 1215 /** 1216 * End submitting draw calls from thread. 1217 * Params: 1218 * _encoder = Encoder. 1219 */ 1220 void bgfx_encoder_end(bgfx_encoder_t* _encoder); 1221 1222 /** 1223 * Sets a debug marker. This allows you to group graphics calls together for easy browsing in 1224 * graphics debugging tools. 1225 * Params: 1226 * _marker = Marker string. 1227 */ 1228 void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const(char)* _marker); 1229 1230 /** 1231 * Set render states for draw primitive. 1232 * Remarks: 1233 * 1. To setup more complex states use: 1234 * `BGFX_STATE_ALPHA_REF(_ref)`, 1235 * `BGFX_STATE_POINT_SIZE(_size)`, 1236 * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, 1237 * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, 1238 * `BGFX_STATE_BLEND_EQUATION(_equation)`, 1239 * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` 1240 * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend 1241 * equation is specified. 1242 * Params: 1243 * _state = State flags. Default state for primitive type is 1244 * triangles. See: `BGFX_STATE_DEFAULT`. 1245 * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. 1246 * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. 1247 * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. 1248 * - `BGFX_STATE_CULL_*` - Backface culling mode. 1249 * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. 1250 * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. 1251 * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. 1252 * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and 1253 * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. 1254 */ 1255 void bgfx_encoder_set_state(bgfx_encoder_t* _this, ulong _state, uint _rgba); 1256 1257 /** 1258 * Set condition for rendering. 1259 * Params: 1260 * _handle = Occlusion query handle. 1261 * _visible = Render if occlusion query is visible. 1262 */ 1263 void bgfx_encoder_set_condition(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible); 1264 1265 /** 1266 * Set stencil test state. 1267 * Params: 1268 * _fstencil = Front stencil state. 1269 * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` 1270 * _fstencil is applied to both front and back facing primitives. 1271 */ 1272 void bgfx_encoder_set_stencil(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil); 1273 1274 /** 1275 * Set scissor for draw primitive. 1276 * Remarks: 1277 * To scissor for all primitives in view see `bgfx::setViewScissor`. 1278 * Params: 1279 * _x = Position x from the left corner of the window. 1280 * _y = Position y from the top corner of the window. 1281 * _width = Width of view scissor region. 1282 * _height = Height of view scissor region. 1283 */ 1284 ushort bgfx_encoder_set_scissor(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height); 1285 1286 /** 1287 * Set scissor from cache for draw primitive. 1288 * Remarks: 1289 * To scissor for all primitives in view see `bgfx::setViewScissor`. 1290 * Params: 1291 * _cache = Index in scissor cache. 1292 */ 1293 void bgfx_encoder_set_scissor_cached(bgfx_encoder_t* _this, ushort _cache); 1294 1295 /** 1296 * Set model matrix for draw primitive. If it is not called, 1297 * the model will be rendered with an identity model matrix. 1298 * Params: 1299 * _mtx = Pointer to first matrix in array. 1300 * _num = Number of matrices in array. 1301 */ 1302 uint bgfx_encoder_set_transform(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num); 1303 1304 /** 1305 * Set model matrix from matrix cache for draw primitive. 1306 * Params: 1307 * _cache = Index in matrix cache. 1308 * _num = Number of matrices from cache. 1309 */ 1310 void bgfx_encoder_set_transform_cached(bgfx_encoder_t* _this, uint _cache, ushort _num); 1311 1312 /** 1313 * Reserve matrices in internal matrix cache. 1314 * Attention: Pointer returned can be modifed until `bgfx::frame` is called. 1315 * Params: 1316 * _transform = Pointer to `Transform` structure. 1317 * _num = Number of matrices. 1318 */ 1319 uint bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num); 1320 1321 /** 1322 * Set shader uniform parameter for draw primitive. 1323 * Params: 1324 * _handle = Uniform. 1325 * _value = Pointer to uniform data. 1326 * _num = Number of elements. Passing `UINT16_MAX` will 1327 * use the _num passed on uniform creation. 1328 */ 1329 void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); 1330 1331 /** 1332 * Set index buffer for draw primitive. 1333 * Params: 1334 * _handle = Index buffer. 1335 * _firstIndex = First index to render. 1336 * _numIndices = Number of indices to render. 1337 */ 1338 void bgfx_encoder_set_index_buffer(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 1339 1340 /** 1341 * Set index buffer for draw primitive. 1342 * Params: 1343 * _handle = Dynamic index buffer. 1344 * _firstIndex = First index to render. 1345 * _numIndices = Number of indices to render. 1346 */ 1347 void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 1348 1349 /** 1350 * Set index buffer for draw primitive. 1351 * Params: 1352 * _tib = Transient index buffer. 1353 * _firstIndex = First index to render. 1354 * _numIndices = Number of indices to render. 1355 */ 1356 void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); 1357 1358 /** 1359 * Set vertex buffer for draw primitive. 1360 * Params: 1361 * _stream = Vertex stream. 1362 * _handle = Vertex buffer. 1363 * _startVertex = First vertex to render. 1364 * _numVertices = Number of vertices to render. 1365 * _layoutHandle = Vertex layout for aliasing vertex buffer. 1366 */ 1367 void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); 1368 1369 /** 1370 * Set vertex buffer for draw primitive. 1371 * Params: 1372 * _stream = Vertex stream. 1373 * _handle = Dynamic vertex buffer. 1374 * _startVertex = First vertex to render. 1375 * _numVertices = Number of vertices to render. 1376 * _layoutHandle = Vertex layout for aliasing vertex buffer. 1377 */ 1378 void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); 1379 1380 /** 1381 * Set vertex buffer for draw primitive. 1382 * Params: 1383 * _stream = Vertex stream. 1384 * _tvb = Transient vertex buffer. 1385 * _startVertex = First vertex to render. 1386 * _numVertices = Number of vertices to render. 1387 * _layoutHandle = Vertex layout for aliasing vertex buffer. 1388 */ 1389 void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); 1390 1391 /** 1392 * Set number of vertices for auto generated vertices use in conjuction 1393 * with gl_VertexID. 1394 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 1395 * Params: 1396 * _numVertices = Number of vertices. 1397 */ 1398 void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint _numVertices); 1399 1400 /** 1401 * Set instance data buffer for draw primitive. 1402 * Params: 1403 * _idb = Transient instance data buffer. 1404 * _start = First instance data. 1405 * _num = Number of data instances. 1406 */ 1407 void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); 1408 1409 /** 1410 * Set instance data buffer for draw primitive. 1411 * Params: 1412 * _handle = Vertex buffer. 1413 * _startVertex = First instance data. 1414 * _num = Number of data instances. 1415 * Set instance data buffer for draw primitive. 1416 */ 1417 void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 1418 1419 /** 1420 * Set instance data buffer for draw primitive. 1421 * Params: 1422 * _handle = Dynamic vertex buffer. 1423 * _startVertex = First instance data. 1424 * _num = Number of data instances. 1425 */ 1426 void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 1427 1428 /** 1429 * Set number of instances for auto generated instances use in conjuction 1430 * with gl_InstanceID. 1431 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 1432 */ 1433 void bgfx_encoder_set_instance_count(bgfx_encoder_t* _this, uint _numInstances); 1434 1435 /** 1436 * Set texture stage for draw primitive. 1437 * Params: 1438 * _stage = Texture unit. 1439 * _sampler = Program sampler. 1440 * _handle = Texture handle. 1441 * _flags = Texture sampling mode. Default value UINT32_MAX uses 1442 * texture sampling settings from the texture. 1443 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 1444 * mode. 1445 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 1446 * sampling. 1447 */ 1448 void bgfx_encoder_set_texture(bgfx_encoder_t* _this, byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); 1449 1450 /** 1451 * Submit an empty primitive for rendering. Uniforms and draw state 1452 * will be applied but no geometry will be submitted. 1453 * Remarks: 1454 * These empty draw calls will sort before ordinary draw calls. 1455 * Params: 1456 * _id = View id. 1457 */ 1458 void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id); 1459 1460 /** 1461 * Submit primitive for rendering. 1462 * Params: 1463 * _id = View id. 1464 * _program = Program. 1465 * _depth = Depth for sorting. 1466 * _preserveState = Preserve internal draw state for next draw call submit. 1467 */ 1468 void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, bool _preserveState); 1469 1470 /** 1471 * Submit primitive with occlusion query for rendering. 1472 * Params: 1473 * _id = View id. 1474 * _program = Program. 1475 * _occlusionQuery = Occlusion query. 1476 * _depth = Depth for sorting. 1477 * _preserveState = Preserve internal draw state for next draw call submit. 1478 */ 1479 void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, bool _preserveState); 1480 1481 /** 1482 * Submit primitive for rendering with index and instance data info from 1483 * indirect buffer. 1484 * Params: 1485 * _id = View id. 1486 * _program = Program. 1487 * _indirectHandle = Indirect buffer. 1488 * _start = First element in indirect buffer. 1489 * _num = Number of dispatches. 1490 * _depth = Depth for sorting. 1491 * _preserveState = Preserve internal draw state for next draw call submit. 1492 */ 1493 void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState); 1494 1495 /** 1496 * Set compute index buffer. 1497 * Params: 1498 * _stage = Compute stage. 1499 * _handle = Index buffer handle. 1500 * _access = Buffer access. See `Access::Enum`. 1501 */ 1502 void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); 1503 1504 /** 1505 * Set compute vertex buffer. 1506 * Params: 1507 * _stage = Compute stage. 1508 * _handle = Vertex buffer handle. 1509 * _access = Buffer access. See `Access::Enum`. 1510 */ 1511 void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); 1512 1513 /** 1514 * Set compute dynamic index buffer. 1515 * Params: 1516 * _stage = Compute stage. 1517 * _handle = Dynamic index buffer handle. 1518 * _access = Buffer access. See `Access::Enum`. 1519 */ 1520 void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); 1521 1522 /** 1523 * Set compute dynamic vertex buffer. 1524 * Params: 1525 * _stage = Compute stage. 1526 * _handle = Dynamic vertex buffer handle. 1527 * _access = Buffer access. See `Access::Enum`. 1528 */ 1529 void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); 1530 1531 /** 1532 * Set compute indirect buffer. 1533 * Params: 1534 * _stage = Compute stage. 1535 * _handle = Indirect buffer handle. 1536 * _access = Buffer access. See `Access::Enum`. 1537 */ 1538 void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_t* _this, byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); 1539 1540 /** 1541 * Set compute image from texture. 1542 * Params: 1543 * _stage = Compute stage. 1544 * _handle = Texture handle. 1545 * _mip = Mip level. 1546 * _access = Image access. See `Access::Enum`. 1547 * _format = Texture format. See: `TextureFormat::Enum`. 1548 */ 1549 void bgfx_encoder_set_image(bgfx_encoder_t* _this, byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); 1550 1551 /** 1552 * Dispatch compute. 1553 * Params: 1554 * _id = View id. 1555 * _program = Compute program. 1556 * _numX = Number of groups X. 1557 * _numY = Number of groups Y. 1558 * _numZ = Number of groups Z. 1559 */ 1560 void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ); 1561 1562 /** 1563 * Dispatch compute indirect. 1564 * Params: 1565 * _id = View id. 1566 * _program = Compute program. 1567 * _indirectHandle = Indirect buffer. 1568 * _start = First element in indirect buffer. 1569 * _num = Number of dispatches. 1570 */ 1571 void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num); 1572 1573 /** 1574 * Discard all previously set state for draw or compute call. 1575 */ 1576 void bgfx_encoder_discard(bgfx_encoder_t* _this); 1577 1578 /** 1579 * Blit 2D texture region between two 2D textures. 1580 * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. 1581 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. 1582 * Params: 1583 * _id = View id. 1584 * _dst = Destination texture handle. 1585 * _dstMip = Destination texture mip level. 1586 * _dstX = Destination texture X position. 1587 * _dstY = Destination texture Y position. 1588 * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube 1589 * this argument represents destination texture cube face. For 3D texture this argument 1590 * represents destination texture Z position. 1591 * _src = Source texture handle. 1592 * _srcMip = Source texture mip level. 1593 * _srcX = Source texture X position. 1594 * _srcY = Source texture Y position. 1595 * _srcZ = If texture is 2D this argument should be 0. If source texture is cube 1596 * this argument represents source texture cube face. For 3D texture this argument 1597 * represents source texture Z position. 1598 * _width = Width of region. 1599 * _height = Height of region. 1600 * _depth = If texture is 3D this argument represents depth of region, otherwise it's 1601 * unused. 1602 */ 1603 void bgfx_encoder_blit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); 1604 1605 /** 1606 * Request screen shot of window back buffer. 1607 * Remarks: 1608 * `bgfx::CallbackI::screenShot` must be implemented. 1609 * Attention: Frame buffer handle must be created with OS' target native window handle. 1610 * Params: 1611 * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be 1612 * made for main window back buffer. 1613 * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback. 1614 */ 1615 void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath); 1616 1617 /** 1618 * Render frame. 1619 * Attention: `bgfx::renderFrame` is blocking call. It waits for 1620 * `bgfx::frame` to be called from API thread to process frame. 1621 * If timeout value is passed call will timeout and return even 1622 * if `bgfx::frame` is not called. 1623 * Warning: This call should be only used on platforms that don't 1624 * allow creating separate rendering thread. If it is called before 1625 * to bgfx::init, render thread won't be created by bgfx::init call. 1626 * Params: 1627 * _msecs = Timeout in milliseconds. 1628 */ 1629 bgfx_render_frame_t bgfx_render_frame(int _msecs); 1630 1631 /** 1632 * Set platform data. 1633 * Warning: Must be called before `bgfx::init`. 1634 * Params: 1635 * _data = Platform data. 1636 */ 1637 void bgfx_set_platform_data(const(bgfx_platform_data_t)* _data); 1638 1639 /** 1640 * Get internal data for interop. 1641 * Attention: It's expected you understand some bgfx internals before you 1642 * use this call. 1643 * Warning: Must be called only on render thread. 1644 */ 1645 const(bgfx_internal_data_t)* bgfx_get_internal_data(); 1646 1647 /** 1648 * Override internal texture with externally created texture. Previously 1649 * created internal texture will released. 1650 * Attention: It's expected you understand some bgfx internals before you 1651 * use this call. 1652 * Warning: Must be called only on render thread. 1653 * Params: 1654 * _handle = Texture handle. 1655 * _ptr = Native API pointer to texture. 1656 */ 1657 ulong bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, ulong _ptr); 1658 1659 /** 1660 * Override internal texture by creating new texture. Previously created 1661 * internal texture will released. 1662 * Attention: It's expected you understand some bgfx internals before you 1663 * use this call. 1664 * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the 1665 * main thread. 1666 * Warning: Must be called only on render thread. 1667 * Params: 1668 * _handle = Texture handle. 1669 * _width = Width. 1670 * _height = Height. 1671 * _numMips = Number of mip-maps. 1672 * _format = Texture format. See: `TextureFormat::Enum`. 1673 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 1674 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 1675 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 1676 * mode. 1677 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 1678 * sampling. 1679 */ 1680 ulong bgfx_override_internal_texture(bgfx_texture_handle_t _handle, ushort _width, ushort _height, byte _numMips, bgfx_texture_format_t _format, ulong _flags); 1681 1682 /** 1683 * Sets a debug marker. This allows you to group graphics calls together for easy browsing in 1684 * graphics debugging tools. 1685 * Params: 1686 * _marker = Marker string. 1687 */ 1688 void bgfx_set_marker(const(char)* _marker); 1689 1690 /** 1691 * Set render states for draw primitive. 1692 * Remarks: 1693 * 1. To setup more complex states use: 1694 * `BGFX_STATE_ALPHA_REF(_ref)`, 1695 * `BGFX_STATE_POINT_SIZE(_size)`, 1696 * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, 1697 * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, 1698 * `BGFX_STATE_BLEND_EQUATION(_equation)`, 1699 * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` 1700 * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend 1701 * equation is specified. 1702 * Params: 1703 * _state = State flags. Default state for primitive type is 1704 * triangles. See: `BGFX_STATE_DEFAULT`. 1705 * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. 1706 * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. 1707 * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. 1708 * - `BGFX_STATE_CULL_*` - Backface culling mode. 1709 * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. 1710 * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. 1711 * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. 1712 * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and 1713 * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. 1714 */ 1715 void bgfx_set_state(ulong _state, uint _rgba); 1716 1717 /** 1718 * Set condition for rendering. 1719 * Params: 1720 * _handle = Occlusion query handle. 1721 * _visible = Render if occlusion query is visible. 1722 */ 1723 void bgfx_set_condition(bgfx_occlusion_query_handle_t _handle, bool _visible); 1724 1725 /** 1726 * Set stencil test state. 1727 * Params: 1728 * _fstencil = Front stencil state. 1729 * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` 1730 * _fstencil is applied to both front and back facing primitives. 1731 */ 1732 void bgfx_set_stencil(uint _fstencil, uint _bstencil); 1733 1734 /** 1735 * Set scissor for draw primitive. 1736 * Remarks: 1737 * To scissor for all primitives in view see `bgfx::setViewScissor`. 1738 * Params: 1739 * _x = Position x from the left corner of the window. 1740 * _y = Position y from the top corner of the window. 1741 * _width = Width of view scissor region. 1742 * _height = Height of view scissor region. 1743 */ 1744 ushort bgfx_set_scissor(ushort _x, ushort _y, ushort _width, ushort _height); 1745 1746 /** 1747 * Set scissor from cache for draw primitive. 1748 * Remarks: 1749 * To scissor for all primitives in view see `bgfx::setViewScissor`. 1750 * Params: 1751 * _cache = Index in scissor cache. 1752 */ 1753 void bgfx_set_scissor_cached(ushort _cache); 1754 1755 /** 1756 * Set model matrix for draw primitive. If it is not called, 1757 * the model will be rendered with an identity model matrix. 1758 * Params: 1759 * _mtx = Pointer to first matrix in array. 1760 * _num = Number of matrices in array. 1761 */ 1762 uint bgfx_set_transform(const(void)* _mtx, ushort _num); 1763 1764 /** 1765 * Set model matrix from matrix cache for draw primitive. 1766 * Params: 1767 * _cache = Index in matrix cache. 1768 * _num = Number of matrices from cache. 1769 */ 1770 void bgfx_set_transform_cached(uint _cache, ushort _num); 1771 1772 /** 1773 * Reserve matrices in internal matrix cache. 1774 * Attention: Pointer returned can be modifed until `bgfx::frame` is called. 1775 * Params: 1776 * _transform = Pointer to `Transform` structure. 1777 * _num = Number of matrices. 1778 */ 1779 uint bgfx_alloc_transform(bgfx_transform_t* _transform, ushort _num); 1780 1781 /** 1782 * Set shader uniform parameter for draw primitive. 1783 * Params: 1784 * _handle = Uniform. 1785 * _value = Pointer to uniform data. 1786 * _num = Number of elements. Passing `UINT16_MAX` will 1787 * use the _num passed on uniform creation. 1788 */ 1789 void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); 1790 1791 /** 1792 * Set index buffer for draw primitive. 1793 * Params: 1794 * _handle = Index buffer. 1795 * _firstIndex = First index to render. 1796 * _numIndices = Number of indices to render. 1797 */ 1798 void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 1799 1800 /** 1801 * Set index buffer for draw primitive. 1802 * Params: 1803 * _handle = Dynamic index buffer. 1804 * _firstIndex = First index to render. 1805 * _numIndices = Number of indices to render. 1806 */ 1807 void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 1808 1809 /** 1810 * Set index buffer for draw primitive. 1811 * Params: 1812 * _tib = Transient index buffer. 1813 * _firstIndex = First index to render. 1814 * _numIndices = Number of indices to render. 1815 */ 1816 void bgfx_set_transient_index_buffer(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); 1817 1818 /** 1819 * Set vertex buffer for draw primitive. 1820 * Params: 1821 * _stream = Vertex stream. 1822 * _handle = Vertex buffer. 1823 * _startVertex = First vertex to render. 1824 * _numVertices = Number of vertices to render. 1825 */ 1826 void bgfx_set_vertex_buffer(byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); 1827 1828 /** 1829 * Set vertex buffer for draw primitive. 1830 * Params: 1831 * _stream = Vertex stream. 1832 * _handle = Dynamic vertex buffer. 1833 * _startVertex = First vertex to render. 1834 * _numVertices = Number of vertices to render. 1835 */ 1836 void bgfx_set_dynamic_vertex_buffer(byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); 1837 1838 /** 1839 * Set vertex buffer for draw primitive. 1840 * Params: 1841 * _stream = Vertex stream. 1842 * _tvb = Transient vertex buffer. 1843 * _startVertex = First vertex to render. 1844 * _numVertices = Number of vertices to render. 1845 */ 1846 void bgfx_set_transient_vertex_buffer(byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices); 1847 1848 /** 1849 * Set number of vertices for auto generated vertices use in conjuction 1850 * with gl_VertexID. 1851 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 1852 * Params: 1853 * _numVertices = Number of vertices. 1854 */ 1855 void bgfx_set_vertex_count(uint _numVertices); 1856 1857 /** 1858 * Set instance data buffer for draw primitive. 1859 * Params: 1860 * _idb = Transient instance data buffer. 1861 * _start = First instance data. 1862 * _num = Number of data instances. 1863 */ 1864 void bgfx_set_instance_data_buffer(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); 1865 1866 /** 1867 * Set instance data buffer for draw primitive. 1868 * Params: 1869 * _handle = Vertex buffer. 1870 * _startVertex = First instance data. 1871 * _num = Number of data instances. 1872 * Set instance data buffer for draw primitive. 1873 */ 1874 void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 1875 1876 /** 1877 * Set instance data buffer for draw primitive. 1878 * Params: 1879 * _handle = Dynamic vertex buffer. 1880 * _startVertex = First instance data. 1881 * _num = Number of data instances. 1882 */ 1883 void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 1884 1885 /** 1886 * Set number of instances for auto generated instances use in conjuction 1887 * with gl_InstanceID. 1888 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 1889 */ 1890 void bgfx_set_instance_count(uint _numInstances); 1891 1892 /** 1893 * Set texture stage for draw primitive. 1894 * Params: 1895 * _stage = Texture unit. 1896 * _sampler = Program sampler. 1897 * _handle = Texture handle. 1898 * _flags = Texture sampling mode. Default value UINT32_MAX uses 1899 * texture sampling settings from the texture. 1900 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 1901 * mode. 1902 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 1903 * sampling. 1904 */ 1905 void bgfx_set_texture(byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); 1906 1907 /** 1908 * Submit an empty primitive for rendering. Uniforms and draw state 1909 * will be applied but no geometry will be submitted. 1910 * Remarks: 1911 * These empty draw calls will sort before ordinary draw calls. 1912 * Params: 1913 * _id = View id. 1914 */ 1915 void bgfx_touch(bgfx_view_id_t _id); 1916 1917 /** 1918 * Submit primitive for rendering. 1919 * Params: 1920 * _id = View id. 1921 * _program = Program. 1922 * _depth = Depth for sorting. 1923 * _preserveState = Preserve internal draw state for next draw call submit. 1924 */ 1925 void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, bool _preserveState); 1926 1927 /** 1928 * Submit primitive with occlusion query for rendering. 1929 * Params: 1930 * _id = View id. 1931 * _program = Program. 1932 * _occlusionQuery = Occlusion query. 1933 * _depth = Depth for sorting. 1934 * _preserveState = Preserve internal draw state for next draw call submit. 1935 */ 1936 void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, bool _preserveState); 1937 1938 /** 1939 * Submit primitive for rendering with index and instance data info from 1940 * indirect buffer. 1941 * Params: 1942 * _id = View id. 1943 * _program = Program. 1944 * _indirectHandle = Indirect buffer. 1945 * _start = First element in indirect buffer. 1946 * _num = Number of dispatches. 1947 * _depth = Depth for sorting. 1948 * _preserveState = Preserve internal draw state for next draw call submit. 1949 */ 1950 void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState); 1951 1952 /** 1953 * Set compute index buffer. 1954 * Params: 1955 * _stage = Compute stage. 1956 * _handle = Index buffer handle. 1957 * _access = Buffer access. See `Access::Enum`. 1958 */ 1959 void bgfx_set_compute_index_buffer(byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); 1960 1961 /** 1962 * Set compute vertex buffer. 1963 * Params: 1964 * _stage = Compute stage. 1965 * _handle = Vertex buffer handle. 1966 * _access = Buffer access. See `Access::Enum`. 1967 */ 1968 void bgfx_set_compute_vertex_buffer(byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); 1969 1970 /** 1971 * Set compute dynamic index buffer. 1972 * Params: 1973 * _stage = Compute stage. 1974 * _handle = Dynamic index buffer handle. 1975 * _access = Buffer access. See `Access::Enum`. 1976 */ 1977 void bgfx_set_compute_dynamic_index_buffer(byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); 1978 1979 /** 1980 * Set compute dynamic vertex buffer. 1981 * Params: 1982 * _stage = Compute stage. 1983 * _handle = Dynamic vertex buffer handle. 1984 * _access = Buffer access. See `Access::Enum`. 1985 */ 1986 void bgfx_set_compute_dynamic_vertex_buffer(byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); 1987 1988 /** 1989 * Set compute indirect buffer. 1990 * Params: 1991 * _stage = Compute stage. 1992 * _handle = Indirect buffer handle. 1993 * _access = Buffer access. See `Access::Enum`. 1994 */ 1995 void bgfx_set_compute_indirect_buffer(byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); 1996 1997 /** 1998 * Set compute image from texture. 1999 * Params: 2000 * _stage = Compute stage. 2001 * _handle = Texture handle. 2002 * _mip = Mip level. 2003 * _access = Image access. See `Access::Enum`. 2004 * _format = Texture format. See: `TextureFormat::Enum`. 2005 */ 2006 void bgfx_set_image(byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); 2007 2008 /** 2009 * Dispatch compute. 2010 * Params: 2011 * _id = View id. 2012 * _program = Compute program. 2013 * _numX = Number of groups X. 2014 * _numY = Number of groups Y. 2015 * _numZ = Number of groups Z. 2016 */ 2017 void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ); 2018 2019 /** 2020 * Dispatch compute indirect. 2021 * Params: 2022 * _id = View id. 2023 * _program = Compute program. 2024 * _indirectHandle = Indirect buffer. 2025 * _start = First element in indirect buffer. 2026 * _num = Number of dispatches. 2027 */ 2028 void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num); 2029 2030 /** 2031 * Discard all previously set state for draw or compute call. 2032 */ 2033 void bgfx_discard(); 2034 2035 /** 2036 * Blit 2D texture region between two 2D textures. 2037 * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. 2038 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. 2039 * Params: 2040 * _id = View id. 2041 * _dst = Destination texture handle. 2042 * _dstMip = Destination texture mip level. 2043 * _dstX = Destination texture X position. 2044 * _dstY = Destination texture Y position. 2045 * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube 2046 * this argument represents destination texture cube face. For 3D texture this argument 2047 * represents destination texture Z position. 2048 * _src = Source texture handle. 2049 * _srcMip = Source texture mip level. 2050 * _srcX = Source texture X position. 2051 * _srcY = Source texture Y position. 2052 * _srcZ = If texture is 2D this argument should be 0. If source texture is cube 2053 * this argument represents source texture cube face. For 3D texture this argument 2054 * represents source texture Z position. 2055 * _width = Width of region. 2056 * _height = Height of region. 2057 * _depth = If texture is 3D this argument represents depth of region, otherwise it's 2058 * unused. 2059 */ 2060 void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); 2061 2062 } 2063 else 2064 { 2065 __gshared 2066 { 2067 /** 2068 * Init attachment. 2069 * Params: 2070 * _handle = Render target texture handle. 2071 * _access = Access. See `Access::Enum`. 2072 * _layer = Cubemap side or depth layer/slice. 2073 * _mip = Mip level. 2074 * _resolve = Resolve flags. See: `BGFX_RESOLVE_*` 2075 */ 2076 alias da_bgfx_attachment_init = void function(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, ushort _layer, ushort _mip, byte _resolve); 2077 da_bgfx_attachment_init bgfx_attachment_init; 2078 2079 /** 2080 * Start VertexLayout. 2081 */ 2082 alias da_bgfx_vertex_layout_begin = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType); 2083 da_bgfx_vertex_layout_begin bgfx_vertex_layout_begin; 2084 2085 /** 2086 * Add attribute to VertexLayout. 2087 * Remarks: Must be called between begin/end. 2088 * Params: 2089 * _attrib = Attribute semantics. See: `bgfx::Attrib` 2090 * _num = Number of elements 1, 2, 3 or 4. 2091 * _type = Element type. 2092 * _normalized = When using fixed point AttribType (f.e. Uint8) 2093 * value will be normalized for vertex shader usage. When normalized 2094 * is set to true, AttribType::Uint8 value in range 0-255 will be 2095 * in range 0.0-1.0 in vertex shader. 2096 * _asInt = Packaging rule for vertexPack, vertexUnpack, and 2097 * vertexConvert for AttribType::Uint8 and AttribType::Int16. 2098 * Unpacking code must be implemented inside vertex shader. 2099 */ 2100 alias da_bgfx_vertex_layout_add = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, byte _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt); 2101 da_bgfx_vertex_layout_add bgfx_vertex_layout_add; 2102 2103 /** 2104 * Decode attribute. 2105 * Params: 2106 * _attrib = Attribute semantics. See: `bgfx::Attrib` 2107 * _num = Number of elements. 2108 * _type = Element type. 2109 * _normalized = Attribute is normalized. 2110 * _asInt = Attribute is packed as int. 2111 */ 2112 alias da_bgfx_vertex_layout_decode = void function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib, byte* _num, bgfx_attrib_type_t* _type, bool* _normalized, bool* _asInt); 2113 da_bgfx_vertex_layout_decode bgfx_vertex_layout_decode; 2114 2115 /** 2116 * Returns true if VertexLayout contains attribute. 2117 * Params: 2118 * _attrib = Attribute semantics. See: `bgfx::Attrib` 2119 */ 2120 alias da_bgfx_vertex_layout_has = bool function(const(bgfx_vertex_layout_t)* _this, bgfx_attrib_t _attrib); 2121 da_bgfx_vertex_layout_has bgfx_vertex_layout_has; 2122 2123 /** 2124 * Skip `_num` bytes in vertex stream. 2125 */ 2126 alias da_bgfx_vertex_layout_skip = bgfx_vertex_layout_t* function(bgfx_vertex_layout_t* _this, byte _num); 2127 da_bgfx_vertex_layout_skip bgfx_vertex_layout_skip; 2128 2129 /** 2130 * End VertexLayout. 2131 */ 2132 alias da_bgfx_vertex_layout_end = void function(bgfx_vertex_layout_t* _this); 2133 da_bgfx_vertex_layout_end bgfx_vertex_layout_end; 2134 2135 /** 2136 * Pack vertex attribute into vertex stream format. 2137 * Params: 2138 * _input = Value to be packed into vertex stream. 2139 * _inputNormalized = `true` if input value is already normalized. 2140 * _attr = Attribute to pack. 2141 * _layout = Vertex stream layout. 2142 * _data = Destination vertex stream where data will be packed. 2143 * _index = Vertex index that will be modified. 2144 */ 2145 alias da_bgfx_vertex_pack = void function(const float[4] _input, bool _inputNormalized, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, void* _data, uint _index); 2146 da_bgfx_vertex_pack bgfx_vertex_pack; 2147 2148 /** 2149 * Unpack vertex attribute from vertex stream format. 2150 * Params: 2151 * _output = Result of unpacking. 2152 * _attr = Attribute to unpack. 2153 * _layout = Vertex stream layout. 2154 * _data = Source vertex stream from where data will be unpacked. 2155 * _index = Vertex index that will be unpacked. 2156 */ 2157 alias da_bgfx_vertex_unpack = void function(float[4] _output, bgfx_attrib_t _attr, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, uint _index); 2158 da_bgfx_vertex_unpack bgfx_vertex_unpack; 2159 2160 /** 2161 * Converts vertex stream data from one vertex stream format to another. 2162 * Params: 2163 * _dstLayout = Destination vertex stream layout. 2164 * _dstData = Destination vertex stream. 2165 * _srcLayout = Source vertex stream layout. 2166 * _srcData = Source vertex stream data. 2167 * _num = Number of vertices to convert from source to destination. 2168 */ 2169 alias da_bgfx_vertex_convert = void function(const(bgfx_vertex_layout_t)* _dstLayout, void* _dstData, const(bgfx_vertex_layout_t)* _srcLayout, const(void)* _srcData, uint _num); 2170 da_bgfx_vertex_convert bgfx_vertex_convert; 2171 2172 /** 2173 * Weld vertices. 2174 * Params: 2175 * _output = Welded vertices remapping table. The size of buffer 2176 * must be the same as number of vertices. 2177 * _layout = Vertex stream layout. 2178 * _data = Vertex stream. 2179 * _num = Number of vertices in vertex stream. 2180 * _epsilon = Error tolerance for vertex position comparison. 2181 */ 2182 alias da_bgfx_weld_vertices = ushort function(ushort* _output, const(bgfx_vertex_layout_t)* _layout, const(void)* _data, ushort _num, float _epsilon); 2183 da_bgfx_weld_vertices bgfx_weld_vertices; 2184 2185 /** 2186 * Convert index buffer for use with different primitive topologies. 2187 * Params: 2188 * _conversion = Conversion type, see `TopologyConvert::Enum`. 2189 * _dst = Destination index buffer. If this argument is NULL 2190 * function will return number of indices after conversion. 2191 * _dstSize = Destination index buffer in bytes. It must be 2192 * large enough to contain output indices. If destination size is 2193 * insufficient index buffer will be truncated. 2194 * _indices = Source indices. 2195 * _numIndices = Number of input indices. 2196 * _index32 = Set to `true` if input indices are 32-bit. 2197 */ 2198 alias da_bgfx_topology_convert = uint function(bgfx_topology_convert_t _conversion, void* _dst, uint _dstSize, const(void)* _indices, uint _numIndices, bool _index32); 2199 da_bgfx_topology_convert bgfx_topology_convert; 2200 2201 /** 2202 * Sort indices. 2203 * Params: 2204 * _sort = Sort order, see `TopologySort::Enum`. 2205 * _dst = Destination index buffer. 2206 * _dstSize = Destination index buffer in bytes. It must be 2207 * large enough to contain output indices. If destination size is 2208 * insufficient index buffer will be truncated. 2209 * _dir = Direction (vector must be normalized). 2210 * _pos = Position. 2211 * _vertices = Pointer to first vertex represented as 2212 * float x, y, z. Must contain at least number of vertices 2213 * referencende by index buffer. 2214 * _stride = Vertex stride. 2215 * _indices = Source indices. 2216 * _numIndices = Number of input indices. 2217 * _index32 = Set to `true` if input indices are 32-bit. 2218 */ 2219 alias da_bgfx_topology_sort_tri_list = void function(bgfx_topology_sort_t _sort, void* _dst, uint _dstSize, const float[3] _dir, const float[3] _pos, const(void)* _vertices, uint _stride, const(void)* _indices, uint _numIndices, bool _index32); 2220 da_bgfx_topology_sort_tri_list bgfx_topology_sort_tri_list; 2221 2222 /** 2223 * Returns supported backend API renderers. 2224 * Params: 2225 * _max = Maximum number of elements in _enum array. 2226 * _enum = Array where supported renderers will be written. 2227 */ 2228 alias da_bgfx_get_supported_renderers = byte function(byte _max, bgfx_renderer_type_t* _enum); 2229 da_bgfx_get_supported_renderers bgfx_get_supported_renderers; 2230 2231 /** 2232 * Returns name of renderer. 2233 * Params: 2234 * _type = Renderer backend type. See: `bgfx::RendererType` 2235 */ 2236 alias da_bgfx_get_renderer_name = const(char)* function(bgfx_renderer_type_t _type); 2237 da_bgfx_get_renderer_name bgfx_get_renderer_name; 2238 2239 alias da_bgfx_init_ctor = void function(bgfx_init_t* _init); 2240 da_bgfx_init_ctor bgfx_init_ctor; 2241 2242 /** 2243 * Initialize bgfx library. 2244 * Params: 2245 * _init = Initialization parameters. See: `bgfx::Init` for more info. 2246 */ 2247 alias da_bgfx_init = bool function(const(bgfx_init_t)* _init); 2248 da_bgfx_init bgfx_init; 2249 2250 /** 2251 * Shutdown bgfx library. 2252 */ 2253 alias da_bgfx_shutdown = void function(); 2254 da_bgfx_shutdown bgfx_shutdown; 2255 2256 /** 2257 * Reset graphic settings and back-buffer size. 2258 * Attention: This call doesn't actually change window size, it just 2259 * resizes back-buffer. Windowing code has to change window size. 2260 * Params: 2261 * _width = Back-buffer width. 2262 * _height = Back-buffer height. 2263 * _flags = See: `BGFX_RESET_*` for more info. 2264 * - `BGFX_RESET_NONE` - No reset flags. 2265 * - `BGFX_RESET_FULLSCREEN` - Not supported yet. 2266 * - `BGFX_RESET_MSAA_X[2/4/8/16]` - Enable 2, 4, 8 or 16 x MSAA. 2267 * - `BGFX_RESET_VSYNC` - Enable V-Sync. 2268 * - `BGFX_RESET_MAXANISOTROPY` - Turn on/off max anisotropy. 2269 * - `BGFX_RESET_CAPTURE` - Begin screen capture. 2270 * - `BGFX_RESET_FLUSH_AFTER_RENDER` - Flush rendering after submitting to GPU. 2271 * - `BGFX_RESET_FLIP_AFTER_RENDER` - This flag specifies where flip 2272 * occurs. Default behavior is that flip occurs before rendering new 2273 * frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`. 2274 * - `BGFX_RESET_SRGB_BACKBUFFER` - Enable sRGB backbuffer. 2275 * _format = Texture format. See: `TextureFormat::Enum`. 2276 */ 2277 alias da_bgfx_reset = void function(uint _width, uint _height, uint _flags, bgfx_texture_format_t _format); 2278 da_bgfx_reset bgfx_reset; 2279 2280 /** 2281 * Advance to next frame. When using multithreaded renderer, this call 2282 * just swaps internal buffers, kicks render thread, and returns. In 2283 * singlethreaded renderer this call does frame rendering. 2284 * Params: 2285 * _capture = Capture frame with graphics debugger. 2286 */ 2287 alias da_bgfx_frame = uint function(bool _capture); 2288 da_bgfx_frame bgfx_frame; 2289 2290 /** 2291 * Returns current renderer backend API type. 2292 * Remarks: 2293 * Library must be initialized. 2294 */ 2295 alias da_bgfx_get_renderer_type = bgfx_renderer_type_t function(); 2296 da_bgfx_get_renderer_type bgfx_get_renderer_type; 2297 2298 /** 2299 * Returns renderer capabilities. 2300 * Remarks: 2301 * Library must be initialized. 2302 */ 2303 alias da_bgfx_get_caps = const(bgfx_caps_t)* function(); 2304 da_bgfx_get_caps bgfx_get_caps; 2305 2306 /** 2307 * Returns performance counters. 2308 * Attention: Pointer returned is valid until `bgfx::frame` is called. 2309 */ 2310 alias da_bgfx_get_stats = const(bgfx_stats_t)* function(); 2311 da_bgfx_get_stats bgfx_get_stats; 2312 2313 /** 2314 * Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx. 2315 * Params: 2316 * _size = Size to allocate. 2317 */ 2318 alias da_bgfx_alloc = const(bgfx_memory_t)* function(uint _size); 2319 da_bgfx_alloc bgfx_alloc; 2320 2321 /** 2322 * Allocate buffer and copy data into it. Data will be freed inside bgfx. 2323 * Params: 2324 * _data = Pointer to data to be copied. 2325 * _size = Size of data to be copied. 2326 */ 2327 alias da_bgfx_copy = const(bgfx_memory_t)* function(const(void)* _data, uint _size); 2328 da_bgfx_copy bgfx_copy; 2329 2330 /** 2331 * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call 2332 * doesn't allocate memory for data. It just copies the _data pointer. You 2333 * can pass `ReleaseFn` function pointer to release this memory after it's 2334 * consumed, otherwise you must make sure _data is available for at least 2 2335 * `bgfx::frame` calls. `ReleaseFn` function must be able to be called 2336 * from any thread. 2337 * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. 2338 * Params: 2339 * _data = Pointer to data. 2340 * _size = Size of data. 2341 */ 2342 alias da_bgfx_make_ref = const(bgfx_memory_t)* function(const(void)* _data, uint _size); 2343 da_bgfx_make_ref bgfx_make_ref; 2344 2345 /** 2346 * Make reference to data to pass to bgfx. Unlike `bgfx::alloc`, this call 2347 * doesn't allocate memory for data. It just copies the _data pointer. You 2348 * can pass `ReleaseFn` function pointer to release this memory after it's 2349 * consumed, otherwise you must make sure _data is available for at least 2 2350 * `bgfx::frame` calls. `ReleaseFn` function must be able to be called 2351 * from any thread. 2352 * Attention: Data passed must be available for at least 2 `bgfx::frame` calls. 2353 * Params: 2354 * _data = Pointer to data. 2355 * _size = Size of data. 2356 * _releaseFn = Callback function to release memory after use. 2357 * _userData = User data to be passed to callback function. 2358 */ 2359 alias da_bgfx_make_ref_release = const(bgfx_memory_t)* function(const(void)* _data, uint _size, void* _releaseFn, void* _userData); 2360 da_bgfx_make_ref_release bgfx_make_ref_release; 2361 2362 /** 2363 * Set debug flags. 2364 * Params: 2365 * _debug = Available flags: 2366 * - `BGFX_DEBUG_IFH` - Infinitely fast hardware. When this flag is set 2367 * all rendering calls will be skipped. This is useful when profiling 2368 * to quickly assess potential bottlenecks between CPU and GPU. 2369 * - `BGFX_DEBUG_PROFILER` - Enable profiler. 2370 * - `BGFX_DEBUG_STATS` - Display internal statistics. 2371 * - `BGFX_DEBUG_TEXT` - Display debug text. 2372 * - `BGFX_DEBUG_WIREFRAME` - Wireframe rendering. All rendering 2373 * primitives will be rendered as lines. 2374 */ 2375 alias da_bgfx_set_debug = void function(uint _debug); 2376 da_bgfx_set_debug bgfx_set_debug; 2377 2378 /** 2379 * Clear internal debug text buffer. 2380 * Params: 2381 * _attr = Background color. 2382 * _small = Default 8x16 or 8x8 font. 2383 */ 2384 alias da_bgfx_dbg_text_clear = void function(byte _attr, bool _small); 2385 da_bgfx_dbg_text_clear bgfx_dbg_text_clear; 2386 2387 /** 2388 * Print formatted data to internal debug text character-buffer (VGA-compatible text mode). 2389 * Params: 2390 * _x = Position x from the left corner of the window. 2391 * _y = Position y from the top corner of the window. 2392 * _attr = Color palette. Where top 4-bits represent index of background, and bottom 2393 * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). 2394 * _format = `printf` style format. 2395 */ 2396 alias da_bgfx_dbg_text_printf = void function(ushort _x, ushort _y, byte _attr, const(char)* _format, ... ); 2397 da_bgfx_dbg_text_printf bgfx_dbg_text_printf; 2398 2399 /** 2400 * Print formatted data from variable argument list to internal debug text character-buffer (VGA-compatible text mode). 2401 * Params: 2402 * _x = Position x from the left corner of the window. 2403 * _y = Position y from the top corner of the window. 2404 * _attr = Color palette. Where top 4-bits represent index of background, and bottom 2405 * 4-bits represent foreground color from standard VGA text palette (ANSI escape codes). 2406 * _format = `printf` style format. 2407 * _argList = Variable arguments list for format string. 2408 */ 2409 alias da_bgfx_dbg_text_vprintf = void function(ushort _x, ushort _y, byte _attr, const(char)* _format, va_list _argList); 2410 da_bgfx_dbg_text_vprintf bgfx_dbg_text_vprintf; 2411 2412 /** 2413 * Draw image into internal debug text buffer. 2414 * Params: 2415 * _x = Position x from the left corner of the window. 2416 * _y = Position y from the top corner of the window. 2417 * _width = Image width. 2418 * _height = Image height. 2419 * _data = Raw image data (character/attribute raw encoding). 2420 * _pitch = Image pitch in bytes. 2421 */ 2422 alias da_bgfx_dbg_text_image = void function(ushort _x, ushort _y, ushort _width, ushort _height, const(void)* _data, ushort _pitch); 2423 da_bgfx_dbg_text_image bgfx_dbg_text_image; 2424 2425 /** 2426 * Create static index buffer. 2427 * Params: 2428 * _mem = Index buffer data. 2429 * _flags = Buffer creation flags. 2430 * - `BGFX_BUFFER_NONE` - No flags. 2431 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 2432 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 2433 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 2434 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 2435 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 2436 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 2437 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 2438 * buffers. 2439 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 2440 * index buffers. 2441 */ 2442 alias da_bgfx_create_index_buffer = bgfx_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags); 2443 da_bgfx_create_index_buffer bgfx_create_index_buffer; 2444 2445 /** 2446 * Set static index buffer debug name. 2447 * Params: 2448 * _handle = Static index buffer handle. 2449 * _name = Static index buffer name. 2450 * _len = Static index buffer name length (if length is INT32_MAX, it's expected 2451 * that _name is zero terminated string. 2452 */ 2453 alias da_bgfx_set_index_buffer_name = void function(bgfx_index_buffer_handle_t _handle, const(char)* _name, int _len); 2454 da_bgfx_set_index_buffer_name bgfx_set_index_buffer_name; 2455 2456 /** 2457 * Destroy static index buffer. 2458 * Params: 2459 * _handle = Static index buffer handle. 2460 */ 2461 alias da_bgfx_destroy_index_buffer = void function(bgfx_index_buffer_handle_t _handle); 2462 da_bgfx_destroy_index_buffer bgfx_destroy_index_buffer; 2463 2464 /** 2465 * Create vertex layout. 2466 * Params: 2467 * _layout = Vertex layout. 2468 */ 2469 alias da_bgfx_create_vertex_layout = bgfx_vertex_layout_handle_t function(const(bgfx_vertex_layout_t)* _layout); 2470 da_bgfx_create_vertex_layout bgfx_create_vertex_layout; 2471 2472 /** 2473 * Destroy vertex layout. 2474 * Params: 2475 * _layoutHandle = Vertex layout handle. 2476 */ 2477 alias da_bgfx_destroy_vertex_layout = void function(bgfx_vertex_layout_handle_t _layoutHandle); 2478 da_bgfx_destroy_vertex_layout bgfx_destroy_vertex_layout; 2479 2480 /** 2481 * Create static vertex buffer. 2482 * Params: 2483 * _mem = Vertex buffer data. 2484 * _layout = Vertex layout. 2485 * _flags = Buffer creation flags. 2486 * - `BGFX_BUFFER_NONE` - No flags. 2487 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 2488 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 2489 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 2490 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 2491 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 2492 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 2493 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic buffers. 2494 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on index buffers. 2495 */ 2496 alias da_bgfx_create_vertex_buffer = bgfx_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); 2497 da_bgfx_create_vertex_buffer bgfx_create_vertex_buffer; 2498 2499 /** 2500 * Set static vertex buffer debug name. 2501 * Params: 2502 * _handle = Static vertex buffer handle. 2503 * _name = Static vertex buffer name. 2504 * _len = Static vertex buffer name length (if length is INT32_MAX, it's expected 2505 * that _name is zero terminated string. 2506 */ 2507 alias da_bgfx_set_vertex_buffer_name = void function(bgfx_vertex_buffer_handle_t _handle, const(char)* _name, int _len); 2508 da_bgfx_set_vertex_buffer_name bgfx_set_vertex_buffer_name; 2509 2510 /** 2511 * Destroy static vertex buffer. 2512 * Params: 2513 * _handle = Static vertex buffer handle. 2514 */ 2515 alias da_bgfx_destroy_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle); 2516 da_bgfx_destroy_vertex_buffer bgfx_destroy_vertex_buffer; 2517 2518 /** 2519 * Create empty dynamic index buffer. 2520 * Params: 2521 * _num = Number of indices. 2522 * _flags = Buffer creation flags. 2523 * - `BGFX_BUFFER_NONE` - No flags. 2524 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 2525 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 2526 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 2527 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 2528 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 2529 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 2530 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 2531 * buffers. 2532 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 2533 * index buffers. 2534 */ 2535 alias da_bgfx_create_dynamic_index_buffer = bgfx_dynamic_index_buffer_handle_t function(uint _num, ushort _flags); 2536 da_bgfx_create_dynamic_index_buffer bgfx_create_dynamic_index_buffer; 2537 2538 /** 2539 * Create dynamic index buffer and initialized it. 2540 * Params: 2541 * _mem = Index buffer data. 2542 * _flags = Buffer creation flags. 2543 * - `BGFX_BUFFER_NONE` - No flags. 2544 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 2545 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 2546 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 2547 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 2548 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 2549 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 2550 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 2551 * buffers. 2552 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 2553 * index buffers. 2554 */ 2555 alias da_bgfx_create_dynamic_index_buffer_mem = bgfx_dynamic_index_buffer_handle_t function(const(bgfx_memory_t)* _mem, ushort _flags); 2556 da_bgfx_create_dynamic_index_buffer_mem bgfx_create_dynamic_index_buffer_mem; 2557 2558 /** 2559 * Update dynamic index buffer. 2560 * Params: 2561 * _handle = Dynamic index buffer handle. 2562 * _startIndex = Start index. 2563 * _mem = Index buffer data. 2564 */ 2565 alias da_bgfx_update_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _startIndex, const(bgfx_memory_t)* _mem); 2566 da_bgfx_update_dynamic_index_buffer bgfx_update_dynamic_index_buffer; 2567 2568 /** 2569 * Destroy dynamic index buffer. 2570 * Params: 2571 * _handle = Dynamic index buffer handle. 2572 */ 2573 alias da_bgfx_destroy_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle); 2574 da_bgfx_destroy_dynamic_index_buffer bgfx_destroy_dynamic_index_buffer; 2575 2576 /** 2577 * Create empty dynamic vertex buffer. 2578 * Params: 2579 * _num = Number of vertices. 2580 * _layout = Vertex layout. 2581 * _flags = Buffer creation flags. 2582 * - `BGFX_BUFFER_NONE` - No flags. 2583 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 2584 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 2585 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 2586 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 2587 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 2588 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 2589 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 2590 * buffers. 2591 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 2592 * index buffers. 2593 */ 2594 alias da_bgfx_create_dynamic_vertex_buffer = bgfx_dynamic_vertex_buffer_handle_t function(uint _num, const(bgfx_vertex_layout_t)* _layout, ushort _flags); 2595 da_bgfx_create_dynamic_vertex_buffer bgfx_create_dynamic_vertex_buffer; 2596 2597 /** 2598 * Create dynamic vertex buffer and initialize it. 2599 * Params: 2600 * _mem = Vertex buffer data. 2601 * _layout = Vertex layout. 2602 * _flags = Buffer creation flags. 2603 * - `BGFX_BUFFER_NONE` - No flags. 2604 * - `BGFX_BUFFER_COMPUTE_READ` - Buffer will be read from by compute shader. 2605 * - `BGFX_BUFFER_COMPUTE_WRITE` - Buffer will be written into by compute shader. When buffer 2606 * is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated from CPU. 2607 * - `BGFX_BUFFER_COMPUTE_READ_WRITE` - Buffer will be used for read/write by compute shader. 2608 * - `BGFX_BUFFER_ALLOW_RESIZE` - Buffer will resize on buffer update if a different amount of 2609 * data is passed. If this flag is not specified, and more data is passed on update, the buffer 2610 * will be trimmed to fit the existing buffer size. This flag has effect only on dynamic 2611 * buffers. 2612 * - `BGFX_BUFFER_INDEX32` - Buffer is using 32-bit indices. This flag has effect only on 2613 * index buffers. 2614 */ 2615 alias da_bgfx_create_dynamic_vertex_buffer_mem = bgfx_dynamic_vertex_buffer_handle_t function(const(bgfx_memory_t)* _mem, const(bgfx_vertex_layout_t)* _layout, ushort _flags); 2616 da_bgfx_create_dynamic_vertex_buffer_mem bgfx_create_dynamic_vertex_buffer_mem; 2617 2618 /** 2619 * Update dynamic vertex buffer. 2620 * Params: 2621 * _handle = Dynamic vertex buffer handle. 2622 * _startVertex = Start vertex. 2623 * _mem = Vertex buffer data. 2624 */ 2625 alias da_bgfx_update_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, const(bgfx_memory_t)* _mem); 2626 da_bgfx_update_dynamic_vertex_buffer bgfx_update_dynamic_vertex_buffer; 2627 2628 /** 2629 * Destroy dynamic vertex buffer. 2630 * Params: 2631 * _handle = Dynamic vertex buffer handle. 2632 */ 2633 alias da_bgfx_destroy_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle); 2634 da_bgfx_destroy_dynamic_vertex_buffer bgfx_destroy_dynamic_vertex_buffer; 2635 2636 /** 2637 * Returns number of requested or maximum available indices. 2638 * Params: 2639 * _num = Number of required indices. 2640 */ 2641 alias da_bgfx_get_avail_transient_index_buffer = uint function(uint _num); 2642 da_bgfx_get_avail_transient_index_buffer bgfx_get_avail_transient_index_buffer; 2643 2644 /** 2645 * Returns number of requested or maximum available vertices. 2646 * Params: 2647 * _num = Number of required vertices. 2648 * _layout = Vertex layout. 2649 */ 2650 alias da_bgfx_get_avail_transient_vertex_buffer = uint function(uint _num, const(bgfx_vertex_layout_t)* _layout); 2651 da_bgfx_get_avail_transient_vertex_buffer bgfx_get_avail_transient_vertex_buffer; 2652 2653 /** 2654 * Returns number of requested or maximum available instance buffer slots. 2655 * Params: 2656 * _num = Number of required instances. 2657 * _stride = Stride per instance. 2658 */ 2659 alias da_bgfx_get_avail_instance_data_buffer = uint function(uint _num, ushort _stride); 2660 da_bgfx_get_avail_instance_data_buffer bgfx_get_avail_instance_data_buffer; 2661 2662 /** 2663 * Allocate transient index buffer. 2664 * Remarks: 2665 * Only 16-bit index buffer is supported. 2666 * Params: 2667 * _tib = TransientIndexBuffer structure is filled and is valid 2668 * for the duration of frame, and it can be reused for multiple draw 2669 * calls. 2670 * _num = Number of indices to allocate. 2671 */ 2672 alias da_bgfx_alloc_transient_index_buffer = void function(bgfx_transient_index_buffer_t* _tib, uint _num); 2673 da_bgfx_alloc_transient_index_buffer bgfx_alloc_transient_index_buffer; 2674 2675 /** 2676 * Allocate transient vertex buffer. 2677 * Params: 2678 * _tvb = TransientVertexBuffer structure is filled and is valid 2679 * for the duration of frame, and it can be reused for multiple draw 2680 * calls. 2681 * _num = Number of vertices to allocate. 2682 * _layout = Vertex layout. 2683 */ 2684 alias da_bgfx_alloc_transient_vertex_buffer = void function(bgfx_transient_vertex_buffer_t* _tvb, uint _num, const(bgfx_vertex_layout_t)* _layout); 2685 da_bgfx_alloc_transient_vertex_buffer bgfx_alloc_transient_vertex_buffer; 2686 2687 /** 2688 * Check for required space and allocate transient vertex and index 2689 * buffers. If both space requirements are satisfied function returns 2690 * true. 2691 * Remarks: 2692 * Only 16-bit index buffer is supported. 2693 * Params: 2694 * _tvb = TransientVertexBuffer structure is filled and is valid 2695 * for the duration of frame, and it can be reused for multiple draw 2696 * calls. 2697 * _layout = Vertex layout. 2698 * _numVertices = Number of vertices to allocate. 2699 * _tib = TransientIndexBuffer structure is filled and is valid 2700 * for the duration of frame, and it can be reused for multiple draw 2701 * calls. 2702 * _numIndices = Number of indices to allocate. 2703 */ 2704 alias da_bgfx_alloc_transient_buffers = bool function(bgfx_transient_vertex_buffer_t* _tvb, const(bgfx_vertex_layout_t)* _layout, uint _numVertices, bgfx_transient_index_buffer_t* _tib, uint _numIndices); 2705 da_bgfx_alloc_transient_buffers bgfx_alloc_transient_buffers; 2706 2707 /** 2708 * Allocate instance data buffer. 2709 * Params: 2710 * _idb = InstanceDataBuffer structure is filled and is valid 2711 * for duration of frame, and it can be reused for multiple draw 2712 * calls. 2713 * _num = Number of instances. 2714 * _stride = Instance stride. Must be multiple of 16. 2715 */ 2716 alias da_bgfx_alloc_instance_data_buffer = void function(bgfx_instance_data_buffer_t* _idb, uint _num, ushort _stride); 2717 da_bgfx_alloc_instance_data_buffer bgfx_alloc_instance_data_buffer; 2718 2719 /** 2720 * Create draw indirect buffer. 2721 * Params: 2722 * _num = Number of indirect calls. 2723 */ 2724 alias da_bgfx_create_indirect_buffer = bgfx_indirect_buffer_handle_t function(uint _num); 2725 da_bgfx_create_indirect_buffer bgfx_create_indirect_buffer; 2726 2727 /** 2728 * Destroy draw indirect buffer. 2729 * Params: 2730 * _handle = Indirect buffer handle. 2731 */ 2732 alias da_bgfx_destroy_indirect_buffer = void function(bgfx_indirect_buffer_handle_t _handle); 2733 da_bgfx_destroy_indirect_buffer bgfx_destroy_indirect_buffer; 2734 2735 /** 2736 * Create shader from memory buffer. 2737 * Params: 2738 * _mem = Shader binary. 2739 */ 2740 alias da_bgfx_create_shader = bgfx_shader_handle_t function(const(bgfx_memory_t)* _mem); 2741 da_bgfx_create_shader bgfx_create_shader; 2742 2743 /** 2744 * Returns the number of uniforms and uniform handles used inside a shader. 2745 * Remarks: 2746 * Only non-predefined uniforms are returned. 2747 * Params: 2748 * _handle = Shader handle. 2749 * _uniforms = UniformHandle array where data will be stored. 2750 * _max = Maximum capacity of array. 2751 */ 2752 alias da_bgfx_get_shader_uniforms = ushort function(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, ushort _max); 2753 da_bgfx_get_shader_uniforms bgfx_get_shader_uniforms; 2754 2755 /** 2756 * Set shader debug name. 2757 * Params: 2758 * _handle = Shader handle. 2759 * _name = Shader name. 2760 * _len = Shader name length (if length is INT32_MAX, it's expected 2761 * that _name is zero terminated string). 2762 */ 2763 alias da_bgfx_set_shader_name = void function(bgfx_shader_handle_t _handle, const(char)* _name, int _len); 2764 da_bgfx_set_shader_name bgfx_set_shader_name; 2765 2766 /** 2767 * Destroy shader. 2768 * Remarks: Once a shader program is created with _handle, 2769 * it is safe to destroy that shader. 2770 * Params: 2771 * _handle = Shader handle. 2772 */ 2773 alias da_bgfx_destroy_shader = void function(bgfx_shader_handle_t _handle); 2774 da_bgfx_destroy_shader bgfx_destroy_shader; 2775 2776 /** 2777 * Create program with vertex and fragment shaders. 2778 * Params: 2779 * _vsh = Vertex shader. 2780 * _fsh = Fragment shader. 2781 * _destroyShaders = If true, shaders will be destroyed when program is destroyed. 2782 */ 2783 alias da_bgfx_create_program = bgfx_program_handle_t function(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders); 2784 da_bgfx_create_program bgfx_create_program; 2785 2786 /** 2787 * Create program with compute shader. 2788 * Params: 2789 * _csh = Compute shader. 2790 * _destroyShaders = If true, shaders will be destroyed when program is destroyed. 2791 */ 2792 alias da_bgfx_create_compute_program = bgfx_program_handle_t function(bgfx_shader_handle_t _csh, bool _destroyShaders); 2793 da_bgfx_create_compute_program bgfx_create_compute_program; 2794 2795 /** 2796 * Destroy program. 2797 * Params: 2798 * _handle = Program handle. 2799 */ 2800 alias da_bgfx_destroy_program = void function(bgfx_program_handle_t _handle); 2801 da_bgfx_destroy_program bgfx_destroy_program; 2802 2803 /** 2804 * Validate texture parameters. 2805 * Params: 2806 * _depth = Depth dimension of volume texture. 2807 * _cubeMap = Indicates that texture contains cubemap. 2808 * _numLayers = Number of layers in texture array. 2809 * _format = Texture format. See: `TextureFormat::Enum`. 2810 * _flags = Texture flags. See `BGFX_TEXTURE_*`. 2811 */ 2812 alias da_bgfx_is_texture_valid = bool function(ushort _depth, bool _cubeMap, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); 2813 da_bgfx_is_texture_valid bgfx_is_texture_valid; 2814 2815 /** 2816 * Calculate amount of memory required for texture. 2817 * Params: 2818 * _info = Resulting texture info structure. See: `TextureInfo`. 2819 * _width = Width. 2820 * _height = Height. 2821 * _depth = Depth dimension of volume texture. 2822 * _cubeMap = Indicates that texture contains cubemap. 2823 * _hasMips = Indicates that texture contains full mip-map chain. 2824 * _numLayers = Number of layers in texture array. 2825 * _format = Texture format. See: `TextureFormat::Enum`. 2826 */ 2827 alias da_bgfx_calc_texture_size = void function(bgfx_texture_info_t* _info, ushort _width, ushort _height, ushort _depth, bool _cubeMap, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format); 2828 da_bgfx_calc_texture_size bgfx_calc_texture_size; 2829 2830 /** 2831 * Create texture from memory buffer. 2832 * Params: 2833 * _mem = DDS, KTX or PVR texture binary data. 2834 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 2835 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 2836 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 2837 * mode. 2838 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 2839 * sampling. 2840 * _skip = Skip top level mips when parsing texture. 2841 * _info = When non-`NULL` is specified it returns parsed texture information. 2842 */ 2843 alias da_bgfx_create_texture = bgfx_texture_handle_t function(const(bgfx_memory_t)* _mem, ulong _flags, byte _skip, bgfx_texture_info_t* _info); 2844 da_bgfx_create_texture bgfx_create_texture; 2845 2846 /** 2847 * Create 2D texture. 2848 * Params: 2849 * _width = Width. 2850 * _height = Height. 2851 * _hasMips = Indicates that texture contains full mip-map chain. 2852 * _numLayers = Number of layers in texture array. Must be 1 if caps 2853 * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. 2854 * _format = Texture format. See: `TextureFormat::Enum`. 2855 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 2856 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 2857 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 2858 * mode. 2859 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 2860 * sampling. 2861 * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If 2862 * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 2863 * 1, expected memory layout is texture and all mips together for each array element. 2864 */ 2865 alias da_bgfx_create_texture_2d = bgfx_texture_handle_t function(ushort _width, ushort _height, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); 2866 da_bgfx_create_texture_2d bgfx_create_texture_2d; 2867 2868 /** 2869 * Create texture with size based on backbuffer ratio. Texture will maintain ratio 2870 * if back buffer resolution changes. 2871 * Params: 2872 * _ratio = Texture size in respect to back-buffer size. See: `BackbufferRatio::Enum`. 2873 * _hasMips = Indicates that texture contains full mip-map chain. 2874 * _numLayers = Number of layers in texture array. Must be 1 if caps 2875 * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. 2876 * _format = Texture format. See: `TextureFormat::Enum`. 2877 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 2878 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 2879 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 2880 * mode. 2881 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 2882 * sampling. 2883 */ 2884 alias da_bgfx_create_texture_2d_scaled = bgfx_texture_handle_t function(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags); 2885 da_bgfx_create_texture_2d_scaled bgfx_create_texture_2d_scaled; 2886 2887 /** 2888 * Create 3D texture. 2889 * Params: 2890 * _width = Width. 2891 * _height = Height. 2892 * _depth = Depth. 2893 * _hasMips = Indicates that texture contains full mip-map chain. 2894 * _format = Texture format. See: `TextureFormat::Enum`. 2895 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 2896 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 2897 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 2898 * mode. 2899 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 2900 * sampling. 2901 * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If 2902 * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 2903 * 1, expected memory layout is texture and all mips together for each array element. 2904 */ 2905 alias da_bgfx_create_texture_3d = bgfx_texture_handle_t function(ushort _width, ushort _height, ushort _depth, bool _hasMips, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); 2906 da_bgfx_create_texture_3d bgfx_create_texture_3d; 2907 2908 /** 2909 * Create Cube texture. 2910 * Params: 2911 * _size = Cube side size. 2912 * _hasMips = Indicates that texture contains full mip-map chain. 2913 * _numLayers = Number of layers in texture array. Must be 1 if caps 2914 * `BGFX_CAPS_TEXTURE_2D_ARRAY` flag is not set. 2915 * _format = Texture format. See: `TextureFormat::Enum`. 2916 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 2917 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 2918 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 2919 * mode. 2920 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 2921 * sampling. 2922 * _mem = Texture data. If `_mem` is non-NULL, created texture will be immutable. If 2923 * `_mem` is NULL content of the texture is uninitialized. When `_numLayers` is more than 2924 * 1, expected memory layout is texture and all mips together for each array element. 2925 */ 2926 alias da_bgfx_create_texture_cube = bgfx_texture_handle_t function(ushort _size, bool _hasMips, ushort _numLayers, bgfx_texture_format_t _format, ulong _flags, const(bgfx_memory_t)* _mem); 2927 da_bgfx_create_texture_cube bgfx_create_texture_cube; 2928 2929 /** 2930 * Update 2D texture. 2931 * Attention: It's valid to update only mutable texture. See `bgfx::createTexture2D` for more info. 2932 * Params: 2933 * _handle = Texture handle. 2934 * _layer = Layer in texture array. 2935 * _mip = Mip level. 2936 * _x = X offset in texture. 2937 * _y = Y offset in texture. 2938 * _width = Width of texture block. 2939 * _height = Height of texture block. 2940 * _mem = Texture update data. 2941 * _pitch = Pitch of input image (bytes). When _pitch is set to 2942 * UINT16_MAX, it will be calculated internally based on _width. 2943 */ 2944 alias da_bgfx_update_texture_2d = void function(bgfx_texture_handle_t _handle, ushort _layer, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); 2945 da_bgfx_update_texture_2d bgfx_update_texture_2d; 2946 2947 /** 2948 * Update 3D texture. 2949 * Attention: It's valid to update only mutable texture. See `bgfx::createTexture3D` for more info. 2950 * Params: 2951 * _handle = Texture handle. 2952 * _mip = Mip level. 2953 * _x = X offset in texture. 2954 * _y = Y offset in texture. 2955 * _z = Z offset in texture. 2956 * _width = Width of texture block. 2957 * _height = Height of texture block. 2958 * _depth = Depth of texture block. 2959 * _mem = Texture update data. 2960 */ 2961 alias da_bgfx_update_texture_3d = void function(bgfx_texture_handle_t _handle, byte _mip, ushort _x, ushort _y, ushort _z, ushort _width, ushort _height, ushort _depth, const(bgfx_memory_t)* _mem); 2962 da_bgfx_update_texture_3d bgfx_update_texture_3d; 2963 2964 /** 2965 * Update Cube texture. 2966 * Attention: It's valid to update only mutable texture. See `bgfx::createTextureCube` for more info. 2967 * Params: 2968 * _handle = Texture handle. 2969 * _layer = Layer in texture array. 2970 * _side = Cubemap side `BGFX_CUBE_MAP_<POSITIVE or NEGATIVE>_<X, Y or Z>`, 2971 * where 0 is +X, 1 is -X, 2 is +Y, 3 is -Y, 4 is +Z, and 5 is -Z. 2972 * +----------+ 2973 * |-z 2| 2974 * | ^ +y | 2975 * | | | Unfolded cube: 2976 * | +---->+x | 2977 * +----------+----------+----------+----------+ 2978 * |+y 1|+y 4|+y 0|+y 5| 2979 * | ^ -x | ^ +z | ^ +x | ^ -z | 2980 * | | | | | | | | | 2981 * | +---->+z | +---->+x | +---->-z | +---->-x | 2982 * +----------+----------+----------+----------+ 2983 * |+z 3| 2984 * | ^ -y | 2985 * | | | 2986 * | +---->+x | 2987 * +----------+ 2988 * _mip = Mip level. 2989 * _x = X offset in texture. 2990 * _y = Y offset in texture. 2991 * _width = Width of texture block. 2992 * _height = Height of texture block. 2993 * _mem = Texture update data. 2994 * _pitch = Pitch of input image (bytes). When _pitch is set to 2995 * UINT16_MAX, it will be calculated internally based on _width. 2996 */ 2997 alias da_bgfx_update_texture_cube = void function(bgfx_texture_handle_t _handle, ushort _layer, byte _side, byte _mip, ushort _x, ushort _y, ushort _width, ushort _height, const(bgfx_memory_t)* _mem, ushort _pitch); 2998 da_bgfx_update_texture_cube bgfx_update_texture_cube; 2999 3000 /** 3001 * Read back texture content. 3002 * Attention: Texture must be created with `BGFX_TEXTURE_READ_BACK` flag. 3003 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_READ_BACK`. 3004 * Params: 3005 * _handle = Texture handle. 3006 * _data = Destination buffer. 3007 * _mip = Mip level. 3008 */ 3009 alias da_bgfx_read_texture = uint function(bgfx_texture_handle_t _handle, void* _data, byte _mip); 3010 da_bgfx_read_texture bgfx_read_texture; 3011 3012 /** 3013 * Set texture debug name. 3014 * Params: 3015 * _handle = Texture handle. 3016 * _name = Texture name. 3017 * _len = Texture name length (if length is INT32_MAX, it's expected 3018 * that _name is zero terminated string. 3019 */ 3020 alias da_bgfx_set_texture_name = void function(bgfx_texture_handle_t _handle, const(char)* _name, int _len); 3021 da_bgfx_set_texture_name bgfx_set_texture_name; 3022 3023 /** 3024 * Returns texture direct access pointer. 3025 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_DIRECT_ACCESS`. This feature 3026 * is available on GPUs that have unified memory architecture (UMA) support. 3027 * Params: 3028 * _handle = Texture handle. 3029 */ 3030 alias da_bgfx_get_direct_access_ptr = void* function(bgfx_texture_handle_t _handle); 3031 da_bgfx_get_direct_access_ptr bgfx_get_direct_access_ptr; 3032 3033 /** 3034 * Destroy texture. 3035 * Params: 3036 * _handle = Texture handle. 3037 */ 3038 alias da_bgfx_destroy_texture = void function(bgfx_texture_handle_t _handle); 3039 da_bgfx_destroy_texture bgfx_destroy_texture; 3040 3041 /** 3042 * Create frame buffer (simple). 3043 * Params: 3044 * _width = Texture width. 3045 * _height = Texture height. 3046 * _format = Texture format. See: `TextureFormat::Enum`. 3047 * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 3048 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 3049 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 3050 * mode. 3051 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 3052 * sampling. 3053 */ 3054 alias da_bgfx_create_frame_buffer = bgfx_frame_buffer_handle_t function(ushort _width, ushort _height, bgfx_texture_format_t _format, ulong _textureFlags); 3055 da_bgfx_create_frame_buffer bgfx_create_frame_buffer; 3056 3057 /** 3058 * Create frame buffer with size based on backbuffer ratio. Frame buffer will maintain ratio 3059 * if back buffer resolution changes. 3060 * Params: 3061 * _ratio = Frame buffer size in respect to back-buffer size. See: 3062 * `BackbufferRatio::Enum`. 3063 * _format = Texture format. See: `TextureFormat::Enum`. 3064 * _textureFlags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 3065 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 3066 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 3067 * mode. 3068 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 3069 * sampling. 3070 */ 3071 alias da_bgfx_create_frame_buffer_scaled = bgfx_frame_buffer_handle_t function(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, ulong _textureFlags); 3072 da_bgfx_create_frame_buffer_scaled bgfx_create_frame_buffer_scaled; 3073 3074 /** 3075 * Create MRT frame buffer from texture handles (simple). 3076 * Params: 3077 * _num = Number of texture handles. 3078 * _handles = Texture attachments. 3079 * _destroyTexture = If true, textures will be destroyed when 3080 * frame buffer is destroyed. 3081 */ 3082 alias da_bgfx_create_frame_buffer_from_handles = bgfx_frame_buffer_handle_t function(byte _num, const(bgfx_texture_handle_t)* _handles, bool _destroyTexture); 3083 da_bgfx_create_frame_buffer_from_handles bgfx_create_frame_buffer_from_handles; 3084 3085 /** 3086 * Create MRT frame buffer from texture handles with specific layer and 3087 * mip level. 3088 * Params: 3089 * _num = Number of attachements. 3090 * _attachment = Attachment texture info. See: `bgfx::Attachment`. 3091 * _destroyTexture = If true, textures will be destroyed when 3092 * frame buffer is destroyed. 3093 */ 3094 alias da_bgfx_create_frame_buffer_from_attachment = bgfx_frame_buffer_handle_t function(byte _num, const(bgfx_attachment_t)* _attachment, bool _destroyTexture); 3095 da_bgfx_create_frame_buffer_from_attachment bgfx_create_frame_buffer_from_attachment; 3096 3097 /** 3098 * Create frame buffer for multiple window rendering. 3099 * Remarks: 3100 * Frame buffer cannot be used for sampling. 3101 * Attention: Availability depends on: `BGFX_CAPS_SWAP_CHAIN`. 3102 * Params: 3103 * _nwh = OS' target native window handle. 3104 * _width = Window back buffer width. 3105 * _height = Window back buffer height. 3106 * _format = Window back buffer color format. 3107 * _depthFormat = Window back buffer depth format. 3108 */ 3109 alias da_bgfx_create_frame_buffer_from_nwh = bgfx_frame_buffer_handle_t function(void* _nwh, ushort _width, ushort _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat); 3110 da_bgfx_create_frame_buffer_from_nwh bgfx_create_frame_buffer_from_nwh; 3111 3112 /** 3113 * Set frame buffer debug name. 3114 * Params: 3115 * _handle = Frame buffer handle. 3116 * _name = Frame buffer name. 3117 * _len = Frame buffer name length (if length is INT32_MAX, it's expected 3118 * that _name is zero terminated string. 3119 */ 3120 alias da_bgfx_set_frame_buffer_name = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _name, int _len); 3121 da_bgfx_set_frame_buffer_name bgfx_set_frame_buffer_name; 3122 3123 /** 3124 * Obtain texture handle of frame buffer attachment. 3125 * Params: 3126 * _handle = Frame buffer handle. 3127 */ 3128 alias da_bgfx_get_texture = bgfx_texture_handle_t function(bgfx_frame_buffer_handle_t _handle, byte _attachment); 3129 da_bgfx_get_texture bgfx_get_texture; 3130 3131 /** 3132 * Destroy frame buffer. 3133 * Params: 3134 * _handle = Frame buffer handle. 3135 */ 3136 alias da_bgfx_destroy_frame_buffer = void function(bgfx_frame_buffer_handle_t _handle); 3137 da_bgfx_destroy_frame_buffer bgfx_destroy_frame_buffer; 3138 3139 /** 3140 * Create shader uniform parameter. 3141 * Remarks: 3142 * 1. Uniform names are unique. It's valid to call `bgfx::createUniform` 3143 * multiple times with the same uniform name. The library will always 3144 * return the same handle, but the handle reference count will be 3145 * incremented. This means that the same number of `bgfx::destroyUniform` 3146 * must be called to properly destroy the uniform. 3147 * 2. Predefined uniforms (declared in `bgfx_shader.sh`): 3148 * - `u_viewRect vec4(x, y, width, height)` - view rectangle for current 3149 * view, in pixels. 3150 * - `u_viewTexel vec4(1.0/width, 1.0/height, undef, undef)` - inverse 3151 * width and height 3152 * - `u_view mat4` - view matrix 3153 * - `u_invView mat4` - inverted view matrix 3154 * - `u_proj mat4` - projection matrix 3155 * - `u_invProj mat4` - inverted projection matrix 3156 * - `u_viewProj mat4` - concatenated view projection matrix 3157 * - `u_invViewProj mat4` - concatenated inverted view projection matrix 3158 * - `u_model mat4[BGFX_CONFIG_MAX_BONES]` - array of model matrices. 3159 * - `u_modelView mat4` - concatenated model view matrix, only first 3160 * model matrix from array is used. 3161 * - `u_modelViewProj mat4` - concatenated model view projection matrix. 3162 * - `u_alphaRef float` - alpha reference value for alpha test. 3163 * Params: 3164 * _name = Uniform name in shader. 3165 * _type = Type of uniform (See: `bgfx::UniformType`). 3166 * _num = Number of elements in array. 3167 */ 3168 alias da_bgfx_create_uniform = bgfx_uniform_handle_t function(const(char)* _name, bgfx_uniform_type_t _type, ushort _num); 3169 da_bgfx_create_uniform bgfx_create_uniform; 3170 3171 /** 3172 * Retrieve uniform info. 3173 * Params: 3174 * _handle = Handle to uniform object. 3175 * _info = Uniform info. 3176 */ 3177 alias da_bgfx_get_uniform_info = void function(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t* _info); 3178 da_bgfx_get_uniform_info bgfx_get_uniform_info; 3179 3180 /** 3181 * Destroy shader uniform parameter. 3182 * Params: 3183 * _handle = Handle to uniform object. 3184 */ 3185 alias da_bgfx_destroy_uniform = void function(bgfx_uniform_handle_t _handle); 3186 da_bgfx_destroy_uniform bgfx_destroy_uniform; 3187 3188 /** 3189 * Create occlusion query. 3190 */ 3191 alias da_bgfx_create_occlusion_query = bgfx_occlusion_query_handle_t function(); 3192 da_bgfx_create_occlusion_query bgfx_create_occlusion_query; 3193 3194 /** 3195 * Retrieve occlusion query result from previous frame. 3196 * Params: 3197 * _handle = Handle to occlusion query object. 3198 * _result = Number of pixels that passed test. This argument 3199 * can be `NULL` if result of occlusion query is not needed. 3200 */ 3201 alias da_bgfx_get_result = bgfx_occlusion_query_result_t function(bgfx_occlusion_query_handle_t _handle, int* _result); 3202 da_bgfx_get_result bgfx_get_result; 3203 3204 /** 3205 * Destroy occlusion query. 3206 * Params: 3207 * _handle = Handle to occlusion query object. 3208 */ 3209 alias da_bgfx_destroy_occlusion_query = void function(bgfx_occlusion_query_handle_t _handle); 3210 da_bgfx_destroy_occlusion_query bgfx_destroy_occlusion_query; 3211 3212 /** 3213 * Set palette color value. 3214 * Params: 3215 * _index = Index into palette. 3216 * _rgba = RGBA floating point values. 3217 */ 3218 alias da_bgfx_set_palette_color = void function(byte _index, const float[4] _rgba); 3219 da_bgfx_set_palette_color bgfx_set_palette_color; 3220 3221 /** 3222 * Set palette color value. 3223 * Params: 3224 * _index = Index into palette. 3225 * _rgba = Packed 32-bit RGBA value. 3226 */ 3227 alias da_bgfx_set_palette_color_rgba8 = void function(byte _index, uint _rgba); 3228 da_bgfx_set_palette_color_rgba8 bgfx_set_palette_color_rgba8; 3229 3230 /** 3231 * Set view name. 3232 * Remarks: 3233 * This is debug only feature. 3234 * In graphics debugger view name will appear as: 3235 * "nnnc <view name>" 3236 * ^ ^ ^ 3237 * | +--- compute (C) 3238 * +------ view id 3239 * Params: 3240 * _id = View id. 3241 * _name = View name. 3242 */ 3243 alias da_bgfx_set_view_name = void function(bgfx_view_id_t _id, const(char)* _name); 3244 da_bgfx_set_view_name bgfx_set_view_name; 3245 3246 /** 3247 * Set view rectangle. Draw primitive outside view will be clipped. 3248 * Params: 3249 * _id = View id. 3250 * _x = Position x from the left corner of the window. 3251 * _y = Position y from the top corner of the window. 3252 * _width = Width of view port region. 3253 * _height = Height of view port region. 3254 */ 3255 alias da_bgfx_set_view_rect = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); 3256 da_bgfx_set_view_rect bgfx_set_view_rect; 3257 3258 /** 3259 * Set view rectangle. Draw primitive outside view will be clipped. 3260 * Params: 3261 * _id = View id. 3262 * _x = Position x from the left corner of the window. 3263 * _y = Position y from the top corner of the window. 3264 * _ratio = Width and height will be set in respect to back-buffer size. 3265 * See: `BackbufferRatio::Enum`. 3266 */ 3267 alias da_bgfx_set_view_rect_ratio = void function(bgfx_view_id_t _id, ushort _x, ushort _y, bgfx_backbuffer_ratio_t _ratio); 3268 da_bgfx_set_view_rect_ratio bgfx_set_view_rect_ratio; 3269 3270 /** 3271 * Set view scissor. Draw primitive outside view will be clipped. When 3272 * _x, _y, _width and _height are set to 0, scissor will be disabled. 3273 * Params: 3274 * _id = View id. 3275 * _x = Position x from the left corner of the window. 3276 * _y = Position y from the top corner of the window. 3277 * _width = Width of view scissor region. 3278 * _height = Height of view scissor region. 3279 */ 3280 alias da_bgfx_set_view_scissor = void function(bgfx_view_id_t _id, ushort _x, ushort _y, ushort _width, ushort _height); 3281 da_bgfx_set_view_scissor bgfx_set_view_scissor; 3282 3283 /** 3284 * Set view clear flags. 3285 * Params: 3286 * _id = View id. 3287 * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear 3288 * operation. See: `BGFX_CLEAR_*`. 3289 * _rgba = Color clear value. 3290 * _depth = Depth clear value. 3291 * _stencil = Stencil clear value. 3292 */ 3293 alias da_bgfx_set_view_clear = void function(bgfx_view_id_t _id, ushort _flags, uint _rgba, float _depth, byte _stencil); 3294 da_bgfx_set_view_clear bgfx_set_view_clear; 3295 3296 /** 3297 * Set view clear flags with different clear color for each 3298 * frame buffer texture. Must use `bgfx::setPaletteColor` to setup clear color 3299 * palette. 3300 * Params: 3301 * _id = View id. 3302 * _flags = Clear flags. Use `BGFX_CLEAR_NONE` to remove any clear 3303 * operation. See: `BGFX_CLEAR_*`. 3304 * _depth = Depth clear value. 3305 * _stencil = Stencil clear value. 3306 * _c0 = Palette index for frame buffer attachment 0. 3307 * _c1 = Palette index for frame buffer attachment 1. 3308 * _c2 = Palette index for frame buffer attachment 2. 3309 * _c3 = Palette index for frame buffer attachment 3. 3310 * _c4 = Palette index for frame buffer attachment 4. 3311 * _c5 = Palette index for frame buffer attachment 5. 3312 * _c6 = Palette index for frame buffer attachment 6. 3313 * _c7 = Palette index for frame buffer attachment 7. 3314 */ 3315 alias da_bgfx_set_view_clear_mrt = void function(bgfx_view_id_t _id, ushort _flags, float _depth, byte _stencil, byte _c0, byte _c1, byte _c2, byte _c3, byte _c4, byte _c5, byte _c6, byte _c7); 3316 da_bgfx_set_view_clear_mrt bgfx_set_view_clear_mrt; 3317 3318 /** 3319 * Set view sorting mode. 3320 * Remarks: 3321 * View mode must be set prior calling `bgfx::submit` for the view. 3322 * Params: 3323 * _id = View id. 3324 * _mode = View sort mode. See `ViewMode::Enum`. 3325 */ 3326 alias da_bgfx_set_view_mode = void function(bgfx_view_id_t _id, bgfx_view_mode_t _mode); 3327 da_bgfx_set_view_mode bgfx_set_view_mode; 3328 3329 /** 3330 * Set view frame buffer. 3331 * Remarks: 3332 * Not persistent after `bgfx::reset` call. 3333 * Params: 3334 * _id = View id. 3335 * _handle = Frame buffer handle. Passing `BGFX_INVALID_HANDLE` as 3336 * frame buffer handle will draw primitives from this view into 3337 * default back buffer. 3338 */ 3339 alias da_bgfx_set_view_frame_buffer = void function(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle); 3340 da_bgfx_set_view_frame_buffer bgfx_set_view_frame_buffer; 3341 3342 /** 3343 * Set view view and projection matrices, all draw primitives in this 3344 * view will use these matrices. 3345 * Params: 3346 * _id = View id. 3347 * _view = View matrix. 3348 * _proj = Projection matrix. 3349 */ 3350 alias da_bgfx_set_view_transform = void function(bgfx_view_id_t _id, const(void)* _view, const(void)* _proj); 3351 da_bgfx_set_view_transform bgfx_set_view_transform; 3352 3353 /** 3354 * Post submit view reordering. 3355 * Params: 3356 * _id = First view id. 3357 * _num = Number of views to remap. 3358 * _order = View remap id table. Passing `NULL` will reset view ids 3359 * to default state. 3360 */ 3361 alias da_bgfx_set_view_order = void function(bgfx_view_id_t _id, ushort _num, const(bgfx_view_id_t)* _order); 3362 da_bgfx_set_view_order bgfx_set_view_order; 3363 3364 /** 3365 * Begin submitting draw calls from thread. 3366 * Params: 3367 * _forThread = Explicitly request an encoder for a worker thread. 3368 */ 3369 alias da_bgfx_encoder_begin = bgfx_encoder_t* function(bool _forThread); 3370 da_bgfx_encoder_begin bgfx_encoder_begin; 3371 3372 /** 3373 * End submitting draw calls from thread. 3374 * Params: 3375 * _encoder = Encoder. 3376 */ 3377 alias da_bgfx_encoder_end = void function(bgfx_encoder_t* _encoder); 3378 da_bgfx_encoder_end bgfx_encoder_end; 3379 3380 /** 3381 * Sets a debug marker. This allows you to group graphics calls together for easy browsing in 3382 * graphics debugging tools. 3383 * Params: 3384 * _marker = Marker string. 3385 */ 3386 alias da_bgfx_encoder_set_marker = void function(bgfx_encoder_t* _this, const(char)* _marker); 3387 da_bgfx_encoder_set_marker bgfx_encoder_set_marker; 3388 3389 /** 3390 * Set render states for draw primitive. 3391 * Remarks: 3392 * 1. To setup more complex states use: 3393 * `BGFX_STATE_ALPHA_REF(_ref)`, 3394 * `BGFX_STATE_POINT_SIZE(_size)`, 3395 * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, 3396 * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, 3397 * `BGFX_STATE_BLEND_EQUATION(_equation)`, 3398 * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` 3399 * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend 3400 * equation is specified. 3401 * Params: 3402 * _state = State flags. Default state for primitive type is 3403 * triangles. See: `BGFX_STATE_DEFAULT`. 3404 * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. 3405 * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. 3406 * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. 3407 * - `BGFX_STATE_CULL_*` - Backface culling mode. 3408 * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. 3409 * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. 3410 * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. 3411 * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and 3412 * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. 3413 */ 3414 alias da_bgfx_encoder_set_state = void function(bgfx_encoder_t* _this, ulong _state, uint _rgba); 3415 da_bgfx_encoder_set_state bgfx_encoder_set_state; 3416 3417 /** 3418 * Set condition for rendering. 3419 * Params: 3420 * _handle = Occlusion query handle. 3421 * _visible = Render if occlusion query is visible. 3422 */ 3423 alias da_bgfx_encoder_set_condition = void function(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible); 3424 da_bgfx_encoder_set_condition bgfx_encoder_set_condition; 3425 3426 /** 3427 * Set stencil test state. 3428 * Params: 3429 * _fstencil = Front stencil state. 3430 * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` 3431 * _fstencil is applied to both front and back facing primitives. 3432 */ 3433 alias da_bgfx_encoder_set_stencil = void function(bgfx_encoder_t* _this, uint _fstencil, uint _bstencil); 3434 da_bgfx_encoder_set_stencil bgfx_encoder_set_stencil; 3435 3436 /** 3437 * Set scissor for draw primitive. 3438 * Remarks: 3439 * To scissor for all primitives in view see `bgfx::setViewScissor`. 3440 * Params: 3441 * _x = Position x from the left corner of the window. 3442 * _y = Position y from the top corner of the window. 3443 * _width = Width of view scissor region. 3444 * _height = Height of view scissor region. 3445 */ 3446 alias da_bgfx_encoder_set_scissor = ushort function(bgfx_encoder_t* _this, ushort _x, ushort _y, ushort _width, ushort _height); 3447 da_bgfx_encoder_set_scissor bgfx_encoder_set_scissor; 3448 3449 /** 3450 * Set scissor from cache for draw primitive. 3451 * Remarks: 3452 * To scissor for all primitives in view see `bgfx::setViewScissor`. 3453 * Params: 3454 * _cache = Index in scissor cache. 3455 */ 3456 alias da_bgfx_encoder_set_scissor_cached = void function(bgfx_encoder_t* _this, ushort _cache); 3457 da_bgfx_encoder_set_scissor_cached bgfx_encoder_set_scissor_cached; 3458 3459 /** 3460 * Set model matrix for draw primitive. If it is not called, 3461 * the model will be rendered with an identity model matrix. 3462 * Params: 3463 * _mtx = Pointer to first matrix in array. 3464 * _num = Number of matrices in array. 3465 */ 3466 alias da_bgfx_encoder_set_transform = uint function(bgfx_encoder_t* _this, const(void)* _mtx, ushort _num); 3467 da_bgfx_encoder_set_transform bgfx_encoder_set_transform; 3468 3469 /** 3470 * Set model matrix from matrix cache for draw primitive. 3471 * Params: 3472 * _cache = Index in matrix cache. 3473 * _num = Number of matrices from cache. 3474 */ 3475 alias da_bgfx_encoder_set_transform_cached = void function(bgfx_encoder_t* _this, uint _cache, ushort _num); 3476 da_bgfx_encoder_set_transform_cached bgfx_encoder_set_transform_cached; 3477 3478 /** 3479 * Reserve matrices in internal matrix cache. 3480 * Attention: Pointer returned can be modifed until `bgfx::frame` is called. 3481 * Params: 3482 * _transform = Pointer to `Transform` structure. 3483 * _num = Number of matrices. 3484 */ 3485 alias da_bgfx_encoder_alloc_transform = uint function(bgfx_encoder_t* _this, bgfx_transform_t* _transform, ushort _num); 3486 da_bgfx_encoder_alloc_transform bgfx_encoder_alloc_transform; 3487 3488 /** 3489 * Set shader uniform parameter for draw primitive. 3490 * Params: 3491 * _handle = Uniform. 3492 * _value = Pointer to uniform data. 3493 * _num = Number of elements. Passing `UINT16_MAX` will 3494 * use the _num passed on uniform creation. 3495 */ 3496 alias da_bgfx_encoder_set_uniform = void function(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); 3497 da_bgfx_encoder_set_uniform bgfx_encoder_set_uniform; 3498 3499 /** 3500 * Set index buffer for draw primitive. 3501 * Params: 3502 * _handle = Index buffer. 3503 * _firstIndex = First index to render. 3504 * _numIndices = Number of indices to render. 3505 */ 3506 alias da_bgfx_encoder_set_index_buffer = void function(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 3507 da_bgfx_encoder_set_index_buffer bgfx_encoder_set_index_buffer; 3508 3509 /** 3510 * Set index buffer for draw primitive. 3511 * Params: 3512 * _handle = Dynamic index buffer. 3513 * _firstIndex = First index to render. 3514 * _numIndices = Number of indices to render. 3515 */ 3516 alias da_bgfx_encoder_set_dynamic_index_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 3517 da_bgfx_encoder_set_dynamic_index_buffer bgfx_encoder_set_dynamic_index_buffer; 3518 3519 /** 3520 * Set index buffer for draw primitive. 3521 * Params: 3522 * _tib = Transient index buffer. 3523 * _firstIndex = First index to render. 3524 * _numIndices = Number of indices to render. 3525 */ 3526 alias da_bgfx_encoder_set_transient_index_buffer = void function(bgfx_encoder_t* _this, const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); 3527 da_bgfx_encoder_set_transient_index_buffer bgfx_encoder_set_transient_index_buffer; 3528 3529 /** 3530 * Set vertex buffer for draw primitive. 3531 * Params: 3532 * _stream = Vertex stream. 3533 * _handle = Vertex buffer. 3534 * _startVertex = First vertex to render. 3535 * _numVertices = Number of vertices to render. 3536 * _layoutHandle = Vertex layout for aliasing vertex buffer. 3537 */ 3538 alias da_bgfx_encoder_set_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); 3539 da_bgfx_encoder_set_vertex_buffer bgfx_encoder_set_vertex_buffer; 3540 3541 /** 3542 * Set vertex buffer for draw primitive. 3543 * Params: 3544 * _stream = Vertex stream. 3545 * _handle = Dynamic vertex buffer. 3546 * _startVertex = First vertex to render. 3547 * _numVertices = Number of vertices to render. 3548 * _layoutHandle = Vertex layout for aliasing vertex buffer. 3549 */ 3550 alias da_bgfx_encoder_set_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); 3551 da_bgfx_encoder_set_dynamic_vertex_buffer bgfx_encoder_set_dynamic_vertex_buffer; 3552 3553 /** 3554 * Set vertex buffer for draw primitive. 3555 * Params: 3556 * _stream = Vertex stream. 3557 * _tvb = Transient vertex buffer. 3558 * _startVertex = First vertex to render. 3559 * _numVertices = Number of vertices to render. 3560 * _layoutHandle = Vertex layout for aliasing vertex buffer. 3561 */ 3562 alias da_bgfx_encoder_set_transient_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices, bgfx_vertex_layout_handle_t _layoutHandle); 3563 da_bgfx_encoder_set_transient_vertex_buffer bgfx_encoder_set_transient_vertex_buffer; 3564 3565 /** 3566 * Set number of vertices for auto generated vertices use in conjuction 3567 * with gl_VertexID. 3568 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 3569 * Params: 3570 * _numVertices = Number of vertices. 3571 */ 3572 alias da_bgfx_encoder_set_vertex_count = void function(bgfx_encoder_t* _this, uint _numVertices); 3573 da_bgfx_encoder_set_vertex_count bgfx_encoder_set_vertex_count; 3574 3575 /** 3576 * Set instance data buffer for draw primitive. 3577 * Params: 3578 * _idb = Transient instance data buffer. 3579 * _start = First instance data. 3580 * _num = Number of data instances. 3581 */ 3582 alias da_bgfx_encoder_set_instance_data_buffer = void function(bgfx_encoder_t* _this, const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); 3583 da_bgfx_encoder_set_instance_data_buffer bgfx_encoder_set_instance_data_buffer; 3584 3585 /** 3586 * Set instance data buffer for draw primitive. 3587 * Params: 3588 * _handle = Vertex buffer. 3589 * _startVertex = First instance data. 3590 * _num = Number of data instances. 3591 * Set instance data buffer for draw primitive. 3592 */ 3593 alias da_bgfx_encoder_set_instance_data_from_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 3594 da_bgfx_encoder_set_instance_data_from_vertex_buffer bgfx_encoder_set_instance_data_from_vertex_buffer; 3595 3596 /** 3597 * Set instance data buffer for draw primitive. 3598 * Params: 3599 * _handle = Dynamic vertex buffer. 3600 * _startVertex = First instance data. 3601 * _num = Number of data instances. 3602 */ 3603 alias da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 3604 da_bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer; 3605 3606 /** 3607 * Set number of instances for auto generated instances use in conjuction 3608 * with gl_InstanceID. 3609 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 3610 */ 3611 alias da_bgfx_encoder_set_instance_count = void function(bgfx_encoder_t* _this, uint _numInstances); 3612 da_bgfx_encoder_set_instance_count bgfx_encoder_set_instance_count; 3613 3614 /** 3615 * Set texture stage for draw primitive. 3616 * Params: 3617 * _stage = Texture unit. 3618 * _sampler = Program sampler. 3619 * _handle = Texture handle. 3620 * _flags = Texture sampling mode. Default value UINT32_MAX uses 3621 * texture sampling settings from the texture. 3622 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 3623 * mode. 3624 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 3625 * sampling. 3626 */ 3627 alias da_bgfx_encoder_set_texture = void function(bgfx_encoder_t* _this, byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); 3628 da_bgfx_encoder_set_texture bgfx_encoder_set_texture; 3629 3630 /** 3631 * Submit an empty primitive for rendering. Uniforms and draw state 3632 * will be applied but no geometry will be submitted. 3633 * Remarks: 3634 * These empty draw calls will sort before ordinary draw calls. 3635 * Params: 3636 * _id = View id. 3637 */ 3638 alias da_bgfx_encoder_touch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id); 3639 da_bgfx_encoder_touch bgfx_encoder_touch; 3640 3641 /** 3642 * Submit primitive for rendering. 3643 * Params: 3644 * _id = View id. 3645 * _program = Program. 3646 * _depth = Depth for sorting. 3647 * _preserveState = Preserve internal draw state for next draw call submit. 3648 */ 3649 alias da_bgfx_encoder_submit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, bool _preserveState); 3650 da_bgfx_encoder_submit bgfx_encoder_submit; 3651 3652 /** 3653 * Submit primitive with occlusion query for rendering. 3654 * Params: 3655 * _id = View id. 3656 * _program = Program. 3657 * _occlusionQuery = Occlusion query. 3658 * _depth = Depth for sorting. 3659 * _preserveState = Preserve internal draw state for next draw call submit. 3660 */ 3661 alias da_bgfx_encoder_submit_occlusion_query = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, bool _preserveState); 3662 da_bgfx_encoder_submit_occlusion_query bgfx_encoder_submit_occlusion_query; 3663 3664 /** 3665 * Submit primitive for rendering with index and instance data info from 3666 * indirect buffer. 3667 * Params: 3668 * _id = View id. 3669 * _program = Program. 3670 * _indirectHandle = Indirect buffer. 3671 * _start = First element in indirect buffer. 3672 * _num = Number of dispatches. 3673 * _depth = Depth for sorting. 3674 * _preserveState = Preserve internal draw state for next draw call submit. 3675 */ 3676 alias da_bgfx_encoder_submit_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState); 3677 da_bgfx_encoder_submit_indirect bgfx_encoder_submit_indirect; 3678 3679 /** 3680 * Set compute index buffer. 3681 * Params: 3682 * _stage = Compute stage. 3683 * _handle = Index buffer handle. 3684 * _access = Buffer access. See `Access::Enum`. 3685 */ 3686 alias da_bgfx_encoder_set_compute_index_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); 3687 da_bgfx_encoder_set_compute_index_buffer bgfx_encoder_set_compute_index_buffer; 3688 3689 /** 3690 * Set compute vertex buffer. 3691 * Params: 3692 * _stage = Compute stage. 3693 * _handle = Vertex buffer handle. 3694 * _access = Buffer access. See `Access::Enum`. 3695 */ 3696 alias da_bgfx_encoder_set_compute_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); 3697 da_bgfx_encoder_set_compute_vertex_buffer bgfx_encoder_set_compute_vertex_buffer; 3698 3699 /** 3700 * Set compute dynamic index buffer. 3701 * Params: 3702 * _stage = Compute stage. 3703 * _handle = Dynamic index buffer handle. 3704 * _access = Buffer access. See `Access::Enum`. 3705 */ 3706 alias da_bgfx_encoder_set_compute_dynamic_index_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); 3707 da_bgfx_encoder_set_compute_dynamic_index_buffer bgfx_encoder_set_compute_dynamic_index_buffer; 3708 3709 /** 3710 * Set compute dynamic vertex buffer. 3711 * Params: 3712 * _stage = Compute stage. 3713 * _handle = Dynamic vertex buffer handle. 3714 * _access = Buffer access. See `Access::Enum`. 3715 */ 3716 alias da_bgfx_encoder_set_compute_dynamic_vertex_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); 3717 da_bgfx_encoder_set_compute_dynamic_vertex_buffer bgfx_encoder_set_compute_dynamic_vertex_buffer; 3718 3719 /** 3720 * Set compute indirect buffer. 3721 * Params: 3722 * _stage = Compute stage. 3723 * _handle = Indirect buffer handle. 3724 * _access = Buffer access. See `Access::Enum`. 3725 */ 3726 alias da_bgfx_encoder_set_compute_indirect_buffer = void function(bgfx_encoder_t* _this, byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); 3727 da_bgfx_encoder_set_compute_indirect_buffer bgfx_encoder_set_compute_indirect_buffer; 3728 3729 /** 3730 * Set compute image from texture. 3731 * Params: 3732 * _stage = Compute stage. 3733 * _handle = Texture handle. 3734 * _mip = Mip level. 3735 * _access = Image access. See `Access::Enum`. 3736 * _format = Texture format. See: `TextureFormat::Enum`. 3737 */ 3738 alias da_bgfx_encoder_set_image = void function(bgfx_encoder_t* _this, byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); 3739 da_bgfx_encoder_set_image bgfx_encoder_set_image; 3740 3741 /** 3742 * Dispatch compute. 3743 * Params: 3744 * _id = View id. 3745 * _program = Compute program. 3746 * _numX = Number of groups X. 3747 * _numY = Number of groups Y. 3748 * _numZ = Number of groups Z. 3749 */ 3750 alias da_bgfx_encoder_dispatch = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ); 3751 da_bgfx_encoder_dispatch bgfx_encoder_dispatch; 3752 3753 /** 3754 * Dispatch compute indirect. 3755 * Params: 3756 * _id = View id. 3757 * _program = Compute program. 3758 * _indirectHandle = Indirect buffer. 3759 * _start = First element in indirect buffer. 3760 * _num = Number of dispatches. 3761 */ 3762 alias da_bgfx_encoder_dispatch_indirect = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num); 3763 da_bgfx_encoder_dispatch_indirect bgfx_encoder_dispatch_indirect; 3764 3765 /** 3766 * Discard all previously set state for draw or compute call. 3767 */ 3768 alias da_bgfx_encoder_discard = void function(bgfx_encoder_t* _this); 3769 da_bgfx_encoder_discard bgfx_encoder_discard; 3770 3771 /** 3772 * Blit 2D texture region between two 2D textures. 3773 * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. 3774 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. 3775 * Params: 3776 * _id = View id. 3777 * _dst = Destination texture handle. 3778 * _dstMip = Destination texture mip level. 3779 * _dstX = Destination texture X position. 3780 * _dstY = Destination texture Y position. 3781 * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube 3782 * this argument represents destination texture cube face. For 3D texture this argument 3783 * represents destination texture Z position. 3784 * _src = Source texture handle. 3785 * _srcMip = Source texture mip level. 3786 * _srcX = Source texture X position. 3787 * _srcY = Source texture Y position. 3788 * _srcZ = If texture is 2D this argument should be 0. If source texture is cube 3789 * this argument represents source texture cube face. For 3D texture this argument 3790 * represents source texture Z position. 3791 * _width = Width of region. 3792 * _height = Height of region. 3793 * _depth = If texture is 3D this argument represents depth of region, otherwise it's 3794 * unused. 3795 */ 3796 alias da_bgfx_encoder_blit = void function(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); 3797 da_bgfx_encoder_blit bgfx_encoder_blit; 3798 3799 /** 3800 * Request screen shot of window back buffer. 3801 * Remarks: 3802 * `bgfx::CallbackI::screenShot` must be implemented. 3803 * Attention: Frame buffer handle must be created with OS' target native window handle. 3804 * Params: 3805 * _handle = Frame buffer handle. If handle is `BGFX_INVALID_HANDLE` request will be 3806 * made for main window back buffer. 3807 * _filePath = Will be passed to `bgfx::CallbackI::screenShot` callback. 3808 */ 3809 alias da_bgfx_request_screen_shot = void function(bgfx_frame_buffer_handle_t _handle, const(char)* _filePath); 3810 da_bgfx_request_screen_shot bgfx_request_screen_shot; 3811 3812 /** 3813 * Render frame. 3814 * Attention: `bgfx::renderFrame` is blocking call. It waits for 3815 * `bgfx::frame` to be called from API thread to process frame. 3816 * If timeout value is passed call will timeout and return even 3817 * if `bgfx::frame` is not called. 3818 * Warning: This call should be only used on platforms that don't 3819 * allow creating separate rendering thread. If it is called before 3820 * to bgfx::init, render thread won't be created by bgfx::init call. 3821 * Params: 3822 * _msecs = Timeout in milliseconds. 3823 */ 3824 alias da_bgfx_render_frame = bgfx_render_frame_t function(int _msecs); 3825 da_bgfx_render_frame bgfx_render_frame; 3826 3827 /** 3828 * Set platform data. 3829 * Warning: Must be called before `bgfx::init`. 3830 * Params: 3831 * _data = Platform data. 3832 */ 3833 alias da_bgfx_set_platform_data = void function(const(bgfx_platform_data_t)* _data); 3834 da_bgfx_set_platform_data bgfx_set_platform_data; 3835 3836 /** 3837 * Get internal data for interop. 3838 * Attention: It's expected you understand some bgfx internals before you 3839 * use this call. 3840 * Warning: Must be called only on render thread. 3841 */ 3842 alias da_bgfx_get_internal_data = const(bgfx_internal_data_t)* function(); 3843 da_bgfx_get_internal_data bgfx_get_internal_data; 3844 3845 /** 3846 * Override internal texture with externally created texture. Previously 3847 * created internal texture will released. 3848 * Attention: It's expected you understand some bgfx internals before you 3849 * use this call. 3850 * Warning: Must be called only on render thread. 3851 * Params: 3852 * _handle = Texture handle. 3853 * _ptr = Native API pointer to texture. 3854 */ 3855 alias da_bgfx_override_internal_texture_ptr = ulong function(bgfx_texture_handle_t _handle, ulong _ptr); 3856 da_bgfx_override_internal_texture_ptr bgfx_override_internal_texture_ptr; 3857 3858 /** 3859 * Override internal texture by creating new texture. Previously created 3860 * internal texture will released. 3861 * Attention: It's expected you understand some bgfx internals before you 3862 * use this call. 3863 * Returns: Native API pointer to texture. If result is 0, texture is not created yet from the 3864 * main thread. 3865 * Warning: Must be called only on render thread. 3866 * Params: 3867 * _handle = Texture handle. 3868 * _width = Width. 3869 * _height = Height. 3870 * _numMips = Number of mip-maps. 3871 * _format = Texture format. See: `TextureFormat::Enum`. 3872 * _flags = Texture creation (see `BGFX_TEXTURE_*`.), and sampler (see `BGFX_SAMPLER_*`) 3873 * flags. Default texture sampling mode is linear, and wrap mode is repeat. 3874 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 3875 * mode. 3876 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 3877 * sampling. 3878 */ 3879 alias da_bgfx_override_internal_texture = ulong function(bgfx_texture_handle_t _handle, ushort _width, ushort _height, byte _numMips, bgfx_texture_format_t _format, ulong _flags); 3880 da_bgfx_override_internal_texture bgfx_override_internal_texture; 3881 3882 /** 3883 * Sets a debug marker. This allows you to group graphics calls together for easy browsing in 3884 * graphics debugging tools. 3885 * Params: 3886 * _marker = Marker string. 3887 */ 3888 alias da_bgfx_set_marker = void function(const(char)* _marker); 3889 da_bgfx_set_marker bgfx_set_marker; 3890 3891 /** 3892 * Set render states for draw primitive. 3893 * Remarks: 3894 * 1. To setup more complex states use: 3895 * `BGFX_STATE_ALPHA_REF(_ref)`, 3896 * `BGFX_STATE_POINT_SIZE(_size)`, 3897 * `BGFX_STATE_BLEND_FUNC(_src, _dst)`, 3898 * `BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)`, 3899 * `BGFX_STATE_BLEND_EQUATION(_equation)`, 3900 * `BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)` 3901 * 2. `BGFX_STATE_BLEND_EQUATION_ADD` is set when no other blend 3902 * equation is specified. 3903 * Params: 3904 * _state = State flags. Default state for primitive type is 3905 * triangles. See: `BGFX_STATE_DEFAULT`. 3906 * - `BGFX_STATE_DEPTH_TEST_*` - Depth test function. 3907 * - `BGFX_STATE_BLEND_*` - See remark 1 about BGFX_STATE_BLEND_FUNC. 3908 * - `BGFX_STATE_BLEND_EQUATION_*` - See remark 2. 3909 * - `BGFX_STATE_CULL_*` - Backface culling mode. 3910 * - `BGFX_STATE_WRITE_*` - Enable R, G, B, A or Z write. 3911 * - `BGFX_STATE_MSAA` - Enable hardware multisample antialiasing. 3912 * - `BGFX_STATE_PT_[TRISTRIP/LINES/POINTS]` - Primitive type. 3913 * _rgba = Sets blend factor used by `BGFX_STATE_BLEND_FACTOR` and 3914 * `BGFX_STATE_BLEND_INV_FACTOR` blend modes. 3915 */ 3916 alias da_bgfx_set_state = void function(ulong _state, uint _rgba); 3917 da_bgfx_set_state bgfx_set_state; 3918 3919 /** 3920 * Set condition for rendering. 3921 * Params: 3922 * _handle = Occlusion query handle. 3923 * _visible = Render if occlusion query is visible. 3924 */ 3925 alias da_bgfx_set_condition = void function(bgfx_occlusion_query_handle_t _handle, bool _visible); 3926 da_bgfx_set_condition bgfx_set_condition; 3927 3928 /** 3929 * Set stencil test state. 3930 * Params: 3931 * _fstencil = Front stencil state. 3932 * _bstencil = Back stencil state. If back is set to `BGFX_STENCIL_NONE` 3933 * _fstencil is applied to both front and back facing primitives. 3934 */ 3935 alias da_bgfx_set_stencil = void function(uint _fstencil, uint _bstencil); 3936 da_bgfx_set_stencil bgfx_set_stencil; 3937 3938 /** 3939 * Set scissor for draw primitive. 3940 * Remarks: 3941 * To scissor for all primitives in view see `bgfx::setViewScissor`. 3942 * Params: 3943 * _x = Position x from the left corner of the window. 3944 * _y = Position y from the top corner of the window. 3945 * _width = Width of view scissor region. 3946 * _height = Height of view scissor region. 3947 */ 3948 alias da_bgfx_set_scissor = ushort function(ushort _x, ushort _y, ushort _width, ushort _height); 3949 da_bgfx_set_scissor bgfx_set_scissor; 3950 3951 /** 3952 * Set scissor from cache for draw primitive. 3953 * Remarks: 3954 * To scissor for all primitives in view see `bgfx::setViewScissor`. 3955 * Params: 3956 * _cache = Index in scissor cache. 3957 */ 3958 alias da_bgfx_set_scissor_cached = void function(ushort _cache); 3959 da_bgfx_set_scissor_cached bgfx_set_scissor_cached; 3960 3961 /** 3962 * Set model matrix for draw primitive. If it is not called, 3963 * the model will be rendered with an identity model matrix. 3964 * Params: 3965 * _mtx = Pointer to first matrix in array. 3966 * _num = Number of matrices in array. 3967 */ 3968 alias da_bgfx_set_transform = uint function(const(void)* _mtx, ushort _num); 3969 da_bgfx_set_transform bgfx_set_transform; 3970 3971 /** 3972 * Set model matrix from matrix cache for draw primitive. 3973 * Params: 3974 * _cache = Index in matrix cache. 3975 * _num = Number of matrices from cache. 3976 */ 3977 alias da_bgfx_set_transform_cached = void function(uint _cache, ushort _num); 3978 da_bgfx_set_transform_cached bgfx_set_transform_cached; 3979 3980 /** 3981 * Reserve matrices in internal matrix cache. 3982 * Attention: Pointer returned can be modifed until `bgfx::frame` is called. 3983 * Params: 3984 * _transform = Pointer to `Transform` structure. 3985 * _num = Number of matrices. 3986 */ 3987 alias da_bgfx_alloc_transform = uint function(bgfx_transform_t* _transform, ushort _num); 3988 da_bgfx_alloc_transform bgfx_alloc_transform; 3989 3990 /** 3991 * Set shader uniform parameter for draw primitive. 3992 * Params: 3993 * _handle = Uniform. 3994 * _value = Pointer to uniform data. 3995 * _num = Number of elements. Passing `UINT16_MAX` will 3996 * use the _num passed on uniform creation. 3997 */ 3998 alias da_bgfx_set_uniform = void function(bgfx_uniform_handle_t _handle, const(void)* _value, ushort _num); 3999 da_bgfx_set_uniform bgfx_set_uniform; 4000 4001 /** 4002 * Set index buffer for draw primitive. 4003 * Params: 4004 * _handle = Index buffer. 4005 * _firstIndex = First index to render. 4006 * _numIndices = Number of indices to render. 4007 */ 4008 alias da_bgfx_set_index_buffer = void function(bgfx_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 4009 da_bgfx_set_index_buffer bgfx_set_index_buffer; 4010 4011 /** 4012 * Set index buffer for draw primitive. 4013 * Params: 4014 * _handle = Dynamic index buffer. 4015 * _firstIndex = First index to render. 4016 * _numIndices = Number of indices to render. 4017 */ 4018 alias da_bgfx_set_dynamic_index_buffer = void function(bgfx_dynamic_index_buffer_handle_t _handle, uint _firstIndex, uint _numIndices); 4019 da_bgfx_set_dynamic_index_buffer bgfx_set_dynamic_index_buffer; 4020 4021 /** 4022 * Set index buffer for draw primitive. 4023 * Params: 4024 * _tib = Transient index buffer. 4025 * _firstIndex = First index to render. 4026 * _numIndices = Number of indices to render. 4027 */ 4028 alias da_bgfx_set_transient_index_buffer = void function(const(bgfx_transient_index_buffer_t)* _tib, uint _firstIndex, uint _numIndices); 4029 da_bgfx_set_transient_index_buffer bgfx_set_transient_index_buffer; 4030 4031 /** 4032 * Set vertex buffer for draw primitive. 4033 * Params: 4034 * _stream = Vertex stream. 4035 * _handle = Vertex buffer. 4036 * _startVertex = First vertex to render. 4037 * _numVertices = Number of vertices to render. 4038 */ 4039 alias da_bgfx_set_vertex_buffer = void function(byte _stream, bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); 4040 da_bgfx_set_vertex_buffer bgfx_set_vertex_buffer; 4041 4042 /** 4043 * Set vertex buffer for draw primitive. 4044 * Params: 4045 * _stream = Vertex stream. 4046 * _handle = Dynamic vertex buffer. 4047 * _startVertex = First vertex to render. 4048 * _numVertices = Number of vertices to render. 4049 */ 4050 alias da_bgfx_set_dynamic_vertex_buffer = void function(byte _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _numVertices); 4051 da_bgfx_set_dynamic_vertex_buffer bgfx_set_dynamic_vertex_buffer; 4052 4053 /** 4054 * Set vertex buffer for draw primitive. 4055 * Params: 4056 * _stream = Vertex stream. 4057 * _tvb = Transient vertex buffer. 4058 * _startVertex = First vertex to render. 4059 * _numVertices = Number of vertices to render. 4060 */ 4061 alias da_bgfx_set_transient_vertex_buffer = void function(byte _stream, const(bgfx_transient_vertex_buffer_t)* _tvb, uint _startVertex, uint _numVertices); 4062 da_bgfx_set_transient_vertex_buffer bgfx_set_transient_vertex_buffer; 4063 4064 /** 4065 * Set number of vertices for auto generated vertices use in conjuction 4066 * with gl_VertexID. 4067 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 4068 * Params: 4069 * _numVertices = Number of vertices. 4070 */ 4071 alias da_bgfx_set_vertex_count = void function(uint _numVertices); 4072 da_bgfx_set_vertex_count bgfx_set_vertex_count; 4073 4074 /** 4075 * Set instance data buffer for draw primitive. 4076 * Params: 4077 * _idb = Transient instance data buffer. 4078 * _start = First instance data. 4079 * _num = Number of data instances. 4080 */ 4081 alias da_bgfx_set_instance_data_buffer = void function(const(bgfx_instance_data_buffer_t)* _idb, uint _start, uint _num); 4082 da_bgfx_set_instance_data_buffer bgfx_set_instance_data_buffer; 4083 4084 /** 4085 * Set instance data buffer for draw primitive. 4086 * Params: 4087 * _handle = Vertex buffer. 4088 * _startVertex = First instance data. 4089 * _num = Number of data instances. 4090 * Set instance data buffer for draw primitive. 4091 */ 4092 alias da_bgfx_set_instance_data_from_vertex_buffer = void function(bgfx_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 4093 da_bgfx_set_instance_data_from_vertex_buffer bgfx_set_instance_data_from_vertex_buffer; 4094 4095 /** 4096 * Set instance data buffer for draw primitive. 4097 * Params: 4098 * _handle = Dynamic vertex buffer. 4099 * _startVertex = First instance data. 4100 * _num = Number of data instances. 4101 */ 4102 alias da_bgfx_set_instance_data_from_dynamic_vertex_buffer = void function(bgfx_dynamic_vertex_buffer_handle_t _handle, uint _startVertex, uint _num); 4103 da_bgfx_set_instance_data_from_dynamic_vertex_buffer bgfx_set_instance_data_from_dynamic_vertex_buffer; 4104 4105 /** 4106 * Set number of instances for auto generated instances use in conjuction 4107 * with gl_InstanceID. 4108 * Attention: Availability depends on: `BGFX_CAPS_VERTEX_ID`. 4109 */ 4110 alias da_bgfx_set_instance_count = void function(uint _numInstances); 4111 da_bgfx_set_instance_count bgfx_set_instance_count; 4112 4113 /** 4114 * Set texture stage for draw primitive. 4115 * Params: 4116 * _stage = Texture unit. 4117 * _sampler = Program sampler. 4118 * _handle = Texture handle. 4119 * _flags = Texture sampling mode. Default value UINT32_MAX uses 4120 * texture sampling settings from the texture. 4121 * - `BGFX_SAMPLER_[U/V/W]_[MIRROR/CLAMP]` - Mirror or clamp to edge wrap 4122 * mode. 4123 * - `BGFX_SAMPLER_[MIN/MAG/MIP]_[POINT/ANISOTROPIC]` - Point or anisotropic 4124 * sampling. 4125 */ 4126 alias da_bgfx_set_texture = void function(byte _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint _flags); 4127 da_bgfx_set_texture bgfx_set_texture; 4128 4129 /** 4130 * Submit an empty primitive for rendering. Uniforms and draw state 4131 * will be applied but no geometry will be submitted. 4132 * Remarks: 4133 * These empty draw calls will sort before ordinary draw calls. 4134 * Params: 4135 * _id = View id. 4136 */ 4137 alias da_bgfx_touch = void function(bgfx_view_id_t _id); 4138 da_bgfx_touch bgfx_touch; 4139 4140 /** 4141 * Submit primitive for rendering. 4142 * Params: 4143 * _id = View id. 4144 * _program = Program. 4145 * _depth = Depth for sorting. 4146 * _preserveState = Preserve internal draw state for next draw call submit. 4147 */ 4148 alias da_bgfx_submit = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _depth, bool _preserveState); 4149 da_bgfx_submit bgfx_submit; 4150 4151 /** 4152 * Submit primitive with occlusion query for rendering. 4153 * Params: 4154 * _id = View id. 4155 * _program = Program. 4156 * _occlusionQuery = Occlusion query. 4157 * _depth = Depth for sorting. 4158 * _preserveState = Preserve internal draw state for next draw call submit. 4159 */ 4160 alias da_bgfx_submit_occlusion_query = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint _depth, bool _preserveState); 4161 da_bgfx_submit_occlusion_query bgfx_submit_occlusion_query; 4162 4163 /** 4164 * Submit primitive for rendering with index and instance data info from 4165 * indirect buffer. 4166 * Params: 4167 * _id = View id. 4168 * _program = Program. 4169 * _indirectHandle = Indirect buffer. 4170 * _start = First element in indirect buffer. 4171 * _num = Number of dispatches. 4172 * _depth = Depth for sorting. 4173 * _preserveState = Preserve internal draw state for next draw call submit. 4174 */ 4175 alias da_bgfx_submit_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num, uint _depth, bool _preserveState); 4176 da_bgfx_submit_indirect bgfx_submit_indirect; 4177 4178 /** 4179 * Set compute index buffer. 4180 * Params: 4181 * _stage = Compute stage. 4182 * _handle = Index buffer handle. 4183 * _access = Buffer access. See `Access::Enum`. 4184 */ 4185 alias da_bgfx_set_compute_index_buffer = void function(byte _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access); 4186 da_bgfx_set_compute_index_buffer bgfx_set_compute_index_buffer; 4187 4188 /** 4189 * Set compute vertex buffer. 4190 * Params: 4191 * _stage = Compute stage. 4192 * _handle = Vertex buffer handle. 4193 * _access = Buffer access. See `Access::Enum`. 4194 */ 4195 alias da_bgfx_set_compute_vertex_buffer = void function(byte _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access); 4196 da_bgfx_set_compute_vertex_buffer bgfx_set_compute_vertex_buffer; 4197 4198 /** 4199 * Set compute dynamic index buffer. 4200 * Params: 4201 * _stage = Compute stage. 4202 * _handle = Dynamic index buffer handle. 4203 * _access = Buffer access. See `Access::Enum`. 4204 */ 4205 alias da_bgfx_set_compute_dynamic_index_buffer = void function(byte _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access); 4206 da_bgfx_set_compute_dynamic_index_buffer bgfx_set_compute_dynamic_index_buffer; 4207 4208 /** 4209 * Set compute dynamic vertex buffer. 4210 * Params: 4211 * _stage = Compute stage. 4212 * _handle = Dynamic vertex buffer handle. 4213 * _access = Buffer access. See `Access::Enum`. 4214 */ 4215 alias da_bgfx_set_compute_dynamic_vertex_buffer = void function(byte _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access); 4216 da_bgfx_set_compute_dynamic_vertex_buffer bgfx_set_compute_dynamic_vertex_buffer; 4217 4218 /** 4219 * Set compute indirect buffer. 4220 * Params: 4221 * _stage = Compute stage. 4222 * _handle = Indirect buffer handle. 4223 * _access = Buffer access. See `Access::Enum`. 4224 */ 4225 alias da_bgfx_set_compute_indirect_buffer = void function(byte _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access); 4226 da_bgfx_set_compute_indirect_buffer bgfx_set_compute_indirect_buffer; 4227 4228 /** 4229 * Set compute image from texture. 4230 * Params: 4231 * _stage = Compute stage. 4232 * _handle = Texture handle. 4233 * _mip = Mip level. 4234 * _access = Image access. See `Access::Enum`. 4235 * _format = Texture format. See: `TextureFormat::Enum`. 4236 */ 4237 alias da_bgfx_set_image = void function(byte _stage, bgfx_texture_handle_t _handle, byte _mip, bgfx_access_t _access, bgfx_texture_format_t _format); 4238 da_bgfx_set_image bgfx_set_image; 4239 4240 /** 4241 * Dispatch compute. 4242 * Params: 4243 * _id = View id. 4244 * _program = Compute program. 4245 * _numX = Number of groups X. 4246 * _numY = Number of groups Y. 4247 * _numZ = Number of groups Z. 4248 */ 4249 alias da_bgfx_dispatch = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint _numX, uint _numY, uint _numZ); 4250 da_bgfx_dispatch bgfx_dispatch; 4251 4252 /** 4253 * Dispatch compute indirect. 4254 * Params: 4255 * _id = View id. 4256 * _program = Compute program. 4257 * _indirectHandle = Indirect buffer. 4258 * _start = First element in indirect buffer. 4259 * _num = Number of dispatches. 4260 */ 4261 alias da_bgfx_dispatch_indirect = void function(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, ushort _start, ushort _num); 4262 da_bgfx_dispatch_indirect bgfx_dispatch_indirect; 4263 4264 /** 4265 * Discard all previously set state for draw or compute call. 4266 */ 4267 alias da_bgfx_discard = void function(); 4268 da_bgfx_discard bgfx_discard; 4269 4270 /** 4271 * Blit 2D texture region between two 2D textures. 4272 * Attention: Destination texture must be created with `BGFX_TEXTURE_BLIT_DST` flag. 4273 * Attention: Availability depends on: `BGFX_CAPS_TEXTURE_BLIT`. 4274 * Params: 4275 * _id = View id. 4276 * _dst = Destination texture handle. 4277 * _dstMip = Destination texture mip level. 4278 * _dstX = Destination texture X position. 4279 * _dstY = Destination texture Y position. 4280 * _dstZ = If texture is 2D this argument should be 0. If destination texture is cube 4281 * this argument represents destination texture cube face. For 3D texture this argument 4282 * represents destination texture Z position. 4283 * _src = Source texture handle. 4284 * _srcMip = Source texture mip level. 4285 * _srcX = Source texture X position. 4286 * _srcY = Source texture Y position. 4287 * _srcZ = If texture is 2D this argument should be 0. If source texture is cube 4288 * this argument represents source texture cube face. For 3D texture this argument 4289 * represents source texture Z position. 4290 * _width = Width of region. 4291 * _height = Height of region. 4292 * _depth = If texture is 3D this argument represents depth of region, otherwise it's 4293 * unused. 4294 */ 4295 alias da_bgfx_blit = void function(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, byte _dstMip, ushort _dstX, ushort _dstY, ushort _dstZ, bgfx_texture_handle_t _src, byte _srcMip, ushort _srcX, ushort _srcY, ushort _srcZ, ushort _width, ushort _height, ushort _depth); 4296 da_bgfx_blit bgfx_blit; 4297 4298 } 4299 }