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.

312 lines
6.7 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: glexts.c
  3. *
  4. * This file is for debugging tools and extensions.
  5. *
  6. * Created: 17-Jan-95
  7. * Adapted from gdiexts
  8. * Author: Drew Bliss
  9. *
  10. * Copyright (c) 1995 Microsoft Corporation
  11. \**************************************************************************/
  12. #include "precomp.c"
  13. #pragma hdrstop
  14. char *gaszHelp[] =
  15. {
  16. "=======================================================================\n"
  17. ,"GLEXTS debugger extentions:\n"
  18. ,"-----------------------------------------------------------------------\n"
  19. ,"batch -- Print current message batching\n"
  20. ,"df ptr -- Dump a float\n"
  21. ,"dd ptr -- Dump a double\n"
  22. ,"dgc ptr -- Dump a __glContext\n"
  23. ,"dlrc ptr -- Dump an LRC\n"
  24. ,"gc -- Print current context\n"
  25. ,"cgc -- Print current context (client side only)\n"
  26. ,"sgc -- Print current context (server side only)\n"
  27. ,"help -- This message\n"
  28. ,"=======================================================================\n"
  29. ,NULL
  30. };
  31. /******************************Public*Routine******************************\
  32. *
  33. * help
  34. *
  35. * Print help
  36. *
  37. * History:
  38. * Tue Jan 17 14:11:21 1995 -by- Drew Bliss [drewb]
  39. * Created
  40. *
  41. \**************************************************************************/
  42. DBG_ENTRY(help)
  43. {
  44. char **ppsz = gaszHelp;
  45. while (*ppsz)
  46. {
  47. PRINT(*ppsz++);
  48. }
  49. }
  50. /******************************Public*Routine******************************\
  51. *
  52. * batch
  53. *
  54. * Print current message batching
  55. *
  56. * History:
  57. * Tue Jan 31 14:03:11 1995 -by- Drew Bliss [drewb]
  58. * Created
  59. *
  60. \**************************************************************************/
  61. DBG_ENTRY(batch)
  62. {
  63. PTEB pteb;
  64. GLCLTSHAREDSECTIONINFO gssi;
  65. GLMSGBATCHINFO gmbi;
  66. pteb = CURRENT_TEB();
  67. if (pteb == NULL)
  68. {
  69. return;
  70. }
  71. if (pteb->glSectionInfo == NULL ||
  72. pteb->glSection == NULL)
  73. {
  74. PRINT("No current section\n");
  75. return;
  76. }
  77. if (!GM_OBJ((DWORD)pteb->glSectionInfo, gssi) ||
  78. !GM_OBJ((DWORD)pteb->glSection, gmbi))
  79. {
  80. return;
  81. }
  82. if (IS_CSR_SERVER_THREAD())
  83. {
  84. PRINT("Server-side message batching:\n");
  85. }
  86. else
  87. {
  88. PRINT("Client-side message batching:\n");
  89. }
  90. PRINT("Section size : 0x%08lX\n", gssi.ulSectionSize);
  91. PRINT("File mapping : 0x%p\n", gssi.hFileMap);
  92. PRINT("Section address: 0x%p\n", gssi.pvSharedMemory);
  93. PRINT("\n");
  94. PRINT("Maximum offset : 0x%08lX\n", gmbi.MaximumOffset);
  95. PRINT("First offset : 0x%08lX\n", gmbi.FirstOffset);
  96. PRINT("Next offset : 0x%08lX\n", gmbi.NextOffset);
  97. PRINT("Return value : 0x%08lX\n", gmbi.ReturnValue);
  98. }
  99. /******************************Public*Routine******************************\
  100. *
  101. * df
  102. *
  103. * Print float
  104. *
  105. * History:
  106. * Tue Jan 17 14:12:19 1995 -by- Drew Bliss [drewb]
  107. * Created
  108. *
  109. \**************************************************************************/
  110. DBG_ENTRY(df)
  111. {
  112. DWORD pf;
  113. float f;
  114. pf = GET_EXPR(pszArguments);
  115. if (!GM_OBJ(pf, f))
  116. {
  117. return;
  118. }
  119. PRINT("%08x %f\n", pf, f);
  120. }
  121. /******************************Public*Routine******************************\
  122. *
  123. * dd
  124. *
  125. * Print double
  126. *
  127. * History:
  128. * Tue Jan 17 14:12:19 1995 -by- Drew Bliss [drewb]
  129. * Created
  130. *
  131. \**************************************************************************/
  132. DBG_ENTRY(dd)
  133. {
  134. DWORD pd;
  135. double d;
  136. pd = GET_EXPR(pszArguments);
  137. if (!GM_OBJ(pd, d))
  138. {
  139. return;
  140. }
  141. PRINT("%08x %lf\n", pd, d);
  142. }
  143. /******************************Public*Routine******************************\
  144. *
  145. * dgc
  146. *
  147. * Dumps a context
  148. *
  149. * History:
  150. * Thu Jan 26 13:35:47 1995 -by- Drew Bliss [drewb]
  151. * Created
  152. *
  153. \**************************************************************************/
  154. DBG_ENTRY(dgc)
  155. {
  156. DWORD pgc;
  157. __GLcontext gc;
  158. pgc = GET_EXPR(pszArguments);
  159. if (!GM_OBJ(pgc, gc))
  160. {
  161. return;
  162. }
  163. PRINT("__glContext %p:\n", pgc);
  164. PRINT("Begin mode : %d\n", gc.beginMode);
  165. PRINT("Render mode : %d\n", gc.renderMode);
  166. PRINT("Error : %d\n", gc.error);
  167. PRINT("Window dimensions: %d x %d\n",
  168. gc.constants.width, gc.constants.height);
  169. }
  170. /******************************Public*Routine******************************\
  171. *
  172. * dlrc
  173. *
  174. * Dump a client-side RC table entry
  175. *
  176. * History:
  177. * Tue Jan 31 11:35:46 1995 -by- Drew Bliss [drewb]
  178. * Created
  179. *
  180. \**************************************************************************/
  181. DBG_ENTRY(dlrc)
  182. {
  183. LRC lrc;
  184. DWORD plrc;
  185. plrc = GET_EXPR(pszArguments);
  186. if (!GM_OBJ(plrc, lrc))
  187. {
  188. return;
  189. }
  190. PRINT("Client-side RC %p\n", plrc);
  191. PRINT("dhrc : %p\n", lrc.dhrc);
  192. PRINT("hrc : %p\n", lrc.hrc);
  193. PRINT("pf : %d\n", lrc.iPixelFormat);
  194. PRINT("tid : %d\n", lrc.tidCurrent);
  195. PRINT("hdc : %p\n", lrc.hdcCurrent);
  196. PRINT("pglDriver: %p\n", lrc.pGLDriver);
  197. }
  198. /******************************Public*Routine******************************\
  199. *
  200. * cgc
  201. *
  202. * Print current client-side context
  203. *
  204. * History:
  205. * Thu Jan 26 13:34:49 1995 -by- Drew Bliss [drewb]
  206. * Created
  207. *
  208. \**************************************************************************/
  209. DBG_ENTRY(cgc)
  210. {
  211. PTEB pteb;
  212. if (IS_CSR_SERVER_THREAD())
  213. {
  214. PRINT("Not a client-side thread\n");
  215. return;
  216. }
  217. pteb = CURRENT_TEB();
  218. if (pteb == NULL)
  219. {
  220. return;
  221. }
  222. PRINT("Current client-side RC is %p\n", pteb->glCurrentRC);
  223. }
  224. /******************************Public*Routine******************************\
  225. *
  226. * sgc
  227. *
  228. * Print current server-side context
  229. *
  230. * History:
  231. * Tue Jan 31 11:36:21 1995 -by- Drew Bliss [drewb]
  232. * Created
  233. *
  234. \**************************************************************************/
  235. DBG_ENTRY(sgc)
  236. {
  237. PTEB pteb;
  238. if (!IS_CSR_SERVER_THREAD())
  239. {
  240. PRINT("Not a server-side thread\n");
  241. return;
  242. }
  243. pteb = CURRENT_TEB();
  244. if (pteb == NULL)
  245. {
  246. return;
  247. }
  248. PRINT("Current server-side HRC is %p, context is %p\n",
  249. pteb->glCurrentRC, pteb->glContext);
  250. }
  251. /******************************Public*Routine******************************\
  252. *
  253. * gc
  254. *
  255. * Calls either cgc or sgc depending on the current thread state
  256. *
  257. * History:
  258. * Tue Jan 31 14:09:22 1995 -by- Drew Bliss [drewb]
  259. * Created
  260. *
  261. \**************************************************************************/
  262. DBG_ENTRY(gc)
  263. {
  264. if (IS_CSR_SERVER_THREAD())
  265. {
  266. sgc(hCurrentProcess, hCurrentThread, dwCurrentPc, pwea, pszArguments);
  267. }
  268. else
  269. {
  270. cgc(hCurrentProcess, hCurrentThread, dwCurrentPc, pwea, pszArguments);
  271. }
  272. }