Skip to content
modkitv0.2

gpu_inspector.h

#include <modkit/gpu_inspector.h>2 functions · 6 structs · 1 enums · 7 typedefs · 2 macros

Debug-gated snapshots of live Modkit GPU resources and completed views.

The inspector enumerates Modkit-owned resource pools only when MK_DEBUG_GPU_INSPECTOR is enabled and a snapshot is requested. It does not own GPU resources and does not depend on a UI library.

Functions

mk_gpu_inspector_get_snapshotfunction

const mk_gpu_inspector_snapshot_t * mk_gpu_inspector_get_snapshot(void)

Build and return the current inspector snapshot.

Returns NULL when graphics is not initialized or MK_DEBUG_GPU_INSPECTOR is disabled. No pool enumeration or snapshot allocation occurs in that case. Build and return the current inspector snapshot.

Returns A borrowed pointer, or NULL when unavailable.

mk_gpu_resource_kind_namefunction

const char * mk_gpu_resource_kind_name(mk_gpu_resource_kind_t kind)

Return a stable human-readable resource-kind name.

Return a stable human-readable resource-kind name.

ParameterTypeDescription
kindmk_gpu_resource_kind_tValue for kind.

Returns A borrowed pointer, or NULL when unavailable.

Structs

mk_gpu_buffer_infostruct

Data for GPU buffer info.

FieldTypeDescription
size_bytesuint64_tThe size bytes.
element_countuint32_tThe element count.
strideuint16_tThe stride.
flagsuint16_tThe flags.
index_sizeuint8_tThe index size.

mk_gpu_inspector_snapshotstruct

A copied diagnostic snapshot.

submitted_frame_number is Modkit's latest submitted frame at request time. Pass rows describe the latest renderer-completed views available from the backend; each row carries its own gpu_frame_number because GPU timings can arrive after the corresponding submission. The returned pointer and all nested arrays remain valid until the next snapshot request, inspector disable, or graphics shutdown. Only resources created through Modkit's texture, render-target, shader and buffer pools are enumerated. Raw bgfx resources and low-level framebuffer wrappers are visible only in the aggregate mk_stats_t backend totals. Borrowed render-target attachment texture views are omitted as standalone texture rows and are described by their owning render-target row instead.

FieldTypeDescription
submitted_frame_numberuint32_tThe submitted frame number.
statsmk_stats_tThe stats.
num_passesuint32_tThe num passes.
passesconst mk_view_stats_t *The passes.
num_resourcesuint32_tThe num resources.
resourcesconst mk_gpu_resource_info_t *The resources.

mk_gpu_render_target_infostruct

Data for GPU render target info.

FieldTypeDescription
widthuint16_tThe width.
heightuint16_tThe height.
typemk_render_target_type_tThe type.
color_attachment_countuint8_tThe color attachment count.
color_formatsmk_texture_format_tThe color formats.
has_depthboolThe has depth.
depth_formatmk_texture_format_tThe depth format.
samplesuint8_tThe samples.
readableboolThe readable.

mk_gpu_resource_infostruct

One live Modkit GPU resource.

diagnostic_id is stable for the lifetime of the pool entry and is unique within its resource kind. estimated_size is an allocation estimate for textures and buffers; shaders use MK_GPU_RESOURCE_SIZE_UNKNOWN.

FieldTypeDescription
diagnostic_iduint32_tThe diagnostic ID.
namecharThe name.
kindmk_gpu_resource_kind_tThe kind.
pending_destroyboolThe pending destroy.
estimated_sizeuint64_tThe estimated size.
metadataunion mk_gpu_resource_info::@301073342264161256224023030173306370306255346141The metadata.
metadata.texturemk_gpu_texture_info_tThe texture.
metadata.render_targetmk_gpu_render_target_info_tThe render target.
metadata.shadermk_gpu_shader_info_tThe shader.
metadata.buffermk_gpu_buffer_info_tThe buffer.

mk_gpu_shader_infostruct

Data for GPU shader info.

FieldTypeDescription
computeboolThe compute.
uniform_countuint8_tThe uniform count.

mk_gpu_texture_infostruct

Data for GPU texture info.

FieldTypeDescription
widthuint16_tThe width.
heightuint16_tThe height.
depthuint16_tThe depth.
layersuint16_tThe layers.
mip_countuint8_tThe mip count.
formatmk_texture_format_tThe format.
cubeboolThe cube.

Enums

mk_gpu_resource_kindenum

Resource kinds represented by the inspector.

ValueDescription
MK_GPU_RESOURCE_TEXTURESelects texture.
MK_GPU_RESOURCE_RENDER_TARGETSelects render target.
MK_GPU_RESOURCE_SHADERSelects shader.
MK_GPU_RESOURCE_VERTEX_BUFFERSelects vertex buffer.
MK_GPU_RESOURCE_INDEX_BUFFERSelects index buffer.
MK_GPU_RESOURCE_DYNAMIC_VERTEX_BUFFERSelects dynamic vertex buffer.
MK_GPU_RESOURCE_DYNAMIC_INDEX_BUFFERSelects dynamic index buffer.
MK_GPU_RESOURCE_KIND_COUNTSelects kind count.

Typedefs

mk_gpu_buffer_info_ttypedef

typedef struct mk_gpu_buffer_info mk_gpu_buffer_info_t

Data for GPU buffer info.

mk_gpu_inspector_snapshot_ttypedef

typedef struct mk_gpu_inspector_snapshot mk_gpu_inspector_snapshot_t

A copied diagnostic snapshot.

submitted_frame_number is Modkit's latest submitted frame at request time. Pass rows describe the latest renderer-completed views available from the backend; each row carries its own gpu_frame_number because GPU timings can arrive after the corresponding submission. The returned pointer and all nested arrays remain valid until the next snapshot request, inspector disable, or graphics shutdown. Only resources created through Modkit's texture, render-target, shader and buffer pools are enumerated. Raw bgfx resources and low-level framebuffer wrappers are visible only in the aggregate mk_stats_t backend totals. Borrowed render-target attachment texture views are omitted as standalone texture rows and are described by their owning render-target row instead.

mk_gpu_render_target_info_ttypedef

typedef struct mk_gpu_render_target_info mk_gpu_render_target_info_t

Data for GPU render target info.

mk_gpu_resource_info_ttypedef

typedef struct mk_gpu_resource_info mk_gpu_resource_info_t

One live Modkit GPU resource.

diagnostic_id is stable for the lifetime of the pool entry and is unique within its resource kind. estimated_size is an allocation estimate for textures and buffers; shaders use MK_GPU_RESOURCE_SIZE_UNKNOWN.

mk_gpu_resource_kind_ttypedef

typedef enum mk_gpu_resource_kind mk_gpu_resource_kind_t

Resource kinds represented by the inspector.

mk_gpu_shader_info_ttypedef

typedef struct mk_gpu_shader_info mk_gpu_shader_info_t

Data for GPU shader info.

mk_gpu_texture_info_ttypedef

typedef struct mk_gpu_texture_info mk_gpu_texture_info_t

Data for GPU texture info.

Macros

MK_GPU_RESOURCE_NAME_MAXdefine

MK_GPU_RESOURCE_NAME_MAX

Maximum supported GPU resource name max.

MK_GPU_RESOURCE_SIZE_UNKNOWNdefine

MK_GPU_RESOURCE_SIZE_UNKNOWN

Constant for GPU resource size unknown.