IDirect3DDevice9::CreateVertexShader method (d3d9.h)

Creates a vertex shader.


HRESULT CreateVertexShader(
  [in]          const DWORD            *pFunction,
  [out, retval] IDirect3DVertexShader9 **ppShader


[in] pFunction

Type: const DWORD*

Pointer to an array of tokens that represents the vertex shader, including any embedded debug and symbol table information.

[out, retval] ppShader

Type: IDirect3DVertexShader9**

Pointer to the returned vertex shader interface (see IDirect3DVertexShader9).

Return value


If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY.


When a device is created, IDirect3D9::CreateDevice uses the behavior flag to determine whether to process vertices in hardware or software. There are three possibilities:

  • Process vertices in hardware by setting D3DCREATE_HARDWARE_VERTEXPROCESSING.
  • Process vertices in software by setting D3DCREATE_SOFTWARE_VERTEXPROCESSING.
  • Process vertices in either hardware or software by setting D3DCREATE_MIXED_VERTEXPROCESSING. To switch a mixed-mode device between software and hardware processing, use IDirect3DDevice9::SetSoftwareVertexProcessing.
For an example using D3DXCompileShader, see HLSLwithoutEffects Sample.


Target Platform Windows
Header d3d9.h (include D3D9.h)
Library D3D9.lib

See also