IDirectXVideoAccelerationService::CreateSurface method (dxva2api.h)

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

Syntax

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
);

Parameters

[in] Width

The width of the surface, in pixels.

[in] Height

The height of the surface, in pixels.

[in] BackBuffers

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

[in] Format

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

[in] Pool

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.

[in] Usage

Reserved. Set this value to zero.

[in] DxvaType

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

Value Meaning
DXVA2_VideoDecoderRenderTarget
Video decoder render target.
DXVA2_VideoProcessorRenderTarget
Video processor render target. Used for IDirectXVideoProcessor::VideoProcessBlt operations.
DXVA2_VideoSoftwareRenderTarget
Software render target. This surface type is for use with software DXVA devices.

[out] ppSurface

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.

[in, out] pSharedHandle

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 code Description
S_OK
The method succeeded.
D3DERR_INVALIDCALL
Invalid parameter
E_FAIL
The DirectX Video Acceleration Manager is not initialized.
E_POINTER
NULL pointer argument.

Remarks

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

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header dxva2api.h

See also

DirectX Video Acceleration 2.0

IDirectXVideoAccelerationService