From 6baa37080165d91e522c99d811f54aec1704aa0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Tue, 25 May 2021 12:47:28 -0700 Subject: [PATCH] Fixed transient index buffer functions to all have 32-bit indices support, and removed 16-bit only restriction from docs. --- bindings/bf/bgfx.bf | 10 ++++------ bindings/cs/bgfx.cs | 10 ++++------ bindings/d/funcs.d | 20 ++++++++------------ bindings/d/types.d | 2 +- include/bgfx/bgfx.h | 22 ++++++++++++++++------ include/bgfx/c99/bgfx.h | 14 ++++++-------- include/bgfx/defines.h | 2 +- scripts/bgfx.idl | 12 +++++------- src/bgfx.cpp | 10 +++++----- src/bgfx.idl.inl | 8 ++++---- src/bgfx_p.h | 27 ++++++++++----------------- 11 files changed, 64 insertions(+), 73 deletions(-) diff --git a/bindings/bf/bgfx.bf b/bindings/bf/bgfx.bf index a73eaf410..d5c25c482 100644 --- a/bindings/bf/bgfx.bf +++ b/bindings/bf/bgfx.bf @@ -2814,9 +2814,10 @@ public static class bgfx /// /// /// Number of required indices. + /// Set to `true` if input indices will be 32-bit. /// [LinkName("bgfx_get_avail_transient_index_buffer")] - public static extern uint32 get_avail_transient_index_buffer(uint32 _num); + public static extern uint32 get_avail_transient_index_buffer(uint32 _num, bool _index32); /// /// Returns number of requested or maximum available vertices. @@ -2840,8 +2841,6 @@ public static class bgfx /// /// Allocate transient index buffer. - /// @remarks - /// Only 16-bit index buffer is supported. /// /// /// TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. @@ -2866,8 +2865,6 @@ public static class bgfx /// Check for required space and allocate transient vertex and index /// buffers. If both space requirements are satisfied function returns /// true. - /// @remarks - /// Only 16-bit index buffer is supported. /// /// /// TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. @@ -2875,9 +2872,10 @@ public static class bgfx /// Number of vertices to allocate. /// TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. /// Number of indices to allocate. + /// Set to `true` if input indices will be 32-bit. /// [LinkName("bgfx_alloc_transient_buffers")] - public static extern bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexLayout* _layout, uint32 _numVertices, TransientIndexBuffer* _tib, uint32 _numIndices); + public static extern bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexLayout* _layout, uint32 _numVertices, TransientIndexBuffer* _tib, uint32 _numIndices, bool _index32); /// /// Allocate instance data buffer. diff --git a/bindings/cs/bgfx.cs b/bindings/cs/bgfx.cs index 684afacb5..42929e2db 100644 --- a/bindings/cs/bgfx.cs +++ b/bindings/cs/bgfx.cs @@ -2768,9 +2768,10 @@ public static partial class bgfx /// /// /// Number of required indices. + /// Set to `true` if input indices will be 32-bit. /// [DllImport(DllName, EntryPoint="bgfx_get_avail_transient_index_buffer", CallingConvention = CallingConvention.Cdecl)] - public static extern unsafe uint get_avail_transient_index_buffer(uint _num); + public static extern unsafe uint get_avail_transient_index_buffer(uint _num, bool _index32); /// /// Returns number of requested or maximum available vertices. @@ -2794,8 +2795,6 @@ public static partial class bgfx /// /// Allocate transient index buffer. - /// @remarks - /// Only 16-bit index buffer is supported. /// /// /// TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. @@ -2820,8 +2819,6 @@ public static partial class bgfx /// Check for required space and allocate transient vertex and index /// buffers. If both space requirements are satisfied function returns /// true. - /// @remarks - /// Only 16-bit index buffer is supported. /// /// /// TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. @@ -2829,10 +2826,11 @@ public static partial class bgfx /// Number of vertices to allocate. /// TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls. /// Number of indices to allocate. + /// Set to `true` if input indices will be 32-bit. /// [DllImport(DllName, EntryPoint="bgfx_alloc_transient_buffers", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] - public static extern unsafe bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexLayout* _layout, uint _numVertices, TransientIndexBuffer* _tib, uint _numIndices); + public static extern unsafe bool alloc_transient_buffers(TransientVertexBuffer* _tvb, VertexLayout* _layout, uint _numVertices, TransientIndexBuffer* _tib, uint _numIndices, bool _index32); /// /// Allocate instance data buffer. diff --git a/bindings/d/funcs.d b/bindings/d/funcs.d index 8485de2b4..310cc0ac0 100644 --- a/bindings/d/funcs.d +++ b/bindings/d/funcs.d @@ -539,8 +539,9 @@ version(BindBgfx_Static) * Returns number of requested or maximum available indices. * Params: * _num = Number of required indices. + * _index32 = Set to `true` if input indices will be 32-bit. */ - uint bgfx_get_avail_transient_index_buffer(uint _num); + uint bgfx_get_avail_transient_index_buffer(uint _num, bool _index32); /** * Returns number of requested or maximum available vertices. @@ -560,8 +561,6 @@ version(BindBgfx_Static) /** * Allocate transient index buffer. - * Remarks: - * Only 16-bit index buffer is supported. * Params: * _tib = TransientIndexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw @@ -586,8 +585,6 @@ version(BindBgfx_Static) * Check for required space and allocate transient vertex and index * buffers. If both space requirements are satisfied function returns * true. - * Remarks: - * Only 16-bit index buffer is supported. * Params: * _tvb = TransientVertexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw @@ -598,8 +595,9 @@ version(BindBgfx_Static) * for the duration of frame, and it can be reused for multiple draw * calls. * _numIndices = Number of indices to allocate. + * _index32 = Set to `true` if input indices will be 32-bit. */ - 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); + 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, bool _index32); /** * Allocate instance data buffer. @@ -2729,8 +2727,9 @@ else * Returns number of requested or maximum available indices. * Params: * _num = Number of required indices. + * _index32 = Set to `true` if input indices will be 32-bit. */ - alias da_bgfx_get_avail_transient_index_buffer = uint function(uint _num); + alias da_bgfx_get_avail_transient_index_buffer = uint function(uint _num, bool _index32); da_bgfx_get_avail_transient_index_buffer bgfx_get_avail_transient_index_buffer; /** @@ -2753,8 +2752,6 @@ else /** * Allocate transient index buffer. - * Remarks: - * Only 16-bit index buffer is supported. * Params: * _tib = TransientIndexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw @@ -2781,8 +2778,6 @@ else * Check for required space and allocate transient vertex and index * buffers. If both space requirements are satisfied function returns * true. - * Remarks: - * Only 16-bit index buffer is supported. * Params: * _tvb = TransientVertexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw @@ -2793,8 +2788,9 @@ else * for the duration of frame, and it can be reused for multiple draw * calls. * _numIndices = Number of indices to allocate. + * _index32 = Set to `true` if input indices will be 32-bit. */ - 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); + 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, bool _index32); da_bgfx_alloc_transient_buffers bgfx_alloc_transient_buffers; /** diff --git a/bindings/d/types.d b/bindings/d/types.d index 4f7203757..18391e902 100644 --- a/bindings/d/types.d +++ b/bindings/d/types.d @@ -10,7 +10,7 @@ public import core.stdc.stdarg : va_list; extern(C) @nogc nothrow: -enum uint BGFX_API_VERSION = 114; +enum uint BGFX_API_VERSION = 115; alias bgfx_view_id_t = ushort; diff --git a/include/bgfx/bgfx.h b/include/bgfx/bgfx.h index 93740a132..bde6e8399 100644 --- a/include/bgfx/bgfx.h +++ b/include/bgfx/bgfx.h @@ -2411,10 +2411,14 @@ namespace bgfx /// Returns number of requested or maximum available indices. /// /// @param[in] _num Number of required indices. + /// @param[in] _index32 Set to `true` if input indices will be 32-bit. /// /// @attention C99 equivalent is `bgfx_get_avail_transient_index_buffer`. /// - uint32_t getAvailTransientIndexBuffer(uint32_t _num); + uint32_t getAvailTransientIndexBuffer( + uint32_t _num + , bool _index32 = false + ); /// Returns number of requested or maximum available vertices. /// @@ -2448,9 +2452,6 @@ namespace bgfx /// @param[in] _num Number of indices to allocate. /// @param[in] _index32 Set to `true` if input indices will be 32-bit. /// - /// @remarks - /// Only 16-bit index buffer is supported. - /// /// @attention C99 equivalent is `bgfx_alloc_transient_index_buffer`. /// void allocTransientIndexBuffer( @@ -2479,8 +2480,16 @@ namespace bgfx /// buffers. If both space requirements are satisfied function returns /// true. /// - /// @remarks - /// Only 16-bit index buffer is supported. + /// @param[out] _tvb TransientVertexBuffer structure is filled and is valid + /// for the duration of frame, and it can be reused for multiple draw + /// calls. + /// @param[in] _layout Vertex layout. + /// @param[in] _num Number of vertices to allocate. + /// @param[out] _tib TransientIndexBuffer structure is filled and is valid + /// for the duration of frame, and it can be reused for multiple draw + /// calls. + /// @param[in] _num Number of indices to allocate. + /// @param[in] _index32 Set to `true` if input indices will be 32-bit. /// /// @attention C99 equivalent is `bgfx_alloc_transient_buffers`. /// @@ -2490,6 +2499,7 @@ namespace bgfx , uint32_t _numVertices , TransientIndexBuffer* _tib , uint32_t _numIndices + , bool _index32 = false ); /// Allocate instance data buffer. diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index dd11a410e..2d118f793 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -1511,11 +1511,12 @@ BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_ha * Returns number of requested or maximum available indices. * * @param[in] _num Number of required indices. + * @param[in] _index32 Set to `true` if input indices will be 32-bit. * * @returns Number of requested or maximum available indices. * */ -BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num); +BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num, bool _index32); /** * Returns number of requested or maximum available vertices. @@ -1541,8 +1542,6 @@ BGFX_C_API uint32_t bgfx_get_avail_instance_data_buffer(uint32_t _num, uint16_t /** * Allocate transient index buffer. - * @remarks - * Only 16-bit index buffer is supported. * * @param[out] _tib TransientIndexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw @@ -1569,8 +1568,6 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_ * Check for required space and allocate transient vertex and index * buffers. If both space requirements are satisfied function returns * true. - * @remarks - * Only 16-bit index buffer is supported. * * @param[out] _tvb TransientVertexBuffer structure is filled and is valid * for the duration of frame, and it can be reused for multiple draw @@ -1581,9 +1578,10 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_ * for the duration of frame, and it can be reused for multiple draw * calls. * @param[in] _numIndices Number of indices to allocate. + * @param[in] _index32 Set to `true` if input indices will be 32-bit. * */ -BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _layout, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); +BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _layout, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices, bool _index32); /** * Allocate instance data buffer. @@ -3597,12 +3595,12 @@ struct bgfx_interface_vtbl bgfx_dynamic_vertex_buffer_handle_t (*create_dynamic_vertex_buffer_mem)(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t* _layout, uint16_t _flags); void (*update_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem); void (*destroy_dynamic_vertex_buffer)(bgfx_dynamic_vertex_buffer_handle_t _handle); - uint32_t (*get_avail_transient_index_buffer)(uint32_t _num); + uint32_t (*get_avail_transient_index_buffer)(uint32_t _num, bool _index32); uint32_t (*get_avail_transient_vertex_buffer)(uint32_t _num, const bgfx_vertex_layout_t * _layout); uint32_t (*get_avail_instance_data_buffer)(uint32_t _num, uint16_t _stride); void (*alloc_transient_index_buffer)(bgfx_transient_index_buffer_t* _tib, uint32_t _num, bool _index32); void (*alloc_transient_vertex_buffer)(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_layout_t * _layout); - bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _layout, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices); + bool (*alloc_transient_buffers)(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _layout, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices, bool _index32); void (*alloc_instance_data_buffer)(bgfx_instance_data_buffer_t* _idb, uint32_t _num, uint16_t _stride); bgfx_indirect_buffer_handle_t (*create_indirect_buffer)(uint32_t _num); void (*destroy_indirect_buffer)(bgfx_indirect_buffer_handle_t _handle); diff --git a/include/bgfx/defines.h b/include/bgfx/defines.h index a8da84907..45a9c61de 100644 --- a/include/bgfx/defines.h +++ b/include/bgfx/defines.h @@ -15,7 +15,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(114) +#define BGFX_API_VERSION UINT32_C(115) /** * Color RGB/alpha/depth write. When it's not specified write will be disabled. diff --git a/scripts/bgfx.idl b/scripts/bgfx.idl index 621329606..87f33d149 100644 --- a/scripts/bgfx.idl +++ b/scripts/bgfx.idl @@ -1,7 +1,7 @@ -- vim: syntax=lua -- bgfx interface -version(114) +version(115) typedef "bool" typedef "char" @@ -1454,6 +1454,8 @@ func.destroy { cname = "destroy_dynamic_vertex_buffer" } func.getAvailTransientIndexBuffer "uint32_t" --- Number of requested or maximum available indices. .num "uint32_t" --- Number of required indices. + .index32 "bool" --- Set to `true` if input indices will be 32-bit. + { default = false } --- Returns number of requested or maximum available vertices. func.getAvailTransientVertexBuffer @@ -1469,9 +1471,6 @@ func.getAvailInstanceDataBuffer --- Allocate transient index buffer. --- ---- @remarks ---- Only 16-bit index buffer is supported. ---- func.allocTransientIndexBuffer "void" .tib "TransientIndexBuffer*" { out } --- TransientIndexBuffer structure is filled and is valid @@ -1494,9 +1493,6 @@ func.allocTransientVertexBuffer --- buffers. If both space requirements are satisfied function returns --- true. --- ---- @remarks ---- Only 16-bit index buffer is supported. ---- func.allocTransientBuffers "bool" .tvb "TransientVertexBuffer*" { out } --- TransientVertexBuffer structure is filled and is valid @@ -1508,6 +1504,8 @@ func.allocTransientBuffers --- for the duration of frame, and it can be reused for multiple draw --- calls. .numIndices "uint32_t" --- Number of indices to allocate. + .index32 "bool" --- Set to `true` if input indices will be 32-bit. + { default = false } --- Allocate instance data buffer. func.allocInstanceDataBuffer diff --git a/src/bgfx.cpp b/src/bgfx.cpp index a3cae55f8..c1b690070 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -4185,10 +4185,10 @@ namespace bgfx s_ctx->destroyDynamicVertexBuffer(_handle); } - uint32_t getAvailTransientIndexBuffer(uint32_t _num) + uint32_t getAvailTransientIndexBuffer(uint32_t _num, bool _index32) { BX_ASSERT(0 < _num, "Requesting 0 indices."); - return s_ctx->getAvailTransientIndexBuffer(_num); + return s_ctx->getAvailTransientIndexBuffer(_num, _index32); } uint32_t getAvailTransientVertexBuffer(uint32_t _num, const VertexLayout& _layout) @@ -4239,15 +4239,15 @@ namespace bgfx ); } - bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexLayout& _layout, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices) + bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexLayout& _layout, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices, bool _index32) { BGFX_MUTEX_SCOPE(s_ctx->m_resourceApiLock); if (_numVertices == getAvailTransientVertexBuffer(_numVertices, _layout) - && _numIndices == getAvailTransientIndexBuffer(_numIndices) ) + && _numIndices == getAvailTransientIndexBuffer(_numIndices, _index32) ) { allocTransientVertexBuffer(_tvb, _numVertices, _layout); - allocTransientIndexBuffer(_tib, _numIndices); + allocTransientIndexBuffer(_tib, _numIndices, _index32); return true; } diff --git a/src/bgfx.idl.inl b/src/bgfx.idl.inl index 6322a8388..572f8feba 100644 --- a/src/bgfx.idl.inl +++ b/src/bgfx.idl.inl @@ -329,9 +329,9 @@ BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_ha bgfx::destroy(handle.cpp); } -BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num) +BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num, bool _index32) { - return bgfx::getAvailTransientIndexBuffer(_num); + return bgfx::getAvailTransientIndexBuffer(_num, _index32); } BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_layout_t * _layout) @@ -356,10 +356,10 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_ bgfx::allocTransientVertexBuffer((bgfx::TransientVertexBuffer*)_tvb, _num, layout); } -BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _layout, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices) +BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _layout, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices, bool _index32) { const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout; - return bgfx::allocTransientBuffers((bgfx::TransientVertexBuffer*)_tvb, layout, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices); + return bgfx::allocTransientBuffers((bgfx::TransientVertexBuffer*)_tvb, layout, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices, _index32); } BGFX_C_API void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint32_t _num, uint16_t _stride) diff --git a/src/bgfx_p.h b/src/bgfx_p.h index b25ce8117..02a233599 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -2124,32 +2124,23 @@ namespace bgfx { m_cmdPre.finish(); m_cmdPost.finish(); - -// if (0 < m_numDropped) -// { -// BX_TRACE("Too many draw calls: %d, dropped %d (max: %d)" -// , m_numRenderItems+m_numDropped -// , m_numDropped -// , BGFX_CONFIG_MAX_DRAW_CALLS -// ); -// } } void sort(); - uint32_t getAvailTransientIndexBuffer(uint32_t _num) + uint32_t getAvailTransientIndexBuffer(uint32_t _num, uint16_t _indexSize) { - uint32_t offset = bx::strideAlign(m_iboffset, sizeof(uint16_t) ); - uint32_t iboffset = offset + _num*sizeof(uint16_t); + const uint32_t offset = bx::strideAlign(m_iboffset, _indexSize); + uint32_t iboffset = offset + _num*_indexSize; iboffset = bx::min(iboffset, g_caps.limits.transientIbSize); - uint32_t num = (iboffset-offset)/sizeof(uint16_t); + const uint32_t num = (iboffset-offset)/_indexSize; return num; } - uint32_t allocTransientIndexBuffer(uint32_t& _num, uint32_t _indexSize) + uint32_t allocTransientIndexBuffer(uint32_t& _num, uint16_t _indexSize) { uint32_t offset = bx::strideAlign(m_iboffset, _indexSize); - uint32_t num = getAvailTransientIndexBuffer(_num); + uint32_t num = getAvailTransientIndexBuffer(_num, _indexSize); m_iboffset = offset + num*_indexSize; _num = num; @@ -3714,11 +3705,13 @@ namespace bgfx m_dynamicVertexBufferHandle.free(_handle.idx); } - BGFX_API_FUNC(uint32_t getAvailTransientIndexBuffer(uint32_t _num) ) + BGFX_API_FUNC(uint32_t getAvailTransientIndexBuffer(uint32_t _num, bool _index32) ) { BGFX_MUTEX_SCOPE(m_resourceApiLock); - return m_submit->getAvailTransientIndexBuffer(_num); + const bool isIndex16 = !_index32; + const uint32_t indexSize = isIndex16 ? 2 : 4; + return m_submit->getAvailTransientIndexBuffer(_num, indexSize); } BGFX_API_FUNC(uint32_t getAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) )