DarkBASIC Professional Help File

DX11 SET CAMERA RWBUFFER

Sets a read/write buffer that can be accessed by the pixel shaders used to render to the given camera.
Read/write buffers are only available to the pixel shader in the rendering pipeline and are quite similar to render targets.
You can not have a buffer set to be writable by the pixel shader stage at the same time that it is used as a read-only buffer for
any object / limb / sprite rendered using this camera while the read/write buffer is bound to it.
Read/write buffers furthermore share shader registers with render targets and read/write textures. While read/write resources (buffers and textures)
will overwrite each other if set to the same stage, all render targets will be bound to the first shader register slots. This means that if you have two
render targets, one read/write buffer at stage 0 and another read/write texture at stage 6, the render targets will be bound to registers u0 and u1 on
the GPU, followed by the buffer at u2 and the texture at u3. As such the resource stages are only used to refer to the resources on the CPU; on the GPU they
will always be bound in strict ascending order as outlined above.
Also, since each camera always has a render target, be it the backbuffer or an image, and the fact that there only is a single output register on DX10 hardware,
this function can only be used in DX11 mode.
Use DX11 SET CAMERA APPEND CONSUME BUFFER to bind an append/consume structured buffer. If you provide an append/consume buffer to this function it will be made accessible
as a RWStructuredBuffer from your pixel shader instead.

Syntax

    DX11 SET CAMERA RWBUFFER camera, buffer, [stage]

Parameters

    camera

> Dword
> The camera to set the RW buffer to be used in the rendering pass of.

    buffer

> Dword
> The buffer to bind as a read/write resource. Note that the buffer must have been created with ACCESSMODE_GPUWRITE to be used in this way.

    [Optional] stage

> Dword
> The stage to bind the writable buffer to; the valid range is [0..7]. Beware that render targets, read/write buffers and read/write textures all share the same 8 register slots on the GPU. Defaults to 0 if omitted.

Returns

This function does not return a value.

See also

CAMERA Functions Menu
DX11 Function Categories