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.

431 lines
14 KiB

  1. /*
  2. * $Id: gensym.cpp,v 1.7 1995/11/21 14:45:51 sjl Exp $
  3. *
  4. * Copyright (c) Microsoft Corp. 1993-1997
  5. *
  6. * All rights reserved.
  7. *
  8. * This file contains private, unpublished information and may not be
  9. * copied in part or in whole without express permission of
  10. * Microsoft Corp.
  11. *
  12. */
  13. #include <stdio.h>
  14. #include "d3di.hpp"
  15. #define DEFINE(type, member) \
  16. printf(#type "_" #member " equ 0%xh\n", ((LONG)(&((type *)0)->member)))
  17. #define MACRO(name) \
  18. printf(#name " equ 0%xh\n", name)
  19. // pcomment prints a comment.
  20. #define pcomment(s) printf("; %s\n",s)
  21. // pequate prints an equate statement.
  22. #define pequate(name, value) printf("%s equ 0%lXH\n",name,value);
  23. #define OFFSET(type, field) ((LONG)(&((type *)0)->field))
  24. // pblank prints a blank line.
  25. #define pblank() printf("\n")
  26. #define printVCACHE(name) \
  27. { \
  28. printf("%-30s equ 0%LXH\n", "PV_LIGHTING_"#name, OFFSET(D3DFE_PROCESSVERTICES, vcache.##name)); \
  29. }
  30. #define printD3DI_LIGHT(name) \
  31. { \
  32. printf("%-30s equ 0%LXH\n", "D3DI_LIGHT_"#name, OFFSET(D3DI_LIGHT, name)); \
  33. }
  34. #define printD3DFE_LIGHTING(name) \
  35. { \
  36. printf("%-30s equ 0%LXH\n", "PV_LIGHTING_"#name, OFFSET(D3DFE_PROCESSVERTICES, lighting.##name)); \
  37. }
  38. #define printDevice(name) \
  39. { \
  40. printf("%-30s equ 0%LXH\n", "DEVI_"#name, OFFSET(DIRECT3DDEVICEI, name)); \
  41. }
  42. #define printDeviceDP2(name) \
  43. { \
  44. printf("%-30s equ 0%LXH\n", #name, OFFSET(CDirect3DDeviceIDP2, name)); \
  45. }
  46. int main()
  47. {
  48. pcomment("------------------------------------------------------------------");
  49. pcomment(" Module Name: offsets.asm");
  50. pcomment("");
  51. pcomment(" Defines D3D assembly-language structures.");
  52. pcomment(" This file is generated");
  53. pcomment("");
  54. pcomment(" Copyright (c) 1998, 1995 Microsoft Corporation");
  55. pcomment("------------------------------------------------------------------");
  56. pblank();
  57. pblank();
  58. DEFINE(D3DINSTRUCTION, wCount);
  59. DEFINE(D3DINSTRUCTION, bSize);
  60. DEFINE(D3DINSTRUCTION, bOpcode);
  61. DEFINE(D3DVERTEX, x);
  62. DEFINE(D3DVERTEX, y);
  63. DEFINE(D3DVERTEX, z);
  64. DEFINE(D3DVERTEX, tu);
  65. DEFINE(D3DVERTEX, tv);
  66. DEFINE(D3DLVERTEX, color);
  67. DEFINE(D3DLVERTEX, specular);
  68. DEFINE(D3DTLVERTEX, sx);
  69. DEFINE(D3DTLVERTEX, sy);
  70. DEFINE(D3DTLVERTEX, sz);
  71. DEFINE(D3DTLVERTEX, rhw);
  72. DEFINE(D3DTLVERTEX, color);
  73. DEFINE(D3DTLVERTEX, specular);
  74. DEFINE(D3DTLVERTEX, tu);
  75. DEFINE(D3DTLVERTEX, tv);
  76. printf("D3DTLVERTEX_size equ %d\n", sizeof(D3DTLVERTEX));
  77. DEFINE(D3DHVERTEX, dwFlags);
  78. DEFINE(D3DHVERTEX, hx);
  79. DEFINE(D3DHVERTEX, hy);
  80. DEFINE(D3DHVERTEX, hz);
  81. printf("D3DHVERTEX_size equ %d\n", sizeof(D3DHVERTEX));
  82. DEFINE(D3DTRIANGLE, v1);
  83. DEFINE(D3DTRIANGLE, v2);
  84. DEFINE(D3DTRIANGLE, v3);
  85. DEFINE(D3DTRIANGLE, wFlags);
  86. printf("D3DTRIANGLE_size equ %d\n", sizeof(D3DTRIANGLE));
  87. DEFINE(D3DMATRIXI, _11);
  88. DEFINE(D3DMATRIXI, _12);
  89. DEFINE(D3DMATRIXI, _13);
  90. DEFINE(D3DMATRIXI, _14);
  91. DEFINE(D3DMATRIXI, _21);
  92. DEFINE(D3DMATRIXI, _22);
  93. DEFINE(D3DMATRIXI, _23);
  94. DEFINE(D3DMATRIXI, _24);
  95. DEFINE(D3DMATRIXI, _31);
  96. DEFINE(D3DMATRIXI, _32);
  97. DEFINE(D3DMATRIXI, _33);
  98. DEFINE(D3DMATRIXI, _34);
  99. DEFINE(D3DMATRIXI, _41);
  100. DEFINE(D3DMATRIXI, _42);
  101. DEFINE(D3DMATRIXI, _43);
  102. DEFINE(D3DMATRIXI, _44);
  103. DEFINE(D3DMATRIXI, type);
  104. DEFINE(D3DLIGHTINGELEMENT, dvPosition);
  105. DEFINE(D3DLIGHTINGELEMENT, dvNormal);
  106. printf("D3DMATRIXI_size equ %d\n", sizeof(D3DMATRIXI));
  107. printf("D3DFE_LIGHTING_size equ %d\n", sizeof(D3DFE_LIGHTING));
  108. printf("D3DFE_VIEWPORTCACHE_size equ %d\n", sizeof(D3DFE_VIEWPORTCACHE));
  109. MACRO(D3DOP_TRIANGLE);
  110. MACRO(D3DCLIP_LEFT);
  111. MACRO(D3DCLIP_RIGHT);
  112. MACRO(D3DCLIP_TOP);
  113. MACRO(D3DCLIP_BOTTOM);
  114. MACRO(D3DCLIP_FRONT);
  115. MACRO(D3DCLIP_BACK);
  116. MACRO(D3DTBLEND_COPY);
  117. MACRO(D3DSHADE_FLAT);
  118. MACRO(D3DCMP_LESSEQUAL);
  119. MACRO(D3DCMP_GREATEREQUAL);
  120. MACRO(D3DCMP_ALWAYS);
  121. MACRO(D3DSTATUS_ZNOTVISIBLE);
  122. MACRO(D3DDP_DONOTUPDATEEXTENTS);
  123. // Geometry pipeline
  124. pcomment("-------------------- VCACHE ------------------------------------");
  125. printVCACHE(scaleX);
  126. printVCACHE(scaleY);
  127. printVCACHE(offsetX);
  128. printVCACHE(offsetY);
  129. printVCACHE(minXgb);
  130. printVCACHE(minYgb);
  131. printVCACHE(maxXgb);
  132. printVCACHE(maxYgb);
  133. printVCACHE(minX);
  134. printVCACHE(minY);
  135. printVCACHE(maxX);
  136. printVCACHE(maxY);
  137. printVCACHE(gb11);
  138. printVCACHE(gb22);
  139. printVCACHE(gb41);
  140. printVCACHE(gb42);
  141. printVCACHE(Kgbx1);
  142. printVCACHE(Kgby1);
  143. printVCACHE(Kgbx2);
  144. printVCACHE(Kgby2);
  145. printVCACHE(dvX);
  146. printVCACHE(dvY);
  147. printVCACHE(dvWidth);
  148. printVCACHE(dvHeight);
  149. printVCACHE(scaleXi);
  150. printVCACHE(scaleYi);
  151. printVCACHE(minXi);
  152. printVCACHE(minYi);
  153. printVCACHE(maxXi);
  154. printVCACHE(maxYi);
  155. printVCACHE(mclip11);
  156. printVCACHE(mclip41);
  157. printVCACHE(mclip22);
  158. printVCACHE(mclip42);
  159. printVCACHE(mclip33);
  160. printVCACHE(mclip43);
  161. pcomment("---------------- D3DFE_LIGHTING ------------------------------------");
  162. printD3DFE_LIGHTING(diffuse);
  163. printD3DFE_LIGHTING(alpha);
  164. printD3DFE_LIGHTING(diffuse0);
  165. printD3DFE_LIGHTING(currentSpecTable);
  166. printD3DFE_LIGHTING(specular);
  167. printD3DFE_LIGHTING(outDiffuse);
  168. printD3DFE_LIGHTING(vertexDiffuse);
  169. printD3DFE_LIGHTING(outSpecular);
  170. printD3DFE_LIGHTING(vertexSpecular);
  171. printD3DFE_LIGHTING(specularComputed);
  172. printD3DFE_LIGHTING(activeLights);
  173. printD3DFE_LIGHTING(material);
  174. printD3DFE_LIGHTING(hMat);
  175. printD3DFE_LIGHTING(ambient_red);
  176. printD3DFE_LIGHTING(ambient_green);
  177. printD3DFE_LIGHTING(ambient_blue);
  178. printD3DFE_LIGHTING(fog_mode);
  179. printD3DFE_LIGHTING(fog_density);
  180. printD3DFE_LIGHTING(fog_start);
  181. printD3DFE_LIGHTING(fog_end);
  182. printD3DFE_LIGHTING(fog_factor);
  183. printD3DFE_LIGHTING(fog_factor_ramp);
  184. printD3DFE_LIGHTING(specThreshold);
  185. printD3DFE_LIGHTING(color_model);
  186. printD3DFE_LIGHTING(ambient_save);
  187. pcomment("---------------- D3DI_LIGHT ------------------------------------");
  188. printD3DI_LIGHT(model_position);
  189. printD3DI_LIGHT(type);
  190. printD3DI_LIGHT(model_direction);
  191. printD3DI_LIGHT(version);
  192. printD3DI_LIGHT(model_eye);
  193. printD3DI_LIGHT(flags);
  194. printD3DI_LIGHT(model_scale);
  195. printD3DI_LIGHT(falloff);
  196. printD3DI_LIGHT(local_diffR);
  197. printD3DI_LIGHT(local_diffG);
  198. printD3DI_LIGHT(local_diffB);
  199. printD3DI_LIGHT(valid);
  200. printD3DI_LIGHT(local_specR);
  201. printD3DI_LIGHT(local_specG);
  202. printD3DI_LIGHT(local_specB);
  203. printD3DI_LIGHT(inv_theta_minus_phi);
  204. printD3DI_LIGHT(halfway);
  205. printD3DI_LIGHT(next);
  206. printD3DI_LIGHT(red);
  207. printD3DI_LIGHT(green);
  208. printD3DI_LIGHT(blue);
  209. printD3DI_LIGHT(shade);
  210. printD3DI_LIGHT(range_squared);
  211. printD3DI_LIGHT(attenuation0);
  212. printD3DI_LIGHT(attenuation1);
  213. printD3DI_LIGHT(attenuation2);
  214. printD3DI_LIGHT(cos_theta_by_2);
  215. printD3DI_LIGHT(cos_phi_by_2);
  216. printD3DI_LIGHT(position);
  217. printD3DI_LIGHT(direction);
  218. printD3DI_LIGHT(range);
  219. pcomment("---------------- DIRECT3DDEVICEI ------------------------------------");
  220. printDevice(dwVersion);
  221. printDevice(dwRampBase);
  222. printDevice(dvRampScale);
  223. printDevice(lpvRampTexture);
  224. printDevice(mCTM);
  225. printDevice(dwMaxTextureIndices);
  226. printDevice(lighting);
  227. printDevice(vcache);
  228. printDevice(dvExtentsAdjust);
  229. printDevice(lpdwRStates);
  230. printDevice(pD3DMappedTexI);
  231. printDevice(ClipperState);
  232. printDevice(dwVertexBase);
  233. printDevice(dwFlags);
  234. printDevice(dwDeviceFlags);
  235. printDevice(dwNumVertices);
  236. printDevice(dwNumPrimitives);
  237. printDevice(dwNumIndices);
  238. printDevice(lpwIndices);
  239. printDevice(primType);
  240. printDevice(nTexCoord);
  241. printDevice(position);
  242. printDevice(normal);
  243. printDevice(diffuse);
  244. printDevice(specular);
  245. printDevice(textures);
  246. printDevice(dwVIDIn);
  247. printDevice(dwVIDOut);
  248. printDevice(dwOutputSize);
  249. printDevice(lpvOut);
  250. printDevice(lpClipFlags);
  251. printDevice(rExtents);
  252. printDevice(dwClipUnion);
  253. printDevice(dwClipIntersection);
  254. printDevice(pfnFlushStates );
  255. printDevice(deviceType );
  256. printDevice(lpDirect3DI );
  257. printDevice(list );
  258. printDevice(texBlocks );
  259. printDevice(buffers );
  260. printDevice(numViewports );
  261. printDevice(viewports );
  262. printDevice(lpCurrentViewport );
  263. printDevice(matBlocks );
  264. printDevice(mDevUnk );
  265. printDevice(guid );
  266. printDevice(matBlocks );
  267. printDevice(mDevUnk );
  268. printDevice(guid );
  269. printDevice(lpD3DHALCallbacks );
  270. printDevice(lpD3DHALGlobalDriverData );
  271. printDevice(lpD3DHALCallbacks2 );
  272. printDevice(lpD3DHALCallbacks3 );
  273. printDevice(lpDD );
  274. printDevice(lpDDGbl );
  275. printDevice(lpDDSTarget );
  276. printDevice(lpDDSZBuffer );
  277. printDevice(lpDDPalTarget );
  278. printDevice(lpDDSTarget_DDS4 );
  279. printDevice(lpDDSZBuffer_DDS4 );
  280. printDevice(dwWidth );
  281. printDevice(dwHeight );
  282. printDevice(transform );
  283. printDevice(dwhContext );
  284. printDevice(bufferHandles );
  285. printDevice(pfnDrawPrim );
  286. printDevice(pfnDrawIndexedPrim );
  287. printDevice(red_mask );
  288. printDevice(red_scale );
  289. printDevice(red_shift );
  290. printDevice(green_mask);
  291. printDevice(green_scale);
  292. printDevice(green_shift);
  293. printDevice(blue_mask);
  294. printDevice(blue_scale);
  295. printDevice(blue_shift);
  296. printDevice(zmask_shift);
  297. printDevice(stencilmask_shift);
  298. printDevice(bDDSTargetIsPalettized);
  299. printDevice(pick_data);
  300. printDevice(lpbClipIns_base);
  301. printDevice(dwClipIns_offset);
  302. printDevice(renderstate_overrides);
  303. printDevice(transformstate_overrides);
  304. printDevice(lightstate_overrides);
  305. printDevice(iClipStatus);
  306. printDevice(D3DStats);
  307. printDevice(dwFVFLastIn);
  308. printDevice(dwFVFLastOut);
  309. printDevice(dwFVFLastTexCoord);
  310. printDevice(dwFVFLastOutputSize);
  311. printDevice(dwFEFlags);
  312. printDevice(dwDebugFlags);
  313. printDevice(v_id);
  314. printDevice(numLights);
  315. printDevice(specular_tables);
  316. printDevice(specular_table);
  317. printDevice(materials);
  318. printDevice(lightVertexFuncTable);
  319. printDevice(pHalProv);
  320. printDevice(hDllProv);
  321. printDevice(pfnDoFlushBeginEnd);
  322. printDevice(d3dHWDevDesc);
  323. printDevice(d3dHELDevDesc);
  324. printDevice(lpOwningIUnknown);
  325. printDevice(lpD3DMappedTexI);
  326. printDevice(lpD3DMappedBlock);
  327. printDevice(lpClipper);
  328. printDevice(dwHintFlags);
  329. printDevice(lpcCurrentPtr);
  330. printDevice(BeginEndCSect);
  331. printDevice(lpvVertexBatch);
  332. printDevice(lpIndexBatch);
  333. printDevice(lpvVertexData);
  334. printDevice(dwBENumVertices);
  335. printDevice(dwMaxVertexCount);
  336. printDevice(lpVertexIndices);
  337. printDevice(dwBENumIndices);
  338. printDevice(dwMaxIndexCount);
  339. printDevice(wFlushed);
  340. printDevice(lpTextureBatched);
  341. printDevice(lpwDPBuffer);
  342. printDevice(dwCurrentBatchVID);
  343. printDevice(lpDPPrimCounts);
  344. printDevice(lpHWCounts);
  345. printDevice(lpHWTris);
  346. printDevice(lpHWVertices);
  347. printDevice(dwHWOffset);
  348. printDevice(dwHWMaxOffset);
  349. printDevice(dwHWTriIndex);
  350. printDevice(dwHWNumCounts);
  351. printDevice(dwDPOffset);
  352. printDevice(dwDPMaxOffset);
  353. printDevice(wTriIndex);
  354. printDevice(TLVbuf);
  355. printDevice(HVbuf);
  356. printDevice(lpD3DExtendedCaps);
  357. printDevice(rstates);
  358. printDevice(tsstates);
  359. printDevice(pfnRampService);
  360. printDevice(pfnRastService);
  361. printDevice(pGeometryFuncs);
  362. printDevice(mWV);
  363. pcomment("---------------- CDirect3DDeviceIDP2 ----------------------");
  364. printDeviceDP2(lpDDSCB1);
  365. printDeviceDP2(lpvDP2Commands);
  366. printDeviceDP2(lpDP2CurrCommand);
  367. printDeviceDP2(dp2data);
  368. printDeviceDP2(dwDP2CommandLength);
  369. printDeviceDP2(dwDP2CommandBufSize);
  370. printDeviceDP2(bDP2CurrCmdOP);
  371. printDeviceDP2(wDP2CurrCmdCnt);
  372. printDeviceDP2(dwDP2Flags);
  373. pcomment("---------------- MISC ------------------------------------");
  374. /*
  375. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  376. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  377. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  378. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  379. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  380. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  381. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  382. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  383. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  384. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  385. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  386. pequate("DEVI_ ", OFFSET(DIRECT3DDEVICEI, ));
  387. */
  388. pequate("_R_", 0);
  389. pequate("_G_", 4);
  390. pequate("_B_", 8);
  391. pequate("_X_", 0);
  392. pequate("_Y_", 4);
  393. pequate("_Z_", 8);
  394. pequate("_W_", 12);
  395. pequate("D3DLIGHTI_COMPUTE_SPECULAR ", D3DLIGHTI_COMPUTE_SPECULAR);
  396. return 0;
  397. }