Export (0) Print
Expand All

Working with Direct3D Render Targets

Several media subtypes for Direct3D render targets are defined for use with the VMR-7 and the VMR-9. 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 Direct3D render target. For VMR-7, this will be a DirectX 7 Direct3D render target, and for VMR-9 this will be a DirectX 9 Direct3D render target. If the VMR is in mixing mode, the surface will also be a Direct3D texture surface. If the VMR is not in mixing mode, the surface will be a regular Direct3D surface. The ARGB pixel formats are only supported when the VMR is in mixing mode. The render target subtypes are:

VMR-7 VMR-9
MEDIASUBTYPE_RGB32_D3D_DX7_RTMEDIASUBTYPE_RGB32_D3D_DX9_RT
MEDIASUBTYPE_RGB16_D3D_DX7_RTMEDIASUBTYPE_RGB16_D3D_DX9_RT
MEDIASUBTYPE_ARGB32_D3D_DX7_RTMEDIASUBTYPE_ARGB32_D3D_DX9_RT
MEDIASUBTYPE_ARGB4444_D3D_DX7_RTMEDIASUBTYPE_ARGB4444_D3D_DX9_RT
MEDIASUBTYPE_ARGB1555_D3D_DX7_RTMEDIASUBTYPE_ARGB1555_D3D_DX9_RT

 

These types are defined in the header file uuids.h. The MEDIASUBTYPE_RGB32 media types are an RGBx888 format and MEDIASUBTYPE_RGB16 media types are an RGB565 format. For more information on these pixel formats, see the DirectX Graphics documentation.

Requesting an Unlocked Surface

Locking and unlocking DirectDraw surfaces are computationally expensive operations. When using the Direct3D 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_NODDSURFACELOCK, 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.

 

 

Community Additions

ADD
Show:
© 2014 Microsoft