Microsoft KB Archive/175334

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:30, 21 July 2020 by X010 (talk | contribs) (Text replacement - "&" to "&")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

HOWTO: Enumerate the MMX Driver


The information in this article applies to:

  • Microsoft DirectX Software Development Kit, version 5.0
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Professional


DirectX version 5.0 and later includes support for processors that support MMX technology. MMX devices are enumerated only by IDirect3D2::EnumDevices(). The MMX device will not be enumerated by IDirect3D::EnumDevices(). You must use the IDirect3D2 interface to enumerate the Direct3D MMX emulation driver.


DirectX version 5.0 includes both the IDirect3D and the IDirect3D2 interfaces. Applications use the methods of the IDirect3D and IDirect3D2 interfaces to create Direct3D objects and set up the environment. The IDirect3D2 interface is obtained by calling the QueryInterface() method from a DirectDraw object. You must enumerate all DirectDraw objects on the system and enumerate all Direct3D objects off of every DirectDraw object in order to obtain all possible Direct3D objects.

DirectX 5.0 applications can enumerate the MMX driver on MMX systems with IDirect3D2::EnumDevices() as follows:

   LPDIRECT3D2 lpD3D2;

   // Query the IDirect3D2 interface off of the desired DirectDraw object
   rval = lpDD->QueryInterface(IID_IDirect3D2, (void**) &lpD3D2);
   if (rval != DD_OK) {
       // Creation of the IDirect3D2 interface failed.
       return FALSE;
    * Enumerate the drivers.
   rval = lpD3D2->EnumDevices(enumDeviceFunc, &NumDriver);
   if (rval != DD_OK) {
       // Enumeration of drivers failed.
       return FALSE;

Now, in the enumDeviceFunc callback function, you can check for the MMX Emulation driver with the following code:

   static HRESULT
   WINAPI enumDeviceFunc(LPGUID lpGuid, LPSTR lpDeviceDescription,

                      LPSTR lpDeviceName, LPD3DDEVICEDESC lpHWDesc,
                      LPD3DDEVICEDESC lpHELDesc, LPVOID lpContext)


      if (!memcmp(lpGuid, &IID_IDirect3DMMXDevice, sizeof(GUID))) {
           // The MMX driver is being enumerated.  Record "lpGuid" for
           // later use if desired.
           return D3DENUMRET_OK;
      .  .  .
      .  .  .
      .  .  . 

The major difference between the IDirect3D2 and the IDirect3D interface is the addition of the CreateDevice method. This method creates a Direct3D device to be used with the DrawPrimitive methods. To use execute buffers with an MMX device, you can call the IDirect3D2::CreateDevice method to create an MMX IDirect3DDevice2 interface and then use the QueryInterface() method to create an IDirect3DDevice interface from IDirect3DDevice2.


For additional information about source code on properly enumerating Direct3D devices, please see the following article in the Microsoft Knowledge Base:

Q172947 SAMPLE: Rendering a Triangle with the Direct3D Immediate Mode

Additional query words:

Keywords : kbDirect3dIM KbDirectX kbSDKWin32 kbFAQ _IK
Issue type : kbhowto
Technology : kbwin2000AdvServ kbwin2000AdvServSearch kbwin2000Serv kbwin2000ServSearch kbwin2000Search kbwin2000ProSearch kbwin2000Pro kbSDKDirectXsearch kbAudDeveloper kbWinAdvServSearch kbSDKDirectX500

Last Reviewed: June 26, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.