-
Notifications
You must be signed in to change notification settings - Fork 448
TexMetadata
The TexMetadata structure describes a (potentially complex) image surface.
struct TexMetadata
{
size_t width;
size_t height;
size_t depth;
size_t arraySize;
size_t mipLevels;
uint32_t miscFlags;
uint32_t miscFlags2;
DXGI_FORMAT format;
TEX_DIMENSION dimension;
}
-
height should be 1 for 1D textures.
-
depth should be 1 for 1D and 2D textures.
-
arraySize should be 1 for non-array resources. For cubemaps it should be 6. For cubemap arrays it should be a multiple of 6 (i.e. numCubes = arraySize / 6).
-
mipLevels should be 1 for non-mipmapped images.
-
ComputeIndex: Returns the image index given the parameters for miplevel (0-based), array item (0-based), and volume slice (0-based). Returns size_t(-1) to indicate an out-of-range error.
-
IsCubemap: Returns true if the image is defined as cubemap or cubemap array as indicated by miscFlags.
-
IsPMAlpha: Returns true if the image data is premultipled alpha content (rather than straight alpha) as indicated by miscFlags2.
-
SetAlphaMode: Encodes the alpha mode into the miscFlags2 field.
-
GetAlphaMode: Returns the alpha mode encoded into the miscFlags2 field.
-
IsVolumemap: Returns true if the image data is a volume map (i.e. 3D texture) as indicated by dimension.
The alpha modes are TEX_ALPHA_MODE_UNKNOWN
, TEX_ALPHA_MODE_STRAIGHT
, TEX_ALPHA_MODE_PREMULTIPLIED
, TEX_ALPHA_MODE_OPAQUE
, and TEX_ALPHA_MODE_CUSTOM
. They match DDS_ALPHA_MODE
.
-
TEX_DIMENSION_TEXTURE1D
,TEX_DIMENSION_TEXTURE2D
, andTEX_DIMENSION_TEXTURE3D
are aliases forD3D10_RESOURCE_DIMEMSION
andD3D11_RESOURCE_DIMENSION
. -
TEX_MISC_TEXTURECUBE
is an alias for the sameD3D10_RESOURCE_MISC_FLAG
andD3D11_RESOURCE_MISC_FLAG
. -
TEX_MISC2_ALPHA_MODE_MASK
is a mask for miscFlags2 to obtain theTEX_ALPHA_MODE
.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
- Xbox One
- Xbox Series X|S
- Windows Subsystem for Linux
- x86
- x64
- ARM64
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- GCC 10.5, 11.4, 12.3
- MinGW 12.2, 13.2
- CMake 3.20
DirectX Tool Kit for DirectX 11