HOWTO: Enumerate the MMX Driver

ID: Q175334


The information in this article applies to:
  • Microsoft DirectX Software Development Kit, version 5.0


SUMMARY

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.


MORE INFORMATION

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.
       lpDD->Release();
       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.


REFERENCES

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 KbDirectX500 kbSDKWin32 kbfaq
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: January 21, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.