Export (0) Print
Expand All

D3DX11SaveTextureToFile function

Note  The D3DX (D3DX 9, D3DX 10, and D3DX 11) utility library is deprecated for Windows 8 and is not supported for Windows Store apps.
Note  Instead of using this function, we recommend that you use the DirectXTex library, CaptureTexture then SaveToXXXFile (where XXX is WIC, DDS, or TGA; WIC doesn't support DDS and TGA; D3DX 9 supported TGA as a common art source format for games). For the simplified scenario of creating a screen shot from a render target texture, we recommend that you use the DirectXTK library, SaveDDSTextureToFile or SaveWICTextureToFile.

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

 

 

Community Additions

ADD
Show:
© 2015 Microsoft