Fixed transient index buffer functions to all have 32-bit indices support, and removed 16-bit only restriction from docs.
This commit is contained in:
parent
5ecddbf4d5
commit
6baa370801
@ -2814,9 +2814,10 @@ public static class bgfx
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="_num">Number of required indices.</param>
|
||||
/// <param name="_index32">Set to `true` if input indices will be 32-bit.</param>
|
||||
///
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns number of requested or maximum available vertices.
|
||||
@ -2840,8 +2841,6 @@ public static class bgfx
|
||||
|
||||
/// <summary>
|
||||
/// Allocate transient index buffer.
|
||||
/// @remarks
|
||||
/// Only 16-bit index buffer is supported.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="_tib">TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param>
|
||||
@ -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.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="_tvb">TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param>
|
||||
@ -2875,9 +2872,10 @@ public static class bgfx
|
||||
/// <param name="_numVertices">Number of vertices to allocate.</param>
|
||||
/// <param name="_tib">TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param>
|
||||
/// <param name="_numIndices">Number of indices to allocate.</param>
|
||||
/// <param name="_index32">Set to `true` if input indices will be 32-bit.</param>
|
||||
///
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
/// Allocate instance data buffer.
|
||||
|
@ -2768,9 +2768,10 @@ public static partial class bgfx
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="_num">Number of required indices.</param>
|
||||
/// <param name="_index32">Set to `true` if input indices will be 32-bit.</param>
|
||||
///
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
/// Returns number of requested or maximum available vertices.
|
||||
@ -2794,8 +2795,6 @@ public static partial class bgfx
|
||||
|
||||
/// <summary>
|
||||
/// Allocate transient index buffer.
|
||||
/// @remarks
|
||||
/// Only 16-bit index buffer is supported.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="_tib">TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param>
|
||||
@ -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.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="_tvb">TransientVertexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param>
|
||||
@ -2829,10 +2826,11 @@ public static partial class bgfx
|
||||
/// <param name="_numVertices">Number of vertices to allocate.</param>
|
||||
/// <param name="_tib">TransientIndexBuffer structure is filled and is valid for the duration of frame, and it can be reused for multiple draw calls.</param>
|
||||
/// <param name="_numIndices">Number of indices to allocate.</param>
|
||||
/// <param name="_index32">Set to `true` if input indices will be 32-bit.</param>
|
||||
///
|
||||
[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);
|
||||
|
||||
/// <summary>
|
||||
/// Allocate instance data buffer.
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
10
src/bgfx.cpp
10
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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
27
src/bgfx_p.h
27
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<uint32_t>(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) )
|
||||
|
Loading…
Reference in New Issue
Block a user