Revamp usage buffer/image usage flags
Author: flooohCreated Sep 22, 2026Updated Sep 26, 2026
Labelssokol-gfx
Main motivation: get rid of the .immutable usage and harmonize usage flags with WebGPU.
sg_buffer_usage: -.vertex_buffer: buffer can be bound as vertex buffer -.index_buffer: buffer can be bound as index buffer -.storage_buffer: buffer can be bound as storage buffer (D3D11: SRV for read-only access, UAV for read/write access) -.staging_buffer: buffer cannot be bound, only used as write-transient-destination and copy-source -.index_staging_buffer: special staging buffer mode for copying into index buffers (only required by WebGL2) -.write_unsealed: valid with.vertex_buffer, .index_buffer, .storage_buffer, can write initial content viasg_write_buffer_unsealed()-.write_transient: valid with.vertex_buffer, .index_buffer, .storage_buffer, .staging_buffer, can write transient data viasg_write_buffer_transient()-.copy_src: valid with.vertex_buffer, .index_buffer, .storage_buffer, .staging_buffer, can be used as source insg_copy_buffer_to_*calls -.copy_dst: valid with.vertex_buffer, .index_buffer, .storage_buffer, can be used as destination insg_copy_*_to_buffercallssg_image_usage: -.storage_image: image can be bound as storage image -.color_attachment: can be used as color pass attachment -.resolve_attachment: can be used as resolve pass attachment -.depth_attachment: can be used as depth/stencil pass attachment -.staging_image: cannot be used as texture, storage image or attachment, only aswrite_transient+copy_src-.write_unsealed: valid with.storage_imageand!.*_attachment-.write_transient: valid with.storage_imageand!.*_attachment-.copy_src: valid with!.*_attachment-.copy_dst: valid with!.*_attachment
Source: floooh/sokol