Skip to content

cf_draw_elements_indirect

Category: graphics
GitHub: cute_graphics.h


Draws the applied mesh with arguments read from a GPU buffer instead of the CPU.

void cf_draw_elements_indirect(CF_StorageBuffer args, int offset, int draw_count);
Parameters Description
args A storage buffer created with indirect_drawable, holding
CF_DrawIndirectArgs (or CF_DrawIndexedIndirectArgs when the mesh
has an index buffer) at offset.
offset Byte offset of the first draw's arguments within args.
draw_count How many consecutive argument blocks to draw.

Remarks

Call in place of cf_draw_elements, after cf_apply_shader. This closes the GPU-driven loop: a compute shader culls, compacts, and writes counts into the args buffer (compute_writable + indirect_drawable), and the draw consumes them with no CPU readback. SDL_GPU backends only; not available on GLES3/web.

cf_draw_elements
CF_DrawIndirectArgs
CF_DrawIndexedIndirectArgs
cf_make_storage_buffer
cf_dispatch_compute