d3d9.dllCompileShader
Microsoft DirectX 9.0 SDK Update (October 2004)

ID3DXEffectCompiler::CompileShader Method


Compile a shader from an effect that contains one or more functions.

Syntax

HRESULT CompileShader(      

    D3DXHANDLE hFunction,     LPCSTR pTarget,     DWORD Flags,     LPD3DXBUFFER* ppShader,     LPD3DXBUFFER* ppErrorMsgs,     LPD3DXCONSTANTTABLE* ppConstantTable );

Parameters

hFunction
[in] Unique identifier to the function to be compiled. This value must not be NULL. See Handles.
pTarget
[in] Identifies the shader version. Use the D3DVS_VERSION macro to generate the encoded version number. See the remarks section for shader versions.
Flags
[in] Compile options. For more information, see D3DXSHADER Compile Options.
ppShader
[out, retval] Buffer containing the compiled shader. The compiler shader is an array of DWORDs. For more information about accessing the buffer, see ID3DXBuffer.
ppErrorMsgs
[out, retval] Buffer containing at least the first compile error message that occurred. This includes effect compiler errors and high-level language compile errors. For more information about accessing the buffer, see ID3DXBuffer.
ppConstantTable
[out] Returns an ID3DXConstantTable interface, which can be used to access shader constants. This value may be NULL.

Return Value

If the method succeeds, the return value is S_OK.

If the arguments are invalid, the method will return D3DERR_INVALIDCALL.

If the method fails, the return value will be E_FAIL.



Remarks

Targets can be specified for vertex shaders, pixel shaders, and texture fill functions.

Vertex shader targetsvs_1_1, vs_2_0, vs_2_sw, vs_3_0
Pixel shader targetsps_1_1, ps_1_2, ps_1_3, ps_1_4, ps_2_0, ps_2_sw, ps_3_0
Texture fill targetstx_0, tx_1

This method compiles a shader from a function that is written in a C-like language. For more information, see HLSL Shader Reference.

See Also

D3DXGetShaderConstantTable


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.