Functions
mk_dibuf_createfunction
mk_dibuf_t mk_dibuf_create(uint32_t index_count, uint16_t flags)
Create empty dynamic index buffer (16-bit indices).
| Parameter | Type | Description |
|---|
index_count | uint32_t | Maximum number of indices |
flags | uint16_t | MK_DYNBUF_* flags |
Returns Dynamic index buffer handle or MK_DIBUF_INVALID on failure
mk_dibuf_create_datafunction
mk_dibuf_t mk_dibuf_create_data(const uint16_t *data, uint32_t count, uint16_t flags)
Create dynamic index buffer with initial data (16-bit).
| Parameter | Type | Description |
|---|
data | const uint16_t * | Initial index data (copied) |
count | uint32_t | Number of indices |
flags | uint16_t | MK_DYNBUF_* flags |
Returns Dynamic index buffer handle or MK_DIBUF_INVALID on failure
mk_dibuf_create_data32function
mk_dibuf_t mk_dibuf_create_data32(const uint32_t *data, uint32_t count, uint16_t flags)
Create dynamic index buffer with initial data (32-bit).
| Parameter | Type | Description |
|---|
data | const uint32_t * | Initial index data (copied) |
count | uint32_t | Number of indices |
flags | uint16_t | MK_DYNBUF_* flags |
Returns Dynamic index buffer handle or MK_DIBUF_INVALID on failure
mk_dibuf_create32function
mk_dibuf_t mk_dibuf_create32(uint32_t index_count, uint16_t flags)
Create empty dynamic index buffer (32-bit indices).
| Parameter | Type | Description |
|---|
index_count | uint32_t | Maximum number of indices |
flags | uint16_t | MK_DYNBUF_* flags |
Returns Dynamic index buffer handle or MK_DIBUF_INVALID on failure
mk_dibuf_destroyfunction
void mk_dibuf_destroy(mk_dibuf_t dibuf)
Get underlying GPU handle (escape hatch requires modkit.h).
Destroy dynamic index buffer.
| Parameter | Type | Description |
|---|
dibuf | mk_dibuf_t | Value for dibuf. |
mk_dibuf_is_validfunction
bool mk_dibuf_is_valid(mk_dibuf_t dibuf)
Check if dynamic index buffer handle is valid.
| Parameter | Type | Description |
|---|
dibuf | mk_dibuf_t | Value for dibuf. |
Returns True when the condition holds.
mk_dibuf_updatefunction
void mk_dibuf_update(mk_dibuf_t dibuf, uint32_t start_index, const uint16_t *data, uint32_t count)
Update dynamic index buffer contents (16-bit).
| Parameter | Type | Description |
|---|
dibuf | mk_dibuf_t | Dynamic index buffer handle |
start_index | uint32_t | First index to update |
data | const uint16_t * | New index data |
count | uint32_t | Number of indices |
mk_dibuf_update32function
void mk_dibuf_update32(mk_dibuf_t dibuf, uint32_t start_index, const uint32_t *data, uint32_t count)
Update dynamic index buffer contents (32-bit).
| Parameter | Type | Description |
|---|
dibuf | mk_dibuf_t | Dynamic index buffer handle |
start_index | uint32_t | First index to update |
data | const uint32_t * | New index data |
count | uint32_t | Number of indices |
mk_dvbuf_createfunction
mk_dvbuf_t mk_dvbuf_create(uint32_t vertex_count, const mk_layout_t *layout, uint16_t flags)
Create empty dynamic vertex buffer.
| Parameter | Type | Description |
|---|
vertex_count | uint32_t | Maximum number of vertices |
layout | const mk_layout_t * | Vertex layout |
flags | uint16_t | MK_DYNBUF_* flags |
Returns Dynamic vertex buffer handle or MK_DVBUF_INVALID on failure
mk_dvbuf_create_datafunction
mk_dvbuf_t mk_dvbuf_create_data(const void *data, uint32_t size, const mk_layout_t *layout, uint16_t flags)
Create dynamic vertex buffer with initial data.
| Parameter | Type | Description |
|---|
data | const void * | Initial vertex data (copied) |
size | uint32_t | Size of data in bytes |
layout | const mk_layout_t * | Vertex layout |
flags | uint16_t | MK_DYNBUF_* flags |
Returns Dynamic vertex buffer handle or MK_DVBUF_INVALID on failure
mk_dvbuf_destroyfunction
void mk_dvbuf_destroy(mk_dvbuf_t dvbuf)
Get underlying GPU handle (escape hatch requires modkit.h).
Destroy dynamic vertex buffer.
| Parameter | Type | Description |
|---|
dvbuf | mk_dvbuf_t | Value for dvbuf. |
mk_dvbuf_is_validfunction
bool mk_dvbuf_is_valid(mk_dvbuf_t dvbuf)
Check if dynamic vertex buffer handle is valid.
| Parameter | Type | Description |
|---|
dvbuf | mk_dvbuf_t | Value for dvbuf. |
Returns True when the condition holds.
mk_dvbuf_updatefunction
void mk_dvbuf_update(mk_dvbuf_t dvbuf, uint32_t start_vertex, const void *data, uint32_t size)
Update dynamic vertex buffer contents.
If MK_DYNBUF_ALLOW_RESIZE is set and data exceeds buffer size, buffer will grow.
| Parameter | Type | Description |
|---|
dvbuf | mk_dvbuf_t | Dynamic vertex buffer handle |
start_vertex | uint32_t | First vertex to update |
data | const void * | New vertex data |
size | uint32_t | Size of data in bytes |
mk_dynbuffer_system_initfunction
void mk_dynbuffer_system_init(void)
Initialize the dynbuffer system.
mk_dynbuffer_system_shutdownfunction
void mk_dynbuffer_system_shutdown(void)
Perform the dynbuffer system shutdown operation.
mk_instance_allocfunction
bool mk_instance_alloc(mk_instance_buf_t *ibuf, uint32_t count, uint16_t stride)
Allocate instance data buffer.
Buffer is valid only for the current frame.
| Parameter | Type | Description |
|---|
ibuf | mk_instance_buf_t * | Output instance buffer struct |
count | uint32_t | Number of instances |
stride | uint16_t | Bytes per instance (must be multiple of 16) |
Returns true on success
mk_instance_availfunction
bool mk_instance_avail(uint32_t count, uint16_t stride)
Check if instance buffer allocation is possible.
| Parameter | Type | Description |
|---|
count | uint32_t | Number of instances |
stride | uint16_t | Bytes per instance (must be multiple of 16) |
Returns true if allocation would succeed
mk_tibuf_allocfunction
bool mk_tibuf_alloc(mk_tibuf_t *tibuf, uint32_t count)
Allocate transient index buffer (16-bit indices).
Buffer is valid only for the current frame.
| Parameter | Type | Description |
|---|
tibuf | mk_tibuf_t * | Output transient buffer struct |
count | uint32_t | Number of indices |
Returns true on success, false if not enough transient memory
mk_tibuf_alloc32function
bool mk_tibuf_alloc32(mk_tibuf32_t *tibuf, uint32_t count)
Allocate transient index buffer (32-bit indices).
| Parameter | Type | Description |
|---|
tibuf | mk_tibuf32_t * | Output transient buffer struct |
count | uint32_t | Number of indices |
Returns true on success, false if not enough transient memory
mk_tibuf_availfunction
bool mk_tibuf_avail(uint32_t count, bool is_32bit)
Check if transient index buffer allocation is possible.
| Parameter | Type | Description |
|---|
count | uint32_t | Number of indices needed |
is_32bit | bool | true for 32-bit indices, false for 16-bit |
Returns true if allocation would succeed
mk_transient_allocfunction
bool mk_transient_alloc(mk_tvbuf_t *tvbuf, uint32_t vertex_count, const mk_layout_t *layout, mk_tibuf_t *tibuf, uint32_t index_count)
Allocate both vertex and index transient buffers atomically.
Either both succeed or both fail.
| Parameter | Type | Description |
|---|
tvbuf | mk_tvbuf_t * | Output transient vertex buffer |
vertex_count | uint32_t | Number of vertices |
layout | const mk_layout_t * | Vertex layout |
tibuf | mk_tibuf_t * | Output transient index buffer (16-bit) |
index_count | uint32_t | Number of indices |
Returns true on success
mk_transient_availfunction
bool mk_transient_avail(uint32_t vertex_count, const mk_layout_t *layout, uint32_t index_count, bool is_index_32bit)
Check if both vertex and index transient buffers can be allocated atomically.
| Parameter | Type | Description |
|---|
vertex_count | uint32_t | Number of vertices |
layout | const mk_layout_t * | Vertex layout |
index_count | uint32_t | Number of indices |
is_index_32bit | bool | true for 32-bit indices |
Returns true if both allocations would succeed
mk_tvbuf_allocfunction
bool mk_tvbuf_alloc(mk_tvbuf_t *tvbuf, uint32_t count, const mk_layout_t *layout)
Allocate transient vertex buffer.
Buffer is valid only for the current frame.
| Parameter | Type | Description |
|---|
tvbuf | mk_tvbuf_t * | Output transient buffer struct |
count | uint32_t | Number of vertices |
layout | const mk_layout_t * | Vertex layout |
Returns true on success, false if not enough transient memory
mk_tvbuf_availfunction
bool mk_tvbuf_avail(uint32_t count, const mk_layout_t *layout)
Check if transient vertex buffer allocation is possible.
| Parameter | Type | Description |
|---|
count | uint32_t | Number of vertices needed |
layout | const mk_layout_t * | Vertex layout |
Returns true if allocation would succeed