IDirectXVideoAccelerationService::CreateSurface method

Creates a DirectX Video Acceleration (DXVA) video processor or DXVA decoder render target.


HRESULT CreateSurface(
  [in]      UINT              Width,
  [in]      UINT              Height,
  [in]      UINT              BackBuffers,
  [in]      D3DFORMAT         Format,
  [in]      D3DPOOL           Pool,
  [in]      DWORD             Usage,
  [in]      DWORD             DxvaType,
  [out]     IDirect3DSurface9 **ppSurface,
  [in, out] HANDLE            *pSharedHandle


Width [in]

The width of the surface, in pixels.

Height [in]

The height of the surface, in pixels.

BackBuffers [in]

The number of back buffers. The method creates BackBuffers + 1 surfaces.

Format [in]

The pixel format, specified as a D3DFORMAT value or FOURCC code. For more information, see the Direct3D documentation.

Pool [in]

The memory pool in which to create the surface, specified as a D3DPOOL value. For more information, see the Direct3D documentation. Decoders should generally use the value D3DPOOL_DEFAULT.

Usage [in]

Reserved. Set this value to zero.

DxvaType [in]

The type of surface to create. Use one of the following values.


Video decoder render target.


Video processor render target. Used for IDirectXVideoProcessor::VideoProcessBlt operations.


Software render target. This surface type is for use with software DXVA devices.


ppSurface [out]

The address of an array of IDirect3DSurface9 pointers allocated by the caller. The size of the array must be 1 + BackBuffers (enough for the back buffers plus one front buffer). The method fills the array with IDirect3DSurface9 pointers. The caller must release all of the interface pointers. In addition, the front buffer holds a reference count on each of the back buffers. Therefore, the back buffers are never deleted until the front buffer is deleted.

pSharedHandle [in, out]

A pointer to a handle that is used to share the surfaces between Direct3D devices. Set this parameter to NULL.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codeDescription

The method succeeded.


Invalid parameter


The DirectX Video Acceleration Manager is not initialized.


NULL pointer argument.



If the method returns E_FAIL, try calling IDirect3DDeviceManager9::ResetDevice to reset the DirectX Video Acceleration Manager.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]



See also

DirectX Video Acceleration 2.0