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.

410 lines
14 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // setup.acp
  4. //
  5. // Assembly structure offset generator.
  6. //
  7. // Copyright (C) Microsoft Corporation, 1997.
  8. //
  9. //----------------------------------------------------------------------------
  10. #include <stdio.h>
  11. #include <windows.h>
  12. typedef double DOUBLE;
  13. #include <d3dp.h>
  14. #include <rast.h>
  15. // #include <refrast.hpp>
  16. #include "stp_base.h"
  17. #define OFFSET(Struct, Field) FIELD_OFFSET(Struct, Field)
  18. char *pSPrefix = "";
  19. #ifdef _X86_
  20. #define EQ(Name, Value) printf("%s EQU 0%Xh\n", Name, Value)
  21. #define TEQ(Name, String) printf("%s EQU %s\n", Name, String)
  22. #define TEQF(Name, Fmt, Args) printf("%s EQU " Fmt "\n", Name, Args)
  23. #define SOFF(Struct, Field) \
  24. printf("%s_%s EQU 0%Xh\n", pSPrefix, #Field, OFFSET(Struct, Field))
  25. #define COMMENT(String) printf("; %s\n", String)
  26. #define TEXTERN(Name, Type) printf("EXTERN %s:%s\n", Name, Type)
  27. #define EXTERN(Name) TEXTERN(Name, "NEAR")
  28. #elif _ALPHA_
  29. #define EQ(Name, Value) printf("#define %s 0x%X\n", Name, Value)
  30. #define TEQ(Name, String) printf("#define %s %s\n", Name, String)
  31. #define TEQF(Name, Fmt, Args) printf("#define %s " Fmt "\n", Name, Args)
  32. #define SOFF(Struct, Field) \
  33. printf("#define %s_%s 0x%X\n", pSPrefix, #Field, OFFSET(Struct, Field))
  34. #define COMMENT(String) printf("/* %s */\n", String)
  35. #define EXTERN(Name) printf("extern %s\n", Name)
  36. #define TEXTERN(Name, Type) printf("extern %s:%s\n", Name, Type)
  37. #endif
  38. #define SPRE(pPre) (pSPrefix = (pPre))
  39. #define CSPRE(pPre) (COMMENT(pPre), SPRE(pPre))
  40. void __cdecl main(int argc, char **argv)
  41. {
  42. COMMENT("------------------------------------------------------"
  43. "----------------------");
  44. COMMENT("");
  45. COMMENT(" Automatically generated structure offsets.");
  46. COMMENT(" NOTE: DO NOT EDIT BY HAND.");
  47. COMMENT("");
  48. COMMENT(" Copyright (C) Microsoft Corporation, 1997.");
  49. COMMENT("");
  50. COMMENT("------------------------------------------------------"
  51. "----------------------");
  52. printf("\n");
  53. CSPRE("ATTRSET");
  54. SOFF(ATTRSET, fZ);
  55. SOFF(ATTRSET, fOoW);
  56. SOFF(ATTRSET, fB);
  57. SOFF(ATTRSET, fG);
  58. SOFF(ATTRSET, fR);
  59. SOFF(ATTRSET, fA);
  60. SOFF(ATTRSET, fUoW);
  61. SOFF(ATTRSET, fVoW);
  62. SOFF(ATTRSET, fBS);
  63. SOFF(ATTRSET, fGS);
  64. SOFF(ATTRSET, fRS);
  65. SOFF(ATTRSET, fFog);
  66. SOFF(ATTRSET, pSurface);
  67. SOFF(ATTRSET, pZ);
  68. SOFF(ATTRSET, ipSurface);
  69. SOFF(ATTRSET, ipZ);
  70. SOFF(ATTRSET, uZ);
  71. SOFF(ATTRSET, uB);
  72. SOFF(ATTRSET, uG);
  73. SOFF(ATTRSET, uR);
  74. SOFF(ATTRSET, uA);
  75. SOFF(ATTRSET, uBS);
  76. SOFF(ATTRSET, uGS);
  77. SOFF(ATTRSET, uRS);
  78. SOFF(ATTRSET, uFog);
  79. SOFF(ATTRSET, iZ);
  80. SOFF(ATTRSET, iOoW);
  81. SOFF(ATTRSET, iB);
  82. SOFF(ATTRSET, iG);
  83. SOFF(ATTRSET, iR);
  84. SOFF(ATTRSET, iA);
  85. SOFF(ATTRSET, iUoW);
  86. SOFF(ATTRSET, iVoW);
  87. SOFF(ATTRSET, iBS);
  88. SOFF(ATTRSET, iGS);
  89. SOFF(ATTRSET, iRS);
  90. SOFF(ATTRSET, iFog);
  91. printf("ATTRSET_iUoW1 EQU 0%Xh\n", OFFSET(ATTRSET, iUoW));
  92. printf("ATTRSET_iVoW1 EQU 0%Xh\n", OFFSET(ATTRSET, iVoW));
  93. printf("\n");
  94. CSPRE("RASTSPAN");
  95. SOFF(D3DI_RASTSPAN, uPix);
  96. SOFF(D3DI_RASTSPAN, uX);
  97. SOFF(D3DI_RASTSPAN, uY);
  98. SOFF(D3DI_RASTSPAN, pSurface);
  99. SOFF(D3DI_RASTSPAN, pZ);
  100. SOFF(D3DI_RASTSPAN, uZ);
  101. SOFF(D3DI_RASTSPAN, uB);
  102. SOFF(D3DI_RASTSPAN, uG);
  103. SOFF(D3DI_RASTSPAN, uR);
  104. SOFF(D3DI_RASTSPAN, uA);
  105. SOFF(D3DI_RASTSPAN, uBS);
  106. SOFF(D3DI_RASTSPAN, uGS);
  107. SOFF(D3DI_RASTSPAN, uRS);
  108. SOFF(D3DI_RASTSPAN, uFog);
  109. SOFF(D3DI_RASTSPAN, iW);
  110. SOFF(D3DI_RASTSPAN, iOoW);
  111. SOFF(D3DI_RASTSPAN, UVoW);
  112. SOFF(D3DI_RASTSPAN, iLOD);
  113. SOFF(D3DI_RASTSPAN, iDLOD);
  114. SOFF(D3DI_RASTSPAN, iDFog);
  115. EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
  116. printf("RASTSPAN_iUoW1 EQU 0%Xh\n", OFFSET(D3DI_RASTSPAN, UVoW));
  117. printf("RASTSPAN_iVoW1 EQU 0%Xh\n", OFFSET(D3DI_RASTSPAN, UVoW) + sizeof(INT32));
  118. printf("\n");
  119. CSPRE("RASTPRIM");
  120. SOFF(D3DI_RASTPRIM, uSpans);
  121. SOFF(D3DI_RASTPRIM, iDZDX);
  122. SOFF(D3DI_RASTPRIM, iDBDX);
  123. SOFF(D3DI_RASTPRIM, iDGDX);
  124. SOFF(D3DI_RASTPRIM, iDRDX);
  125. SOFF(D3DI_RASTPRIM, iDADX);
  126. SOFF(D3DI_RASTPRIM, iDBSDX);
  127. SOFF(D3DI_RASTPRIM, iDGSDX);
  128. SOFF(D3DI_RASTPRIM, iDRSDX);
  129. SOFF(D3DI_RASTPRIM, DUVoWDX);
  130. SOFF(D3DI_RASTPRIM, DUVoWDY);
  131. SOFF(D3DI_RASTPRIM, iDOoWDX);
  132. SOFF(D3DI_RASTPRIM, uFlags);
  133. SOFF(D3DI_RASTPRIM, pNext);
  134. EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
  135. printf("RASTPRIM_iDUoW1DX EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDX));
  136. printf("RASTPRIM_iDVoW1DX EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDX) + sizeof(INT32));
  137. printf("RASTPRIM_iDUoW1DY EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDY));
  138. printf("RASTPRIM_iDVoW1DY EQU 0%Xh\n", OFFSET(D3DI_RASTPRIM, DUVoWDY) + sizeof(INT32));
  139. EQ("D3DI_RASTPRIM_X_DEC", D3DI_RASTPRIM_X_DEC);
  140. printf("\n");
  141. CSPRE("RASTCTX");
  142. SOFF(D3DI_RASTCTX, pPrim);
  143. SOFF(D3DI_RASTCTX, SI);
  144. SOFF(D3DI_RASTCTX, pSurfaceBits);
  145. SOFF(D3DI_RASTCTX, iSurfaceStep);
  146. SOFF(D3DI_RASTCTX, iSurfaceBitCount);
  147. SOFF(D3DI_RASTCTX, iSurfaceType);
  148. SOFF(D3DI_RASTCTX, pZBits);
  149. SOFF(D3DI_RASTCTX, iZStride);
  150. SOFF(D3DI_RASTCTX, iZStep);
  151. SOFF(D3DI_RASTCTX, iZBitCount);
  152. SOFF(D3DI_RASTCTX, pdwRenderState);
  153. SOFF(D3DI_RASTCTX, pTexture);
  154. SOFF(D3DI_RASTCTX, pfnRenderSpans);
  155. SOFF(D3DI_RASTCTX, pfnBegin);
  156. SOFF(D3DI_RASTCTX, pfnTestPassEnd);
  157. SOFF(D3DI_RASTCTX, pfnTestFailEnd);
  158. SOFF(D3DI_RASTCTX, pfnTexAddr);
  159. SOFF(D3DI_RASTCTX, pfnTexRead);
  160. SOFF(D3DI_RASTCTX, pfnTexAddrEnd);
  161. SOFF(D3DI_RASTCTX, pfnTexBlendEnd);
  162. SOFF(D3DI_RASTCTX, pfnColorGenEnd);
  163. SOFF(D3DI_RASTCTX, pfnSrcBlend);
  164. SOFF(D3DI_RASTCTX, pfnDestBlend);
  165. SOFF(D3DI_RASTCTX, pfnBufRead);
  166. SOFF(D3DI_RASTCTX, pfnColorBlendEnd);
  167. SOFF(D3DI_RASTCTX, pfnAlphaTestPassEnd);
  168. SOFF(D3DI_RASTCTX, pfnAlphaTestFailEnd);
  169. SOFF(D3DI_RASTCTX, pfnPixelEnd);
  170. SOFF(D3DI_RASTCTX, pfnLoopEnd);
  171. SOFF(D3DI_RASTCTX, pfnTexBlendGetAlpha);
  172. SOFF(D3DI_RASTCTX, pfnTexBlendOpAlpha);
  173. SOFF(D3DI_RASTCTX, pfnTexBlendGetColor);
  174. SOFF(D3DI_RASTCTX, pfnTexBlendOpColor);
  175. SOFF(D3DI_RASTCTX, iZAndMask);
  176. SOFF(D3DI_RASTCTX, iZNeg);
  177. SOFF(D3DI_RASTCTX, iZXorMask);
  178. SOFF(D3DI_RASTCTX, iAAndMask);
  179. SOFF(D3DI_RASTCTX, iANeg);
  180. SOFF(D3DI_RASTCTX, iAXorMask);
  181. SOFF(D3DI_RASTCTX, iARef);
  182. SOFF(D3DI_RASTCTX, iSAndMask);
  183. SOFF(D3DI_RASTCTX, iSNeg);
  184. SOFF(D3DI_RASTCTX, iSXorMask);
  185. SOFF(D3DI_RASTCTX, pRampMap);
  186. SOFF(D3DI_RASTCTX, cActTex);
  187. SOFF(D3DI_RASTCTX, cActBldStage);
  188. EQ("SIZEOF_PFNTEXREAD", sizeof(PFNTEXREAD));
  189. EQ("SIZEOF_RASTCTX", sizeof(D3DI_RASTCTX));
  190. EQ("SIZEOF_UV_UNION", sizeof(UV_UNION));
  191. EQ("SIZEOF_INT32", sizeof(INT32));
  192. printf("\n");
  193. CSPRE("SPANITER");
  194. SOFF(D3DI_SPANITER, uBB);
  195. SOFF(D3DI_SPANITER, uBG);
  196. SOFF(D3DI_SPANITER, uBR);
  197. SOFF(D3DI_SPANITER, uBA);
  198. SOFF(D3DI_SPANITER, uFogB);
  199. SOFF(D3DI_SPANITER, uFogG);
  200. SOFF(D3DI_SPANITER, uFogR);
  201. SOFF(D3DI_SPANITER, uFog);
  202. SOFF(D3DI_SPANITER, iFogBDX);
  203. SOFF(D3DI_SPANITER, iFogGDX);
  204. SOFF(D3DI_SPANITER, iFogRDX);
  205. SOFF(D3DI_SPANITER, iDFog);
  206. SOFF(D3DI_SPANITER, uZDeferred);
  207. SOFF(D3DI_SPANITER, TexUV);
  208. SOFF(D3DI_SPANITER, TexCol);
  209. SOFF(D3DI_SPANITER, uDitherOffset);
  210. SOFF(D3DI_SPANITER, iXStep);
  211. SOFF(D3DI_SPANITER, iDW);
  212. SOFF(D3DI_SPANITER, iSpecialW);
  213. SOFF(D3DI_SPANITER, bStencilPass);
  214. EQ("SIZEOF_SPANITER", sizeof(D3DI_SPANITER));
  215. printf("SPANITER_iU1 EQU 0%Xh\n", OFFSET(D3DI_SPANITER, TexUV));
  216. printf("SPANITER_iV1 EQU 0%Xh\n", OFFSET(D3DI_SPANITER, TexUV) + sizeof(INT32));
  217. printf("\n");
  218. CSPRE("SPANTEX");
  219. SOFF(D3DI_SPANTEX, uFlags);
  220. SOFF(D3DI_SPANTEX, Format);
  221. SOFF(D3DI_SPANTEX, TexAddrU);
  222. SOFF(D3DI_SPANTEX, TexAddrV);
  223. SOFF(D3DI_SPANTEX, uMagFilter);
  224. SOFF(D3DI_SPANTEX, uMinFilter);
  225. SOFF(D3DI_SPANTEX, uMipFilter);
  226. SOFF(D3DI_SPANTEX, BorderColor);
  227. SOFF(D3DI_SPANTEX, TransparentColor);
  228. SOFF(D3DI_SPANTEX, pBits);
  229. SOFF(D3DI_SPANTEX, pPalette);
  230. SOFF(D3DI_SPANTEX, cLOD);
  231. SOFF(D3DI_SPANTEX, iSizeU);
  232. SOFF(D3DI_SPANTEX, iSizeV);
  233. SOFF(D3DI_SPANTEX, iShiftU);
  234. SOFF(D3DI_SPANTEX, iShiftV);
  235. SOFF(D3DI_SPANTEX, iShiftPitch);
  236. SOFF(D3DI_SPANTEX, uMaskU);
  237. SOFF(D3DI_SPANTEX, uMaskV);
  238. SOFF(D3DI_SPANTEX, iFlipMaskU);
  239. SOFF(D3DI_SPANTEX, iFlipMaskV);
  240. SOFF(D3DI_SPANTEX, iClampMinU);
  241. SOFF(D3DI_SPANTEX, iClampMinV);
  242. SOFF(D3DI_SPANTEX, iClampMaxU);
  243. SOFF(D3DI_SPANTEX, iClampMaxV);
  244. SOFF(D3DI_SPANTEX, iClampEnU);
  245. SOFF(D3DI_SPANTEX, iClampEnV);
  246. EQ("SIZEOF_PSPANTEX", sizeof(PD3DI_SPANTEX));
  247. printf("\n");
  248. COMMENT("INTCARRYVAL");
  249. SPRE("ICV");
  250. SOFF(INTCARRYVAL, iV);
  251. SOFF(INTCARRYVAL, iFrac);
  252. SOFF(INTCARRYVAL, iDFrac);
  253. SOFF(INTCARRYVAL, iNC);
  254. SOFF(INTCARRYVAL, iCY);
  255. printf("\n");
  256. COMMENT("SETUPCTX");
  257. SPRE("SCTX");
  258. SOFF(SETUPCTX, uFlags);
  259. SOFF(SETUPCTX, X20);
  260. SOFF(SETUPCTX, iY);
  261. SOFF(SETUPCTX, Attr);
  262. SOFF(SETUPCTX, DAttrDX);
  263. SOFF(SETUPCTX, DAttrDY);
  264. SOFF(SETUPCTX, DAttrNC);
  265. SOFF(SETUPCTX, DAttrCY);
  266. SOFF(SETUPCTX, pPrim);
  267. SOFF(SETUPCTX, bNextValid);
  268. SOFF(SETUPCTX, fDX10);
  269. SOFF(SETUPCTX, fDX20);
  270. SOFF(SETUPCTX, fDY10);
  271. SOFF(SETUPCTX, fDY20);
  272. SOFF(SETUPCTX, fOoDet);
  273. SOFF(SETUPCTX, fNX10);
  274. SOFF(SETUPCTX, fNX20);
  275. SOFF(SETUPCTX, fNY10);
  276. SOFF(SETUPCTX, fNY20);
  277. SOFF(SETUPCTX, fDX);
  278. SOFF(SETUPCTX, fDY);
  279. SOFF(SETUPCTX, fX20NC);
  280. SOFF(SETUPCTX, fX20CY);
  281. SOFF(SETUPCTX, pCtx);
  282. printf("\n");
  283. COMMENT("D3DTLVERTEX");
  284. SPRE("TL");
  285. SOFF(D3DTLVERTEX, dvSZ);
  286. SOFF(D3DTLVERTEX, dvRHW);
  287. SOFF(D3DTLVERTEX, dcColor);
  288. SOFF(D3DTLVERTEX, dcSpecular);
  289. SOFF(D3DTLVERTEX, dvTU);
  290. SOFF(D3DTLVERTEX, dvTV);
  291. printf("\n");
  292. COMMENT("RASTCTX");
  293. SPRE("RCTX");
  294. SOFF(D3DI_RASTCTX, pdwRenderState);
  295. printf("\n");
  296. COMMENT("Flags");
  297. EQ("TRIP_X_DEC", TRIP_X_DEC);
  298. EQ("TRIP_RASTPRIM_OVERFLOW", TRIP_RASTPRIM_OVERFLOW);
  299. EQ("TRIP_FIXED_OVERFLOW", TRIP_FIXED_OVERFLOW);
  300. printf("\n");
  301. COMMENT("D3DRENDERSTATE values.");
  302. EQ("RS_ZBIAS", D3DRS_ZBIAS*sizeof(DWORD));
  303. // EQ("RS_WRAPU", D3DRENDERSTATE_WRAPU*sizeof(DWORD));
  304. // EQ("RS_WRAPV", D3DRENDERSTATE_WRAPV*sizeof(DWORD));
  305. EQ("RS_SHADEMODE", D3DRS_SHADEMODE*sizeof(DWORD));
  306. EQ("RS_STENCILREF", D3DRS_STENCILREF*sizeof(DWORD));
  307. EQ("RS_STENCILMASK", D3DRS_STENCILMASK*sizeof(DWORD));
  308. EQ("RS_STENCILPASS", D3DRS_STENCILPASS*sizeof(DWORD));
  309. EQ("RS_STENCILZFAIL", D3DRS_STENCILZFAIL*sizeof(DWORD));
  310. EQ("RS_STENCILFAIL", D3DRS_STENCILFAIL*sizeof(DWORD));
  311. EQ("RS_STENCILWRITEMASK", D3DRS_STENCILWRITEMASK*sizeof(DWORD));
  312. EQ("RS_ALPHAREF", D3DRS_ALPHAREF*sizeof(DWORD));
  313. // EQ("RS_ROP2", D3DRENDERSTATE_ROP2*sizeof(DWORD));
  314. // EQ("RS_TEXTUREPERSPECTIVE", D3DRENDERSTATE_TEXTUREPERSPECTIVE*sizeof(DWORD));
  315. EQ("RS_FOGCOLOR", D3DRS_FOGCOLOR*sizeof(DWORD));
  316. EQ("RS_FOGENABLE", D3DRS_FOGENABLE*sizeof(DWORD));
  317. EQ("RS_TEXTUREFACTOR", D3DRS_TEXTUREFACTOR*sizeof(DWORD));
  318. printf("\n");
  319. COMMENT("Raster Op values.");
  320. // EQ("R2_BLACK", R2_BLACK);
  321. // EQ("R2_NOTMERGEPEN", R2_NOTMERGEPEN);
  322. // EQ("R2_MASKNOTPEN", R2_MASKNOTPEN);
  323. // EQ("R2_NOTCOPYPEN", R2_NOTCOPYPEN);
  324. // EQ("R2_MASKPENNOT", R2_MASKPENNOT);
  325. // EQ("R2_NOT", R2_NOT);
  326. // EQ("R2_XORPEN", R2_XORPEN);
  327. // EQ("R2_NOTMASKPEN", R2_NOTMASKPEN);
  328. // EQ("R2_MASKPEN", R2_MASKPEN);
  329. // EQ("R2_NOTXORPEN", R2_NOTXORPEN);
  330. // EQ("R2_NOP", R2_NOP);
  331. // EQ("R2_MERGENOTPEN", R2_MERGENOTPEN);
  332. // EQ("R2_COPYPEN", R2_COPYPEN);
  333. // EQ("R2_MERGEPENNOT", R2_MERGEPENNOT);
  334. // EQ("R2_MERGEPEN", R2_MERGEPEN);
  335. // EQ("R2_WHITE", R2_WHITE);
  336. EQ("D3DSTENCILOP_KEEP", D3DSTENCILOP_KEEP);
  337. EQ("D3DSTENCILOP_ZERO", D3DSTENCILOP_ZERO);
  338. EQ("D3DSTENCILOP_REPLACE", D3DSTENCILOP_REPLACE);
  339. EQ("D3DSTENCILOP_INCRSAT", D3DSTENCILOP_INCRSAT);
  340. EQ("D3DSTENCILOP_DECRSAT", D3DSTENCILOP_DECRSAT);
  341. EQ("D3DSTENCILOP_INVERT", D3DSTENCILOP_INVERT);
  342. EQ("D3DSTENCILOP_INCR", D3DSTENCILOP_INCR);
  343. EQ("D3DSTENCILOP_DECR", D3DSTENCILOP_DECR);
  344. printf("\n");
  345. COMMENT("Miscellaneous defines.");
  346. EQ("D3DSHADE_FLAT", D3DSHADE_FLAT);
  347. EQ("D3DTFG_LINEAR", D3DTFG_LINEAR);
  348. EQ("D3DTFG_POINT", D3DTFG_POINT);
  349. EQ("TEX_TO_FINAL_SHIFT", TEX_TO_FINAL_SHIFT);
  350. EQ("TEX_SHIFT", TEX_SHIFT);
  351. EQ("TEX_FINAL_SHIFT", TEX_FINAL_SHIFT);
  352. EQ("RAST_STYPE_B5G6R5", RAST_STYPE_B5G6R5);
  353. EQ("RAST_STYPE_B5G5R5", RAST_STYPE_B5G5R5);
  354. /*
  355. printf("\n");
  356. COMMENT("FP constants.");
  357. TEXTERN("_g_fTwoPow8", "DWORD");
  358. TEXTERN("_g_fTwoPow16", "DWORD");
  359. TEXTERN("_g_fOoTwoPow16", "DWORD");
  360. TEXTERN("_g_fTwoPow20", "DWORD");
  361. TEXTERN("_g_fTwoPow31", "DWORD");
  362. TEXTERN("_g_fTwoPow39", "DWORD");
  363. EQ("C_Z_LIMIT", C_Z_LIMIT);
  364. EQ("C_OOW_LIMIT", C_OOW_LIMIT);
  365. EQ("C_COLOR_LIMIT", C_COLOR_LIMIT);
  366. EQ("C_TEX_LIMIT", C_TEX_LIMIT);
  367. //TEQF("Z_SCALE", "_g_fTwoPow%d", (Z_SHIFT));
  368. //TEQF("OOW_SCALE", "_g_fTwoPow%d", (OOW_SHIFT));
  369. //TEQF("OOW_W_SCALE", "_g_fTwoPow%d", (OOW_W_SHIFT));
  370. //TEQF("COLOR_SCALE", "_g_fTwoPow%d", (COLOR_SHIFT));
  371. //TEQF("TEX_SCALE", "_g_fTwoPow%d", (TEX_SHIFT));
  372. */
  373. exit(0);
  374. }