- _end_canary
uint _end_canary;
Undocumented in source.
- _start_canary
uint _start_canary;
Undocumented in source.
- d3d11_buffer
const(void)* d3d11_buffer;
Undocumented in source.
- data
Range data;
Undocumented in source.
- gl_buffers
uint[2] gl_buffers;
Undocumented in source.
- label
const(char)* label;
Undocumented in source.
- mtl_buffers
const(void)*[2] mtl_buffers;
Undocumented in source.
- size
size_t size;
Undocumented in source.
- usage
BufferUsage usage;
Undocumented in source.
- wgpu_buffer
const(void)* wgpu_buffer;
Undocumented in source.
sg_buffer_desc
Creation parameters for sg_buffer objects, used in the sg_make_buffer() call.
The default configuration is:
.size: 0 (*must* be >0 for buffers without data) .usage .vertex_buffer = true, .immutable = true .data.ptr 0 (*must* be valid for immutable buffers without storage buffer usage) .data.size 0 (*must* be > 0 for immutable buffers without storage buffer usage) .label 0 (optional string label)
For immutable buffers which are initialized with initial data, keep the .size item zero-initialized, and set the size together with the pointer to the initial data in the .data item.
For immutable or mutable buffers without initial data, keep the .data item zero-initialized, and set the buffer size in the .size item instead.
You can also set both size values, but currently both size values must be identical (this may change in the future when the dynamic resource management may become more flexible).
NOTE: Immutable buffers without storage-buffer-usage *must* be created with initial content, this restriction doesn't apply to storage buffer usage, because storage buffers may also get their initial content by running a compute shader on them.
NOTE: Buffers without initial data will have undefined content, e.g. do *not* expect the buffer to be zero-initialized!
ADVANCED TOPIC: Injecting native 3D-API buffers:
The following struct members allow to inject your own GL, Metal or D3D11 buffers into sokol_gfx:
.gl_buffersSG_NUM_INFLIGHT_FRAMES .mtl_buffersSG_NUM_INFLIGHT_FRAMES .d3d11_buffer
You must still provide all other struct items except the .data item, and these must match the creation parameters of the native buffers you provide. For sg_buffer_desc.usage.immutable buffers, only provide a single native 3D-API buffer, otherwise you need to provide SG_NUM_INFLIGHT_FRAMES buffers (only for GL and Metal, not D3D11). Providing multiple buffers for GL and Metal is necessary because sokol_gfx will rotate through them when calling sg_update_buffer() to prevent lock-stalls.
Note that it is expected that immutable injected buffer have already been initialized with content, and the .content member must be 0!
Also you need to call sg_reset_state_cache() after calling native 3D-API functions, and before calling any sokol_gfx function.