mk_batch_stats_getfunction
void mk_batch_stats_get(mk_batch_stats *out_stats)Get state from the batch stats.
| Parameter | Type | Description |
|---|---|---|
out_stats | mk_batch_stats * | Receives the stats. |
#include <modkit/pass.h>56 functions · 12 structs · 7 enums · 19 typedefs · 5 macros
Sokol-style pass-based rendering API.
A pass is a transient rendering scope that owns a bgfx view, encoder, clear state, and render target. The user never sees view IDs, encoders, or bgfx_touch those are handled internally. Two ways to draw:Simple API (mk_clear, mk_cube, mk_rect2d) zero boilerplate, uses implicit passes internally.Pass API (mk_begin_pass/mk_end_pass) explicit multi-pass control without touching bgfx views or encoders. Example (simple 2D): Example (3D with camera): Example (render to texture, then display): Example (NanoVG via escape hatches):
mk_batch_stats_getfunctionvoid mk_batch_stats_get(mk_batch_stats *out_stats)Get state from the batch stats.
| Parameter | Type | Description |
|---|---|---|
out_stats | mk_batch_stats * | Receives the stats. |
mk_begin_passfunctionbool mk_begin_pass(const mk_pass_desc *desc)Begin a rendering pass.
Allocates a bgfx view, configures clear/rect/transform, begins an encoder. Only one pass may be active at a time. Nested passes are not supported.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_pass_desc * | Pass descriptor (clear, camera, target, sort). |
Returns True when the operation succeeds.
mk_dispatchfunctionvoid mk_dispatch(const mk_dispatch_desc *desc)Dispatch a compute program into the active pass (explicit mk_begin_pass, or the implicit simple-API pass).
Resolves the pass's encoder + view automatically.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_dispatch_desc * | Configuration descriptor. |
mk_dispatch_exfunctionvoid mk_dispatch_ex(mk_encoder_t enc, mk_view_id_t view, const mk_dispatch_desc *desc)Dispatch a compute program into a specific encoder + view (multi-threaded path).
| Parameter | Type | Description |
|---|---|---|
enc | mk_encoder_t | Value for enc. |
view | mk_view_id_t | Value for view. |
desc | const mk_dispatch_desc * | Configuration descriptor. |
mk_draw_rejection_stats_getfunctionvoid mk_draw_rejection_stats_get(mk_draw_rejection_stats *out_stats)Read compact rejection counts accumulated since the current frame began.
| Parameter | Type | Description |
|---|---|---|
out_stats | mk_draw_rejection_stats * | Receives the stats. |
mk_end_passfunctionvoid mk_end_pass(void)End the current pass.
Flushes any active draw2d/draw3d contexts, ends the encoder, and frees the allocated view.
mk_in_passfunctionbool mk_in_pass(void)Check whether a pass is currently active.
Returns true if mk_begin_pass was called without a matching mk_end_pass.
mk_pass_2dfunctionmk_pass_desc mk_pass_2d(uint32_t clear_color)Explicit painter-ordered 2D pass.
| Parameter | Type | Description |
|---|---|---|
clear_color | uint32_t | Value for clear color. |
Returns The resulting value.
mk_pass_3dfunctionmk_pass_desc mk_pass_3d(uint32_t clear_color, const float *view_mtx, const float *proj_mtx)3D pass: clears color + depth, sets view/projection matrices.
| Parameter | Type | Description |
|---|---|---|
clear_color | uint32_t | RGBA clear color. |
view_mtx | const float * | 4x4 view matrix. |
proj_mtx | const float * | 4x4 projection matrix. |
Returns The resulting value.
mk_pass_apply_view_orderfunctionvoid mk_pass_apply_view_order(void)Apply view order for the pass.
mk_pass_canvasfunctionstruct mk_canvas * mk_pass_canvas(void)Get a draw2d context bound to the current pass.
Lazy-created on first call. Automatically flushed on mk_end_pass(). If a draw3d context is active, it is flushed first (context switch).
Returns Draw2d context. Only valid until mk_end_pass().
mk_pass_clearfunctionmk_pass_desc mk_pass_clear(uint32_t clear_color)2D pass: clears color + depth, no camera transform.
| Parameter | Type | Description |
|---|---|---|
clear_color | uint32_t | RGBA clear color. |
Returns The resulting value.
mk_pass_defer_view_freefunctionvoid mk_pass_defer_view_free(mk_view_id_t view)Queue a view ID to be freed at the next mk_pass_frame_begin().
Use this when a subsystem allocates its own views via mk_view_alloc() and needs to release them. Immediate mk_view_free() can wipe bgfx view state before bgfx_frame() executes submitted draws — deferring matches the internal behavior used by mk_end_pass() for the pass's own view.
| Parameter | Type | Description |
|---|---|---|
view | mk_view_id_t | View ID to defer-free. No-op for MK_VIEW_INVALID. |
mk_pass_drawfunctionmk_result mk_pass_draw(const mk_draw_desc *desc)Submit one draw into the active pass (explicit mk_begin_pass, or the implicit simple-API pass).
Resolves the pass's encoder + view automatically.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_draw_desc * | Configuration descriptor. |
Returns MK_SUCCESS or an error result.
mk_pass_draw_exfunctionmk_result mk_pass_draw_ex(mk_encoder_t enc, mk_view_id_t view, const mk_draw_desc *desc)Submit one draw into a specific encoder + view.
This is the multi-threaded entry point: a worker that owns a mk_render_ctx_t passes its per-thread encoder and the pass's view. Touches no global pass state.
| Parameter | Type | Description |
|---|---|---|
enc | mk_encoder_t | Value for enc. |
view | mk_view_id_t | Value for view. |
desc | const mk_draw_desc * | Configuration descriptor. |
Returns MK_SUCCESS or an error result.
mk_pass_draw_ex_reportfunctionmk_result mk_pass_draw_ex_report(mk_encoder_t enc, mk_view_id_t view, const mk_draw_desc *desc, mk_resolved_draw_report *out_report)Draw ex report for the pass.
| Parameter | Type | Description |
|---|---|---|
enc | mk_encoder_t | Value for enc. |
view | mk_view_id_t | Value for view. |
desc | const mk_draw_desc * | Configuration descriptor. |
out_report | mk_resolved_draw_report * | Receives the report. |
Returns MK_SUCCESS or an error result.
mk_pass_draw_reportfunctionmk_result mk_pass_draw_report(const mk_draw_desc *desc, mk_resolved_draw_report *out_report)Draw report for the pass.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_draw_desc * | Configuration descriptor. |
out_report | mk_resolved_draw_report * | Receives the report. |
Returns MK_SUCCESS or an error result.
mk_pass_draw3dfunctionstruct mk_draw3d_ctx * mk_pass_draw3d(void)Get a draw3d context bound to the current pass.
Lazy-created on first call. Automatically flushed on mk_end_pass(). If a draw2d context is active, it is flushed first (context switch).
Returns Draw3d context. Only valid until mk_end_pass().
mk_pass_encoderfunctionmk_encoder_t mk_pass_encoder(void)Get the current pass's encoder.
Use this for subsystems that require an explicit encoder, such as NanoVG (mk_nvg_set_encoder), text rendering (mk_text_begin), or raw mk_encoder_* submissions.
Returns The encoder for the current pass. Only valid until mk_end_pass().
mk_pass_frame_beginfunctionvoid mk_pass_frame_begin(void)Reset per-frame state.
Called by mk_frame_begin().
mk_pass_frame_endfunctionbool mk_pass_frame_end(void)Flush any dangling pass.
Returns True when the operation succeeds.
mk_pass_implicit_camera_defaultfunctionvoid mk_pass_implicit_camera_default(const float view[16], const float proj[16])Store the draw3d default-camera matrices WITHOUT marking the camera as user-overridden.
Called by draw3d's ensure path each frame. Internal.
| Parameter | Type | Description |
|---|---|---|
view | const float | Value for view. |
proj | const float | Value for proj. |
mk_pass_implicit_camera_overriddenfunctionbool mk_pass_implicit_camera_overridden(void)True once mk_set_camera/mk_set_camera_raw overrode the default camera.
Returns True when the operation succeeds.
mk_pass_implicit_camera_projfunctionconst float * mk_pass_implicit_camera_proj(void)Stored implicit camera projection matrix (16 floats, never NULL).
Returns A borrowed pointer, or NULL when unavailable.
mk_pass_implicit_camera_reset_overridefunctionvoid mk_pass_implicit_camera_reset_override(void)Clear the mk_set_camera override so the draw3d default camera (mk_cam_*) drives the implicit pass again.
Called by the mk_cam_* setters. Internal.
mk_pass_implicit_camera_viewfunctionconst float * mk_pass_implicit_camera_view(void)Stored implicit camera view matrix (16 floats, never NULL).
Returns A borrowed pointer, or NULL when unavailable.
mk_pass_implicit_encoderfunctionmk_encoder_t mk_pass_implicit_encoder(void)Get the encoder for the current implicit pass.
Returns Encoder, or NULL if no implicit pass is active.
mk_pass_implicit_ensure_2dfunctionvoid mk_pass_implicit_ensure_2d(void)Ensure an implicit 2D pass is active for the simple API.
Opens a 2D overlay pass. If a 3D implicit pass is active, it is flushed first (the 2D pass does NOT clear, compositing on top).
mk_pass_implicit_ensure_3dfunctionvoid mk_pass_implicit_ensure_3d(void)Ensure an implicit 3D pass is active for the simple API.
Opens a 3D pass with the sticky clear color and the stored implicit camera (mk_set_camera / mk_set_camera_raw / the draw3d default camera). If a 2D implicit pass is active, it is flushed first.
mk_pass_implicit_flushfunctionvoid mk_pass_implicit_flush(void)Flush (end) the current implicit pass if any.
Called by mk_draw3d_flush() and mk_canvas_flush().
mk_pass_implicit_frame_endfunctionvoid mk_pass_implicit_frame_end(void)Frame-end fallback: if NO pass ran this frame (e.g.
an mk_clear()-only or empty frame), opens + closes an implicit pass so the backbuffer is still cleared with the sticky clear color. Called by mk_frame_end() after mk_pass_frame_end().
mk_pass_implicit_set_clearfunctionvoid mk_pass_implicit_set_clear(uint32_t color)Set the clear color for the implicit simple API pass (sticky across frames).
| Parameter | Type | Description |
|---|---|---|
color | uint32_t | Value for color. |
mk_pass_implicit_typefunctionmk_implicit_pass_type_t mk_pass_implicit_type(void)Get the current implicit pass type.
Returns The resulting handle or value.
mk_pass_implicit_viewfunctionmk_view_id_t mk_pass_implicit_view(void)Get the view for the current implicit pass.
Returns View ID, or MK_VIEW_INVALID if no implicit pass is active.
mk_pass_material_rolefunctionmk_material_pass_role mk_pass_material_role(void)Perform the pass material role operation.
Returns The resulting value.
mk_pass_material_role_for_viewfunctionmk_material_pass_role mk_pass_material_role_for_view(mk_view_t view)Perform the pass material role for view operation.
| Parameter | Type | Description |
|---|---|---|
view | mk_view_t | Value for view. |
Returns The resulting value.
mk_pass_offscreenfunctionmk_pass_desc mk_pass_offscreen(mk_render_target_t target, uint32_t clear_color)Offscreen 2D pass: renders to a render target.
| Parameter | Type | Description |
|---|---|---|
target | mk_render_target_t | Render target. |
clear_color | uint32_t | RGBA clear color. |
Returns The resulting value.
mk_pass_offscreen_2dfunctionmk_pass_desc mk_pass_offscreen_2d(mk_render_target_t target, uint32_t clear_color)Explicit painter-ordered offscreen 2D pass.
| Parameter | Type | Description |
|---|---|---|
target | mk_render_target_t | Value for target. |
clear_color | uint32_t | Value for clear color. |
Returns The resulting value.
mk_pass_offscreen_3dfunctionmk_pass_desc mk_pass_offscreen_3d(mk_render_target_t target, uint32_t clear_color, const float *view_mtx, const float *proj_mtx)Offscreen 3D pass: renders to a render target with camera.
| Parameter | Type | Description |
|---|---|---|
target | mk_render_target_t | Render target. |
clear_color | uint32_t | RGBA clear color. |
view_mtx | const float * | 4x4 view matrix. |
proj_mtx | const float * | 4x4 projection matrix. |
Returns The resulting value.
mk_pass_phase_modefunctionmk_pass_phase_mode_t mk_pass_phase_mode(void)Perform the pass phase mode operation.
Returns The resulting handle or value.
mk_pass_prepare_phasefunctionmk_view_t mk_pass_prepare_phase(mk_draw_phase_t phase)API-thread-only phase preparation.
| Parameter | Type | Description |
|---|---|---|
phase | mk_draw_phase_t | Value for phase. |
Returns The resulting handle or value.
mk_pass_provider_disable_mask_for_viewfunctionmk_shader_provider_mask_t mk_pass_provider_disable_mask_for_view(mk_view_t view)Disable the mask for view for the pass provider.
| Parameter | Type | Description |
|---|---|---|
view | mk_view_t | Value for view. |
Returns The resulting handle or value.
mk_pass_provider_state_for_viewfunctionvoid mk_pass_provider_state_for_view(mk_view_t view, float out_camera[4], float out_output[4])Perform the pass provider state for view operation.
| Parameter | Type | Description |
|---|---|---|
view | mk_view_t | Value for view. |
out_camera | float | Receives the camera. |
out_output | float | Receives the output. |
mk_pass_register_view_orderfunctionvoid mk_pass_register_view_order(mk_view_t view)Register view order for the pass.
| Parameter | Type | Description |
|---|---|---|
view | mk_view_t | Value for view. |
mk_pass_resolve_draw_viewfunctionmk_view_t mk_pass_resolve_draw_view(mk_draw_phase_t phase, uint64_t resolved_state, mk_material_t material)Draw view for the pass resolve.
| Parameter | Type | Description |
|---|---|---|
phase | mk_draw_phase_t | Value for phase. |
resolved_state | uint64_t | Value for resolved state. |
material | mk_material_t | Value for material. |
Returns The resulting handle or value.
mk_pass_sort_depth_worldfunctionuint32_t mk_pass_sort_depth_world(float x, float y, float z)Perform the pass sort depth world operation.
| Parameter | Type | Description |
|---|---|---|
x | float | Value for x. |
y | float | Value for y. |
z | float | Value for z. |
Returns The resulting value.
mk_pass_spritefunctionstruct mk_sprite_ctx * mk_pass_sprite(void)Begin sprite-batch rendering bound to the current pass — the pass-native entry point for the sprite/atlas system (no manual encoder/view juggling).
Mirrors mk_pass_canvas(): flushes any other active draw context, then begins a pooled sprite batch on the pass's encoder + view with a screen-space orthographic projection. Draw with mk_sprite_draw*(); the batch is flushed automatically on mk_end_pass() (or when you switch to another draw context). Returns MK_SPRITE_CTX_INVALID if no pass is active or sprites are disabled.
Returns A borrowed pointer, or NULL when unavailable.
mk_begin_pass(&mk_pass_clear(0x202020ff));
mk_sprite_ctx_t s = mk_pass_sprite();
mk_sprite_draw(s, my_sprite, 100, 100);
mk_end_pass();mk_pass_submit_modefunctionmk_submit_mode_t mk_pass_submit_mode(void)Current pass policy; used by the high-level model package.
Returns The resulting handle or value.
mk_pass_system_initfunctionvoid mk_pass_system_init(void)Initialize the pass system.
Called by mk_init().
mk_pass_system_shutdownfunctionvoid mk_pass_system_shutdown(void)Shutdown the pass system.
Called by mk_shutdown().
mk_pass_targetfunctionmk_render_target_t mk_pass_target(void)Get the current pass's render target (NULL = backbuffer).
Subsystems that need to allocate auxiliary views (e.g. model.c's transmission framebuffer-capture path) read this to configure those views with the same render target as the caller's pass.
Returns The render target for the current pass, or MK_RENDER_TARGET_INVALID if rendering to the backbuffer or no pass is active.
mk_pass_textfunctionvoid mk_pass_text(void)Begin text rendering bound to the current pass — the pass-native default text path (no custom shader, no encoder/view juggling).
Mirrors mk_pass_canvas(): flushes any active draw2d/draw3d batch, then begins the built-in text subsystem on the pass's encoder + view with a screen-space (pixel) orthographic projection. After calling this you draw with the normal mk_text_draw()/mk_text_draw_styled() functions; the batch is flushed automatically on mk_end_pass() (or when you switch to another draw context). For custom-shaded text, skip this and use mk_text_build() + mk_pass_draw() with your own pipeline instead.
mk_begin_pass(&mk_pass_clear(0x202020ff));
mk_pass_text();
mk_text_draw(font, 20, 20, "Hello", 0, 0xFFFFFFFF, MK_TEXT_ALIGN_LEFT | MK_TEXT_ALIGN_TOP);
mk_end_pass();mk_pass_viewfunctionmk_view_id_t mk_pass_view(void)Get the current pass's view ID.
Use this for subsystems that require an explicit view ID, such as NanoVG (mk_nvg_set_view), or for debugging.
Returns The view ID for the current pass. Only valid until mk_end_pass().
mk_set_camerafunctionvoid mk_set_camera(const struct mk_camera *camera)Set the camera used by the implicit (simple-API) pass.
Affects mk_pass_draw/mk_dispatch/mk_cube/etc. when called WITHOUT an explicit mk_begin_pass. The camera persists across frames; call once or per-frame. Does NOT affect explicit passes those take their camera from mk_pass_desc.view_mtx/proj_mtx.
| Parameter | Type | Description |
|---|---|---|
camera | const struct mk_camera * | Camera whose view/projection matrices are applied. |
mk_set_camera_rawfunctionvoid mk_set_camera_raw(const float *view_mtx, const float *proj_mtx)Set the implicit-pass camera from raw matrices.
| Parameter | Type | Description |
|---|---|---|
view_mtx | const float * | 4x4 view matrix (NULL = identity). |
proj_mtx | const float * | 4x4 projection matrix (NULL = identity). |
mk_sort_depth_from_distancefunctionuint32_t mk_sort_depth_from_distance(float view_distance)Encode a non-negative view-forward distance into a monotonic bgfx sort key.
| Parameter | Type | Description |
|---|---|---|
view_distance | float | Value for view distance. |
Returns The resulting value.
mk_batch_statsstructData for batch stats.
| Field | Type | Description |
|---|---|---|
packets | uint32_t | The packets. |
instanced_draws | uint32_t | The instanced draws. |
instances | uint32_t | The instances. |
fallback_draws | uint32_t | The fallback draws. |
mk_dispatch_descstructCompute dispatch descriptor.
Zero-init = sane defaults: num_x/y/z 0 => 1 (a single workgroup on that axis) discard 0 => MK_DISCARD_ALL
| Field | Type | Description |
|---|---|---|
shader | mk_shader_t | Compute program (mk_shader_load_compute*). |
num_x | uint32_t | X workgroup count; zero selects one. |
num_y | uint32_t | Y workgroup count; zero selects one. |
num_z | uint32_t | Z workgroup count; zero selects one. |
images | mk_image_binding | The images. |
image_count | uint8_t | The image count. |
buffers | mk_storage_binding | The buffers. |
buffer_count | uint8_t | The buffer count. |
indirect_buffers | mk_indirect_binding | The indirect buffers. |
indirect_buffer_count | uint8_t | The indirect buffer count. |
uniforms | mk_uniform_binding | The uniforms. |
uniform_count | uint8_t | The uniform count. |
use_indirect | bool | The use indirect. |
indirect_buffer | mk_indirect_buf_t | The indirect buffer. |
indirect_start | uint32_t | The indirect start. |
indirect_count | uint32_t | 0 selects one command. |
discard | uint8_t | 0 => MK_DISCARD_ALL |
mk_draw_descstructDraw descriptor.
Zero-init = sane defaults: pipeline invalid + shader set => inline shortcut (state 0 => MK_STATE_DEFAULT) ibuf invalid => non-indexed draw transform NULL => identity (no set_transform) discard 0 => MK_DISCARD_ALL Geometry precedence per stream: transient > dynamic > static. Instance data precedence: transient instance buffer > dynamic vertex buffer static vertex buffer > count-only instancing.
| Field | Type | Description |
|---|---|---|
pipeline | mk_pipeline_t | The pipeline. |
shader | mk_shader_t | The shader. |
state | uint64_t | inline shortcut state; 0 => MK_STATE_DEFAULT |
blend_rgba | uint32_t | inline shortcut blend factor |
material | mk_material_t | The material. |
geometry | mk_geometry_t | The geometry. |
instanced_pipeline | mk_pipeline_t | The instanced pipeline. |
pipeline_retained_resource | bool | Internal pipeline ownership marker; callers leave false. |
shader_retained_resource | bool | Internal shader ownership marker; callers leave false. |
instanced_pipeline_retained_resource | bool | Internal instanced-pipeline ownership marker; callers leave false. |
flags | uint32_t | The flags. |
provider_mask | mk_shader_provider_mask_t | The provider mask. |
provider_disable_mask | mk_shader_provider_mask_t | The provider disable mask. |
stencil_front | uint32_t | The stencil front. |
stencil_back | uint32_t | The stencil back. |
stencil_override | bool | The stencil override. |
vbuf | mk_vbuf_t | The vbuf. |
ibuf | mk_ibuf_t | optional; invalid => non-indexed |
vbuf_retained_resource | bool | Internal vertex-buffer ownership marker; callers leave false. |
ibuf_retained_resource | bool | Internal index-buffer ownership marker; callers leave false. |
dvbuf | mk_dvbuf_t | optional dynamic vbuf |
dibuf | mk_dibuf_t | optional dynamic ibuf |
tvbuf | const mk_tvbuf_t * | optional transient vbuf (wins if set) |
tibuf | const mk_tibuf_t * | optional transient ibuf (wins if set) |
stream | uint8_t | vertex stream index (default 0) |
vbuf_start | uint32_t | First vertex; zero with vbuf_num zero selects the whole buffer. |
vbuf_num | uint32_t | Vertex count; zero with vbuf_start zero selects the whole buffer. |
ibuf_first | uint32_t | First index; zero with ibuf_num zero selects the whole buffer. |
ibuf_num | uint32_t | Index count; zero with ibuf_first zero selects the whole buffer. |
vertex_count | uint32_t | bufferless draw: when >0 AND no vbuf/dvbuf/tvbuf is set, draw this many vertices with no vertex buffer (gl_VertexID; fullscreen triangle/quad). |
transform | const float * | The transform. |
instance_buffer | const mk_instance_buf_t * | optional transient instance data |
instance_vbuf | mk_vbuf_t | optional static instance data |
instance_vbuf_retained_resource | bool | Internal instance-buffer ownership marker; callers leave false. |
instance_dvbuf | mk_dvbuf_t | optional dynamic instance data |
instance_start | uint32_t | first instance record |
instance_stride | uint16_t | bytes per instance, documentation only |
instance_count | uint32_t | The instance count. |
use_indirect | bool | The use indirect. |
indirect_buffer | mk_indirect_buf_t | The indirect buffer. |
indirect_start | uint32_t | The indirect start. |
indirect_count | uint32_t | 0 selects one command. |
textures | mk_tex_binding | The textures. |
texture_count | uint8_t | The texture count. |
uniforms | mk_uniform_binding | The uniforms. |
uniform_count | uint8_t | The uniform count. |
binding_overflow | bool | internal resolver marker; callers leave false |
phase | mk_draw_phase_t | The phase. |
depth | uint32_t | The depth. |
has_depth | bool | permits an explicit depth of zero |
discard | uint8_t | 0 => MK_DISCARD_ALL |
mk_draw_rejection_statsstructData for draw rejection stats.
| Field | Type | Description |
|---|---|---|
total | uint32_t | The total. |
invalid_argument | uint32_t | The invalid argument. |
invalid_state | uint32_t | The invalid state. |
unsupported | uint32_t | The unsupported. |
binding_capacity | uint32_t | The binding capacity. |
binding_conflict | uint32_t | The binding conflict. |
binding_type | uint32_t | The binding type. |
other | uint32_t | The other. |
mk_image_bindingstructA storage-image binding for a compute dispatch.
| Field | Type | Description |
|---|---|---|
stage | uint8_t | Image stage 0..15. |
texture | mk_texture_t | Storage image (mk_texture_create_storage). |
mip | uint8_t | Mip level (default 0). |
access | mk_access_t | READ / WRITE / READWRITE. |
format | mk_texture_format_t | Access format. |
mk_indirect_bindingstructData for indirect binding.
| Field | Type | Description |
|---|---|---|
stage | uint8_t | The stage. |
buffer | mk_indirect_buf_t | The buffer. |
access | mk_access_t | The access. |
mk_pass_descstructPass descriptor.
All fields have sensible defaults when zero-initialized. Zero-init gives: no clear, no camera, backbuffer target, default sort. Use the convenience constructors (mk_pass_clear, mk_pass_3d, etc.) for common configurations.
| Field | Type | Description |
|---|---|---|
name | const char * | Debug name (optional, NULL ok). |
clear_color | uint32_t | RGBA clear color. |
clear_depth | float | Depth clear value (0 = use default 1.0). |
clear_stencil | uint8_t | Stencil clear value. |
clear_flags | uint16_t | MK_CLEAR_COLOR | MK_CLEAR_DEPTH etc. |
clear_colors | const uint32_t * | The clear colors. |
clear_color_count | uint8_t | The clear color count. |
target | mk_render_target_t | The target. |
viewport_x | uint16_t | The viewport x. |
viewport_y | uint16_t | The viewport y. |
viewport_width | uint16_t | The viewport width. |
viewport_height | uint16_t | The viewport height. |
sort | mk_pass_sort_t | The sort. |
view_mtx | const float * | 4x4 view matrix (NULL = identity) |
proj_mtx | const float * | 4x4 projection matrix (NULL = identity) |
camera_position | const float * | World-space xyz; NULL derives from view. |
output | mk_pass_output_desc | Immutable view/output provider state. |
provider_disable_mask | mk_shader_provider_mask_t | The provider disable mask. |
phase_mode | mk_pass_phase_mode_t | The phase mode. |
submit_mode | mk_submit_mode_t | The submit mode. |
material_pass | mk_material_pass_role | The material pass. |
mk_pass_output_descstructData for pass output desc.
| Field | Type | Description |
|---|---|---|
mode | mk_pass_output_mode_t | Display encoding or raw-linear output. |
exposure | float | Linear multiplier; <= 0 selects 1.0. |
tonemap_operator | mk_tonemap_op | Operator used by display-output shaders. |
mk_resolved_draw_reportstructData for resolved draw report.
| Field | Type | Description |
|---|---|---|
result | mk_result | The result. |
effective_providers | mk_shader_provider_mask_t | The effective providers. |
sampler_count | uint8_t | The sampler count. |
selected_pbr_variant_id | uint32_t | The selected PBR variant ID. |
pbr_extension_mask | uint32_t | The PBR extension mask. |
pbr_family | uint32_t | The PBR family. |
pbr_downgrade_mask | uint32_t | The PBR downgrade mask. |
mk_storage_bindingstructA storage-buffer binding for a compute dispatch.
dvbuf wins if both set.
| Field | Type | Description |
|---|---|---|
stage | uint8_t | Buffer stage 0..15. |
dvbuf | mk_dvbuf_t | Dynamic vertex buffer (MK_DYNBUF_COMPUTE_*), preferred. |
vbuf | mk_vbuf_t | Static vertex buffer (compute-access). |
access | mk_access_t | READ / WRITE / READWRITE. |
mk_tex_bindingstructA single texture binding for a draw.
| Field | Type | Description |
|---|---|---|
stage | uint8_t | Texture stage 0..15. |
sampler | mk_uniform_t | Sampler uniform (MK_UNIFORM_SAMPLER). |
texture | mk_texture_t | Texture to bind. |
sampler_flags | uint32_t | Sampler override when has_sampler_override is true. |
has_sampler_override | bool | The has sampler override. |
retained_resource | bool | Internal ownership marker; callers leave false. |
sampler_retained_resource | bool | Internal sampler ownership marker; callers leave false. |
mk_uniform_bindingstructA single uniform binding for a draw.
value is read during the call only.
| Field | Type | Description |
|---|---|---|
uniform | mk_uniform_t | Uniform handle (VEC4 / MAT3 / MAT4). |
value | const float * | Pointer to caller data. |
count | uint16_t | Number of vec4s/mats; 0 => 1. |
retained_resource | bool | Internal ownership marker; callers leave false. |
mk_draw_flag_tenumValues for draw flag.
| Value | Description |
|---|---|
MK_DRAW_NO_BATCH | Selects draw no batch. |
mk_draw_phase_tenumValues for draw phase.
| Value | Description |
|---|---|
MK_DRAW_PHASE_AUTO | Selects auto. |
MK_DRAW_PHASE_OPAQUE | Selects opaque. |
MK_DRAW_PHASE_TRANSPARENT | Selects transparent. |
mk_implicit_pass_typeenumValues for implicit pass type.
| Value | Description |
|---|---|
MK_IMPLICIT_PASS_NONE | No implicit pass open. |
MK_IMPLICIT_PASS_3D | 3D scene pass (from ensure_ctx) |
MK_IMPLICIT_PASS_2D | 2D overlay pass (from ensure_2d) |
mk_pass_output_mode_tenumValues for pass output mode.
| Value | Description |
|---|---|
MK_PASS_OUTPUT_DISPLAY | Selects display. |
MK_PASS_OUTPUT_RAW_LINEAR | Selects raw linear. |
mk_pass_phase_mode_tenumValues for pass phase mode.
| Value | Description |
|---|---|
MK_PASS_PHASE_SINGLE | Selects single. |
MK_PASS_PHASE_AUTOMATIC_3D | Selects automatic 3D. |
mk_pass_sortenumPass sorting mode.
| Value | Description |
|---|---|
MK_PASS_SORT_DEFAULT | Default sorting. |
MK_PASS_SORT_SEQUENTIAL | Render in submission order. |
MK_PASS_SORT_DEPTH_ASC | Front-to-back (opaque optimization). |
MK_PASS_SORT_DEPTH_DESC | Back-to-front (transparency). |
mk_submit_mode_tenumValues for submit mode.
| Value | Description |
|---|---|
MK_SUBMIT_IMMEDIATE | Selects immediate. |
MK_SUBMIT_AUTO_BATCH | Selects auto batch. |
mk_batch_statstypedeftypedef struct mk_batch_stats mk_batch_statsData for batch stats.
mk_dispatch_desctypedeftypedef struct mk_dispatch_desc mk_dispatch_descCompute dispatch descriptor.
Zero-init = sane defaults: num_x/y/z 0 => 1 (a single workgroup on that axis) discard 0 => MK_DISCARD_ALL
mk_draw_desctypedeftypedef struct mk_draw_desc mk_draw_descDraw descriptor.
Zero-init = sane defaults: pipeline invalid + shader set => inline shortcut (state 0 => MK_STATE_DEFAULT) ibuf invalid => non-indexed draw transform NULL => identity (no set_transform) discard 0 => MK_DISCARD_ALL Geometry precedence per stream: transient > dynamic > static. Instance data precedence: transient instance buffer > dynamic vertex buffer static vertex buffer > count-only instancing.
mk_draw_flag_ttypedeftypedef enum mk_draw_flag_t mk_draw_flag_tValues for draw flag.
mk_draw_phase_ttypedeftypedef enum mk_draw_phase_t mk_draw_phase_tValues for draw phase.
mk_draw_rejection_statstypedeftypedef struct mk_draw_rejection_stats mk_draw_rejection_statsData for draw rejection stats.
mk_image_bindingtypedeftypedef struct mk_image_binding mk_image_bindingA storage-image binding for a compute dispatch.
mk_implicit_pass_type_ttypedeftypedef enum mk_implicit_pass_type mk_implicit_pass_type_tValues for implicit pass type.
mk_indirect_bindingtypedeftypedef struct mk_indirect_binding mk_indirect_bindingData for indirect binding.
mk_pass_desctypedeftypedef struct mk_pass_desc mk_pass_descPass descriptor.
All fields have sensible defaults when zero-initialized. Zero-init gives: no clear, no camera, backbuffer target, default sort. Use the convenience constructors (mk_pass_clear, mk_pass_3d, etc.) for common configurations.
mk_pass_output_desctypedeftypedef struct mk_pass_output_desc mk_pass_output_descData for pass output desc.
mk_pass_output_mode_ttypedeftypedef enum mk_pass_output_mode_t mk_pass_output_mode_tValues for pass output mode.
mk_pass_phase_mode_ttypedeftypedef enum mk_pass_phase_mode_t mk_pass_phase_mode_tValues for pass phase mode.
mk_pass_sort_ttypedeftypedef enum mk_pass_sort mk_pass_sort_tPass sorting mode.
mk_resolved_draw_reporttypedeftypedef struct mk_resolved_draw_report mk_resolved_draw_reportData for resolved draw report.
mk_storage_bindingtypedeftypedef struct mk_storage_binding mk_storage_bindingA storage-buffer binding for a compute dispatch.
dvbuf wins if both set.
mk_submit_mode_ttypedeftypedef enum mk_submit_mode_t mk_submit_mode_tValues for submit mode.
mk_tex_bindingtypedeftypedef struct mk_tex_binding mk_tex_bindingA single texture binding for a draw.
mk_uniform_bindingtypedeftypedef struct mk_uniform_binding mk_uniform_bindingA single uniform binding for a draw.
value is read during the call only.
MK_DISPATCH_MAX_BUFFERSdefineMK_DISPATCH_MAX_BUFFERSMaximum supported dispatch buffers.
MK_DISPATCH_MAX_IMAGESdefineMK_DISPATCH_MAX_IMAGESMaximum supported dispatch images.
MK_DISPATCH_MAX_INDIRECT_BUFFERSdefineMK_DISPATCH_MAX_INDIRECT_BUFFERSMaximum supported dispatch indirect buffers.
MK_DRAW_MAX_TEXTURESdefineMK_DRAW_MAX_TEXTURESMaximum supported draw textures.
MK_DRAW_MAX_UNIFORMSdefineMK_DRAW_MAX_UNIFORMSMaximum supported draw uniforms.