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.

301 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. typedef double DOUBLE;
  13. #include <d3dp.h>
  14. #include <rast.h>
  15. #include "stp_base.h"
  16. #define OFFSET(Struct, Field) FIELD_OFFSET(Struct, Field)
  17. char *pSPrefix = "";
  18. #ifdef _X86_
  19. #define EQ(Name, Value) printf("%s EQU 0%Xh\n", Name, Value)
  20. #define TEQ(Name, String) printf("%s EQU %s\n", Name, String)
  21. #define TEQF(Name, Fmt, Args) printf("%s EQU " Fmt "\n", Name, Args)
  22. #define SOFF(Struct, Field) \
  23. printf("%s_%s EQU 0%Xh\n", pSPrefix, #Field, OFFSET(Struct, Field))
  24. #define COMMENT(String) printf("; %s\n", String)
  25. #define TEXTERN(Name, Type) printf("EXTERN %s:%s\n", Name, Type)
  26. #define EXTERN(Name) TEXTERN(Name, "NEAR")
  27. #elif (_ALPHA_ || _IA64_)
  28. #define EQ(Name, Value) printf("#define %s 0x%X\n", Name, Value)
  29. #define TEQ(Name, String) printf("#define %s %s\n", Name, String)
  30. #define TEQF(Name, Fmt, Args) printf("#define %s " Fmt "\n", Name, Args)
  31. #define SOFF(Struct, Field) \
  32. printf("#define %s_%s 0x%X\n", pSPrefix, #Field, OFFSET(Struct, Field))
  33. #define COMMENT(String) printf("/* %s */\n", String)
  34. #define EXTERN(Name) printf("extern %s\n", Name)
  35. #define TEXTERN(Name, Type) printf("extern %s:%s\n", Name, Type)
  36. #endif
  37. #define SPRE(pPre) (pSPrefix = (pPre))
  38. #define CSPRE(pPre) (COMMENT(pPre), SPRE(pPre))
  39. void __cdecl main(int argc, char **argv)
  40. {
  41. COMMENT("------------------------------------------------------"
  42. "----------------------");
  43. COMMENT("");
  44. COMMENT(" Automatically generated structure offsets.");
  45. COMMENT(" NOTE: DO NOT EDIT BY HAND.");
  46. COMMENT("");
  47. COMMENT(" Copyright (C) Microsoft Corporation, 1997.");
  48. COMMENT("");
  49. COMMENT("------------------------------------------------------"
  50. "----------------------");
  51. printf("\n");
  52. CSPRE("ATTRSET");
  53. SOFF(ATTRSET, pSurface);
  54. SOFF(ATTRSET, pZ);
  55. SOFF(ATTRSET, fZ);
  56. SOFF(ATTRSET, fOoW);
  57. SOFF(ATTRSET, fUoW);
  58. SOFF(ATTRSET, fVoW);
  59. SOFF(ATTRSET, fB);
  60. SOFF(ATTRSET, fG);
  61. SOFF(ATTRSET, fR);
  62. SOFF(ATTRSET, fA);
  63. SOFF(ATTRSET, fDIdx);
  64. SOFF(ATTRSET, fDIdxA);
  65. SOFF(ATTRSET, fBS);
  66. SOFF(ATTRSET, fGS);
  67. SOFF(ATTRSET, fRS);
  68. SOFF(ATTRSET, fFog);
  69. SOFF(ATTRSET, ipSurface);
  70. SOFF(ATTRSET, ipZ);
  71. SOFF(ATTRSET, uZ);
  72. SOFF(ATTRSET, uB);
  73. SOFF(ATTRSET, uG);
  74. SOFF(ATTRSET, uR);
  75. SOFF(ATTRSET, uA);
  76. SOFF(ATTRSET, uBS);
  77. SOFF(ATTRSET, uGS);
  78. SOFF(ATTRSET, uRS);
  79. SOFF(ATTRSET, uFog);
  80. SOFF(ATTRSET, iZ);
  81. SOFF(ATTRSET, iOoW);
  82. SOFF(ATTRSET, iUoW);
  83. SOFF(ATTRSET, iVoW);
  84. SOFF(ATTRSET, iB);
  85. SOFF(ATTRSET, iG);
  86. SOFF(ATTRSET, iR);
  87. SOFF(ATTRSET, iA);
  88. SOFF(ATTRSET, iBS);
  89. SOFF(ATTRSET, iGS);
  90. SOFF(ATTRSET, iRS);
  91. SOFF(ATTRSET, iFog);
  92. EQ("SIZEOF_ATTRSET", sizeof(ATTRSET));
  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, iIdx);
  106. SOFF(D3DI_RASTSPAN, iIdxA);
  107. SOFF(D3DI_RASTSPAN, uBS);
  108. SOFF(D3DI_RASTSPAN, uGS);
  109. SOFF(D3DI_RASTSPAN, uRS);
  110. SOFF(D3DI_RASTSPAN, uFog);
  111. SOFF(D3DI_RASTSPAN, iDFog);
  112. SOFF(D3DI_RASTSPAN, iW);
  113. SOFF(D3DI_RASTSPAN, iOoW);
  114. SOFF(D3DI_RASTSPAN, UVoW);
  115. SOFF(D3DI_RASTSPAN, iLOD);
  116. SOFF(D3DI_RASTSPAN, iDLOD);
  117. EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
  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, iDIdxDX);
  127. SOFF(D3DI_RASTPRIM, iDIdxADX);
  128. SOFF(D3DI_RASTPRIM, iDBSDX);
  129. SOFF(D3DI_RASTPRIM, iDGSDX);
  130. SOFF(D3DI_RASTPRIM, iDRSDX);
  131. SOFF(D3DI_RASTPRIM, iDOoWDX);
  132. SOFF(D3DI_RASTPRIM, iDOoWDY);
  133. SOFF(D3DI_RASTPRIM, DUVoWDX);
  134. SOFF(D3DI_RASTPRIM, DUVoWDY);
  135. EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
  136. printf("\n");
  137. COMMENT("INTCARRYVAL");
  138. SPRE("ICV");
  139. SOFF(INTCARRYVAL, iV);
  140. SOFF(INTCARRYVAL, iFrac);
  141. SOFF(INTCARRYVAL, iDFrac);
  142. SOFF(INTCARRYVAL, iNC);
  143. SOFF(INTCARRYVAL, iCY);
  144. printf("\n");
  145. COMMENT("SETUPCTX");
  146. SPRE("SCTX");
  147. SOFF(SETUPCTX, PrimProcessor);
  148. SOFF(SETUPCTX, pCtx);
  149. SOFF(SETUPCTX, uFlags);
  150. SOFF(SETUPCTX, pFlatVtx);
  151. SOFF(SETUPCTX, X20);
  152. SOFF(SETUPCTX, iY);
  153. SOFF(SETUPCTX, Attr);
  154. SOFF(SETUPCTX, DAttrDX);
  155. SOFF(SETUPCTX, DAttrDY);
  156. SOFF(SETUPCTX, DAttrNC);
  157. SOFF(SETUPCTX, DAttrCY);
  158. SOFF(SETUPCTX, pPrim);
  159. SOFF(SETUPCTX, uPwlFlags);
  160. SOFF(SETUPCTX, fNextOoW);
  161. SOFF(SETUPCTX, fNextUoW1);
  162. SOFF(SETUPCTX, fNextVoW1);
  163. SOFF(SETUPCTX, iDLocalFogDX);
  164. SOFF(SETUPCTX, fDX10);
  165. SOFF(SETUPCTX, fDX20);
  166. SOFF(SETUPCTX, fDY10);
  167. SOFF(SETUPCTX, fDY20);
  168. SOFF(SETUPCTX, fOoDet);
  169. SOFF(SETUPCTX, fNX10);
  170. SOFF(SETUPCTX, fNX20);
  171. SOFF(SETUPCTX, fNY10);
  172. SOFF(SETUPCTX, fNY20);
  173. SOFF(SETUPCTX, fDX);
  174. SOFF(SETUPCTX, fDY);
  175. SOFF(SETUPCTX, fX20NC);
  176. SOFF(SETUPCTX, fX20CY);
  177. SOFF(SETUPCTX, pCtx);
  178. SOFF(SETUPCTX, pfnTriSetupFirstAttr);
  179. SOFF(SETUPCTX, pfnTriSetupZEnd);
  180. SOFF(SETUPCTX, pfnTriSetupTexEnd);
  181. SOFF(SETUPCTX, pfnTriSetupDiffEnd);
  182. SOFF(SETUPCTX, pfnTriSetupSpecEnd);
  183. SOFF(SETUPCTX, pfnTriSetupFogEnd);
  184. printf("\n");
  185. COMMENT("D3DTLVERTEX");
  186. SPRE("TL");
  187. SOFF(D3DTLVERTEX, dvSZ);
  188. SOFF(D3DTLVERTEX, dvRHW);
  189. SOFF(D3DTLVERTEX, dcColor);
  190. SOFF(D3DTLVERTEX, dcSpecular);
  191. SOFF(D3DTLVERTEX, dvTU);
  192. SOFF(D3DTLVERTEX, dvTV);
  193. printf("\n");
  194. COMMENT("RAST_GENERIC_VERTEX");
  195. SPRE("TM");
  196. SOFF(RAST_GENERIC_VERTEX, texCoord);
  197. printf("\n");
  198. COMMENT("RASTCTX");
  199. SPRE("RCTX");
  200. SOFF(D3DI_RASTCTX, pdwRenderState);
  201. SOFF(D3DI_RASTCTX, iZBitCount);
  202. SOFF(D3DI_RASTCTX, pTexture);
  203. SOFF(D3DI_RASTCTX, RampBase);
  204. SOFF(D3DI_RASTCTX, RampSize);
  205. SOFF(D3DI_RASTCTX, bRampSpecular);
  206. SOFF(D3DI_RASTCTX, cActTex);
  207. printf("\n");
  208. COMMENT("SPANTEX");
  209. SPRE("STEX");
  210. printf("\n");
  211. COMMENT("Flags");
  212. EQ("TRIF_X_DEC", TRIF_X_DEC);
  213. EQ("TRIF_RASTPRIM_OVERFLOW", TRIF_RASTPRIM_OVERFLOW);
  214. EQ("PRIMF_FIXED_OVERFLOW", PRIMF_FIXED_OVERFLOW);
  215. EQ("PRIMSF_GLOBAL_FOG_USED", PRIMSF_GLOBAL_FOG_USED);
  216. printf("\n");
  217. COMMENT("D3DRENDERSTATE values.");
  218. EQ("RS_SHADEMODE", D3DRS_SHADEMODE*sizeof(DWORD));
  219. EQ("RS_WRAP0", D3DRS_WRAP0*sizeof(DWORD));
  220. printf("\n");
  221. COMMENT("Miscellaneous defines.");
  222. EQ("D3DSHADE_FLAT", D3DSHADE_FLAT);
  223. EQ("D3DWRAP_U", D3DWRAP_U);
  224. EQ("D3DWRAP_V", D3DWRAP_V);
  225. printf("\n");
  226. COMMENT("FP constants.");
  227. TEXTERN("_g_fOne", "DWORD");
  228. TEXTERN("_g_fOo255", "DWORD");
  229. TEXTERN("_g_fTwoPow8", "DWORD");
  230. TEXTERN("_g_fTwoPow15", "DWORD");
  231. TEXTERN("_g_fOoTwoPow15", "DWORD");
  232. TEXTERN("_g_fTwoPow16", "DWORD");
  233. TEXTERN("_g_fOoTwoPow16", "DWORD");
  234. TEXTERN("_g_fTwoPow20", "DWORD");
  235. TEXTERN("_g_fTwoPow31", "DWORD");
  236. TEXTERN("_g_fNearTwoPow31", "DWORD");
  237. TEXTERN("_g_fOoTwoPow31", "DWORD");
  238. TEXTERN("_g_fOoNearTwoPow31", "DWORD");
  239. TEXTERN("_g_fTwoPow32", "DWORD");
  240. TEXTERN("_g_fNearTwoPow32", "DWORD");
  241. TEXTERN("_g_fTwoPow39", "DWORD");
  242. TEXTERN("_g_fTwoPow47", "DWORD");
  243. EQ("C_Z_LIMIT", C_Z_LIMIT);
  244. EQ("C_OOW_LIMIT", C_OOW_LIMIT);
  245. EQ("C_COLOR_LIMIT", C_COLOR_LIMIT);
  246. EQ("C_INDEX_COLOR_LIMIT", C_INDEX_COLOR_LIMIT);
  247. EQ("C_TEX_LIMIT", C_TEX_LIMIT);
  248. EQ("C_FOG_LIMIT", C_FOG_LIMIT);
  249. TEQF("Z16_FRAC_SCALE", "_g_fTwoPow%d", (Z16_FRAC_SHIFT));
  250. TEQF("OO_Z16_FRAC_SCALE", "_g_fOoTwoPow%d", (Z16_FRAC_SHIFT));
  251. TEQF("Z16_SCALE", "_g_fNearTwoPow%d", (Z16_SHIFT));
  252. if (Z32_FRAC_SHIFT == 0)
  253. {
  254. TEQ("Z32_FRAC_SCALE", "_g_fOne");
  255. TEQ("OO_Z32_FRAC_SCALE", "_g_fOoNearTwoPow31");
  256. }
  257. else
  258. {
  259. TEQF("Z32_FRAC_SCALE", "_g_fTwoPow%d", (Z32_FRAC_SHIFT));
  260. TEQF("OO_Z32_FRAC_SCALE", "_g_fOoNearTwoPow%d", (Z32_FRAC_SHIFT));
  261. }
  262. TEQF("Z32_SCALE", "_g_fNearTwoPow%d", (Z32_SHIFT));
  263. TEQF("OOW_SCALE", "_g_fNearTwoPow%d", (OOW_SHIFT));
  264. TEQF("OOW_W_SCALE", "_g_fTwoPow%d", (OOW_W_SHIFT));
  265. TEQF("COLOR_SCALE", "_g_fTwoPow%d", (COLOR_SHIFT));
  266. EQ("COLOR_SHIFT", COLOR_SHIFT);
  267. TEQF("INDEX_COLOR_SCALE", "_g_fTwoPow%d", (INDEX_COLOR_SHIFT));
  268. EQ("INDEX_COLOR_SHIFT", INDEX_COLOR_SHIFT);
  269. TEQF("INDEX_COLOR_FIXED_SCALE", "_g_fTwoPow%d", (INDEX_COLOR_FIXED_SHIFT));
  270. EQ("INDEX_COLOR_FIXED_SHIFT", INDEX_COLOR_FIXED_SHIFT);
  271. TEQF("TEX_SCALE", "_g_fTwoPow%d", (TEX_SHIFT));
  272. EQ("FOG_SHIFT", FOG_SHIFT);
  273. TEQF("FOG_SCALE", "_g_fTwoPow%d", (FOG_SHIFT));
  274. exit(0);
  275. }