Functions
mk_framebuf_create_from_attachmentsfunction
mk_framebuf_t mk_framebuf_create_from_attachments(const mk_attachment_t *atts, int count)
Create a framebuffer that targets the given attachments (face+mip views of existing textures).
The framebuffer does NOT own the textures; destroying it via mk_framebuf_destroy() leaves them intact. Mips are NOT auto-generated (callers that hand-render a mip chain rely on this).
| Parameter | Type | Description |
|---|
atts | const mk_attachment_t * | Array of attachments (color first; a depth attachment may follow) |
count | int | Number of attachments |
Returns Framebuffer handle, or MK_FRAMEBUF_INVALID on failure
mk_framebuf_create_from_attachments_autogen_mipsfunction
mk_framebuf_t mk_framebuf_create_from_attachments_autogen_mips(const mk_attachment_t *atts, int count)
Same as mk_framebuf_create_from_attachments, but asks the backend to generate mipmaps for attached color textures when resolving the render target.
Use this only for rendering mip 0 of textures created with a full mip chain.
| Parameter | Type | Description |
|---|
atts | const mk_attachment_t * | Value for atts. |
count | int | Number of entries. |
Returns The resulting handle or value.
mk_framebuf_destroyfunction
void mk_framebuf_destroy(mk_framebuf_t fb)
Destroy a framebuffer created by mk_framebuf_create_from_attachments().
The underlying textures are left intact.
| Parameter | Type | Description |
|---|
fb | mk_framebuf_t | Value for fb. |
mk_framebuf_is_valid_descfunction
bool mk_framebuf_is_valid_desc(const mk_attachment_t *atts, int count)
Whether a framebuffer built from these attachments would be valid on this backend (format/size compatibility).
Use to gate before mk_framebuf_create_from_attachments. Returns false on a NULL/invalid texture.
| Parameter | Type | Description |
|---|
atts | const mk_attachment_t * | Value for atts. |
count | int | Number of entries. |
Returns True when the condition holds.
mk_render_target_createfunction
mk_render_target_t mk_render_target_create(const mk_render_target_desc *desc)
Create a render target from descriptor.
| Parameter | Type | Description |
|---|
desc | const mk_render_target_desc * | Target descriptor |
Returns Target handle or MK_RENDER_TARGET_INVALID on failure
mk_render_target_depthfunction
mk_render_target_t mk_render_target_depth(uint16_t width, uint16_t height, mk_target_format_t format)
Create depth-only render target (for shadow maps).
| Parameter | Type | Description |
|---|
width | uint16_t | Width in pixels |
height | uint16_t | Height in pixels |
format | mk_target_format_t | Depth format |
Returns Target handle
mk_render_target_destroyfunction
void mk_render_target_destroy(mk_render_target_t target)
Destroy a render target.
Does not destroy the associated window (for window targets).
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
mk_render_target_get_color_spacefunction
mk_color_space_t mk_render_target_get_color_space(mk_render_target_t target)
Get color space from the render target.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
Returns The resulting handle or value.
mk_render_target_get_depth_texturefunction
mk_texture_t mk_render_target_get_depth_texture(mk_render_target_t target)
Get depth attachment as texture (for sampling).
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Render target |
Returns Texture or MK_TEXTURE_INVALID if not available
mk_render_target_get_framebufferfunction
mk_framebuf_t mk_render_target_get_framebuffer(mk_render_target_t target)
Get the framebuffer handle for this render target.
Returns MK_FRAMEBUF_INVALID for main window target (uses backbuffer).
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
Returns The resulting handle or value.
mk_render_target_get_namefunction
const char * mk_render_target_get_name(mk_render_target_t target)
Get target name.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
Returns A borrowed pointer, or NULL when unavailable.
mk_render_target_get_sizefunction
void mk_render_target_get_size(mk_render_target_t target, uint16_t *width, uint16_t *height)
Get current dimensions.
For scaled targets, this returns the current computed size.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
width | uint16_t * | Value for width. |
height | uint16_t * | Value for height. |
mk_render_target_get_texturefunction
mk_texture_t mk_render_target_get_texture(mk_render_target_t target, uint8_t attachment)
Get color attachment as texture (for sampling in shaders).
Only valid for MK_TARGET_TEXTURE and MK_TARGET_MRT.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Render target |
attachment | uint8_t | Attachment index (0-3) |
Returns Texture or MK_TEXTURE_INVALID if not available
mk_render_target_get_typefunction
mk_render_target_type_t mk_render_target_get_type(mk_render_target_t target)
Get target type.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
Returns The resulting handle or value.
mk_render_target_get_windowfunction
mk_window_t mk_render_target_get_window(mk_render_target_t target)
Get the associated window (for window targets).
Returns NULL for texture targets.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
Returns The resulting handle or value.
mk_render_target_initfunction
void mk_render_target_init(void)
Initialize render target system.
Called automatically by mk_init().
mk_render_target_is_validfunction
bool mk_render_target_is_valid(mk_render_target_t target)
Check if render target is valid.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
Returns True when the condition holds.
mk_render_target_resizefunction
void mk_render_target_resize(mk_render_target_t target, uint16_t width, uint16_t height)
Manually resize a texture render target.
Has no effect on window targets (they auto-resize). For scaled targets, this temporarily overrides the scale until next auto-resize.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
width | uint16_t | Value for width. |
height | uint16_t | Value for height. |
mk_render_target_scaledfunction
mk_render_target_t mk_render_target_scaled(float scale, mk_target_format_t format)
Create texture render target scaled relative to main window.
Auto-resizes when window resizes.
| Parameter | Type | Description |
|---|
scale | float | Scale factor (0.5 = half, 1.0 = full, 2.0 = double) |
format | mk_target_format_t | Color format |
Returns Target handle
mk_render_target_scaled_tofunction
mk_render_target_t mk_render_target_scaled_to(float scale, mk_target_format_t format, mk_window_t window)
Create texture render target scaled relative to a specific window.
| Parameter | Type | Description |
|---|
scale | float | Scale factor |
format | mk_target_format_t | Color format |
window | mk_window_t | Reference window for scaling |
Returns Target handle
mk_render_target_shutdownfunction
void mk_render_target_shutdown(void)
Shutdown render target system.
Called automatically by mk_shutdown().
mk_render_target_texturefunction
mk_render_target_t mk_render_target_texture(uint16_t width, uint16_t height, mk_target_format_t format)
Create texture render target with fixed size.
| Parameter | Type | Description |
|---|
width | uint16_t | Width in pixels |
height | uint16_t | Height in pixels |
format | mk_target_format_t | Color format |
Returns Target handle
mk_render_target_update_allfunction
void mk_render_target_update_all(void)
Process pending resize events for all targets.
Called automatically each frame.
mk_render_target_update_scalefunction
void mk_render_target_update_scale(mk_render_target_t target)
Force recalculation of scaled target size.
Called automatically when reference window resizes.
| Parameter | Type | Description |
|---|
target | mk_render_target_t | Value for target. |
mk_render_target_windowfunction
mk_render_target_t mk_render_target_window(mk_window_t window)
Create window render target.
| Parameter | Type | Description |
|---|
window | mk_window_t | Window handle (NULL = main window) |
Returns Target handle