mk_clustered_clearfunction
void mk_clustered_clear(void)Clear the clustered.
#include <modkit/clustered_lighting.h>3 functions · 3 structs · 1 enums · 3 typedefs
Forward+ light-list texture construction.
mk_clustered_clearfunctionvoid mk_clustered_clear(void)Clear the clustered.
mk_clustered_get_layoutfunctionvoid mk_clustered_get_layout(mk_clustered_layout *out)Copy the currently prepared clustered-lighting layout.
| Parameter | Type | Description |
|---|---|---|
out | mk_clustered_layout * | Receives the layout. |
mk_clustered_preparefunctionbool mk_clustered_prepare(const mk_clustered_prepare_desc *desc)Build or update cached clustered textures for the current light generation.
Local lights use conservative point-sphere or spot-cone bounding spheres. The CPU upload completes before this call returns, so no compute-to-sample barrier is required. Core PBR consumes stages 8-10; extension-heavy PBR remains bounded forward because those stages belong to extension maps. A failed build retains the previous allocation but disables its generation and selects bounded forward mode.
| Parameter | Type | Description |
|---|---|---|
desc | const mk_clustered_prepare_desc * | Configuration descriptor. |
Returns True when the operation succeeds.
mk_clustered_layoutstructPrepared cluster dimensions, counters, and GPU textures.
| Field | Type | Description |
|---|---|---|
light_generation | uint64_t | Immutable frame-light generation consumed. |
cluster_x | uint16_t | The cluster x. |
cluster_y | uint16_t | The cluster y. |
cluster_z | uint16_t | The cluster z. |
light_texture_width | uint16_t | Eight texels, one row per source light. |
light_texture_height | uint16_t | The light texture height. |
grid_texture_width | uint16_t | cluster_x. |
grid_texture_height | uint16_t | cluster_y * cluster_z. |
index_texture_width | uint16_t | 1024 texels. |
index_texture_height | uint16_t | The index texture height. |
local_light_count | uint32_t | The local light count. |
directional_light_count | uint32_t | The directional light count. |
index_count | uint32_t | The index count. |
overflow_clusters | uint32_t | The overflow clusters. |
dropped_indices | uint32_t | The dropped indices. |
light_texture | mk_texture_t | Shared RGBA32F light and shadow data. |
grid_texture | mk_texture_t | RGBA32F; RG is float offset/count. |
index_texture | mk_texture_t | R32F; exact float indices, capped at 2^24. |
mk_clustered_prepare_descstructInputs used to prepare clustered-lighting textures for a frame.
| Field | Type | Description |
|---|---|---|
camera | const mk_camera * | The camera. |
viewport_width | uint16_t | The viewport width. |
viewport_height | uint16_t | The viewport height. |
settings | mk_clustered_settings | The settings. |
mk_clustered_settingsstructCluster-grid dimensions and storage limits.
| Field | Type | Description |
|---|---|---|
tile_width | uint16_t | Zero selects 64 pixels. |
tile_height | uint16_t | Zero selects 64 pixels. |
depth_slices | uint8_t | Zero selects 24. |
max_lights_per_cluster | uint16_t | Zero selects 64. |
max_indices | uint32_t | Zero selects 1,048,576. |
@272374001373325103324230062076152076105103021111enumFixed texture stages reserved by clustered lighting.
| Value | Description |
|---|---|
MK_LIGHTING_SHADOW_STAGE | Selects shadow stage. |
MK_LIGHTING_CLUSTER_LIGHT_STAGE | Selects cluster light stage. |
MK_LIGHTING_CLUSTER_GRID_STAGE | Selects cluster grid stage. |
MK_LIGHTING_CLUSTER_INDEX_STAGE | Selects cluster index stage. |
mk_clustered_layouttypedeftypedef struct mk_clustered_layout mk_clustered_layoutPrepared cluster dimensions, counters, and GPU textures.
mk_clustered_prepare_desctypedeftypedef struct mk_clustered_prepare_desc mk_clustered_prepare_descInputs used to prepare clustered-lighting textures for a frame.
mk_clustered_settingstypedeftypedef struct mk_clustered_settings mk_clustered_settingsCluster-grid dimensions and storage limits.