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.

412 lines
13 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. #include <d3dp.h>
  13. #include <rast.h>
  14. #include "stp_base.h"
  15. #define OFFSET(Struct, Field) FIELD_OFFSET(Struct, Field)
  16. char *pSPrefix = "";
  17. #ifdef _X86_
  18. #define EQ(Name, Value) printf("%s EQU 0%Xh\n", Name, Value)
  19. #define TEQ(Name, String) printf("%s EQU %s\n", Name, String)
  20. #define TEQF(Name, Fmt, Args) printf("%s EQU " Fmt "\n", Name, Args)
  21. #define SOFF(Struct, Field) \
  22. printf("%s_%s EQU 0%Xh\n", pSPrefix, #Field, OFFSET(Struct, Field))
  23. #define COMMENT(String) printf("; %s\n", String)
  24. #define TEXTERN(Name, Type) printf("EXTERN %s:%s\n", Name, Type)
  25. #define EXTERN(Name) TEXTERN(Name, "NEAR")
  26. #elif _ALPHA_
  27. #define EQ(Name, Value) printf("#define %s 0x%X\n", Name, Value)
  28. #define TEQ(Name, String) printf("#define %s %s\n", Name, String)
  29. #define TEQF(Name, Fmt, Args) printf("#define %s " Fmt "\n", Name, Args)
  30. #define SOFF(Struct, Field) \
  31. printf("#define %s_%s 0x%X\n", pSPrefix, #Field, OFFSET(Struct, Field))
  32. #define COMMENT(String) printf("/* %s */\n", String)
  33. #define EXTERN(Name) printf("extern %s\n", Name)
  34. #define TEXTERN(Name, Type) printf("extern %s:%s\n", Name, Type)
  35. #endif
  36. #define SPRE(pPre) (pSPrefix = (pPre))
  37. #define CSPRE(pPre) (COMMENT(pPre), SPRE(pPre))
  38. void main(int argc, char **argv)
  39. {
  40. COMMENT("------------------------------------------------------"
  41. "----------------------");
  42. COMMENT("");
  43. COMMENT(" Automatically generated structure offsets.");
  44. COMMENT(" NOTE: DO NOT EDIT BY HAND.");
  45. COMMENT("");
  46. COMMENT(" Copyright (C) Microsoft Corporation, 1997.");
  47. COMMENT("");
  48. COMMENT("------------------------------------------------------"
  49. "----------------------");
  50. printf("\n");
  51. CSPRE("ATTRSET");
  52. SOFF(ATTRSET, fZ);
  53. SOFF(ATTRSET, fOoW);
  54. SOFF(ATTRSET, fB);
  55. SOFF(ATTRSET, fG);
  56. SOFF(ATTRSET, fR);
  57. SOFF(ATTRSET, fA);
  58. SOFF(ATTRSET, fUoW1);
  59. SOFF(ATTRSET, fVoW1);
  60. SOFF(ATTRSET, fBS);
  61. SOFF(ATTRSET, fGS);
  62. SOFF(ATTRSET, fRS);
  63. SOFF(ATTRSET, fFog);
  64. SOFF(ATTRSET, fUoW2);
  65. SOFF(ATTRSET, fVoW2);
  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, iUoW1);
  86. SOFF(ATTRSET, iVoW1);
  87. SOFF(ATTRSET, iBS);
  88. SOFF(ATTRSET, iGS);
  89. SOFF(ATTRSET, iRS);
  90. SOFF(ATTRSET, iFog);
  91. SOFF(ATTRSET, iUoW2);
  92. SOFF(ATTRSET, iVoW2);
  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, iUoW1);
  112. SOFF(D3DI_RASTSPAN, iVoW1);
  113. SOFF(D3DI_RASTSPAN, iUoW2);
  114. SOFF(D3DI_RASTSPAN, iVoW2);
  115. SOFF(D3DI_RASTSPAN, iLOD);
  116. SOFF(D3DI_RASTSPAN, iDLOD);
  117. SOFF(D3DI_RASTSPAN, iDFog);
  118. EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
  119. printf("\n");
  120. CSPRE("RASTPRIM");
  121. SOFF(D3DI_RASTPRIM, uSpans);
  122. SOFF(D3DI_RASTPRIM, iDZDX);
  123. SOFF(D3DI_RASTPRIM, iDBDX);
  124. SOFF(D3DI_RASTPRIM, iDGDX);
  125. SOFF(D3DI_RASTPRIM, iDRDX);
  126. SOFF(D3DI_RASTPRIM, iDADX);
  127. SOFF(D3DI_RASTPRIM, iDBSDX);
  128. SOFF(D3DI_RASTPRIM, iDGSDX);
  129. SOFF(D3DI_RASTPRIM, iDRSDX);
  130. SOFF(D3DI_RASTPRIM, iDOoWDX);
  131. SOFF(D3DI_RASTPRIM, iDOoWDY);
  132. SOFF(D3DI_RASTPRIM, iDUoW1DX);
  133. SOFF(D3DI_RASTPRIM, iDVoW1DX);
  134. SOFF(D3DI_RASTPRIM, iDUoW1DY);
  135. SOFF(D3DI_RASTPRIM, iDVoW1DY);
  136. SOFF(D3DI_RASTPRIM, iDUoW2DX);
  137. SOFF(D3DI_RASTPRIM, iDVoW2DX);
  138. SOFF(D3DI_RASTPRIM, iDUoW2DY);
  139. SOFF(D3DI_RASTPRIM, iDVoW2DY);
  140. SOFF(D3DI_RASTPRIM, uFlags);
  141. SOFF(D3DI_RASTPRIM, pNext);
  142. EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
  143. EQ("D3DI_RASTPRIM_X_DEC", D3DI_RASTPRIM_X_DEC);
  144. printf("\n");
  145. CSPRE("RASTCTX");
  146. SOFF(D3DI_RASTCTX, pPrim);
  147. SOFF(D3DI_RASTCTX, SI);
  148. SOFF(D3DI_RASTCTX, pSurfaceBits);
  149. SOFF(D3DI_RASTCTX, iSurfaceStep);
  150. SOFF(D3DI_RASTCTX, iSurfaceBitCount);
  151. SOFF(D3DI_RASTCTX, iSurfaceType);
  152. SOFF(D3DI_RASTCTX, pZBits);
  153. SOFF(D3DI_RASTCTX, iZStride);
  154. SOFF(D3DI_RASTCTX, iZStep);
  155. SOFF(D3DI_RASTCTX, iZBitCount);
  156. SOFF(D3DI_RASTCTX, pdwRenderState);
  157. SOFF(D3DI_RASTCTX, pTexture);
  158. SOFF(D3DI_RASTCTX, pfnRenderSpans);
  159. SOFF(D3DI_RASTCTX, pfnBegin);
  160. SOFF(D3DI_RASTCTX, pfnTestPassEnd);
  161. SOFF(D3DI_RASTCTX, pfnTestFailEnd);
  162. SOFF(D3DI_RASTCTX, pfnTex1AddrEnd);
  163. SOFF(D3DI_RASTCTX, pfnTexRead);
  164. SOFF(D3DI_RASTCTX, pfnTex2AddrEnd);
  165. SOFF(D3DI_RASTCTX, pfnTexBlendEnd);
  166. SOFF(D3DI_RASTCTX, pfnColorGenEnd);
  167. SOFF(D3DI_RASTCTX, pfnSrcBlend);
  168. SOFF(D3DI_RASTCTX, pfnDestBlend);
  169. SOFF(D3DI_RASTCTX, pfnBufRead);
  170. SOFF(D3DI_RASTCTX, pfnColorBlendEnd);
  171. SOFF(D3DI_RASTCTX, pfnAlphaTestPassEnd);
  172. SOFF(D3DI_RASTCTX, pfnAlphaTestFailEnd);
  173. SOFF(D3DI_RASTCTX, pfnPixelEnd);
  174. SOFF(D3DI_RASTCTX, pfnLoopEnd);
  175. SOFF(D3DI_RASTCTX, pfnTexBlendGetAlpha);
  176. SOFF(D3DI_RASTCTX, pfnTexBlendOpAlpha);
  177. SOFF(D3DI_RASTCTX, pfnTexBlendGetColor);
  178. SOFF(D3DI_RASTCTX, pfnTexBlendOpColor);
  179. SOFF(D3DI_RASTCTX, iZAndMask);
  180. SOFF(D3DI_RASTCTX, iZNeg);
  181. SOFF(D3DI_RASTCTX, iZXorMask);
  182. SOFF(D3DI_RASTCTX, iAAndMask);
  183. SOFF(D3DI_RASTCTX, iANeg);
  184. SOFF(D3DI_RASTCTX, iAXorMask);
  185. SOFF(D3DI_RASTCTX, iARef);
  186. SOFF(D3DI_RASTCTX, iSAndMask);
  187. SOFF(D3DI_RASTCTX, iSNeg);
  188. SOFF(D3DI_RASTCTX, iSXorMask);
  189. SOFF(D3DI_RASTCTX, pRampMap);
  190. SOFF(D3DI_RASTCTX, cActTex);
  191. EQ("SIZEOF_PFNTEXREAD", sizeof(PFNTEXREAD));
  192. EQ("SIZEOF_RASTCTX", sizeof(D3DI_RASTCTX));
  193. printf("\n");
  194. CSPRE("SPANITER");
  195. SOFF(D3DI_SPANITER, uBB);
  196. SOFF(D3DI_SPANITER, uBG);
  197. SOFF(D3DI_SPANITER, uBR);
  198. SOFF(D3DI_SPANITER, uBA);
  199. SOFF(D3DI_SPANITER, uFogB);
  200. SOFF(D3DI_SPANITER, uFogG);
  201. SOFF(D3DI_SPANITER, uFogR);
  202. SOFF(D3DI_SPANITER, uFog);
  203. SOFF(D3DI_SPANITER, iFogBDX);
  204. SOFF(D3DI_SPANITER, iFogGDX);
  205. SOFF(D3DI_SPANITER, iFogRDX);
  206. SOFF(D3DI_SPANITER, iDFog);
  207. SOFF(D3DI_SPANITER, uZDeferred);
  208. SOFF(D3DI_SPANITER, iU1);
  209. SOFF(D3DI_SPANITER, iV1);
  210. SOFF(D3DI_SPANITER, iU2);
  211. SOFF(D3DI_SPANITER, iV2);
  212. SOFF(D3DI_SPANITER, TexCol);
  213. SOFF(D3DI_SPANITER, uDitherOffset);
  214. SOFF(D3DI_SPANITER, iXStep);
  215. SOFF(D3DI_SPANITER, iDW);
  216. SOFF(D3DI_SPANITER, iSpecialW);
  217. SOFF(D3DI_SPANITER, bStencilPass);
  218. EQ("SIZEOF_SPANITER", sizeof(D3DI_SPANITER));
  219. printf("\n");
  220. CSPRE("SPANTEX");
  221. SOFF(D3DI_SPANTEX, uFlags);
  222. SOFF(D3DI_SPANTEX, Format);
  223. SOFF(D3DI_SPANTEX, TexAddrU);
  224. SOFF(D3DI_SPANTEX, TexAddrV);
  225. SOFF(D3DI_SPANTEX, uMagFilter);
  226. SOFF(D3DI_SPANTEX, uMinFilter);
  227. SOFF(D3DI_SPANTEX, uMipFilter);
  228. SOFF(D3DI_SPANTEX, BorderColor);
  229. SOFF(D3DI_SPANTEX, TransparentColor);
  230. SOFF(D3DI_SPANTEX, pBits);
  231. SOFF(D3DI_SPANTEX, pPalette);
  232. SOFF(D3DI_SPANTEX, cLOD);
  233. SOFF(D3DI_SPANTEX, iSizeU);
  234. SOFF(D3DI_SPANTEX, iSizeV);
  235. SOFF(D3DI_SPANTEX, iShiftU);
  236. SOFF(D3DI_SPANTEX, iShiftV);
  237. SOFF(D3DI_SPANTEX, iShiftPitch);
  238. SOFF(D3DI_SPANTEX, uMaskU);
  239. SOFF(D3DI_SPANTEX, uMaskV);
  240. SOFF(D3DI_SPANTEX, iFlipMaskU);
  241. SOFF(D3DI_SPANTEX, iFlipMaskV);
  242. SOFF(D3DI_SPANTEX, iClampMinU);
  243. SOFF(D3DI_SPANTEX, iClampMinV);
  244. SOFF(D3DI_SPANTEX, iClampMaxU);
  245. SOFF(D3DI_SPANTEX, iClampMaxV);
  246. SOFF(D3DI_SPANTEX, iClampEnU);
  247. SOFF(D3DI_SPANTEX, iClampEnV);
  248. EQ("SIZEOF_PSPANTEX", sizeof(PD3DI_SPANTEX));
  249. printf("\n");
  250. COMMENT("INTCARRYVAL");
  251. SPRE("ICV");
  252. SOFF(INTCARRYVAL, iV);
  253. SOFF(INTCARRYVAL, iFrac);
  254. SOFF(INTCARRYVAL, iDFrac);
  255. SOFF(INTCARRYVAL, iNC);
  256. SOFF(INTCARRYVAL, iCY);
  257. printf("\n");
  258. COMMENT("SETUPCTX");
  259. SPRE("SCTX");
  260. SOFF(SETUPCTX, uFlags);
  261. SOFF(SETUPCTX, X20);
  262. SOFF(SETUPCTX, iY);
  263. SOFF(SETUPCTX, Attr);
  264. SOFF(SETUPCTX, DAttrDX);
  265. SOFF(SETUPCTX, DAttrDY);
  266. SOFF(SETUPCTX, DAttrNC);
  267. SOFF(SETUPCTX, DAttrCY);
  268. SOFF(SETUPCTX, pPrim);
  269. SOFF(SETUPCTX, bNextValid);
  270. SOFF(SETUPCTX, fDX10);
  271. SOFF(SETUPCTX, fDX20);
  272. SOFF(SETUPCTX, fDY10);
  273. SOFF(SETUPCTX, fDY20);
  274. SOFF(SETUPCTX, fOoDet);
  275. SOFF(SETUPCTX, fNX10);
  276. SOFF(SETUPCTX, fNX20);
  277. SOFF(SETUPCTX, fNY10);
  278. SOFF(SETUPCTX, fNY20);
  279. SOFF(SETUPCTX, fDX);
  280. SOFF(SETUPCTX, fDY);
  281. SOFF(SETUPCTX, fX20NC);
  282. SOFF(SETUPCTX, fX20CY);
  283. SOFF(SETUPCTX, pCtx);
  284. printf("\n");
  285. COMMENT("D3DTLVERTEX");
  286. SPRE("TL");
  287. SOFF(D3DTLVERTEX, dvSZ);
  288. SOFF(D3DTLVERTEX, dvRHW);
  289. SOFF(D3DTLVERTEX, dcColor);
  290. SOFF(D3DTLVERTEX, dcSpecular);
  291. SOFF(D3DTLVERTEX, dvTU);
  292. SOFF(D3DTLVERTEX, dvTV);
  293. printf("\n");
  294. COMMENT("RASTCTX");
  295. SPRE("RCTX");
  296. SOFF(D3DI_RASTCTX, pdwRenderState);
  297. printf("\n");
  298. COMMENT("Flags");
  299. EQ("TRIP_X_DEC", TRIP_X_DEC);
  300. EQ("TRIP_RASTPRIM_OVERFLOW", TRIP_RASTPRIM_OVERFLOW);
  301. EQ("TRIP_FIXED_OVERFLOW", TRIP_FIXED_OVERFLOW);
  302. printf("\n");
  303. COMMENT("D3DRENDERSTATE values.");
  304. EQ("RS_ZBIAS", D3DRENDERSTATE_ZBIAS*sizeof(DWORD));
  305. EQ("RS_WRAPU", D3DRENDERSTATE_WRAPU*sizeof(DWORD));
  306. EQ("RS_WRAPV", D3DRENDERSTATE_WRAPV*sizeof(DWORD));
  307. EQ("RS_SHADEMODE", D3DRENDERSTATE_SHADEMODE*sizeof(DWORD));
  308. EQ("RS_STENCILREF", D3DRENDERSTATE_STENCILREF*sizeof(DWORD));
  309. EQ("RS_STENCILMASK", D3DRENDERSTATE_STENCILMASK*sizeof(DWORD));
  310. EQ("RS_STENCILPASS", D3DRENDERSTATE_STENCILPASS*sizeof(DWORD));
  311. EQ("RS_STENCILZFAIL", D3DRENDERSTATE_STENCILZFAIL*sizeof(DWORD));
  312. EQ("RS_STENCILFAIL", D3DRENDERSTATE_STENCILFAIL*sizeof(DWORD));
  313. EQ("RS_STENCILWRITEMASK", D3DRENDERSTATE_STENCILWRITEMASK*sizeof(DWORD));
  314. EQ("RS_ALPHAREF", D3DRENDERSTATE_ALPHAREF*sizeof(DWORD));
  315. EQ("RS_ROP2", D3DRENDERSTATE_ROP2*sizeof(DWORD));
  316. EQ("RS_TEXTUREPERSPECTIVE", D3DRENDERSTATE_TEXTUREPERSPECTIVE*sizeof(DWORD));
  317. EQ("RS_FOGCOLOR", D3DRENDERSTATE_FOGCOLOR*sizeof(DWORD));
  318. EQ("RS_FOGENABLE", D3DRENDERSTATE_FOGENABLE*sizeof(DWORD));
  319. EQ("RS_TEXTUREFACTOR", D3DRENDERSTATE_TEXTUREFACTOR*sizeof(DWORD));
  320. printf("\n");
  321. COMMENT("Raster Op values.");
  322. EQ("R2_BLACK", R2_BLACK);
  323. EQ("R2_NOTMERGEPEN", R2_NOTMERGEPEN);
  324. EQ("R2_MASKNOTPEN", R2_MASKNOTPEN);
  325. EQ("R2_NOTCOPYPEN", R2_NOTCOPYPEN);
  326. EQ("R2_MASKPENNOT", R2_MASKPENNOT);
  327. EQ("R2_NOT", R2_NOT);
  328. EQ("R2_XORPEN", R2_XORPEN);
  329. EQ("R2_NOTMASKPEN", R2_NOTMASKPEN);
  330. EQ("R2_MASKPEN", R2_MASKPEN);
  331. EQ("R2_NOTXORPEN", R2_NOTXORPEN);
  332. EQ("R2_NOP", R2_NOP);
  333. EQ("R2_MERGENOTPEN", R2_MERGENOTPEN);
  334. EQ("R2_COPYPEN", R2_COPYPEN);
  335. EQ("R2_MERGEPENNOT", R2_MERGEPENNOT);
  336. EQ("R2_MERGEPEN", R2_MERGEPEN);
  337. EQ("R2_WHITE", R2_WHITE);
  338. EQ("D3DSTENCILOP_KEEP", D3DSTENCILOP_KEEP);
  339. EQ("D3DSTENCILOP_ZERO", D3DSTENCILOP_ZERO);
  340. EQ("D3DSTENCILOP_REPLACE", D3DSTENCILOP_REPLACE);
  341. EQ("D3DSTENCILOP_INCRSAT", D3DSTENCILOP_INCRSAT);
  342. EQ("D3DSTENCILOP_DECRSAT", D3DSTENCILOP_DECRSAT);
  343. EQ("D3DSTENCILOP_INVERT", D3DSTENCILOP_INVERT);
  344. EQ("D3DSTENCILOP_INCR", D3DSTENCILOP_INCR);
  345. EQ("D3DSTENCILOP_DECR", D3DSTENCILOP_DECR);
  346. printf("\n");
  347. COMMENT("Miscellaneous defines.");
  348. EQ("D3DSHADE_FLAT", D3DSHADE_FLAT);
  349. EQ("D3DTFG_LINEAR", D3DTFG_LINEAR);
  350. EQ("D3DTFG_POINT", D3DTFG_POINT);
  351. EQ("TEX_TO_FINAL_SHIFT", TEX_TO_FINAL_SHIFT);
  352. EQ("TEX_SHIFT", TEX_SHIFT);
  353. EQ("TEX_FINAL_SHIFT", TEX_FINAL_SHIFT);
  354. EQ("RR_STYPE_B5G6R5", RR_STYPE_B5G6R5);
  355. EQ("RR_STYPE_B5G5R5", RR_STYPE_B5G5R5);
  356. /*
  357. printf("\n");
  358. COMMENT("FP constants.");
  359. TEXTERN("_g_fTwoPow8", "DWORD");
  360. TEXTERN("_g_fTwoPow16", "DWORD");
  361. TEXTERN("_g_fOoTwoPow16", "DWORD");
  362. TEXTERN("_g_fTwoPow20", "DWORD");
  363. TEXTERN("_g_fTwoPow31", "DWORD");
  364. TEXTERN("_g_fTwoPow39", "DWORD");
  365. EQ("C_Z_LIMIT", C_Z_LIMIT);
  366. EQ("C_OOW_LIMIT", C_OOW_LIMIT);
  367. EQ("C_COLOR_LIMIT", C_COLOR_LIMIT);
  368. EQ("C_TEX_LIMIT", C_TEX_LIMIT);
  369. //TEQF("Z_SCALE", "_g_fTwoPow%d", (Z_SHIFT));
  370. //TEQF("OOW_SCALE", "_g_fTwoPow%d", (OOW_SHIFT));
  371. //TEQF("OOW_W_SCALE", "_g_fTwoPow%d", (OOW_W_SHIFT));
  372. //TEQF("COLOR_SCALE", "_g_fTwoPow%d", (COLOR_SHIFT));
  373. //TEQF("TEX_SCALE", "_g_fTwoPow%d", (TEX_SHIFT));
  374. */
  375. exit(0);
  376. }