mk_pipeline_blend_rgbafunction
uint32_t mk_pipeline_blend_rgba(mk_pipeline_t p)Get the baked blend factor constant.
| Parameter | Type | Description |
|---|---|---|
p | mk_pipeline_t | Value for p. |
Returns The resulting value.
#include <modkit/pipeline.h>12 functions · 2 structs · 1 typedefs · 1 macros
Immutable pipeline objects (PSO).
A pipeline bakes a shader program, an (optional) vertex layout, and the full render state (blend/depth/cull/primitive/write masks + stencil) into one immutable handle. This is the modern, footgun-free way to describe "how to draw": create the pipeline once, then submit draws through it with mk_pass_draw() no per-submit global state to rebind after MK_DISCARD_ALL. Mental model (sokol / WebGPU / Metal): apply pipeline -> apply bindings -> draw Example: Uses generational handles for use-after-free detection (id 0 = invalid).
mk_pipeline_blend_rgbafunctionuint32_t mk_pipeline_blend_rgba(mk_pipeline_t p)Get the baked blend factor constant.
| Parameter | Type | Description |
|---|---|---|
p | mk_pipeline_t | Value for p. |
Returns The resulting value.
mk_pipeline_createfunctionmk_pipeline_t mk_pipeline_create(const mk_pipeline_desc *desc)Create an immutable pipeline.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_pipeline_desc * | Pipeline descriptor (shader required; zero-init = sane defaults). |
Returns Pipeline handle, or MK_PIPELINE_INVALID on failure.
mk_pipeline_destroyfunctionvoid mk_pipeline_destroy(mk_pipeline_t pipeline)Destroy a pipeline.
Does NOT destroy the shader it references (the caller owns the shader's lifetime).
| Parameter | Type | Description |
|---|---|---|
pipeline | mk_pipeline_t | Value for pipeline. |
mk_pipeline_is_validfunctionbool mk_pipeline_is_valid(mk_pipeline_t pipeline)Check if a pipeline is publicly valid and not pending destruction.
| Parameter | Type | Description |
|---|---|---|
pipeline | mk_pipeline_t | Value for pipeline. |
Returns True when the condition holds.
mk_pipeline_pinfunctionbool mk_pipeline_pin(mk_pipeline_t pipeline)Perform the pipeline pin operation.
| Parameter | Type | Description |
|---|---|---|
pipeline | mk_pipeline_t | Value for pipeline. |
Returns True when the operation succeeds.
mk_pipeline_shaderfunctionmk_shader_t mk_pipeline_shader(mk_pipeline_t p)Get the shader baked into the pipeline (MK_SHADER_INVALID if handle stale).
| Parameter | Type | Description |
|---|---|---|
p | mk_pipeline_t | Value for p. |
Returns The resulting handle or value.
mk_pipeline_statefunctionuint64_t mk_pipeline_state(mk_pipeline_t p)Get the baked render state word (0 if handle stale).
| Parameter | Type | Description |
|---|---|---|
p | mk_pipeline_t | Value for p. |
Returns The resulting value.
mk_pipeline_stencil_backfunctionuint32_t mk_pipeline_stencil_back(mk_pipeline_t p)Get the baked stencil back state.
| Parameter | Type | Description |
|---|---|---|
p | mk_pipeline_t | Value for p. |
Returns The resulting value.
mk_pipeline_stencil_frontfunctionuint32_t mk_pipeline_stencil_front(mk_pipeline_t p)Get the baked stencil front state.
| Parameter | Type | Description |
|---|---|---|
p | mk_pipeline_t | Value for p. |
Returns The resulting value.
mk_pipeline_system_initfunctionvoid mk_pipeline_system_init(void)Initialize the pipeline system.
mk_pipeline_system_shutdownfunctionvoid mk_pipeline_system_shutdown(void)Perform the pipeline system shutdown operation.
mk_pipeline_unpinfunctionvoid mk_pipeline_unpin(mk_pipeline_t pipeline)Perform the pipeline unpin operation.
| Parameter | Type | Description |
|---|---|---|
pipeline | mk_pipeline_t | Value for pipeline. |
mk_pipeline_descstructImmutable pipeline descriptor.
All fields have sane defaults when zero: state == 0 -> MK_STATE_DEFAULT is substituted at create time layout NULL -> no layout is stored (the bound vbuf carries its own) stencil 0/0 -> stencil disabled blend_rgba 0 -> blend factor constant of 0 (only used by *_FACTOR blends)
| Field | Type | Description |
|---|---|---|
name | const char * | Debug name (optional, NULL ok). |
shader | mk_shader_t | REQUIRED: vs+fs program. |
layout | const mk_layout_t * | Optional expected vertex layout (copied). |
state | uint64_t | The state. |
blend_rgba | uint32_t | Blend factor constant (for *_FACTOR blends). |
stencil_front | uint32_t | The stencil front. |
stencil_back | uint32_t | The stencil back. |
mk_pipeline_tstructData for pipeline.
| Field | Type | Description |
|---|---|---|
id | uint32_t | The ID. |
mk_pipeline_desctypedeftypedef struct mk_pipeline_desc mk_pipeline_descImmutable pipeline descriptor.
All fields have sane defaults when zero: state == 0 -> MK_STATE_DEFAULT is substituted at create time layout NULL -> no layout is stored (the bound vbuf carries its own) stencil 0/0 -> stencil disabled blend_rgba 0 -> blend factor constant of 0 (only used by *_FACTOR blends)
MK_PIPELINE_INVALIDdefineMK_PIPELINE_INVALIDInvalid sentinel for pipeline.