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.

112 lines
4.3 KiB

  1. #ifndef _D3DHALEX_H
  2. #define _D3DHALEX_H
  3. //-----------------------------------------------------------------------------
  4. //
  5. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  6. //
  7. // File: d3dhalex.h
  8. // Content: Direct3D HAL Extensions and Helpers include file
  9. // This file contains definitions and macros which although not
  10. // essential for building a driver are useful helpers and
  11. // utilities.
  12. //
  13. //-----------------------------------------------------------------------------
  14. //-----------------------------------------------------------------------------
  15. //
  16. // Macros to help with handling the new GetDriverInfo2 mechanism. The following
  17. // macros assist with handling the GetDriverInfo2 sub-call of GetDriverInfo.
  18. // Two of the macros are simplified ways of differentiating between
  19. // GetDriverInfo2 calls and DDStereoMode calls. The others are simplified ways
  20. // of getting the data structures associated with those two calls.
  21. //
  22. // The following code fragment demonstrates how to handle GetDriverInfo2 using
  23. // these macros. Compare this with the code fragment in d3dhal.h
  24. //
  25. // D3DCAPS8 myD3DCaps8;
  26. //
  27. // DWORD CALLBACK
  28. // DdGetDriverInfo(LPDDHAL_GETDRIVERINFODATA lpData)
  29. // {
  30. // if (MATCH_GUID((lpData->guidInfo), GUID_GetDriverInfo2) )
  31. // {
  32. // ASSERT(NULL != lpData);
  33. // ASSERT(NULL != lpData->lpvData);
  34. //
  35. // // Is this a call to GetDriverInfo2 or DDStereoMode?
  36. // if (D3DGDI_IS_GDI2(lpData))
  37. // {
  38. // // Yes, its a call to GetDriverInfo2, fetch the
  39. // // DD_GETDRIVERINFO2DATA data structure.
  40. // DD_GETDRIVERINFO2DATA* pgdi2 = D3DGDI_GET_GDI2_DATA(lpData);
  41. // ASSERT(NULL != pgdi2);
  42. //
  43. // // What type of request is this?
  44. // switch (pgdi2->dwType)
  45. // {
  46. // case D3DGDI2_TYPE_GETD3DCAPS8:
  47. // {
  48. // // The runtime is requesting the DX8 D3D caps so
  49. // // copy them over now.
  50. //
  51. // // It should be noted that the dwExpectedSize field
  52. // // of DD_GETDRIVERINFODATA is not used for
  53. // // GetDriverInfo2 calls and should be ignored.
  54. // size_t copySize = min(sizeof(myD3DCaps8), pgdi2->dwExpectedSize);
  55. // memcpy(lpData->lpvData, &myD3DCaps8, copySize);
  56. // lpData->dwActualSize = copySize;
  57. // lpData->ddRVal = DD_OK;
  58. // return DDHAL_DRIVER_HANDLED;
  59. // }
  60. // default:
  61. // // For any other GetDriverInfo2 types not handled
  62. // // or understood by the driver set an ddRVal of
  63. // // DDERR_CURRENTLYNOTAVAIL and return
  64. // // DDHAL_DRIVER_HANDLED.
  65. // return DDHAL_DRIVER_HANDLED;
  66. // }
  67. // }
  68. // else
  69. // {
  70. // // It must be a call a request for stereo mode support.
  71. // // Fetch the stereo mode data
  72. // DD_STEREOMODE* pStereoMode = D3DGDI_GET_STEREOMODE_DATA(pData);
  73. // ASSERT(NULL != pStereoMode);
  74. //
  75. // // Process the stereo mode request...
  76. // lpData->dwActualSize = sizeof(DD_STEREOMODE);
  77. // lpData->ddRVal = DD_OK;
  78. // return DDHAL_DRIVER_HANDLED;
  79. // }
  80. // }
  81. //
  82. // // Handle any other device GUIDs...
  83. //
  84. // } // DdGetDriverInfo
  85. //
  86. //-----------------------------------------------------------------------------
  87. //
  88. // Macros to determine what type of call a call to GetDriverInfo with the
  89. // GUID GUID_GetDriverInfo2/GUID_DDStereoMode. A GetDriverInfo2 call or
  90. // a DDStereoMode call.
  91. //
  92. #define D3DGDI_IS_GDI2(pData) \
  93. ((((DD_GETDRIVERINFO2DATA*)(pData->lpvData))->dwMagic) == D3DGDI2_MAGIC)
  94. #define D3DGDI_IS_STEREOMODE(pData) \
  95. ((((DD_STEREOMODE*) (pData->lpvData))->dwHeight) != D3DGDI2_MAGIC)
  96. //
  97. // Macros to return the appropriate GetDriverInfo data structure for a
  98. // call to GetDriverInfo with the GUID GUID_GetDriverInfo2/GUID_DDStereoMode.
  99. //
  100. #define D3DGDI_GET_GDI2_DATA(pData) \
  101. (D3DGDI_IS_GDI2(pData) ? (((DD_GETDRIVERINFO2DATA*)(pData->lpvData))) : NULL)
  102. #define D3DGDI_GET_STEREOMODE_DATA(pData) \
  103. (D3DGDI_IS_STEREOMODE(pData) ? (((DD_STEREOMODE*)(pData->lpvData))) : NULL)
  104. #endif /* _D3DHALEX_H */