-
Notifications
You must be signed in to change notification settings - Fork 447
Filter Flags
DirectXTex |
---|
enum TEX_FILTER_FLAGS
TEX_FILTER_DEFAULT
Default flags
This selects the filtering mode used for resizing and mipmap generation. In most cases it defaults to using "Fant" (aka "Box").
-
TEX_FILTER_POINT
Nearest neighbhor -
TEX_FILTER_LINEAR
Bilinear/Trilinear interpolation -
TEX_FILTER_CUBIC
Bicubic/Tricubic interpoloation -
TEX_FILTER_FANT
Fant which is equivalent to a box filter for down-scaling. -
TEX_FILTER_BOX
Box filter (alias for Fant since they are equivalent for down-scaling). When using the non-WIC codepaths, Box filter fails if the texture is not a power of 2 in width & height. -
TEX_FILTER_TRIANGLE
Finite low-pass triangle filter. This is not supported by WIC so always uses custom filtering paths.
The legacy D3DX library implemented Point, Linear, Box, and Triangle.
This selects the use of dithering for format conversions. By default it uses no dithering.
-
TEX_FILTER_DITHER
4x4 ordered dithering -
TEX_FILTER_DITHER_DIFFUSION
Error-diffusion dithering (aka Floyd–Steinberg dithering)
This controls how edge pixels are filtered. It defaults to CLAMP which is the only one supported by the WIC code paths. These have no impact on POINT or BOX filtering methods.
-
TEX_FILTER_WRAP_U
-
TEX_FILTER_WRAP_V
-
TEX_FILTER_WRAP_W
-
TEX_FILTER_WRAP
These indicates the texture will be used with wrap texture addressing modesD3D11_TEXTURE_ADDRESS_WRAP
in U, V, and/or W. This affects Linear, Cubic, and Triangle filtering. -
TEX_FILTER_MIRROR_U
-
TEX_FILTER_MIRROR_V
-
TEX_FILTER_MIRROR_W
-
TEX_FILTER_MIRROR
These indicates the texture will be used with mirror texture addressing modesD3D11_TEXTURE_ADDRESS_MIRROR
in U, V, and/or W. This affects Cubic filtering. For Linear and Triangle filtering, MIRROR and the default of clamp give the same result.
This controls color space transformation for conversions.
-
TEX_FILTER_SRGB_IN
Indicates the input format is the sRGB format. This is implied if using aDXGI_FORMAT_*_SRGB
format -
TEX_FILTER_SRGB_OUT
Indicates the output format is the sRGB format. This is implied if using aDXGI_FORMAT_*_SRGB
format -
TEX_FILTER_SRGB
This is the same as setting bothTEX_FILTER_SRGB_IN
andTEX_FILTER_SRGB_OUT
The sRGB color space overall is approximately equivalent to gamma 2.2. It's actually linear below a threshold, and gamma 2.4 beyond that.
When both WIC-based and non-WIC based codepaths are in place, these flags can influence the standard logic choice. These are primarily used for testing and debugging purposes.
TEX_FILTER_FORCE_NON_WIC
TEX_FILTER_FORCE_WIC
TEX_FILTER_SEPARATE_ALPHA
WIC makes use of pre-multiplied alpha when resizing images, which works fine for standard transparency data. If the alpha channel, however, contains some other kind of value then the resulting image can have 'holes' in it. Use of this flag uses an alternative algorithm which resizes the RGB and alpha channels independantly and then recombines the result. This flag is not used by the non-WIC code paths, but will cause the Convert() function to use non-WIC paths.
For Convert operations, these flags control special-case logic in the non-WIC paths. Without these flags, RGB to R conversions default to converting to a luminance value and RGB to RG conversion defaults to copying the RED and GREEN channels. These are implemented in the non-WIC code paths.
-
TEX_FILTER_RGB_COPY_RED
When converting from RGB to R formats, this indicates that the RED channel could be copied. For RGB to RG conversions, it can be combined with GREEN or BLUE to control which channels end up in the output. -
TEX_FILTER_RGB_COPY_GREEN
When converting from RGB to R formats, this indicates that the GREEN channel could be copied. For RGB to RG conversions, it can be combined with RED or BLUE to control which channels end up in the output. -
TEX_FILTER_RGB_COPY_BLUE
When converting from RGB to R formats, this indicates that the BLUE channel could be copied. For RGB to RG conversions, it can be combined with RED or GREEN to control which channels end up in the output. -
TEX_FILTER_RGB_COPY_ALPHA
When converting from RGB(A) to R formats, this indicates that the ALPHA channel could be copied. For RGB(A) to RG conversions, it can be combined with RED or GREEN or BLUE to control which channels end up in the output.
For Convert operations, these flags enable special-case logic in the non-WIC paths.
-
TEX_FILTER_FLOAT_X2BIAS
Enables special*2 -1
conversion cases for converting unorm <-> float, and positive-only-floats <-> float/snorm. These are typically used with normal maps.
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 [email protected] 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