Microsoft DirectX 8.1 (C++)

D3DXFilterTexture

Filters the mipmap levels of a texture.

HRESULT D3DXFilterTexture(
  LPDIRECT3DTEXTURE8 pTexture,
  CONST PALETTEENTRY* pPalette,
  UINT SrcLevel,
  DWORD MipFilter
);

Parameters

pTexture
[in] Pointer to an IDirect3DTexture8 interface, representing the texture object to filter.
pPalette
[out] Pointer to a PALETTEENTRY structure, representing a 256-color palette to fill in, or NULL for nonpalletized formats. If a palette is not specified, the default Microsoft® Direct3D® palette (an all opaque white palette) is provided.
SrcLevel
[in] The level whose image is used to generate the subsequent levels. Specifying D3DX_DEFAULT for this parameter is equivalent to specifying 0.
MipFilter
[in] A combination of one or more D3DX_FILTER flags 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 2, 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 values.

D3DERR_INVALIDCALL
D3DXERR_INVALIDDATA

Remarks

A box filter or a point filter is recursively applied to each texture level to generate the next texture level. All other filters use SrcLevel to generate all the sysequenct mip levels.

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 IDirect3DTexture8::AddDirtyRect on the texture.

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

Requirements

  Header: Declared in D3dx8tex.h.
  Import Library: Use D3dx8.lib.