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.

445 lines
19 KiB

  1. //
  2. // No Check-in Source Code.
  3. //
  4. // Do not make this code available to non-Microsoft personnel
  5. // without Intel's express permission
  6. //
  7. /**
  8. *** Copyright (C) 1996-97 Intel Corporation. All rights reserved.
  9. ***
  10. *** The information and source code contained herein is the exclusive
  11. *** property of Intel Corporation and may not be disclosed, examined
  12. *** or reproduced in whole or in part without explicit written authorization
  13. *** from the company.
  14. **/
  15. /******************************Module*Header*******************************\
  16. * Module Name: glia64.c *
  17. * *
  18. * This module implements a program which generates structure offset *
  19. * definitions for OpenGL structures that are accessed in assembly code. *
  20. * *
  21. * Created: 24-Aug-1992 01:24:49 *
  22. * Author: Charles Whitmer [chuckwh] *
  23. * Ported for OpenGL 4/1/1994 Otto Berkes [ottob] *
  24. * *
  25. * Copyright (c) 1994 Microsoft Corporation *
  26. \**************************************************************************/
  27. #include <nt.h>
  28. #include <ntrtl.h>
  29. #include <nturtl.h>
  30. #include <stddef.h>
  31. #include <stdio.h>
  32. #include <windows.h>
  33. #include <ddraw.h>
  34. #include <glp.h>
  35. // #include <winddi.h>
  36. #include "types.h"
  37. #include "render.h"
  38. #include "context.h"
  39. #include "attrib.h"
  40. #include "gencx.h"
  41. #define OFFSET(type, field) ((LONG)(&((type *)0)->field))
  42. // pcomment prints a comment.
  43. #define pcomment(s) fprintf(outfh,"// %s\n",s)
  44. // pequate prints an equate statement.
  45. #define pequate(m,v) fprintf(outfh,"%s == 0x%lX\n",m,v);
  46. // pblank prints a blank line.
  47. #define pblank() fprintf(outfh,"\n")
  48. // pstruct defines an empty structure with the correct size.
  49. #define pstruct(n,c) fprintf(outfh, \
  50. ".size %s %d\n", \
  51. n,c);
  52. // pstr prints a string.
  53. #define pstr(s) fprintf(outfh,"%s\n",s)
  54. //extern __cdecl exit(int);
  55. /******************************Public*Routine******************************\
  56. * GLia64 *
  57. * *
  58. * This is how we make structures consistent between C and ASM for OpenGL. *
  59. * *
  60. \**************************************************************************/
  61. int __cdecl main(int argc,char *argv[])
  62. {
  63. FILE *outfh;
  64. char *outName;
  65. if (argc == 2) {
  66. outName = argv[ 1 ];
  67. } else {
  68. #ifdef TREE2
  69. outName = "\\nt\\private\\windows\\gdi\\opengl2\\server\\soft\\ia64\\oglia64.inc";
  70. #else
  71. outName = "\\nt\\private\\windows\\gdi\\opengl\\server\\soft\\ia64\\oglia64.inc";
  72. #endif
  73. }
  74. outfh = fopen( outName, "w" );
  75. if (outfh == NULL) {
  76. fprintf(stderr, "GENia64: Could not create output file '%s'.\n", outName);
  77. exit (1);
  78. }
  79. fprintf( stderr, "GLia64: Writing %s header file.\n", outName );
  80. pblank();
  81. pcomment("------------------------------------------------------------------");
  82. pcomment(" Module Name: glia64.inc");
  83. pcomment("");
  84. pcomment(" Defines OpenGL assembly-language structures.");
  85. pcomment("");
  86. pcomment(" Copyright (c) 1994 Microsoft Corporation");
  87. pcomment("------------------------------------------------------------------");
  88. pblank();
  89. pblank();
  90. pblank();
  91. // UNUSED
  92. #if 0
  93. // Stuff from: \nt\public\sdk\inc\gl\gl.h
  94. pcomment("Pixel Format Descriptor");
  95. pblank();
  96. pequate("PFD_cColorBits ",OFFSET(PIXELFORMATDESCRIPTOR,cColorBits ));
  97. pequate("PFD_iPixelType ",OFFSET(PIXELFORMATDESCRIPTOR,iPixelType ));
  98. pequate("PFD_cDepthBits ",OFFSET(PIXELFORMATDESCRIPTOR,cDepthBits ));
  99. pcomment("GL Test Functions");
  100. pblank();
  101. pequate("GL_NEVER ",GL_NEVER );
  102. pequate("GL_LESS ",GL_LESS );
  103. pequate("GL_EQUAL ",GL_EQUAL );
  104. pequate("GL_LEQUAL ",GL_LEQUAL );
  105. pequate("GL_GREATER ",GL_GREATER );
  106. pequate("GL_NOTEQUAL ",GL_NOTEQUAL);
  107. pequate("GL_GEQUAL ",GL_GEQUAL );
  108. pequate("GL_ALWAYS ",GL_ALWAYS );
  109. pblank();
  110. pblank();
  111. pcomment("GL Mode Flags");
  112. pblank();
  113. pequate("__GL_SHADE_RGB ",__GL_SHADE_RGB );
  114. pequate("__GL_SHADE_SMOOTH ",__GL_SHADE_SMOOTH );
  115. pequate("__GL_SHADE_DEPTH_TEST ",__GL_SHADE_DEPTH_TEST );
  116. pequate("__GL_SHADE_DITHER ",__GL_SHADE_DITHER );
  117. pequate("__GL_SHADE_LOGICOP ",__GL_SHADE_LOGICOP );
  118. pequate("__GL_SHADE_MASK ",__GL_SHADE_MASK );
  119. pblank();
  120. pblank();
  121. pcomment("GL Type Sizes");
  122. pblank();
  123. pequate("GLbyteSize ",sizeof(GLbyte));
  124. pequate("GLshortSize ",sizeof(GLshort));
  125. pequate("GLintSize ",sizeof(GLint));
  126. pequate("GLfloatSize ",sizeof(GLfloat));
  127. pequate("__GLfloatSize ",sizeof(__GLfloat));
  128. pequate("__GLzValueSize ",sizeof(__GLzValue));
  129. pblank();
  130. pblank();
  131. // Stuff from: \nt\private\windows\gdi\opengl\server\inc\types.h
  132. pcomment("__GLcolorRec structure");
  133. pblank();
  134. pstruct("GLcolorRec",sizeof(struct __GLcolorRec));
  135. pblank();
  136. pequate("COLOR_r ",OFFSET(struct __GLcolorRec,r ));
  137. pequate("COLOR_g ",OFFSET(struct __GLcolorRec,g ));
  138. pequate("COLOR_b ",OFFSET(struct __GLcolorRec,b ));
  139. pequate("COLOR_a ",OFFSET(struct __GLcolorRec,a ));
  140. pblank();
  141. pblank();
  142. // Stuff from: \nt\private\windows\gdi\opengl\server\inc\render.h
  143. pcomment("__GLfragmentRec structure");
  144. pblank();
  145. pstruct("GLfragmentRec",sizeof(struct __GLfragmentRec));
  146. pblank();
  147. pequate("FRAG_x ",OFFSET(struct __GLfragmentRec,x ));
  148. pequate("FRAG_y ",OFFSET(struct __GLfragmentRec,y ));
  149. pequate("FRAG_z ",OFFSET(struct __GLfragmentRec,z ));
  150. pequate("FRAG_color ",OFFSET(struct __GLfragmentRec,color ));
  151. pequate("FRAG_s ",OFFSET(struct __GLfragmentRec,s ));
  152. pequate("FRAG_t ",OFFSET(struct __GLfragmentRec,t ));
  153. pequate("FRAG_qw ",OFFSET(struct __GLfragmentRec,qw ));
  154. pequate("FRAG_f ",OFFSET(struct __GLfragmentRec,f ));
  155. pblank();
  156. pcomment("__GLshadeRec structure");
  157. pblank();
  158. pstruct("__GLshadeRec",sizeof(struct __GLshadeRec));
  159. pblank();
  160. pequate("SHADE_dxLeftLittle ",OFFSET(struct __GLshadeRec,dxLeftLittle ));
  161. pequate("SHADE_dxLeftBig ",OFFSET(struct __GLshadeRec,dxLeftBig ));
  162. pequate("SHADE_dxLeftFrac ",OFFSET(struct __GLshadeRec,dxLeftFrac ));
  163. pequate("SHADE_ixLeft ",OFFSET(struct __GLshadeRec,ixLeft ));
  164. pequate("SHADE_ixLeftFrac ",OFFSET(struct __GLshadeRec,ixLeftFrac ));
  165. pequate("SHADE_dxRightLittle",OFFSET(struct __GLshadeRec,dxRightLittle ));
  166. pequate("SHADE_dxRightBig ",OFFSET(struct __GLshadeRec,dxRightBig ));
  167. pequate("SHADE_dxRightFrac ",OFFSET(struct __GLshadeRec,dxRightFrac ));
  168. pequate("SHADE_ixRight ",OFFSET(struct __GLshadeRec,ixRight ));
  169. pequate("SHADE_ixRightFrac ",OFFSET(struct __GLshadeRec,ixRightFrac ));
  170. pequate("SHADE_area ",OFFSET(struct __GLshadeRec,area ));
  171. pequate("SHADE_dxAC ",OFFSET(struct __GLshadeRec,dxAC ));
  172. pequate("SHADE_dxBC ",OFFSET(struct __GLshadeRec,dxBC ));
  173. pequate("SHADE_dyAC ",OFFSET(struct __GLshadeRec,dyAC ));
  174. pequate("SHADE_dyBC ",OFFSET(struct __GLshadeRec,dyBC ));
  175. pequate("SHADE_frag ",OFFSET(struct __GLshadeRec,frag ));
  176. pequate("SHADE_spanLength ",OFFSET(struct __GLshadeRec,length ));
  177. pequate("SHADE_rLittle ",OFFSET(struct __GLshadeRec,rLittle ));
  178. pequate("SHADE_gLittle ",OFFSET(struct __GLshadeRec,gLittle ));
  179. pequate("SHADE_bLittle ",OFFSET(struct __GLshadeRec,bLittle ));
  180. pequate("SHADE_aLittle ",OFFSET(struct __GLshadeRec,aLittle ));
  181. pequate("SHADE_rBig ",OFFSET(struct __GLshadeRec,rBig ));
  182. pequate("SHADE_gBig ",OFFSET(struct __GLshadeRec,gBig ));
  183. pequate("SHADE_bBig ",OFFSET(struct __GLshadeRec,bBig ));
  184. pequate("SHADE_aBig ",OFFSET(struct __GLshadeRec,aBig ));
  185. pequate("SHADE_drdx ",OFFSET(struct __GLshadeRec,drdx ));
  186. pequate("SHADE_dgdx ",OFFSET(struct __GLshadeRec,dgdx ));
  187. pequate("SHADE_dbdx ",OFFSET(struct __GLshadeRec,dbdx ));
  188. pequate("SHADE_dadx ",OFFSET(struct __GLshadeRec,dadx ));
  189. pequate("SHADE_drdy ",OFFSET(struct __GLshadeRec,drdy ));
  190. pequate("SHADE_dgdy ",OFFSET(struct __GLshadeRec,dgdy ));
  191. pequate("SHADE_dbdy ",OFFSET(struct __GLshadeRec,dbdy ));
  192. pequate("SHADE_dady ",OFFSET(struct __GLshadeRec,dady ));
  193. pequate("SHADE_zLittle ",OFFSET(struct __GLshadeRec,zLittle ));
  194. pequate("SHADE_zBig ",OFFSET(struct __GLshadeRec,zBig ));
  195. pequate("SHADE_dzdx ",OFFSET(struct __GLshadeRec,dzdx ));
  196. pequate("SHADE_dzdyf ",OFFSET(struct __GLshadeRec,dzdyf ));
  197. pequate("SHADE_dzdxf ",OFFSET(struct __GLshadeRec,dzdxf ));
  198. pequate("SHADE_sLittle ",OFFSET(struct __GLshadeRec,sLittle ));
  199. pequate("SHADE_tLittle ",OFFSET(struct __GLshadeRec,tLittle ));
  200. pequate("SHADE_qwLittle ",OFFSET(struct __GLshadeRec,qwLittle ));
  201. pequate("SHADE_sBig ",OFFSET(struct __GLshadeRec,sBig ));
  202. pequate("SHADE_tBig ",OFFSET(struct __GLshadeRec,tBig ));
  203. pequate("SHADE_qwBig ",OFFSET(struct __GLshadeRec,qwBig ));
  204. pequate("SHADE_dsdx ",OFFSET(struct __GLshadeRec,dsdx ));
  205. pequate("SHADE_dtdx ",OFFSET(struct __GLshadeRec,dtdx ));
  206. pequate("SHADE_dqwdx ",OFFSET(struct __GLshadeRec,dqwdx ));
  207. pequate("SHADE_dsdy ",OFFSET(struct __GLshadeRec,dsdy ));
  208. pequate("SHADE_dtdy ",OFFSET(struct __GLshadeRec,dtdy ));
  209. pequate("SHADE_dqwdy ",OFFSET(struct __GLshadeRec,dqwdy ));
  210. pequate("SHADE_fLittle ",OFFSET(struct __GLshadeRec,fLittle ));
  211. pequate("SHADE_fBig ",OFFSET(struct __GLshadeRec,fBig ));
  212. pequate("SHADE_dfdy ",OFFSET(struct __GLshadeRec,dfdy ));
  213. pequate("SHADE_dfdx ",OFFSET(struct __GLshadeRec,dfdx ));
  214. pequate("SHADE_modeFlags ",OFFSET(struct __GLshadeRec,modeFlags ));
  215. pequate("SHADE_zbuf ",OFFSET(struct __GLshadeRec,zbuf ));
  216. pequate("SHADE_zbufBig ",OFFSET(struct __GLshadeRec,zbufBig ));
  217. pequate("SHADE_zbufLittle ",OFFSET(struct __GLshadeRec,zbufLittle ));
  218. pequate("SHADE_sbuf ",OFFSET(struct __GLshadeRec,sbuf ));
  219. pequate("SHADE_sbufBig ",OFFSET(struct __GLshadeRec,sbufBig ));
  220. pequate("SHADE_sbufLittle ",OFFSET(struct __GLshadeRec,sbufLittle ));
  221. pequate("SHADE_colors ",OFFSET(struct __GLshadeRec,colors ));
  222. pequate("SHADE_fbcolors ",OFFSET(struct __GLshadeRec,fbcolors ));
  223. pequate("SHADE_stipplePat ",OFFSET(struct __GLshadeRec,stipplePat ));
  224. pequate("SHADE_done ",OFFSET(struct __GLshadeRec,done ));
  225. pequate("SHADE_cfb ",OFFSET(struct __GLshadeRec,cfb ));
  226. pblank();
  227. pblank();
  228. pcomment("__GLpolygonMachineRec structure");
  229. pblank();
  230. pstruct("GLpolygonMachineRec",sizeof(struct __GLpolygonMachineRec));
  231. pblank();
  232. pequate("POLY_stipple ",OFFSET(struct __GLpolygonMachineRec,stipple));
  233. pequate("POLY_shader ",OFFSET(struct __GLpolygonMachineRec,shader ));
  234. pblank();
  235. pblank();
  236. // Stuff from: \nt\private\windows\gdi\opengl\server\inc\buffers.h
  237. pequate("DIB_FORMAT ",DIB_FORMAT);
  238. pcomment("__GLbufferRec structure");
  239. pblank();
  240. pstruct("GLbufferRec",sizeof(struct __GLbufferRec));
  241. pblank();
  242. pequate("BUF_gc ",OFFSET(struct __GLbufferRec,gc ));
  243. pequate("BUF_width ",OFFSET(struct __GLbufferRec,width ));
  244. pequate("BUF_height ",OFFSET(struct __GLbufferRec,height ));
  245. pequate("BUF_depth ",OFFSET(struct __GLbufferRec,depth ));
  246. pequate("BUF_base ",OFFSET(struct __GLbufferRec,base ));
  247. pequate("BUF_size ",OFFSET(struct __GLbufferRec,size ));
  248. pequate("BUF_elementSize ",OFFSET(struct __GLbufferRec,elementSize ));
  249. pequate("BUF_outerWidth ",OFFSET(struct __GLbufferRec,outerWidth ));
  250. pequate("BUF_xOrigin ",OFFSET(struct __GLbufferRec,xOrigin ));
  251. pequate("BUF_yOrigin ",OFFSET(struct __GLbufferRec,yOrigin ));
  252. pequate("BUF_other ",OFFSET(struct __GLbufferRec,other ));
  253. pblank();
  254. pblank();
  255. pcomment("__GLcolorBufferRec structure");
  256. pblank();
  257. pstruct("GLcolorBufferRec",sizeof(struct __GLcolorBufferRec));
  258. pblank();
  259. pequate("CBUF_redMax ",OFFSET(struct __GLcolorBufferRec,redMax ));
  260. pequate("CBUF_greenMax ",OFFSET(struct __GLcolorBufferRec,greenMax ));
  261. pequate("CBUF_blueMax ",OFFSET(struct __GLcolorBufferRec,blueMax ));
  262. pequate("CBUF_iRedScale ",OFFSET(struct __GLcolorBufferRec,iRedScale ));
  263. pequate("CBUF_iGreenScale ",OFFSET(struct __GLcolorBufferRec,iGreenScale));
  264. pequate("CBUF_iBlueScale ",OFFSET(struct __GLcolorBufferRec,iBlueScale ));
  265. pequate("CBUF_iAlphaScale ",OFFSET(struct __GLcolorBufferRec,iAlphaScale));
  266. pequate("CBUF_iRedShift ",OFFSET(struct __GLcolorBufferRec,redShift ));
  267. pequate("CBUF_iGreenShift ",OFFSET(struct __GLcolorBufferRec,greenShift));
  268. pequate("CBUF_iBlueShift ",OFFSET(struct __GLcolorBufferRec,blueShift ));
  269. pequate("CBUF_iAlphaShift ",OFFSET(struct __GLcolorBufferRec,alphaShift));
  270. pequate("CBUF_sourceMask ",OFFSET(struct __GLcolorBufferRec,sourceMask ));
  271. pequate("CBUF_destMask ",OFFSET(struct __GLcolorBufferRec,destMask ));
  272. pequate("CBUF_other ",OFFSET(struct __GLcolorBufferRec,other ));
  273. pblank();
  274. pblank();
  275. // Stuff from: \nt\private\windows\gdi\opengl\server\inc\attrib.h
  276. pcomment("__GLdepthStateRec structure");
  277. pblank();
  278. pstruct("GLdepthStateRec",sizeof(struct __GLdepthStateRec));
  279. pblank();
  280. pequate("DEPTH_testFunc ",OFFSET(struct __GLdepthStateRec,testFunc ));
  281. pequate("DEPTH_writeEnable ",OFFSET(struct __GLdepthStateRec,writeEnable));
  282. pblank();
  283. pblank();
  284. pcomment("__GLattributeRec structure");
  285. pblank();
  286. pstruct("GLattributeRec",sizeof(struct __GLattributeRec));
  287. pblank();
  288. pequate("ATTR_polygonStipple",OFFSET(struct __GLattributeRec,polygonStipple));
  289. pequate("ATTR_depth ",OFFSET(struct __GLattributeRec,depth));
  290. pequate("ATTR_enables ",OFFSET(struct __GLattributeRec,enables));
  291. pequate("ATTR_raster ",OFFSET(struct __GLattributeRec,raster));
  292. pequate("ATTR_hints ",OFFSET(struct __GLattributeRec,hints));
  293. pblank();
  294. pblank();
  295. // Stuff from: \nt\private\windows\gdi\opengl\server\inc\context.h
  296. pcomment("__GLcontextConstantsRec structure");
  297. pblank();
  298. pstruct("GLcontextConstantsRec",sizeof(struct __GLcontextConstantsRec));
  299. pblank();
  300. pequate("CTXCONST_viewportXAdjust",OFFSET(struct __GLcontextConstantsRec,viewportXAdjust));
  301. pequate("CTXCONST_viewportYAdjust",OFFSET(struct __GLcontextConstantsRec,viewportYAdjust));
  302. pequate("CTXCONST_width ",OFFSET(struct __GLcontextConstantsRec,width));
  303. pequate("CTXCONST_height ",OFFSET(struct __GLcontextConstantsRec,height));
  304. pcomment("__GLcontextRec structure");
  305. pblank();
  306. pstruct("GLcontextRec",sizeof(struct __GLcontextRec));
  307. pblank();
  308. pequate("CTX_gcState ",OFFSET(struct __GLcontextRec,gcState ));
  309. pequate("CTX_state ",OFFSET(struct __GLcontextRec,state ));
  310. pequate("CTX_renderMode ",OFFSET(struct __GLcontextRec,renderMode ));
  311. pequate("CTX_modes ",OFFSET(struct __GLcontextRec,modes ));
  312. pequate("CTX_constants ",OFFSET(struct __GLcontextRec,constants ));
  313. pequate("CTX_drawBuffer ",OFFSET(struct __GLcontextRec,drawBuffer ));
  314. pequate("CTX_readBuffer ",OFFSET(struct __GLcontextRec,readBuffer ));
  315. pequate("CTX_polygon ",OFFSET(struct __GLcontextRec,polygon ));
  316. pequate("CTX_pixel ",OFFSET(struct __GLcontextRec,pixel ));
  317. pblank();
  318. pblank();
  319. // Stuff from: \nt\private\windows\gdi\opengl\server\inc\gencx.h
  320. pcomment("__GLGENcontextRec structure");
  321. pblank();
  322. pstruct("GLGENcontextRec",sizeof(struct __GLGENcontextRec));
  323. pblank();
  324. pequate("GENCTX_hrc ",OFFSET(struct __GLGENcontextRec,hrc ));
  325. pequate("GENCTX_CurrentDC ",OFFSET(struct __GLGENcontextRec,CurrentDC ));
  326. pequate("GENCTX_CurrentFormat ",OFFSET(struct __GLGENcontextRec,CurrentFormat ));
  327. pequate("GENCTX_iDCType ",OFFSET(struct __GLGENcontextRec,iDCType ));
  328. pequate("GENCTX_iSurfType ",OFFSET(struct __GLGENcontextRec,iSurfType ));
  329. pequate("GENCTX_ColorsBits ",OFFSET(struct __GLGENcontextRec,ColorsBits));
  330. pequate("GENCTX_pajTranslateVector",OFFSET(struct __GLGENcontextRec,pajTranslateVector));
  331. pequate("GENCTX_pPrivateArea ",OFFSET(struct __GLGENcontextRec,pPrivateArea));
  332. pblank();
  333. pblank();
  334. pcomment("SPANREC structure");
  335. pblank();
  336. pstruct("SPANREC",sizeof(SPANREC));
  337. pblank();
  338. pequate("SPANREC_r ",OFFSET(SPANREC,r ));
  339. pequate("SPANREC_g ",OFFSET(SPANREC,g ));
  340. pequate("SPANREC_b ",OFFSET(SPANREC,b ));
  341. pequate("SPANREC_a ",OFFSET(SPANREC,a ));
  342. pequate("SPANREC_z ",OFFSET(SPANREC,z ));
  343. pblank();
  344. pblank();
  345. pcomment("GENACCEL structure");
  346. pblank();
  347. pstruct("GENACCEL",sizeof(GENACCEL));
  348. pblank();
  349. pequate("SURFACE_TYPE_DIB ",SURFACE_TYPE_DIB);
  350. pblank();
  351. pequate("GENACCEL_spanDelta ",
  352. OFFSET(GENACCEL,spanDelta ));
  353. pequate("GENACCEL_flags ",
  354. OFFSET(GENACCEL,flags ));
  355. pequate("GENACCEL_fastSpanFuncPtr ",
  356. OFFSET(GENACCEL,__fastSpanFuncPtr ));
  357. pequate("GENACCEL_fastFlatSpanFuncPtr ",
  358. OFFSET(GENACCEL,__fastFlatSpanFuncPtr ));
  359. pequate("GENACCEL_fastSmoothSpanFuncPtr ",
  360. OFFSET(GENACCEL,__fastSmoothSpanFuncPtr ));
  361. pequate("GENACCEL_fastZSpanFuncPtr ",
  362. OFFSET(GENACCEL,__fastZSpanFuncPtr));
  363. pblank();
  364. pblank();
  365. #endif
  366. return 0;
  367. }