D3DX10CompileFromFile function

Note

Instead of using this legacy function, we recommend that you compile offline by using the Fxc.exe command-line compiler or use the D3DCompile API.

 

Compile a shader or an effect from a file.

Syntax

HRESULT D3DX10CompileFromFile(
  _In_        LPCTSTR            pSrcFile,
  _In_  const D3D_SHADER_MACRO *pDefines,
  _In_        LPD3D10INCLUDE     pInclude,
  _In_        LPCSTR             pFunctionName,
  _In_        LPCSTR             pProfile,
  _In_        UINT               Flags1,
  _In_        UINT               Flags2,
  _In_        ID3DX10ThreadPump  *pPump,
  _Out_       ID3D10Blob         **ppShader,
  _Out_       ID3D10Blob         **ppErrorMsgs,
  _Out_       HRESULT            *pHResult
);

Parameters

pSrcFile [in]

Type: LPCTSTR

The name of the file that contains the shader code. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the data type resolves to LPCSTR.

pDefines [in]

Type: const D3D_SHADER_MACRO*

Optional. Pointer to an array of macro definitions (see D3D_SHADER_MACRO). The last structure in the array serves as a terminator and must have all members set to 0. If not used, set pDefines to NULL.

pInclude [in]

Type: LPD3D10INCLUDE

Optional. Pointer to an ID3D10Include Interface interface for handling include files. Setting this to NULL will cause a compile error if a shader contains a #include.

pFunctionName [in]

Type: LPCSTR

Name of the shader-entry point function where shader execution begins. When you compile an effect, D3DX10CompileFromFile ignores pFunctionName; we recommend that you set pFunctionName to NULL because it is good programming practice to set a pointer parameter to NULL if the called function will not use it.

pProfile [in]

Type: LPCSTR

A string that specifies the shader model; can be any profile in shader model 2, shader model 3, or shader model 4.

Flags1 [in]

Type: UINT

Shader compile flags.

Flags2 [in]

Type: UINT

Effect compile flags. When you compile a shader and not an effect file, D3DX10CompileFromFile ignores Flags2; we recommend that you set Flags2 to zero because it is good programming practice to set a nonpointer parameter to zero if the called function will not use it.

pPump [in]

Type: ID3DX10ThreadPump*

A pointer to a thread pump interface (see ID3DX10ThreadPump Interface). Use NULL to specify that this function should not return until it is completed.

ppShader [out]

Type: ID3D10Blob**

A pointer to an ID3D10Blob Interface which contains the compiled shader, as well as any embedded debug and symbol-table information.

ppErrorMsgs [out]

Type: ID3D10Blob**

A pointer to an ID3D10Blob Interface which contains a listing of errors and warnings that occurred during compilation. These errors and warnings are identical to the debug output from a debugger.

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 10 Return Codes.

Remarks

Requirements

Requirement Value
Header
D3DX10Async.h

See also

General Purpose Functions