Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
D3DX11CreateShaderResourceViewFromFile

D3DX11CreateShaderResourceViewFromFile 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 these:
  • DirectXTK library (runtime), CreateXXXTextureFromFile (where XXX is DDS or WIC)
  • DirectXTex library (tools), LoadFromXXXFile (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) then CreateShaderResourceView
 

Create a shader-resource view from a file.

Syntax


HRESULT D3DX11CreateShaderResourceViewFromFile(
  _In_  ID3D11Device             *pDevice,
  _In_  LPCTSTR                  pSrcFile,
  _In_  D3DX11_IMAGE_LOAD_INFO   *pLoadInfo,
  _In_  ID3DX11ThreadPump        *pPump,
  _Out_ ID3D11ShaderResourceView **ppShaderResourceView,
  _Out_ HRESULT                  *pHResult
);

Parameters

pDevice [in]

Type: ID3D11Device*

A pointer to the device (see ID3D11Device) that will use the resource.

pSrcFile [in]

Type: LPCTSTR

Name of the file that contains the shader-resource view. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the data type resolves to LPCSTR.

pLoadInfo [in]

Type: D3DX11_IMAGE_LOAD_INFO*

Optional. Identifies the characteristics of a texture (see D3DX11_IMAGE_LOAD_INFO) when the data processor is created; set this to NULL to read the characteristics of a texture when the texture is loaded.

pPump [in]

Type: ID3DX11ThreadPump*

Pointer to a thread-pump interface (see ID3DX11ThreadPump Interface). If NULL is specified, this function will behave synchronously and will not return until it is finished.

ppShaderResourceView [out]

Type: ID3D11ShaderResourceView**

Address of a pointer to the shader-resource view (see ID3D11ShaderResourceView).

pHResult [out]

Type: HRESULT*

A pointer to the return value. May be NULL. If pPump is not NULL, then pHResult must be a valid memory location until the asynchronous execution completes.

Return value

Type: HRESULT

The return value is one of the values listed in Direct3D 11 Return Codes.

Remarks

For a list of supported image formats, see D3DX11_IMAGE_FILE_FORMAT.

Requirements

Header

D3DX11tex.h

Library

D3DX11.lib

See also

D3DX Functions

 

 

Community Additions

ADD
Show:
© 2015 Microsoft