DarkBASIC Professional Help File

DX11 SET CAMERA DEPTH STENCIL BUFFER

Sets the current depth / stencil buffer of the specified camera.
Only images created using DX11 CREATE RENDER TARGET with the makeDepthStencilBuffer parameter set to true, or depth / stencil buffers used by other cameras
(DX11 GET CAMERA DEPTH STENCIL BUFFER) are valid to use as depth stencil buffers.
You can read these as two-channel images where the red channel contains the depth data from a render pass and the green channel holds any stencil data.
Most commonly one would use the depth part as a shadow map when the camera is rendered from the point of view of a light source.
The depth / stencil buffer can furthermore be written to directly by the output merger without any need for a pixel shader, thus making this a significantly faster way
to render shadow maps for geometry that doesn't have any transparent parts (in case of transparency a pixel shader is needed to ensure that only the opaque parts of the
mesh is drawn to the depth buffer).
A depth / stencil buffer should furthermore have the same dimensions (width / height) as the render target associated with the same camera as this buffer.

Syntax

    DX11 SET CAMERA DEPTH STENCIL BUFFER camera, depthStencilBuf, [arrayIndex]

Parameters

    camera

> Dword
> The camera to set the depth / stencil buffer of.

    depthStencilBuf

> Dword
> The depth stencil buffer image to set the specified camera to use. If you set this to nullptr (zero) the old depth / stencil buffer will be retained.

    [Optional] arrayIndex

> Dword
> If the depth / stencil buffer image was created as a render target array you can set this to determine what image in the array to set as the buffer. The array count starts at zero.

Returns

This function does not return a value.

See also

CAMERA Functions Menu
DX11 Function Categories