Microsoft DirectX 8.1 (C++)

Working with DirectX7 D3D Render Targets

This topic applies to Windows XP Home Edition and Windows XP Professional only.

Five new media subtypes have been defined for use with the VMR. When an upstream filter proposes a connection with one of these subtypes, it indicates to the VMR that the rendering is to be performed on a DirectX 7 D3D render target. If the VMR is in mixing mode, the surface will also be a D3D texture surface. If the VMR is not in mixing mode, the surface will be a regular D3D surface. The ARGB pixel formats are only supported when the VMR is in mixing mode. The new subtypes are:

These new types are defined in uuids.h along with the other DirectShow media subtypes. MEDIASUBTYPE_RGB32_D3D_DX7_RT is an RGBx888 format and MEDIASUBTYPE_RGB16_D3D_DX7_RT is an RGB565 format. For more information on these pixel formats, see the DirectX D3D documentation.

Requesting an Unlocked Surface

Locking and unlocking DirectDraw surfaces are computationally expensive operations. When using the D3D render target media subtypes, the upstream filter needs the surfaces to be unlocked so that it can operate on them with the graphics hardware. To avoid an unnecessary locking-unlocking operation, the VMR supports a new flag on the IMemAllocator::GetBuffer method, AM_GBF_NODDRAWSURFACELOCK, that instructs the VMR not to lock the DirectDraw surface before passing a sample to the upstream filter. When this flag is used, calls to IMediaSample::GetPointer will fail because there is no locked pointer. To obtain access to the DirectDraw surface, the filter must call QueryInterface on the returned IMediaSample object and request the IVMRSurface interface. Obviously, the upstream filter must ensure that the surface is not locked when it releases the sample back to the free list.