Fixed issue #2330. Added support for 32-bit indices in transient index buffer.

This commit is contained in:
Branimir Karadžić
2020-12-15 19:01:25 -08:00
parent 2bc35df070
commit 5c304dad3b
19 changed files with 119 additions and 93 deletions

View File

@@ -2074,6 +2074,7 @@ public static class bgfx
public uint32 size;
public uint32 startIndex;
public IndexBufferHandle handle;
public uint8 isIndex16;
}
[CRepr]
@@ -2842,9 +2843,10 @@ public static class bgfx
///
/// <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="_num">Number of indices to allocate.</param>
/// <param name="_index32">Set to `true` if input indices will be 32-bit.</param>
///
[LinkName("bgfx_alloc_transient_index_buffer")]
public static extern void alloc_transient_index_buffer(TransientIndexBuffer* _tib, uint32 _num);
public static extern void alloc_transient_index_buffer(TransientIndexBuffer* _tib, uint32 _num, bool _index32);
/// <summary>
/// Allocate transient vertex buffer.

View File

@@ -2051,6 +2051,7 @@ public static partial class bgfx
public uint size;
public uint startIndex;
public IndexBufferHandle handle;
public byte isIndex16;
}
public unsafe struct TransientVertexBuffer
@@ -2798,9 +2799,10 @@ public static partial class bgfx
///
/// <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="_num">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_index_buffer", CallingConvention = CallingConvention.Cdecl)]
public static extern unsafe void alloc_transient_index_buffer(TransientIndexBuffer* _tib, uint _num);
public static extern unsafe void alloc_transient_index_buffer(TransientIndexBuffer* _tib, uint _num, bool _index32);
/// <summary>
/// Allocate transient vertex buffer.

View File

@@ -567,8 +567,9 @@ version(BindBgfx_Static)
* for the duration of frame, and it can be reused for multiple draw
* calls.
* _num = Number of indices to allocate.
* _index32 = Set to `true` if input indices will be 32-bit.
*/
void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint _num);
void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint _num, bool _index32);
/**
* Allocate transient vertex buffer.
@@ -2751,8 +2752,9 @@ else
* for the duration of frame, and it can be reused for multiple draw
* calls.
* _num = Number of indices to allocate.
* _index32 = Set to `true` if input indices will be 32-bit.
*/
alias da_bgfx_alloc_transient_index_buffer = void function(bgfx_transient_index_buffer_t* _tib, uint _num);
alias da_bgfx_alloc_transient_index_buffer = void function(bgfx_transient_index_buffer_t* _tib, uint _num, bool _index32);
da_bgfx_alloc_transient_index_buffer bgfx_alloc_transient_index_buffer;
/**

View File

@@ -10,7 +10,7 @@ public import core.stdc.stdarg : va_list;
extern(C) @nogc nothrow:
enum uint BGFX_API_VERSION = 111;
enum uint BGFX_API_VERSION = 112;
alias bgfx_view_id_t = ushort;
@@ -891,6 +891,7 @@ struct bgfx_transient_index_buffer_t
uint size; /// Data size.
uint startIndex; /// First index.
bgfx_index_buffer_handle_t handle; /// Index buffer handle.
bool isIndex16; /// Index buffer format is 16-bits if true, otherwise it is 32-bit.
}
/// Transient vertex buffer.