mk_buffer_system_initfunction
void mk_buffer_system_init(void)Raw transient buffer types and functions.
Available when modkit.h is included. Prefer mk_tvbuf_t / mk_tibuf_t from dynbuffer.h for new code.
#include <modkit/buffer.h>16 functions · 2 structs · 2 macros
Vertex and index buffer abstraction.
GPU vertex and index buffer management. For low-level GPU interop, include modkit.h for escape hatch accessors.
mk_buffer_system_initfunctionvoid mk_buffer_system_init(void)Raw transient buffer types and functions.
Available when modkit.h is included. Prefer mk_tvbuf_t / mk_tibuf_t from dynbuffer.h for new code.
mk_buffer_system_shutdownfunctionvoid mk_buffer_system_shutdown(void)Perform the buffer system shutdown operation.
mk_ibuf_createfunctionmk_ibuf_t mk_ibuf_create(const uint16_t *data, uint32_t count)Create index buffer from 16-bit indices.
Data is copied internally.
| Parameter | Type | Description |
|---|---|---|
data | const uint16_t * | Pointer to index data (uint16_t array) |
count | uint32_t | Number of indices |
Returns Index buffer handle or MK_IBUF_INVALID on failure
mk_ibuf_create_reffunctionmk_ibuf_t mk_ibuf_create_ref(const uint16_t *data, uint32_t count)Create index buffer using reference (no copy).
Data must remain valid for lifetime of buffer.
| Parameter | Type | Description |
|---|---|---|
data | const uint16_t * | Pointer to index data (uint16_t array, must remain valid) |
count | uint32_t | Number of indices |
Returns Index buffer handle or MK_IBUF_INVALID on failure
mk_ibuf_create_ref32functionmk_ibuf_t mk_ibuf_create_ref32(const uint32_t *data, uint32_t count)Create 32-bit index buffer using reference (no copy).
| Parameter | Type | Description |
|---|---|---|
data | const uint32_t * | Pointer to index data (uint32_t array, must remain valid) |
count | uint32_t | Number of indices |
Returns Index buffer handle or MK_IBUF_INVALID on failure
mk_ibuf_create32functionmk_ibuf_t mk_ibuf_create32(const uint32_t *data, uint32_t count)Create index buffer from 32-bit indices.
Data is copied internally.
| Parameter | Type | Description |
|---|---|---|
data | const uint32_t * | Pointer to index data (uint32_t array) |
count | uint32_t | Number of indices |
Returns Index buffer handle or MK_IBUF_INVALID on failure
mk_ibuf_destroyfunctionvoid mk_ibuf_destroy(mk_ibuf_t ibuf)Get underlying GPU handle (escape hatch requires modkit.h).
Destroy index buffer and release resources.
| Parameter | Type | Description |
|---|---|---|
ibuf | mk_ibuf_t | Value for ibuf. |
mk_ibuf_is_validfunctionbool mk_ibuf_is_valid(mk_ibuf_t ibuf)Check if index buffer handle is valid.
| Parameter | Type | Description |
|---|---|---|
ibuf | mk_ibuf_t | Value for ibuf. |
Returns True when the condition holds.
mk_ibuf_pinfunctionbool mk_ibuf_pin(mk_ibuf_t ibuf)Retain/release an internal reference.
| Parameter | Type | Description |
|---|---|---|
ibuf | mk_ibuf_t | Value for ibuf. |
Returns True when the operation succeeds.
mk_ibuf_unpinfunctionvoid mk_ibuf_unpin(mk_ibuf_t ibuf)Perform the ibuf unpin operation.
| Parameter | Type | Description |
|---|---|---|
ibuf | mk_ibuf_t | Value for ibuf. |
mk_vbuf_createfunctionmk_vbuf_t mk_vbuf_create(const void *data, uint32_t size, const mk_layout_t *layout)Create vertex buffer from data.
Data is copied internally.
| Parameter | Type | Description |
|---|---|---|
data | const void * | Pointer to vertex data |
size | uint32_t | Size of data in bytes |
layout | const mk_layout_t * | Vertex layout describing the data |
Returns Vertex buffer handle or MK_VBUF_INVALID on failure
mk_vbuf_create_reffunctionmk_vbuf_t mk_vbuf_create_ref(const void *data, uint32_t size, const mk_layout_t *layout)Create vertex buffer using reference (no copy).
Data must remain valid for lifetime of buffer.
| Parameter | Type | Description |
|---|---|---|
data | const void * | Pointer to vertex data (must remain valid) |
size | uint32_t | Size of data in bytes |
layout | const mk_layout_t * | Vertex layout describing the data |
Returns Vertex buffer handle or MK_VBUF_INVALID on failure
mk_vbuf_destroyfunctionvoid mk_vbuf_destroy(mk_vbuf_t vbuf)Get underlying GPU handle (escape hatch requires modkit.h).
Destroy vertex buffer and release resources.
| Parameter | Type | Description |
|---|---|---|
vbuf | mk_vbuf_t | Value for vbuf. |
mk_vbuf_is_validfunctionbool mk_vbuf_is_valid(mk_vbuf_t vbuf)Check if vertex buffer handle is valid.
| Parameter | Type | Description |
|---|---|---|
vbuf | mk_vbuf_t | Value for vbuf. |
Returns True when the condition holds.
mk_vbuf_pinfunctionbool mk_vbuf_pin(mk_vbuf_t vbuf)Retain/release an internal reference.
| Parameter | Type | Description |
|---|---|---|
vbuf | mk_vbuf_t | Value for vbuf. |
Returns True when the operation succeeds.
mk_vbuf_unpinfunctionvoid mk_vbuf_unpin(mk_vbuf_t vbuf)Perform the vbuf unpin operation.
| Parameter | Type | Description |
|---|---|---|
vbuf | mk_vbuf_t | Value for vbuf. |
mk_ibuf_tstructData for ibuf.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_vbuf_tstructData for vbuf.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
MK_IBUF_INVALIDdefineMK_IBUF_INVALIDInvalid sentinel for ibuf.
MK_VBUF_INVALIDdefineMK_VBUF_INVALIDInvalid sentinel for vbuf.