Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
4.0 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: D3DEnum.h
  3. //
  4. // Desc: Functions to enumerate DDraw/D3D drivers, devices, and modes.
  5. //
  6. // Copyright (c) 1997-1999 Microsoft Corporation. All rights reserved
  7. //-----------------------------------------------------------------------------
  8. #ifndef D3DENUM_H
  9. #define D3DENUM_H
  10. #define D3D_OVERLOADS
  11. #include <d3d.h>
  12. //-----------------------------------------------------------------------------
  13. // Flag and error definitions
  14. //-----------------------------------------------------------------------------
  15. #define D3DENUM_SOFTWAREONLY 0x00000001 // Software-devices only flag
  16. #define D3DENUMERR_NODIRECTDRAW 0x81000001 // Could not create DDraw
  17. #define D3DENUMERR_ENUMERATIONFAILED 0x81000002 // Enumeration failed
  18. #define D3DENUMERR_SUGGESTREFRAST 0x81000003 // Suggest using the RefRast
  19. #define D3DENUMERR_NOCOMPATIBLEDEVICES 0x81000004 // No devices were found that
  20. // meet the app's desired
  21. // capabilities
  22. //-----------------------------------------------------------------------------
  23. // Name: struct D3DEnum_DeviceInfo
  24. // Desc: Structure to hold info about the enumerated Direct3D devices.
  25. //-----------------------------------------------------------------------------
  26. struct D3DEnum_DeviceInfo
  27. {
  28. // D3D Device info
  29. TCHAR strDesc[40];
  30. GUID* pDeviceGUID;
  31. D3DDEVICEDESC7 ddDeviceDesc;
  32. BOOL bHardware;
  33. // DDraw Driver info
  34. GUID* pDriverGUID;
  35. DDCAPS ddDriverCaps;
  36. DDCAPS ddHELCaps;
  37. // DDraw Mode Info
  38. DDSURFACEDESC2 ddsdFullscreenMode;
  39. BOOL bWindowed;
  40. BOOL bStereo;
  41. // For internal use (apps should not need to use these)
  42. GUID guidDevice;
  43. GUID guidDriver;
  44. DDSURFACEDESC2* pddsdModes;
  45. DWORD dwNumModes;
  46. DWORD dwCurrentMode;
  47. BOOL bDesktopCompatible;
  48. BOOL bStereoCompatible;
  49. };
  50. // For code not yet switched to new struct name
  51. typedef D3DEnum_DeviceInfo D3DDEVICEINFO;
  52. //-----------------------------------------------------------------------------
  53. // Name: D3DEnum_EnumerateDevices()
  54. // Desc: Enumerates all drivers, devices, and modes. The callback function is
  55. // called each device, to confirm that the device supports the feature
  56. // set required by the app.
  57. //-----------------------------------------------------------------------------
  58. HRESULT D3DEnum_EnumerateDevices(HRESULT (*fn)(DDCAPS*, D3DDEVICEDESC7*));
  59. //-----------------------------------------------------------------------------
  60. // Name: D3DEnum_FreeResources()
  61. // Desc: Cleans up any memory allocated during device enumeration
  62. //-----------------------------------------------------------------------------
  63. VOID D3DEnum_FreeResources();
  64. //-----------------------------------------------------------------------------
  65. // Name: D3DEnum_GetDevices()
  66. // Desc: Returns a ptr to the array of enumerated D3DDEVICEINFO structures.
  67. //-----------------------------------------------------------------------------
  68. VOID D3DEnum_GetDevices(D3DEnum_DeviceInfo** ppDevices, DWORD* pdwCount);
  69. //-----------------------------------------------------------------------------
  70. // Name: D3DEnum_SelectDefaultDevice()
  71. // Desc: Picks a driver based on a set of passed in criteria. The
  72. // D3DENUM_SOFTWAREONLY flag can be used to pick a software device.
  73. //-----------------------------------------------------------------------------
  74. HRESULT D3DEnum_SelectDefaultDevice(D3DEnum_DeviceInfo** pDevice,
  75. DWORD dwFlags = 0L);
  76. //-----------------------------------------------------------------------------
  77. // Name: D3DEnum_UserChangeDevice()
  78. // Desc: Pops up a dialog which allows the user to select a new device.
  79. //-----------------------------------------------------------------------------
  80. HRESULT D3DEnum_UserChangeDevice(D3DEnum_DeviceInfo** ppDevice);
  81. #endif // D3DENUM_H