ComputeBufferReadAsync

Family: Compute · 2 forms

What it does

ComputeBufferReadAsync takes bufferID (an integer), and answers an integer. That is the first of 2 forms. bufferID is the id of a Buffer object, obtained elsewhere in the Compute family.

Syntax

1
ComputeBufferReadAsync(bufferID integer) → integer
2
ComputeBufferReadAsync(bufferID integer, memblockID integer) → integer

Parameters

NameTypeIn forms
bufferIDintegerall
memblockIDinteger2

Every form returns

integer

Example · generated

Form 1, the short one

buffer = CreateComputeBuffer(10, "value")DO  Print(ComputeBufferReadAsync(buffer))  Sync()LOOP

Form 2, with every argument

buffer = CreateComputeBuffer(10, "value")DO  Print(ComputeBufferReadAsync(buffer, 1))  Sync()LOOP

CreateComputeBuffer is there to give the call something to act on; ComputeBufferReadAsync is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

14 commands in Compute