ID3DXEffectCompiler::CompileShader
Compiles a shader from an effect that contains one or more functions.
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] Pointer to a shader profile which determines the shader instruction set. See D3DXGetVertexShaderProfile or D3DXGetPixelShaderProfile for a list of the profiles available.
- Flags
- [in] Compile options. For more information, see D3DXSHADER Flags.
- 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 Values
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 targets |
vs_1_1, vs_2_0, vs_2_sw, vs_3_0 |
Pixel shader targets |
ps_1_1, ps_1_2, ps_1_3, ps_1_4, ps_2_0, ps_2_sw, ps_3_0 |
Texture fill targets |
tx_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.
Requirements
Header: Declared in D3dx9effect.h.
See Also
D3DXGetShaderConstantTable