Usage

sg_usage

A resource usage hint describing the update strategy of buffers and images. This is used in the sg_buffer_desc.usage and sg_image_desc.usage members when creating buffers and images:

Values

ValueMeaning
Default
Immutable
Dynamic
Stream
Num

Detailed Description

SG USAGE IMMUTABLE

the resource will never be updated with new data, instead the content of the resource must be provided on creation

SG USAGE DYNAMIC

the resource will be updated infrequently with new data (this could range from "once after creation", to "quite often but not every frame")

SG USAGE STREAM

the resource will be updated each frame with new content

The rendering backends use this hint to prevent that the CPU needs to wait for the GPU when attempting to update a resource that might be currently accessed by the GPU.

Resource content is updated with the functions sg_update_buffer() or sg_append_buffer() for buffer objects, and sg_update_image() for image objects. For the sg_update_*() functions, only one update is allowed per frame and resource object, while sg_append_buffer() can be called multiple times per frame on the same buffer. The application must update all data required for rendering (this means that the update data can be smaller than the resource size, if only a part of the overall resource size is used for rendering, you only need to make sure that the data that *is* used is valid).

The default usage is SG_USAGE_IMMUTABLE

Meta