DarkBASIC Professional Help File

DX11 CREATE TEXTURE ARRAY

Creates a texture array. Each texture in the array will be initialized to a blank image, optionally filled with the specified colour.
Texture arrays are, as the name implies, arrays of textures. Each image in such an array must have the same format and dimensions but may contain
different pixel data. Furthermore a texture array only occupies a single register slot on the GPU, meaning that you can use this to achieve an
arbitrary number of textures on a single object / sprite. This is intended as a means to avoid having to pack multiple textures into a larger texture atlas
as was common for things like terrains having multiple textures to blend between, as well as normal and specular maps, etc., before texture arrays were available.
*
Take note that in order to use an image from a texture array for rendering, you will have to write your own shader that makes use of a Texture2DArray resource.
You cannot set a sub-image of a texture array as a "normal" Texture2D texture for an object or sprite.

Syntax

    Return Dword = DX11 CREATE TEXTURE ARRAY(width, height, arraySize, [format], [generateMipMaps], [red], [green], [blue], [alpha], [accessMode])

Parameters

    width

> Dword
> The width of the texture images in pixels. Every image in the array will have this width.

    height

> Dword
> The height of the texture images in pixels. Every image in the array will have this height.

    arraySize

> Dword
> The number of textures (images) that the array will contain. Must be between 1 and 2048. A size of 1 is obviously pointless for a texture array though.

    [Optional] format

> Dword
> The format of the created images. Corresponds directly to the DXGI_FORMAT enumeration that you can find on MSDN. Defaults to B8G8R8A8 which is the default used by DBPro as well.

    [Optional] generateMipMaps

> Boolean
> Set to true to generate mip maps. Defaults to false if omitted.

    [Optional] red

> Float
> The red component to fill the images with.

    [Optional] green

> Float
> The green component to fill the images with.

    [Optional] blue

> Float
> The blue component to fill the images with.

    [Optional] alpha

> Float
> The alpha component to fill the images with.

    [Optional] accessMode

> Dword
> Set to one of the ACCESSMODE_XXX constants. ACCESSMODE_DIRECT_CPUWRITABLE allows faster editing of the image from the CPU (but slower read times by the GPU), ACCESSMODE_GPUWRITABLE is needed to create a images that can be used as read/write resources in a shader.

Returns

The created texture (image) array.

See also

IMAGE Functions Menu
DX11 Function Categories