Game Development Reference
In-Depth Information
pSrcFile —Name of the text file that contains the shader source
code that we want to compile
pDefines —This parameter is optional, and we specify null for it
in this topic.
pInclude —Pointer to an ID3DXInclude interface. This inter-
face is designed to be implemented by the application so that we
can override default include behavior. In general, the default behav-
ior is fine and we can ignore this parameter by specifying null.
pFunctionName —A string specifying the name of the entry point
function. For example, if the shader's entry point function were
called Main , we would pass “Main” for this parameter.
pTarget —A string specifying the shader version to compile the
HLSL source code to. Valid vertex shader versions are: vs_1_1,
vs_2_0, vs_2_sw. Valid pixel shader versions are: ps_1_1, ps_1_2,
ps_1_3, ps_1_4, ps_2_0, ps_2_sw. For example, if we wanted to
compile our vertex shader to version 2.0, we would pass vs_2_0 for
this parameter.
Remark: The ability to compile to different shader versions is one of
the major benefits of using HLSL over assembly language. With HLSL
we can almost instantly port a shader to a different version by simply
recompiling to the desired target. Using assembly, we would have to
port the code by hand.
Flags —Optional compiling flags; specify 0 for no flags. Valid
options are:
D3DXSHADER_DEBUG —Instructs the compiler to write debug
information
D3DXSHADER_SKIPVALIDATION —Instructs the compiler not
to do any code validation. This should only be used when you
are using a shader that is known to work.
D3DXSHADER_SKIPOPTIMIZATION —Instructs the compiler
not to perform any code optimization. In practice this would
only be used in debugging, where you would not want the com-
piler to alter the code in any way.
ppShader —Returns a pointer to an ID3DXBuffer that contains
the compiled shader code. This compiled shader code is then used
as a parameter to another function to actually create the ver-
tex/pixel shader.
ppErrorMsgs —Returns a pointer to an ID3DXBuffer that con-
tains a string of error codes and messages
Search WWH ::




Custom Search