This topic has not yet been rated - Rate this topic

D3DX11SaveTextureToFile function

Applies to: desktop apps only

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 Consumer Preview and is not supported for Metro style apps.

Save a texture to a file.

Syntax

HRESULT D3DX11SaveTextureToFile(
  ID3D11DeviceContext *pContext,
  __in  ID3D11Resource *pSrcTexture,
  __in  D3DX11_IMAGE_FILE_FORMAT DestFormat,
  __in  LPCTSTR pDestFile
);

Parameters

pContext

Type: ID3D11DeviceContext*

A pointer to an ID3D11DeviceContext object.

pSrcTexture [in]

Type: ID3D11Resource*

Pointer to the texture to be saved. See ID3D11Resource.

DestFormat [in]

Type: D3DX11_IMAGE_FILE_FORMAT

The format the texture will be saved as (see D3DX11_IMAGE_FILE_FORMAT). D3DX11_IFF_DDS is the preferred format since it is the only option that supports all the formats in DXGI_FORMAT.

pDestFile [in]

Type: LPCTSTR

Name of the destination output file where the texture will be saved. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the data type resolves to LPCSTR.

Return value

Type: HRESULT

The return value is one of the values listed in Direct3D 11 Return Codes; use the return value to see if the DestFormat is supported.

Remarks

D3DX11SaveTextureToFile writes out the extra DDS_HEADER_DXT10 structure for the input texture only if necessary (for example, because the input texture is in standard RGB (sRGB) format). If D3DX11SaveTextureToFile writes out the DDS_HEADER_DXT10 structure, it sets the dwFourCC member of the DDS_PIXELFORMAT structure for the texture to DX10 to indicate the prescense of the DDS_HEADER_DXT10 extended header.

Requirements

Header

D3DX11tex.h

Library

D3DX11.lib

See also

D3DX Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
saving shared resources
Is there any reason this function does not work with a ID3D11Texture2D created with the D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX misc flag ? What is the best practice for saving resources shared between multiple d3d11 devices ?