Leaked source code of windows server 2003
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.

167 lines
7.4 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ddithunk.h
  6. * Content: header file used by the NT DDI thunk layer
  7. * History:
  8. * Date By Reason
  9. * ==== == ======
  10. * 03-Dec-99 smac Created it
  11. *
  12. ***************************************************************************/
  13. #ifndef __DDITHUNK_INCLUDED__
  14. #define __DDITHUNK_INCLUDED__
  15. // Entire file should not be used in Win9x builds
  16. #ifndef WIN95
  17. #define MAX_ZSTENCIL_FORMATS 40
  18. typedef struct _DDSURFHANDLE *PDDSURFHANDLE;
  19. typedef struct _DEFERREDCREATE *PDEFERREDCREATE;
  20. typedef struct _D3DCONTEXTHANDLE
  21. {
  22. HANDLE dwhContext;
  23. DWORD dwFlags;
  24. struct _DDDEVICEHANDLE* pDevice;
  25. DWORD dwPID;
  26. HANDLE hDeferHandle;
  27. struct _DDSURFHANDLE* pSurface;
  28. struct _DDSURFHANDLE* pDDSZ;
  29. } D3DCONTEXTHANDLE, * PD3DCONTEXTHANDLE;
  30. #define D3DCONTEXT_DEFERCREATE 0x00000001
  31. typedef struct _DDDEVICEHANDLE
  32. {
  33. HANDLE hDD;
  34. DWLIST SurfaceHandleList;
  35. char szDeviceName[MAX_DRIVER_NAME];
  36. LPDDRAWI_DIRECTDRAW_LCL pDD; // Used by Refrast and RGB HEL
  37. BOOL bDeviceLost;
  38. UINT DisplayUniqueness;
  39. PDDSURFHANDLE pSurfList;
  40. PD3DCONTEXTHANDLE pContext;
  41. D3DFORMAT DisplayFormatWithoutAlpha;
  42. D3DFORMAT DisplayFormatWithAlpha;
  43. UINT DisplayPitch;
  44. DWORD DriverLevel;
  45. RECT rcMonitor;
  46. HWND hLastWnd;
  47. LPRGNDATA pClipList; //result from pOrigClipList
  48. LPRGNDATA pOrigClipList; //ClipList before ClipRgnToRect
  49. VOID* pSwInitFunction;
  50. BOOL bIsWhistler;
  51. DWORD PCIID;
  52. DWORD DriverVersionHigh;
  53. DWORD DriverVersionLow;
  54. DWORD ForceFlagsOff;
  55. DWORD ForceFlagsOn;
  56. DWORD dwFlags;
  57. DWORD DDCaps;
  58. DWORD SVBCaps;
  59. HANDLE hLibrary;
  60. PDEFERREDCREATE pDeferList;
  61. D3DDEVTYPE DeviceType;
  62. } DDDEVICEHANDLE, * PDDDEVICEHANDLE;
  63. #define DDDEVICE_SUPPORTD3DBUF 0x01 //this device has D3DBuf callbacks
  64. #define DDDEVICE_DP2ERROR 0x02 //A DP2 call failed
  65. #define DDDEVICE_SUPPORTSUBVOLUMELOCK 0x04 //this device supports sub-volume texture lock
  66. #define DDDEVICE_READY 0x08 //All vidmem surfs have been destroyed for this device
  67. #define DDDEVICE_GETDRIVERINFO2 0x10 // Driver support the GetDriverInfo2 call
  68. #define DDDEVICE_INITIALIZED 0x20 // The device has been initialized
  69. #define DDHANDLE(x) \
  70. (((PDDDEVICEHANDLE)(x))->hDD)
  71. typedef struct _DDSURFHANDLE
  72. {
  73. // NOTE: dwCookie must be the first element
  74. // since we need easy access to it from the
  75. // client and the thunk layer itself.
  76. DWORD dwCookie; // CreateSurfaceEx handle
  77. HANDLE hSurface; // Kernel mode surface handle
  78. D3DPOOL Pool; // Location of surface
  79. D3DFORMAT Format;
  80. D3DRESOURCETYPE Type; // What kind of surface it is
  81. ULONG_PTR fpVidMem;
  82. DWORD dwLinearSize;
  83. LONG lPitch;
  84. LPDDRAWI_DDRAWSURFACE_LCL pLcl;
  85. PDDDEVICEHANDLE pDevice;
  86. DWORD dwFlags;
  87. DWORD dwHeight;
  88. LONG lSlicePitch; // Offset to next slice for volume texture
  89. struct _DDSURFHANDLE* pNext;
  90. struct _DDSURFHANDLE* pPrevious;
  91. UINT LockRefCnt;
  92. } DDSURFHANDLE, * PDDSURFHANDLE;
  93. typedef struct _DEFERREDCREATE
  94. {
  95. D3D8_CREATESURFACEDATA CreateData;
  96. struct _DEFERREDCREATE *pNext;
  97. } DEFERREDCREATE, *PDEFERREDCREATE;
  98. #define DDSURF_SYSMEMALLOCATED 0x00000001
  99. #define DDSURF_DEFERCREATEEX 0x00000002
  100. #define DDSURF_HAL 0x00000004
  101. #define DDSURF_SOFTWARE 0x00000008
  102. #define DDSURF_CREATECOMPLETE 0x00000010
  103. #define DDSURF_TREATASVIDMEM 0x00000020 // Flag to indicate that surf should
  104. // be treated as vid-mem for the
  105. // "do vid-mem surfaces exist" case
  106. #define IS_SOFTWARE_DRIVER(x) \
  107. (((PDDDEVICEHANDLE)(x))->pDD != NULL)
  108. #define IS_SOFTWARE_DRIVER_SURFACE(x) \
  109. (((PDDSURFHANDLE)(x))->dwFlags & DDSURF_SOFTWARE)
  110. #define IS_SURFACE_LOOSABLE(x) \
  111. (!IS_SOFTWARE_DRIVER_SURFACE(x) && \
  112. ((((PDDSURFHANDLE)(x))->Pool == D3DPOOL_LOCALVIDMEM) || \
  113. (((PDDSURFHANDLE)(x))->Pool == D3DPOOL_NONLOCALVIDMEM)))
  114. __inline HANDLE GetSurfHandle(HANDLE hSurface)
  115. {
  116. if(hSurface)
  117. {
  118. return(((PDDSURFHANDLE)hSurface)->hSurface);
  119. }
  120. return NULL;
  121. }
  122. __inline D3DRESOURCETYPE GetSurfType(HANDLE hSurface)
  123. {
  124. if(hSurface)
  125. {
  126. return(((PDDSURFHANDLE)hSurface)->Type);
  127. }
  128. return (D3DRESOURCETYPE) 0;
  129. }
  130. // Function protoptypes
  131. extern LPDDRAWI_DIRECTDRAW_LCL SwDDICreateDirectDraw( void);
  132. extern void ConvertToOldFormat(LPDDPIXELFORMAT pOldFormat, D3DFORMAT NewFormat);
  133. extern void SwDDIMungeCaps (HINSTANCE hLibrary, HANDLE hDD, PD3D8_DRIVERCAPS pDriverCaps, PD3D8_CALLBACKS pCallbacks, LPDDSURFACEDESC, UINT*, VOID* pSwInitFunction);
  134. extern LPDDRAWI_DDRAWSURFACE_LCL SwDDIBuildHeavyWeightSurface (LPDDRAWI_DIRECTDRAW_LCL, PD3D8_CREATESURFACEDATA pCreateSurface, DD_SURFACE_LOCAL* pSurfaceLocal, DD_SURFACE_GLOBAL* pSurfaceGlobal, DD_SURFACE_MORE* pSurfaceMore, DWORD index);
  135. extern void SwDDICreateSurfaceEx(LPDDRAWI_DIRECTDRAW_LCL pDrv, LPDDRAWI_DDRAWSURFACE_LCL pLcl);
  136. extern void SwDDIAttachSurfaces (LPDDRAWI_DDRAWSURFACE_LCL pFrom, LPDDRAWI_DDRAWSURFACE_LCL pTo);
  137. extern HRESULT SwDDICreateSurface( PD3D8_CREATESURFACEDATA pCreateSurface, DD_SURFACE_LOCAL* pDDSurfaceLocal, DD_SURFACE_GLOBAL* pDDSurfaceGlobal, DD_SURFACE_MORE* pDDSurfaceMore);
  138. extern void AddUnknownZFormats( UINT NumFormats, DDPIXELFORMAT* pFormats, UINT* pNumUnknownFormats, D3DFORMAT* pUnknownFormats);
  139. extern DWORD SwDDILock( HANDLE hDD, PDDSURFHANDLE pSurf, DD_LOCKDATA* pLockData);
  140. extern DWORD SwDDIUnlock( HANDLE hDD, PDDSURFHANDLE pSurf, DD_UNLOCKDATA* pUnlockData);
  141. extern DWORD SwDDIDestroySurface( HANDLE hDD, PDDSURFHANDLE pSurf);
  142. extern HRESULT MapLegacyResult(HRESULT hr);
  143. #endif // !WIN95
  144. #endif // __DDITHUNK_INCLUDED__