DarkBASIC Professional Help File

DX11 ADD CONSTANT BUFFER

Adds a constant buffer to all shaders in the specified shader technique.
You can have up to 12 constant buffers per shader, however the first one is reserved for per-frame data supplied by the engine.
This used to contain the view / projection matrices for the rendering camera but that has since been delegated to the system buffer
bound to register t24. Constant buffer register b0 is still reserved for future re-use however.
Any registers you add yourself will use register b1 and up to register b11.
Each constant buffer can hold 4096 x 4 bytes. It is wise to partition data into different constant buffers based on how often their contents
will change, such that you have one per-frame buffer, one per-scene buffer, and so on. This saves the overhead of having to transfer all
constant data to the shader when you have in fact only changed a small fraction of it.

Syntax

    DX11 ADD CONSTANT BUFFER shaderTechnique, cbuffer

Parameters

    shaderTechnique

> Dword
> The shader technique to add the cbuffer to.

    cbuffer

> Dword
> The constant buffer to add to the shader technique.

Returns

This function does not return a value.

See also

SHADERTECHNIQUE Functions Menu
DX11 Function Categories