D3DXFilterTexture

Filters mipmap levels of a texture.

HRESULT D3DXFilterTexture(
  LPDIRECT3DBASETEXTURE9 pBaseTexture,
  CONST PALETTEENTRY * pPalette,
  UINT SrcLevel,
  DWORD MipFilter
);

Parameters

pBaseTexture
[in] Pointer to an IDirect3DBaseTexture9 interface that represents the texture object to filter.
pPalette
[out] Pointer to a PALETTEENTRY structure that represents a 256-color palette to fill in, or NULL for nonpalletized formats. If a palette is not specified, the default Direct3D palette (an all opaque white palette) is provided. See Remarks.
SrcLevel
[in] Level whose image is used to generate the subsequent levels. Specifying D3DX_DEFAULT for this parameter is equivalent to specifying 0.
MipFilter
[in] Combination of one or more D3DX_FILTER controlling how the mipmap is filtered. Specifying D3DX_DEFAULT for this parameter is the equivalent of specifying D3DX_FILTER_BOX if the texture size is a power of two, and D3DX_FILTER_BOX | D3DX_FILTER_DITHER otherwise.

Return Values

If the function succeeds, the return value is D3D_OK. If the function fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA.

Remarks

A filter is recursively applied to each texture level to generate the next texture level.

Writing to a non-level-zero surface of the texture will not cause the dirty rectangle to be updated. If D3DXFilterTexture is called and the surface was not already dirty (this is unlikely under normal usage scenarios), the application needs to explicitly call IDirect3DTexture9::AddDirtyRect on the texture.

Textures created in the default pool (D3DPOOL_DEFAULT) cannot be used with D3DXFilterTexture (unless created with D3DUSAGE_DYNAMIC) because a lock operation is needed on the object. Note that locks are prohibited on textures in the default pool (unless they are dynamic).

For details on PALETTEENTRY, see the Platform SDK. Note that as of DirectX 8.0, the peFlags member of the PALETTEENTRY structure does not function as documented in the Platform SDK. The peFlags member is now the alpha channel for 8-bit palletized formats.

There is only one texture filtering function, but two macros that call this method.

#define D3DXFilterCubeTexture D3DXFilterTexture
#define D3DXFilterVolumeTexture D3DXFilterTexture

Requirements

Header: Declared in D3dx9tex.h.