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.

314 lines
9.7 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_ || _IA64_)
  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 __cdecl 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, pSurface);
  53. SOFF(ATTRSET, pZ);
  54. SOFF(ATTRSET, fZ);
  55. SOFF(ATTRSET, fOoW);
  56. SOFF(ATTRSET, fUoW1);
  57. SOFF(ATTRSET, fVoW1);
  58. SOFF(ATTRSET, fUoW2);
  59. SOFF(ATTRSET, fVoW2);
  60. SOFF(ATTRSET, fB);
  61. SOFF(ATTRSET, fG);
  62. SOFF(ATTRSET, fR);
  63. SOFF(ATTRSET, fA);
  64. SOFF(ATTRSET, fDIdx);
  65. SOFF(ATTRSET, fDIdxA);
  66. SOFF(ATTRSET, fBS);
  67. SOFF(ATTRSET, fGS);
  68. SOFF(ATTRSET, fRS);
  69. SOFF(ATTRSET, fFog);
  70. SOFF(ATTRSET, ipSurface);
  71. SOFF(ATTRSET, ipZ);
  72. SOFF(ATTRSET, uZ);
  73. SOFF(ATTRSET, uB);
  74. SOFF(ATTRSET, uG);
  75. SOFF(ATTRSET, uR);
  76. SOFF(ATTRSET, uA);
  77. SOFF(ATTRSET, uBS);
  78. SOFF(ATTRSET, uGS);
  79. SOFF(ATTRSET, uRS);
  80. SOFF(ATTRSET, uFog);
  81. SOFF(ATTRSET, iZ);
  82. SOFF(ATTRSET, iOoW);
  83. SOFF(ATTRSET, iUoW1);
  84. SOFF(ATTRSET, iVoW1);
  85. SOFF(ATTRSET, iUoW2);
  86. SOFF(ATTRSET, iVoW2);
  87. SOFF(ATTRSET, iB);
  88. SOFF(ATTRSET, iG);
  89. SOFF(ATTRSET, iR);
  90. SOFF(ATTRSET, iA);
  91. SOFF(ATTRSET, iBS);
  92. SOFF(ATTRSET, iGS);
  93. SOFF(ATTRSET, iRS);
  94. SOFF(ATTRSET, iFog);
  95. EQ("SIZEOF_ATTRSET", sizeof(ATTRSET));
  96. printf("\n");
  97. CSPRE("RASTSPAN");
  98. SOFF(D3DI_RASTSPAN, uPix);
  99. SOFF(D3DI_RASTSPAN, uX);
  100. SOFF(D3DI_RASTSPAN, uY);
  101. SOFF(D3DI_RASTSPAN, pSurface);
  102. SOFF(D3DI_RASTSPAN, pZ);
  103. SOFF(D3DI_RASTSPAN, uZ);
  104. SOFF(D3DI_RASTSPAN, uB);
  105. SOFF(D3DI_RASTSPAN, uG);
  106. SOFF(D3DI_RASTSPAN, uR);
  107. SOFF(D3DI_RASTSPAN, uA);
  108. SOFF(D3DI_RASTSPAN, iIdx);
  109. SOFF(D3DI_RASTSPAN, iIdxA);
  110. SOFF(D3DI_RASTSPAN, uBS);
  111. SOFF(D3DI_RASTSPAN, uGS);
  112. SOFF(D3DI_RASTSPAN, uRS);
  113. SOFF(D3DI_RASTSPAN, uFog);
  114. SOFF(D3DI_RASTSPAN, iDFog);
  115. SOFF(D3DI_RASTSPAN, iW);
  116. SOFF(D3DI_RASTSPAN, iOoW);
  117. SOFF(D3DI_RASTSPAN, iUoW1);
  118. SOFF(D3DI_RASTSPAN, iVoW1);
  119. SOFF(D3DI_RASTSPAN, iUoW2);
  120. SOFF(D3DI_RASTSPAN, iVoW2);
  121. SOFF(D3DI_RASTSPAN, iLOD);
  122. SOFF(D3DI_RASTSPAN, iDLOD);
  123. EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
  124. printf("\n");
  125. CSPRE("RASTPRIM");
  126. SOFF(D3DI_RASTPRIM, uSpans);
  127. SOFF(D3DI_RASTPRIM, iDZDX);
  128. SOFF(D3DI_RASTPRIM, iDBDX);
  129. SOFF(D3DI_RASTPRIM, iDGDX);
  130. SOFF(D3DI_RASTPRIM, iDRDX);
  131. SOFF(D3DI_RASTPRIM, iDADX);
  132. SOFF(D3DI_RASTPRIM, iDIdxDX);
  133. SOFF(D3DI_RASTPRIM, iDIdxADX);
  134. SOFF(D3DI_RASTPRIM, iDBSDX);
  135. SOFF(D3DI_RASTPRIM, iDGSDX);
  136. SOFF(D3DI_RASTPRIM, iDRSDX);
  137. SOFF(D3DI_RASTPRIM, iDOoWDX);
  138. SOFF(D3DI_RASTPRIM, iDOoWDY);
  139. SOFF(D3DI_RASTPRIM, iDUoW1DX);
  140. SOFF(D3DI_RASTPRIM, iDVoW1DX);
  141. SOFF(D3DI_RASTPRIM, iDUoW1DY);
  142. SOFF(D3DI_RASTPRIM, iDVoW1DY);
  143. SOFF(D3DI_RASTPRIM, iDUoW2DX);
  144. SOFF(D3DI_RASTPRIM, iDVoW2DX);
  145. SOFF(D3DI_RASTPRIM, iDUoW2DY);
  146. SOFF(D3DI_RASTPRIM, iDVoW2DY);
  147. EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
  148. printf("\n");
  149. COMMENT("INTCARRYVAL");
  150. SPRE("ICV");
  151. SOFF(INTCARRYVAL, iV);
  152. SOFF(INTCARRYVAL, iFrac);
  153. SOFF(INTCARRYVAL, iDFrac);
  154. SOFF(INTCARRYVAL, iNC);
  155. SOFF(INTCARRYVAL, iCY);
  156. printf("\n");
  157. COMMENT("SETUPCTX");
  158. SPRE("SCTX");
  159. SOFF(SETUPCTX, PrimProcessor);
  160. SOFF(SETUPCTX, pCtx);
  161. SOFF(SETUPCTX, uFlags);
  162. SOFF(SETUPCTX, pFlatVtx);
  163. SOFF(SETUPCTX, X20);
  164. SOFF(SETUPCTX, iY);
  165. SOFF(SETUPCTX, Attr);
  166. SOFF(SETUPCTX, DAttrDX);
  167. SOFF(SETUPCTX, DAttrDY);
  168. SOFF(SETUPCTX, DAttrNC);
  169. SOFF(SETUPCTX, DAttrCY);
  170. SOFF(SETUPCTX, pPrim);
  171. SOFF(SETUPCTX, uPwlFlags);
  172. SOFF(SETUPCTX, fNextOoW);
  173. SOFF(SETUPCTX, fNextUoW1);
  174. SOFF(SETUPCTX, fNextVoW1);
  175. SOFF(SETUPCTX, iDLocalFogDX);
  176. SOFF(SETUPCTX, fDX10);
  177. SOFF(SETUPCTX, fDX20);
  178. SOFF(SETUPCTX, fDY10);
  179. SOFF(SETUPCTX, fDY20);
  180. SOFF(SETUPCTX, fOoDet);
  181. SOFF(SETUPCTX, fNX10);
  182. SOFF(SETUPCTX, fNX20);
  183. SOFF(SETUPCTX, fNY10);
  184. SOFF(SETUPCTX, fNY20);
  185. SOFF(SETUPCTX, fDX);
  186. SOFF(SETUPCTX, fDY);
  187. SOFF(SETUPCTX, fX20NC);
  188. SOFF(SETUPCTX, fX20CY);
  189. SOFF(SETUPCTX, pCtx);
  190. SOFF(SETUPCTX, pfnTriSetupFirstAttr);
  191. SOFF(SETUPCTX, pfnTriSetupZEnd);
  192. SOFF(SETUPCTX, pfnTriSetupTex1End);
  193. SOFF(SETUPCTX, pfnTriSetupTex2End);
  194. SOFF(SETUPCTX, pfnTriSetupDiffEnd);
  195. SOFF(SETUPCTX, pfnTriSetupSpecEnd);
  196. SOFF(SETUPCTX, pfnTriSetupFogEnd);
  197. printf("\n");
  198. COMMENT("D3DTLVERTEX");
  199. SPRE("TL");
  200. SOFF(D3DTLVERTEX, dvSZ);
  201. SOFF(D3DTLVERTEX, dvRHW);
  202. SOFF(D3DTLVERTEX, dcColor);
  203. SOFF(D3DTLVERTEX, dcSpecular);
  204. SOFF(D3DTLVERTEX, dvTU);
  205. SOFF(D3DTLVERTEX, dvTV);
  206. printf("\n");
  207. COMMENT("RAST_GENERIC_VERTEX");
  208. SPRE("TM");
  209. SOFF(RAST_GENERIC_VERTEX, dvTU2);
  210. SOFF(RAST_GENERIC_VERTEX, dvTV2);
  211. printf("\n");
  212. COMMENT("RASTCTX");
  213. SPRE("RCTX");
  214. SOFF(D3DI_RASTCTX, pdwRenderState);
  215. SOFF(D3DI_RASTCTX, iZBitCount);
  216. SOFF(D3DI_RASTCTX, pTexture);
  217. SOFF(D3DI_RASTCTX, RampBase);
  218. SOFF(D3DI_RASTCTX, RampSize);
  219. SOFF(D3DI_RASTCTX, bRampSpecular);
  220. printf("\n");
  221. COMMENT("SPANTEX");
  222. SPRE("STEX");
  223. printf("\n");
  224. COMMENT("Flags");
  225. EQ("TRIF_X_DEC", TRIF_X_DEC);
  226. EQ("TRIF_RASTPRIM_OVERFLOW", TRIF_RASTPRIM_OVERFLOW);
  227. EQ("PRIMF_FIXED_OVERFLOW", PRIMF_FIXED_OVERFLOW);
  228. EQ("PRIMSF_GLOBAL_FOG_USED", PRIMSF_GLOBAL_FOG_USED);
  229. printf("\n");
  230. COMMENT("D3DRENDERSTATE values.");
  231. EQ("RS_SHADEMODE", D3DRENDERSTATE_SHADEMODE*sizeof(DWORD));
  232. EQ("RS_WRAP0", D3DHAL_MAX_RSTATES_AND_STAGES*sizeof(DWORD));
  233. printf("\n");
  234. COMMENT("Miscellaneous defines.");
  235. EQ("D3DSHADE_FLAT", D3DSHADE_FLAT);
  236. EQ("D3DWRAP_U", D3DWRAP_U);
  237. EQ("D3DWRAP_V", D3DWRAP_V);
  238. printf("\n");
  239. COMMENT("FP constants.");
  240. TEXTERN("_g_fOne", "DWORD");
  241. TEXTERN("_g_fOo255", "DWORD");
  242. TEXTERN("_g_fTwoPow8", "DWORD");
  243. TEXTERN("_g_fTwoPow15", "DWORD");
  244. TEXTERN("_g_fOoTwoPow15", "DWORD");
  245. TEXTERN("_g_fTwoPow16", "DWORD");
  246. TEXTERN("_g_fOoTwoPow16", "DWORD");
  247. TEXTERN("_g_fTwoPow20", "DWORD");
  248. TEXTERN("_g_fTwoPow31", "DWORD");
  249. TEXTERN("_g_fNearTwoPow31", "DWORD");
  250. TEXTERN("_g_fOoTwoPow31", "DWORD");
  251. TEXTERN("_g_fOoNearTwoPow31", "DWORD");
  252. TEXTERN("_g_fTwoPow32", "DWORD");
  253. TEXTERN("_g_fNearTwoPow32", "DWORD");
  254. TEXTERN("_g_fTwoPow39", "DWORD");
  255. TEXTERN("_g_fTwoPow47", "DWORD");
  256. EQ("C_Z_LIMIT", C_Z_LIMIT);
  257. EQ("C_OOW_LIMIT", C_OOW_LIMIT);
  258. EQ("C_COLOR_LIMIT", C_COLOR_LIMIT);
  259. EQ("C_INDEX_COLOR_LIMIT", C_INDEX_COLOR_LIMIT);
  260. EQ("C_TEX_LIMIT", C_TEX_LIMIT);
  261. EQ("C_FOG_LIMIT", C_FOG_LIMIT);
  262. TEQF("Z16_FRAC_SCALE", "_g_fTwoPow%d", (Z16_FRAC_SHIFT));
  263. TEQF("OO_Z16_FRAC_SCALE", "_g_fOoTwoPow%d", (Z16_FRAC_SHIFT));
  264. TEQF("Z16_SCALE", "_g_fNearTwoPow%d", (Z16_SHIFT));
  265. if (Z32_FRAC_SHIFT == 0)
  266. {
  267. TEQ("Z32_FRAC_SCALE", "_g_fOne");
  268. TEQ("OO_Z32_FRAC_SCALE", "_g_fOoNearTwoPow31");
  269. }
  270. else
  271. {
  272. TEQF("Z32_FRAC_SCALE", "_g_fTwoPow%d", (Z32_FRAC_SHIFT));
  273. TEQF("OO_Z32_FRAC_SCALE", "_g_fOoNearTwoPow%d", (Z32_FRAC_SHIFT));
  274. }
  275. TEQF("Z32_SCALE", "_g_fNearTwoPow%d", (Z32_SHIFT));
  276. TEQF("OOW_SCALE", "_g_fNearTwoPow%d", (OOW_SHIFT));
  277. TEQF("OOW_W_SCALE", "_g_fTwoPow%d", (OOW_W_SHIFT));
  278. TEQF("COLOR_SCALE", "_g_fTwoPow%d", (COLOR_SHIFT));
  279. EQ("COLOR_SHIFT", COLOR_SHIFT);
  280. TEQF("INDEX_COLOR_SCALE", "_g_fTwoPow%d", (INDEX_COLOR_SHIFT));
  281. EQ("INDEX_COLOR_SHIFT", INDEX_COLOR_SHIFT);
  282. TEQF("INDEX_COLOR_FIXED_SCALE", "_g_fTwoPow%d", (INDEX_COLOR_FIXED_SHIFT));
  283. EQ("INDEX_COLOR_FIXED_SHIFT", INDEX_COLOR_FIXED_SHIFT);
  284. TEQF("TEX_SCALE", "_g_fTwoPow%d", (TEX_SHIFT));
  285. EQ("FOG_SHIFT", FOG_SHIFT);
  286. TEQF("FOG_SCALE", "_g_fTwoPow%d", (FOG_SHIFT));
  287. exit(0);
  288. }