Platform SDK: DirectX

D3DXCheckTextureRequirements

The D3DXCheckTextureRequirements function returns information about texture creation. It provides an easy mechanism to determine the closest surface type that works with the current Direct3DDevice device. Given an ideal texture format, width, and height, and a mipmapping flag, it returns the closest match that works with the chosen device.

HRESULT D3DXCheckTextureRequirements(
  LPDIRECT3DDEVICE7 pd3dDevice,
  LPDWORD pFlags,
  LPDWORD pWidth,
  LPDWORD pHeight,
  D3DX_SURFACEFORMAT* pPixelFormat,
);

Parameters

pd3dDevice
A pointer to the Direct3D device, an IDirect3DDevice7 interface, associated with the texture.
pFlags
A pointer to a DWORD value. This parameter allows you to specify the D3DX_TEXTURE_NOMIPMAP flag if mipmap generation is not desired. This value can be NULL. The D3DX_TEXTURE_NOMIPMAP flag may be returned in the case where mipmap creation is not supported.
pWidth
A pointer to a DWORD value, indicating the width in pixels. If you specify zero or D3DX_DEFAULT, the width will be taken from the file. This parameter returns the corrected width.
pHeight
A pointer to a DWORD value, indicating the height in pixels. If you specify zero or D3DX_DEFAULT, the height will be taken from the file. This parameter returns the corrected height.
pPixelFormat
A pointer to a member of the D3DX_SURFACEFORMAT enumerated type. The input value for this parameter should be the desired texture format. The return value will be the closest texture format that is supported by the hardware.

Return Values

If the function succeeds, the return value is S_OK.

If the function fails, the return value may be one of the following values:

D3DXERR_INVALIDPARAMETER
D3DXERR_NOMATCHFOUND
D3DXERR_NULLPOINTER

Remarks

This function provides a helper to determine what resizing and format conversion the D3DXCreateTexture, D3DXCreateTextureFromFile, and D3DXCreateCubeMapTexture functions will need to do. In most cases, the create functions can be used directly without performing this step.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Version: Requires DirectX 7.0.
  Header: Declared in d3dxcore.h.
  Library: Use d3dx.lib.