Skip to content

Latest commit

 

History

History
110 lines (78 loc) · 5.4 KB

nf-d3dcompiler-d3dcompilefromfile.md

File metadata and controls

110 lines (78 loc) · 5.4 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:d3dcompiler.D3DCompileFromFile
D3DCompileFromFile function (d3dcompiler.h)
Compiles Microsoft High Level Shader Language (HLSL) code into bytecode for a given target. (D3DCompileFromFile)
D3DCompileFromFile
D3DCompileFromFile function [HLSL]
d3dcompiler/D3DCompileFromFile
direct3dhlsl.d3dcompilefromfile
direct3dhlsl\d3dcompilefromfile.htm
direct3dhlsl
09F1DB4F-C279-4E25-8A1C-34272EB62C07
12/05/2018
D3DCompileFromFile, D3DCompileFromFile function [HLSL], d3dcompiler/D3DCompileFromFile, direct3dhlsl.d3dcompilefromfile
d3dcompiler.h
Windows
D3DCompiler.lib
D3DCompiler_47.dll
Windows
19H1
D3DCompileFromFile
d3dcompiler/D3DCompileFromFile
c++
APIRef
kbSyntax
DllExport
D3DCompiler_47.dll
D3DCompileFromFile

D3DCompileFromFile function

-description

Note  You can use this API to develop your Windows Store apps, but you can't use it in apps that you submit to the Windows Store. Refer to the section, "Compiling shaders for UWP", in the remarks for D3DCompile2.
 
Compiles Microsoft High Level Shader Language (HLSL) code into bytecode for a given target.

-parameters

-param pFileName [in]

A pointer to a constant null-terminated string that contains the name of the file that contains the shader code.

-param pDefines [in, optional]

An optional array of D3D_SHADER_MACRO structures that define shader macros. Each macro definition contains a name and a null-terminated definition. If not used, set to NULL. The last structure in the array serves as a terminator and must have all members set to NULL.

-param pInclude [in, optional]

An optional pointer to an ID3DInclude interface that the compiler uses to handle include files. If you set this parameter to NULL and the shader contains a #include, a compile error occurs. You can pass the D3D_COMPILE_STANDARD_FILE_INCLUDE macro, which is a pointer to a default include handler. This default include handler includes files that are relative to the current directory.

#define D3D_COMPILE_STANDARD_FILE_INCLUDE ((ID3DInclude*)(UINT_PTR)1)

-param pEntrypoint [in]

A pointer to a constant null-terminated string that contains the name of the shader entry point function where shader execution begins. When you compile an effect, D3DCompileFromFile ignores pEntrypoint; we recommend that you set pEntrypoint to NULL because it is good programming practice to set a pointer parameter to NULL if the called function will not use it.

-param pTarget [in]

A pointer to a constant null-terminated string that specifies the shader target or set of shader features to compile against. The shader target can be a shader model (for example, shader model 2, shader model 3, shader model 4, or shader model 5 and later). The target can also be an effect type (for example, fx_4_1). For info about the targets that various profiles support, see Specifying Compiler Targets.

-param Flags1 [in]

A combination of shader compile options that are combined by using a bitwise OR operation. The resulting value specifies how the compiler compiles the HLSL code.

-param Flags2 [in]

A combination of effect compile options that are combined by using a bitwise OR operation. The resulting value specifies how the compiler compiles the effect. When you compile a shader and not an effect file, D3DCompileFromFile 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.

-param ppCode [out]

A pointer to a variable that receives a pointer to the ID3DBlob interface that you can use to access the compiled code.

-param ppErrorMsgs [out, optional]

An optional pointer to a variable that receives a pointer to the ID3DBlob interface that you can use to access compiler error messages, or NULL if there are no errors.

-returns

Returns one of the Direct3D 11 return codes.

-remarks

Note  The D3dcompiler_44.dll or later version of the file contains the D3DCompileFromFile compiler function.
 

-see-also

Functions