DarkBASIC Professional Help File

DX11 GET BUFFER VECTOR4

Returns the vector4 stored at the specified position in the given buffer.
A vector4 is simply stored as four floats after each other and can be read / written as such if preferred. A vector4 corresponds to the float4 HLSL construct.
Take note that only primitive data types (booleans, integers, unsigned integers and floats) can be used as elements in an array buffer. Because of this, you cannot use this function with an array buffer.
The offsetInElement argument is only used by structured buffers; array- and byte address buffers will ignore it.

Syntax

    Return Dword = DX11 GET BUFFER VECTOR4(buffer, offset, [offsetInElement], [destinationVector])

Parameters

    buffer

> Dword
> The buffer to read the vector4 data from.

    offset

> Dword
> The offset within the buffer to read the value from. If called for a structured buffer or an array buffer, this corresponds to the element id to get. For a byte address buffer it is the offset in bytes from the beginning of the buffer. Note that byte address buffers can only be read from at 4-byte aligned addresses by the GPU.

    [Optional] offsetInElement

> Dword
> The offset within the current struct of the given element. Only relevant for structured buffers to allow writing struct entries with multiple data types. Ignored for all other buffer types. Set to zero (or whatever other value) if you want to store the return value to your own previously created vector4 instance.

    [Optional] destinationVector

> Dword
> A previously created vector4 that will be filled out with the read data. Defaults to nullptr if omitted, in which case a temporary vector will be created and returned.

Returns

The vector4 stored at the given offset in the buffer. This will either be the same vector4 that was provided as the last argument, or a temporary vector4 valid until the next DX11 SYNC call if no destination vector was provided.

See also

DIRECTCOMPUTE Functions Menu
DX11 Function Categories