ID3DXInclude::Open method

A user-implemented method for opening and reading the contents of a shader #include file.

Syntax

HRESULT Open(
  [in]  D3DXINCLUDE_TYPE IncludeType,
  [in]  LPCSTR           pFileName,
  [in]  LPCVOID          pParentData,
  [out] LPCVOID          *ppData,
  [out] UINT             *pBytes
);

Parameters

IncludeType [in]

Type: D3DXINCLUDE_TYPE

The location of the #include file. See D3DXINCLUDE_TYPE.

pFileName [in]

Type: LPCSTR

Name of the #include file.

pParentData [in]

Type: LPCVOID

Pointer to the container that includes the #include file. The compiler might pass NULL in pParentData. For more information, see the "Searching for Include Files" section in Compile an Effect (Direct3D 11).

ppData [out]

Type: LPCVOID*

Pointer to the returned buffer that contains the include directives. This pointer remains valid until ID3DXInclude::Close is called.

pBytes [out]

Type: UINT*

Number of bytes returned in ppData.

Return value

Type: HRESULT

The user-implemented method should return S_OK. If the callback fails when reading the #include file, the API that caused the callback to be called will fail. This is one of the following:

  • The HLSL shader will fail one of the D3DXCompileShader*** functions.
  • The assembly shader will fail one of the D3DXAssembleShader*** functions.
  • The effect will fail one of the D3DXCreateEffect*** or D3DXCreateEffectCompiler*** functions.

Requirements

Requirement Value
Header
D3DX9Shader.h
Library
D3dx9.lib

See also

ID3DXInclude

ID3DXInclude::Close