D3D11CalcSubresource function (d3d11.h)

Calculates a subresource index for a texture.

Syntax

UINT D3D11CalcSubresource(
  UINT MipSlice,
  UINT ArraySlice,
  UINT MipLevels
);

Parameters

MipSlice

Type: UINT

A zero-based index for the mipmap level to address; 0 indicates the first, most detailed mipmap level.

ArraySlice

Type: UINT

The zero-based index for the array level to address; always use 0 for volume (3D) textures.

MipLevels

Type: UINT

Number of mipmap levels in the resource.

Return value

Type: UINT

The index which equals MipSlice + (ArraySlice * MipLevels).

Remarks

A buffer is an unstructured resource and is therefore defined as containing a single subresource. APIs that take buffers do not need a subresource index. A texture on the other hand is highly structured. Each texture object may contain one or more subresources depending on the size of the array and the number of mipmap levels.

For volume (3D) textures, all slices for a given mipmap level are a single subresource index.

Requirements

Requirement Value
Target Platform Windows
Header d3d11.h
DLL D3d11.lib

See also

Core Functions

Resource Functions