DarkBASIC Professional Help File

DX11 SET COMPUTE SHADER BUFFER

Sets a read-only buffer that can be accessed by the specified compute shader.
You can bind up to 64 different buffer and image resources for read access by a compute shader. These will use registers t0 through t63.
Take note that buffers and textures share the same register slots, thus setting a buffer to slot 1 followed by setting a texture to the same slot will overwrite the previously set buffer.
You can unbind buffers by specifying nullptr as the buffer argument; this is neccessary if the same buffer is bound as a RW buffer by the same shader since a resource cannot simultaneously be bound for
read-only and write access (you can read from the read/write resource as the name suggests though).
Read-only buffers are declared like so in HLSL:

- Buffer BufferName : register(t?) where «datatype» can be either bool, int, uint or float and ? ranges between 0 and 63 for array buffers
[DX11 only]
- StructuredBuffer BufferName : register(t?) where ? ranges between 0 and 63 for structured buffers
- ByteAddressBuffer BufferName : register(t?) where ? ranges between 0 and 63 for byte address buffers

.

Syntax

    DX11 SET COMPUTE SHADER BUFFER shader, slot, buffer

Parameters

    shader

> Dword
> The compute shader to set the buffer resource for.

    slot

> Dword
> The shader register slot to bind the buffer to. The valid range is 0 through 63. Take note that texture resources use the same register slots.

    buffer

> Dword
> The buffer to bind to the specified slot of the given compute shader. Set to nullptr to remove a previously bound buffer / texture from the given slot.

Returns

This function does not return a value.

See also

DIRECTCOMPUTE Functions Menu
DX11 Function Categories