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.

417 lines
16 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 "ddrawpr.h"
  14. #include "dxgint.h"
  15. #include "resource.hpp"
  16. #include "texture.hpp"
  17. #include "volume.hpp"
  18. #include "mipmap.hpp"
  19. #include "mipvol.hpp"
  20. #include "cubemap.hpp"
  21. #include "surface.hpp"
  22. #include "d3d8ddi.h"
  23. #include <windows.h>
  24. #include <assert.h>
  25. #include <math.h>
  26. #include <stdlib.h>
  27. #include <stdio.h>
  28. #include "dpf.h"
  29. #include "d3di.hpp"
  30. #include "ddi.h"
  31. #include "d3dpr.hpp"
  32. #include "ddrawp.h"
  33. #include "memalloc.h"
  34. #include "fltval.h"
  35. #include "stateset.hpp"
  36. #include "hmgr.hpp"
  37. #include "d3dexcept.hpp"
  38. #include "drawprim.hpp"
  39. #include "resource.inl"
  40. #include "pipeln.h"
  41. #define DEFINE(type, member) \
  42. printf(#type "_" #member " equ 0%xh\n", ((LONG)(&((type *)0)->member)))
  43. #define MACRO(name) \
  44. printf(#name " equ 0%xh\n", name)
  45. main()
  46. // pcomment prints a comment.
  47. #define pcomment(s) printf("; %s\n",s)
  48. // pequate prints an equate statement.
  49. #define pequate(name, value) printf("%s equ 0x%08lX\n",name,value);
  50. #define OFFSET(type, field) ((LONG)(&((type *)0)->field))
  51. // pblank prints a blank line.
  52. #define pblank() printf("\n")
  53. #define printVCACHE(name) \
  54. { \
  55. printf("%-30s equ 0%LXH\n", "PV_VCACHE_"#name, OFFSET(D3DFE_PROCESSVERTICES, vcache.##name)); \
  56. }
  57. #define printD3DI_LIGHT(name) \
  58. { \
  59. printf("%-30s equ 0%LXH\n", "D3DI_LIGHT_"#name, OFFSET(D3DI_LIGHT, name)); \
  60. }
  61. #define printD3DFE_LIGHTING(name) \
  62. { \
  63. printf("%-30s equ 0%LXH\n", "PV_LIGHTING_"#name, OFFSET(D3DFE_PROCESSVERTICES, lighting.##name)); \
  64. }
  65. #define printDevice(name) \
  66. { \
  67. printf("%-30s equ 0%LXH\n", "DEVI_"#name, OFFSET(CD3DHal, name)); \
  68. }
  69. #define printPV(name) \
  70. { \
  71. printf("%-30s equ 0%LXH\n", "D3DPV_"#name, OFFSET(D3DFE_PROCESSVERTICES, name)); \
  72. }
  73. #define printDeviceDP2(name) \
  74. { \
  75. printf("%-30s equ 0%LXH\n", #name, OFFSET(CD3DHalDP2, name)); \
  76. }
  77. {
  78. pcomment("------------------------------------------------------------------");
  79. pcomment(" Module Name: offsets.asm");
  80. pcomment("");
  81. pcomment(" Defines D3D assembly-language structures.");
  82. pcomment(" This file is generated");
  83. pcomment("");
  84. pcomment(" Copyright (c) 1998, 1995 Microsoft Corporation");
  85. pcomment("------------------------------------------------------------------");
  86. pblank();
  87. pblank();
  88. DEFINE(D3DINSTRUCTION, wCount);
  89. DEFINE(D3DINSTRUCTION, bSize);
  90. DEFINE(D3DINSTRUCTION, bOpcode);
  91. DEFINE(D3DVERTEX, x);
  92. DEFINE(D3DVERTEX, y);
  93. DEFINE(D3DVERTEX, z);
  94. DEFINE(D3DVERTEX, tu);
  95. DEFINE(D3DVERTEX, tv);
  96. DEFINE(D3DHVERTEX, dwFlags);
  97. DEFINE(D3DHVERTEX, hx);
  98. DEFINE(D3DHVERTEX, hy);
  99. DEFINE(D3DHVERTEX, hz);
  100. printf("D3DHVERTEX_size equ %d\n", sizeof(D3DHVERTEX));
  101. DEFINE(D3DTRIANGLE, v1);
  102. DEFINE(D3DTRIANGLE, v2);
  103. DEFINE(D3DTRIANGLE, v3);
  104. DEFINE(D3DTRIANGLE, wFlags);
  105. printf("D3DTRIANGLE_size equ %d\n", sizeof(D3DTRIANGLE));
  106. DEFINE(D3DMATRIXI, _11);
  107. DEFINE(D3DMATRIXI, _12);
  108. DEFINE(D3DMATRIXI, _13);
  109. DEFINE(D3DMATRIXI, _14);
  110. DEFINE(D3DMATRIXI, _21);
  111. DEFINE(D3DMATRIXI, _22);
  112. DEFINE(D3DMATRIXI, _23);
  113. DEFINE(D3DMATRIXI, _24);
  114. DEFINE(D3DMATRIXI, _31);
  115. DEFINE(D3DMATRIXI, _32);
  116. DEFINE(D3DMATRIXI, _33);
  117. DEFINE(D3DMATRIXI, _34);
  118. DEFINE(D3DMATRIXI, _41);
  119. DEFINE(D3DMATRIXI, _42);
  120. DEFINE(D3DMATRIXI, _43);
  121. DEFINE(D3DMATRIXI, _44);
  122. printf("D3DMATRIXI_size equ %d\n", sizeof(D3DMATRIXI));
  123. printf("D3DFE_LIGHTING_size equ %d\n", sizeof(D3DFE_LIGHTING));
  124. printf("D3DFE_VIEWPORTCACHE_size equ %d\n", sizeof(D3DFE_VIEWPORTCACHE));
  125. MACRO(D3DOP_TRIANGLE);
  126. MACRO(D3DCS_LEFT);
  127. MACRO(D3DCS_RIGHT);
  128. MACRO(D3DCS_TOP);
  129. MACRO(D3DCS_BOTTOM);
  130. MACRO(D3DCS_FRONT);
  131. MACRO(D3DCS_BACK);
  132. MACRO(D3DTBLEND_COPY);
  133. MACRO(D3DSHADE_FLAT);
  134. MACRO(D3DCMP_LESSEQUAL);
  135. MACRO(D3DCMP_GREATEREQUAL);
  136. MACRO(D3DCMP_ALWAYS);
  137. MACRO(D3DSTATUS_ZNOTVISIBLE);
  138. MACRO(D3DDEV_DONOTCLIP);
  139. // Geometry pipeline
  140. pcomment("-------------------- VCACHE ------------------------------------");
  141. printVCACHE(scaleX);
  142. printVCACHE(scaleY);
  143. printVCACHE(scaleZ);
  144. printVCACHE(offsetX);
  145. printVCACHE(offsetY);
  146. printVCACHE(offsetZ);
  147. printVCACHE(minXgb);
  148. printVCACHE(minYgb);
  149. printVCACHE(maxXgb);
  150. printVCACHE(maxYgb);
  151. printVCACHE(minX);
  152. printVCACHE(minY);
  153. printVCACHE(maxX);
  154. printVCACHE(maxY);
  155. printVCACHE(gb11);
  156. printVCACHE(gb22);
  157. printVCACHE(gb41);
  158. printVCACHE(gb42);
  159. printVCACHE(Kgbx1);
  160. printVCACHE(Kgby1);
  161. printVCACHE(Kgbx2);
  162. printVCACHE(Kgby2);
  163. printVCACHE(dvX);
  164. printVCACHE(dvY);
  165. printVCACHE(dvWidth);
  166. printVCACHE(dvHeight);
  167. printVCACHE(scaleXi);
  168. printVCACHE(scaleYi);
  169. printVCACHE(minXi);
  170. printVCACHE(minYi);
  171. printVCACHE(maxXi);
  172. printVCACHE(maxYi);
  173. pcomment("---------------- D3DFE_LIGHTING ------------------------------------");
  174. printD3DFE_LIGHTING(diffuse);
  175. printD3DFE_LIGHTING(alpha);
  176. printD3DFE_LIGHTING(diffuse0);
  177. printD3DFE_LIGHTING(currentSpecTable);
  178. printD3DFE_LIGHTING(specular);
  179. printD3DFE_LIGHTING(outDiffuse);
  180. printD3DFE_LIGHTING(vertexAmbient);
  181. printD3DFE_LIGHTING(vertexDiffuse);
  182. printD3DFE_LIGHTING(outSpecular);
  183. printD3DFE_LIGHTING(vertexSpecular);
  184. printD3DFE_LIGHTING(dwLightingFlags);
  185. printD3DFE_LIGHTING(alphaSpecular);
  186. printD3DFE_LIGHTING(model_eye);
  187. printD3DFE_LIGHTING(activeLights);
  188. printD3DFE_LIGHTING(material);
  189. printD3DFE_LIGHTING(ambientSceneScaled);
  190. printD3DFE_LIGHTING(ambientScene);
  191. printD3DFE_LIGHTING(fog_mode);
  192. printD3DFE_LIGHTING(fog_density);
  193. printD3DFE_LIGHTING(fog_start);
  194. printD3DFE_LIGHTING(fog_end);
  195. printD3DFE_LIGHTING(fog_factor);
  196. printD3DFE_LIGHTING(specThreshold);
  197. printD3DFE_LIGHTING(ambient_save);
  198. printD3DFE_LIGHTING(materialAlpha);
  199. printD3DFE_LIGHTING(materialAlphaS);
  200. printD3DFE_LIGHTING(dwDiffuse0);
  201. printD3DFE_LIGHTING(directionToCamera);
  202. printD3DFE_LIGHTING(dwAmbientSrcIndex);
  203. printD3DFE_LIGHTING(dwDiffuseSrcIndex);
  204. printD3DFE_LIGHTING(dwSpecularSrcIndex);
  205. printD3DFE_LIGHTING(dwEmissiveSrcIndex);
  206. pcomment("---------------- D3DI_LIGHT ------------------------------------");
  207. printD3DI_LIGHT(model_position);
  208. printD3DI_LIGHT(type);
  209. printD3DI_LIGHT(model_direction);
  210. printD3DI_LIGHT(flags);
  211. printD3DI_LIGHT(falloff);
  212. printD3DI_LIGHT(inv_theta_minus_phi);
  213. printD3DI_LIGHT(halfway);
  214. printD3DI_LIGHT(next);
  215. printD3DI_LIGHT(range_squared);
  216. printD3DI_LIGHT(attenuation0);
  217. printD3DI_LIGHT(attenuation1);
  218. printD3DI_LIGHT(attenuation2);
  219. printD3DI_LIGHT(cos_theta_by_2);
  220. printD3DI_LIGHT(cos_phi_by_2);
  221. printD3DI_LIGHT(position);
  222. printD3DI_LIGHT(direction);
  223. printD3DI_LIGHT(range);
  224. pcomment("---------------- D3DFE_PROCESSVERTICES ------------------------------");
  225. printPV(mCTM);
  226. printPV(dwMaxTextureIndices);
  227. printPV(lighting);
  228. printPV(vcache);
  229. printPV(lpdwRStates);
  230. printPV(ClipperState);
  231. printPV(dwFlags);
  232. printPV(dwDeviceFlags);
  233. printPV(dwNumVertices);
  234. printPV(dwNumPrimitives);
  235. printPV(dwNumIndices);
  236. printPV(lpwIndices);
  237. printPV(primType);
  238. printPV(nTexCoord);
  239. printPV(position);
  240. printPV(normal);
  241. printPV(diffuse);
  242. printPV(specular);
  243. printPV(textures);
  244. printPV(dwVIDIn);
  245. printPV(dwVIDOut);
  246. printPV(dwOutputSize);
  247. printPV(lpvOut);
  248. printPV(lpClipFlags);
  249. printPV(dwClipUnion);
  250. printPV(dwClipIntersection);
  251. printPV(texOffset);
  252. printPV(normalOffset);
  253. printPV(diffuseOffset);
  254. printPV(specularOffset);
  255. printPV(texOffsetOut);
  256. printPV(diffuseOffsetOut);
  257. printPV(specularOffsetOut);
  258. printPV(dwClipMaskOffScreen);
  259. printPV(dwFirstClippedVertex);
  260. printPV(userClipPlane);
  261. printPV(dwFlags2);
  262. pcomment("---------------- CD3DHal ------------------------------------");
  263. printDevice(m_DeviceType );
  264. // printDevice(ddiType );
  265. // printDevice(lpD3DHALCallbacks );
  266. // printDevice(lpD3DHALGlobalDriverData );
  267. // printDevice(lpD3DHALCallbacks2 );
  268. // printDevice(lpD3DHALCallbacks3 );
  269. // printDevice(lpDD );
  270. // printDevice(lpD3DExtendedCaps);
  271. // printDevice(pfnRastService);
  272. printDevice(transform );
  273. printDevice(dwFEFlags);
  274. printDevice(specular_tables);
  275. printDevice(specular_table);
  276. printDevice(lightVertexFuncTable);
  277. printDevice(m_lpD3DMappedTexI);
  278. printDevice(m_dwHintFlags);
  279. // printDevice(lpwDPBuffer);
  280. printDevice(HVbuf);
  281. printDevice(rstates);
  282. printDevice(tsstates);
  283. pcomment("---------------- MISC ------------------------------------");
  284. /*
  285. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  286. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  287. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  288. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  289. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  290. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  291. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  292. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  293. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  294. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  295. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  296. pequate("DEVI_ ", OFFSET(CD3DHal, ));
  297. */
  298. pequate("_R_", 0);
  299. pequate("_G_", 4);
  300. pequate("_B_", 8);
  301. pequate("_X_", 0);
  302. pequate("_Y_", 4);
  303. pequate("_Z_", 8);
  304. pequate("_W_", 12);
  305. pequate("D3DLIGHTI_COMPUTE_SPECULAR ", D3DLIGHTI_COMPUTE_SPECULAR);
  306. pcomment("---------------- dwHintFlags-----------------------------------");
  307. pequate("D3DDEVBOOL_HINTFLAGS_INSCENE ", D3DDEVBOOL_HINTFLAGS_INSCENE );
  308. pequate("D3DDEVBOOL_HINTFLAGS_MULTITHREADED ", D3DDEVBOOL_HINTFLAGS_MULTITHREADED);
  309. pcomment("---------------- m_dwRuntimeFlags ---------------------------------");
  310. pequate("D3DRT_RECORDSTATEMODE ", D3DRT_RECORDSTATEMODE );
  311. pequate("D3DRT_EXECUTESTATEMODE ", D3DRT_EXECUTESTATEMODE );
  312. pequate("D3DRT_NEED_TEXTURE_UPDATE ", D3DRT_NEED_TEXTURE_UPDATE );
  313. pcomment("---------------- dwFEFlags ------------------------------------");
  314. pequate("D3DFE_WORLDMATRIX_DIRTY ", D3DFE_WORLDMATRIX_DIRTY );
  315. pequate("D3DFE_TLVERTEX ", D3DFE_TLVERTEX );
  316. pequate("D3DFE_PROJMATRIX_DIRTY ", D3DFE_PROJMATRIX_DIRTY );
  317. pequate("D3DFE_VIEWMATRIX_DIRTY ", D3DFE_VIEWMATRIX_DIRTY );
  318. pequate("D3DFE_NEED_TRANSFORM_LIGHTS ", D3DFE_NEED_TRANSFORM_LIGHTS );
  319. pequate("D3DFE_MATERIAL_DIRTY ", D3DFE_MATERIAL_DIRTY );
  320. pequate("D3DFE_CLIPPLANES_DIRTY ", D3DFE_CLIPPLANES_DIRTY );
  321. pequate("D3DFE_LIGHTS_DIRTY ", D3DFE_LIGHTS_DIRTY );
  322. pequate("D3DFE_VERTEXBLEND_DIRTY ", D3DFE_VERTEXBLEND_DIRTY );
  323. pequate("D3DFE_FRUSTUMPLANES_DIRTY ", D3DFE_FRUSTUMPLANES_DIRTY );
  324. pequate("D3DFE_WORLDVIEWMATRIX_DIRTY ", D3DFE_WORLDVIEWMATRIX_DIRTY );
  325. pequate("D3DFE_FVF_DIRTY ", D3DFE_FVF_DIRTY );
  326. pequate("D3DFE_MAP_TSS_TO_RS ", D3DFE_MAP_TSS_TO_RS );
  327. pequate("D3DFE_INVWORLDVIEWMATRIX_DIRTY ", D3DFE_INVWORLDVIEWMATRIX_DIRTY);
  328. pequate("D3DRT_LOSTSURFACES ", D3DRT_LOSTSURFACES );
  329. pequate("D3DFE_DISABLE_TEXTURES ", D3DFE_DISABLE_TEXTURES );
  330. pequate("D3DFE_CLIPMATRIX_DIRTY ", D3DFE_CLIPMATRIX_DIRTY );
  331. pequate("D3DFE_TLHAL ", D3DFE_TLHAL );
  332. pcomment("---------------- pv->dwFlags ------------------------------------");
  333. pequate("D3DPV_FOG ", D3DPV_FOG );
  334. pequate("D3DPV_DOCOLORVERTEX ", D3DPV_DOCOLORVERTEX );
  335. pequate("D3DPV_LIGHTING ", D3DPV_LIGHTING );
  336. pequate("D3DPV_SOA ", D3DPV_SOA );
  337. pequate("D3DPV_COLORVERTEX_E ", D3DPV_COLORVERTEX_E );
  338. pequate("D3DPV_COLORVERTEX_D ", D3DPV_COLORVERTEX_D );
  339. pequate("D3DPV_COLORVERTEX_S ", D3DPV_COLORVERTEX_S );
  340. pequate("D3DPV_COLORVERTEX_A ", D3DPV_COLORVERTEX_A );
  341. pequate("D3DPV_DONOTCOPYSPECULAR ", D3DPV_DONOTCOPYSPECULAR );
  342. pequate("D3DPV_NONCLIPPED ", D3DPV_NONCLIPPED );
  343. pequate("D3DPV_FRUSTUMPLANES_DIRTY ", D3DPV_FRUSTUMPLANES_DIRTY );
  344. pequate("D3DPV_VBCALL ", D3DPV_VBCALL );
  345. pequate("D3DPV_DONOTCOPYTEXTURE ", D3DPV_DONOTCOPYTEXTURE );
  346. pequate("D3DPV_TLVCLIP ", D3DPV_TLVCLIP );
  347. pequate("D3DPV_TRANSFORMONLY ", D3DPV_TRANSFORMONLY );
  348. pequate("D3DPV_DONOTCOPYDIFFUSE ", D3DPV_DONOTCOPYDIFFUSE );
  349. pequate("D3DPV_PERSIST ", D3DPV_PERSIST );
  350. pcomment("---------------- pv->dwDeviceFlags ------------------------------");
  351. pequate("D3DDEV_GUARDBAND ", D3DDEV_GUARDBAND );
  352. pequate("D3DDEV_RANGEBASEDFOG ", D3DDEV_RANGEBASEDFOG );
  353. pequate("D3DDEV_FOG ", D3DDEV_FOG );
  354. pequate("D3DDEV_SHADERDIRTY ", D3DDEV_SHADERDIRTY);
  355. pequate("D3DDEV_DONOTSTRIPELEMENTS ", D3DDEV_DONOTSTRIPELEMENTS);
  356. pequate("D3DDEV_VERTEXSHADERS ", D3DDEV_VERTEXSHADERS);
  357. pequate("D3DDEV_VBPROCVER ", D3DDEV_VBPROCVER);
  358. pequate("D3DDEV_DOPOINTSPRITEEMULATION ", D3DDEV_DOPOINTSPRITEEMULATION);
  359. pequate("D3DDEV_FLATSHADEMODE ", D3DDEV_FLATSHADEMODE);
  360. pequate("D3DDEV_SPECULARENABLE ", D3DDEV_SPECULARENABLE);
  361. pequate("D3DDEV_TRANSFORMEDFVF ", D3DDEV_TRANSFORMEDFVF);
  362. pequate("D3DDEV_INDEXEDVERTEXBLENDENABLE ", D3DDEV_INDEXEDVERTEXBLENDENABLE);
  363. pequate("D3DDEV_FRUSTUMPLANES_DIRTY ", D3DDEV_FRUSTUMPLANES_DIRTY);
  364. pequate("D3DDEV_TEXTRANSFORMDIRTY ", D3DDEV_TEXTRANSFORMDIRTY );
  365. pequate("D3DDEV_TRANSFORMDIRTY ", D3DDEV_TRANSFORMDIRTY );
  366. pequate("D3DDEV_REMAPTEXTUREINDICES ", D3DDEV_REMAPTEXTUREINDICES);
  367. pequate("D3DDEV_LIGHTSDIRTY ", D3DDEV_LIGHTSDIRTY );
  368. pequate("D3DDEV_DONOTCLIP ", D3DDEV_DONOTCLIP );
  369. pequate("D3DDEV_MODELSPACELIGHTING ", D3DDEV_MODELSPACELIGHTING );
  370. pequate("D3DDEV_LOCALVIEWER ", D3DDEV_LOCALVIEWER );
  371. pequate("D3DDEV_NORMALIZENORMALS ", D3DDEV_NORMALIZENORMALS );
  372. pequate("D3DDEV_TEXTURETRANSFORM ", D3DDEV_TEXTURETRANSFORM );
  373. pequate("D3DDEV_STRIDE ", D3DDEV_STRIDE );
  374. pequate("D3DDEV_COLORVERTEX ", D3DDEV_COLORVERTEX );
  375. pequate("D3DDEV_POSITIONINCAMERASPACE ", D3DDEV_POSITIONINCAMERASPACE);
  376. pequate("D3DDEV_NORMALINCAMERASPACE ", D3DDEV_NORMALINCAMERASPACE);
  377. pequate("D3DDEV_LIGHTING ", D3DDEV_LIGHTING);
  378. return 0;
  379. }