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.

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