Skip to main content
MFCreateDXSurfaceBuffer function

Creates a media buffer object that manages a Direct3D 9 surface.


HRESULT MFCreateDXSurfaceBuffer(
  _In_   REFIID riid,
  _In_   IUnknown *punkSurface,
  _In_   BOOL fBottomUpWhenLinear,
  _Out_  IMFMediaBuffer **ppBuffer


riid [in]

Identifies the type of Direct3D 9 surface. Currently this value must be IID_IDirect3DSurface9.

punkSurface [in]

A pointer to the IUnknown interface of the DirectX surface.

fBottomUpWhenLinear [in]

If TRUE, the buffer's IMF2DBuffer::ContiguousCopyTo method copies the buffer into a bottom-up format. The bottom-up format is compatible with GDI for uncompressed RGB images. If this parameter is FALSE, the ContiguousCopyTo method copies the buffer into a top-down format, which is compatible with DirectX.

For more information about top-down versus bottom-up images, see Image Stride.

ppBuffer [out]

Receives a pointer to the IMFMediaBuffer interface. The caller must release the buffer.

Return value

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

Return codeDescription

The method succeeded.


Invalid argument.



This function creates a media buffer object that holds a pointer to the Direct3D surface specified in punkSurface. Locking the buffer gives the caller access to the surface memory. When the buffer object is destroyed, it releases the surface. For more information about media buffers, see Media Buffers.

Note  This function does not allocate the Direct3D surface itself.

The buffer object created by this function also exposes the IMF2DBuffer interface. For more information, see DirectX Surface Buffer.

This function does not support DXGI surfaces.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]







See also

DirectX Surface Buffer
Media Foundation Functions
Media Buffers