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.

272 lines
7.0 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * ***************
  4. * * SAMPLE CODE *
  5. * ***************
  6. *
  7. * Module Name: debug.h
  8. *
  9. * Debugging support interfaces.
  10. *
  11. * Copyright (c) 1994-1998 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-1999 Microsoft Corporation. All rights reserved.
  13. \*****************************************************************************/
  14. extern
  15. VOID
  16. DebugPrint(
  17. LONG DebugPrintLevel,
  18. PCHAR DebugMessage,
  19. ...
  20. );
  21. #if DBG
  22. // In order to enable per component debugging, DebugFilter will
  23. // contain the bit pattern that will turn on messages for them.
  24. // Debug messages with a debuglevel of 0 will be printed regardless
  25. // of the filter in effect.The DWORD in which the DebugFilter is
  26. // stored and the patterns of the filter masks will allow up to
  27. // 4 separate components to be tracked, each one with 8 separate
  28. // subcomponents.
  29. // Note: During the transition phase to this new functionality, a
  30. // filter of 0 will print ALL messages, but will later be switched
  31. // to print NONE (expect of course , those at level 0)
  32. extern DWORD DebugFilter;
  33. extern DWORD DebugPrintFilter;
  34. #define DEBUG_FILTER_D3D 0x000000FF
  35. #define DEBUG_FILTER_DD 0x0000FF00
  36. #define DEBUG_FILTER_GDI 0x00FF0000
  37. #define MINOR_DEBUG
  38. #define DISPDBG(arg) DebugPrint arg
  39. #define DBG_COMPONENT(arg, component) \
  40. { DebugPrintFilter = component; \
  41. DebugPrint arg ; \
  42. DebugPrintFilter = 0; \
  43. }
  44. #define DBG_D3D(arg) DBG_COMPONENT(arg,DEBUG_FILTER_D3D)
  45. #define DBG_DD(arg) DBG_COMPONENT(arg,DEBUG_FILTER_DD)
  46. #define DBG_GDI(arg) DBG_COMPONENT(arg,DEBUG_FILTER_GDI)
  47. #define RIP(x) { DebugPrint(-1000, x); DebugBreak();}
  48. #define ASSERTDD(x, y) if (!(x)) RIP (y)
  49. extern VOID __cdecl DebugMsg(PCHAR DebugMessage, ...);
  50. extern void DumpSurface(LONG Level, LPDDRAWI_DDRAWSURFACE_LCL lpDDSurface, LPDDSURFACEDESC lpDDSurfaceDesc);
  51. extern void DecodeBlend(LONG Level, DWORD i );
  52. #define DUMPSURFACE(a, b, c) DumpSurface(a, b, c);
  53. #define DECODEBLEND(a, b) DecodeBlend(a, b);
  54. #define PRINTALLP2REGISTER PrintAllP2Registers
  55. #define PRINTDIFFP2REGISTER PrintDifferentP2Registers
  56. #define SAVEALLP2REGISTER SaveAllP2Registers
  57. VOID PrintAllP2Registers( ULONG ulDebugLevel, PPDev ppdev);
  58. VOID SaveAllP2Registers( PPDev ppdev);
  59. VOID PrintDifferentP2Registers(ULONG ulDebugLevel, PPDev ppdev);
  60. #if TRACKMEMALLOC
  61. //------------------------------------------------------------------------------
  62. //
  63. // Memory Tracker
  64. //
  65. //------------------------------------------------------------------------------
  66. VOID MemTrackerAddInstance();
  67. VOID MemTrackerRemInstance();
  68. PVOID MemTrackerAllocateMem(PVOID p,
  69. LONG lSize,
  70. PCHAR pModule,
  71. LONG lLineNo,
  72. BOOL bStopWhenFreed);
  73. VOID MemTrackerFreeMem( VOID *p);
  74. VOID MemTrackerDebugChk();
  75. #define MEMTRACKERADDINSTANCE MemTrackerAddInstance
  76. #define MEMTRACKERREMINSTANCE MemTrackerRemInstance
  77. #define MEMTRACKERALLOCATEMEM MemTrackerAllocateMem
  78. #define MEMTRACKERFREEMEM MemTrackerFreeMem
  79. #define MEMTRACKERDEBUGCHK MemTrackerDebugChk
  80. #else
  81. #define MEMTRACKERADDINSTANCE / ## /
  82. #define MEMTRACKERREMINSTANCE / ## /
  83. #define MEMTRACKERALLOCATEMEM / ## /
  84. #define MEMTRACKERFREEMEM / ## /
  85. #define MEMTRACKERDEBUGCHK / ## /
  86. #endif
  87. //------------------------------------------------------------------------------
  88. //
  89. // THUNK_LAYER
  90. //
  91. // By Setting THUNK_LAYER equal to 1 you are adding a wrapper call on top of
  92. // all DDI rendering functions. In this thunk layer of wrapper calls
  93. // several usefull debugging features are enabled.
  94. //
  95. // Surface checks--which can help catch errant rendering routines
  96. // Event logging---which can record rendering evernts to a log file
  97. //
  98. //------------------------------------------------------------------------------
  99. #define THUNK_LAYER 0
  100. #if THUNK_LAYER
  101. BOOL
  102. xDrvBitBlt(SURFOBJ* psoDst,
  103. SURFOBJ* psoSrc,
  104. SURFOBJ* psoMsk,
  105. CLIPOBJ* pco,
  106. XLATEOBJ* pxlo,
  107. RECTL* prclDst,
  108. POINTL* pptlSrc,
  109. POINTL* pptlMsk,
  110. BRUSHOBJ* pbo,
  111. POINTL* pptlBrush,
  112. ROP4 rop4);
  113. BOOL
  114. xDrvCopyBits(
  115. SURFOBJ* psoDst,
  116. SURFOBJ* psoSrc,
  117. CLIPOBJ* pco,
  118. XLATEOBJ* pxlo,
  119. RECTL* prclDst,
  120. POINTL* pptlSrc);
  121. BOOL
  122. xDrvTransparentBlt(
  123. SURFOBJ * psoDst,
  124. SURFOBJ * psoSrc,
  125. CLIPOBJ * pco,
  126. XLATEOBJ * pxlo,
  127. RECTL * prclDst,
  128. RECTL * prclSrc,
  129. ULONG iTransColor,
  130. ULONG ulReserved);
  131. BOOL xDrvAlphaBlend(
  132. SURFOBJ *psoDst,
  133. SURFOBJ *psoSrc,
  134. CLIPOBJ *pco,
  135. XLATEOBJ *pxlo,
  136. RECTL *prclDst,
  137. RECTL *prclSrc,
  138. BLENDOBJ *pBlendObj);
  139. BOOL
  140. xDrvGradientFill(
  141. SURFOBJ *psoDst,
  142. CLIPOBJ *pco,
  143. XLATEOBJ *pxlo,
  144. TRIVERTEX *pVertex,
  145. ULONG nVertex,
  146. PVOID pMesh,
  147. ULONG nMesh,
  148. RECTL *prclExtents,
  149. POINTL *pptlDitherOrg,
  150. ULONG ulMode
  151. );
  152. BOOL
  153. xDrvTextOut(SURFOBJ* pso,
  154. STROBJ* pstro,
  155. FONTOBJ* pfo,
  156. CLIPOBJ* pco,
  157. RECTL* prclExtra,
  158. RECTL* prclOpaque,
  159. BRUSHOBJ* pboFore,
  160. BRUSHOBJ* pboOpaque,
  161. POINTL* pptlBrush,
  162. MIX mix);
  163. BOOL
  164. xDrvFillPath(
  165. SURFOBJ* pso,
  166. PATHOBJ* ppo,
  167. CLIPOBJ* pco,
  168. BRUSHOBJ* pbo,
  169. POINTL* pptlBrush,
  170. MIX mix,
  171. FLONG flOptions);
  172. BOOL
  173. xDrvLineTo(
  174. SURFOBJ* pso,
  175. CLIPOBJ* pco,
  176. BRUSHOBJ* pbo,
  177. LONG x1,
  178. LONG y1,
  179. LONG x2,
  180. LONG y2,
  181. RECTL* prclBounds,
  182. MIX mix);
  183. BOOL
  184. xDrvStrokePath(
  185. SURFOBJ* pso,
  186. PATHOBJ* ppo,
  187. CLIPOBJ* pco,
  188. XFORMOBJ* pxo,
  189. BRUSHOBJ* pbo,
  190. POINTL* pptlBrush,
  191. LINEATTRS* pla,
  192. MIX mix);
  193. #endif
  194. #else
  195. #define DISPDBG(arg)
  196. #define DBG_D3D(arg)
  197. #define DBG_DD(arg)
  198. #define DBG_GDI(arg)
  199. #define RIP(x)
  200. #define ASSERTDD(x, y)
  201. #define DUMPSURFACE(a, b, c)
  202. #define DECODEBLEND(a, b)
  203. #define MEMTRACKERADDINSTANCE / ## /
  204. #define MEMTRACKERREMINSTANCE / ## /
  205. #define MEMTRACKERALLOCATEMEM / ## /
  206. #define MEMTRACKERFREEMEM / ## /
  207. #define MEMTRACKERDEBUGCHK / ## /
  208. #define PRINTALLP2REGISTER / ## /
  209. #define PRINTDIFFP2REGISTER / ## /
  210. #define SAVEALLP2REGISTER / ## /
  211. #endif
  212. #define DebugBreak EngDebugBreak
  213. #define MAKE_BITMAPS_OPAQUE 0
  214. //@@BEGIN_DDKSPLIT
  215. #if GDI_TEST
  216. //
  217. // GDI debug functions
  218. //
  219. void vPuntAfter(ULONG flags, SURFOBJ * psoSrc, SURFOBJ * psoDst);
  220. ULONG vPuntBefore(SURFOBJ * psoSrc, SURFOBJ * psoDst);
  221. #endif
  222. //@@END_DDKSPLIT