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.

186 lines
5.7 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // offs_acp.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 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("RASTSPAN");
  52. SOFF(D3DI_RASTSPAN, uPix);
  53. SOFF(D3DI_RASTSPAN, uX);
  54. SOFF(D3DI_RASTSPAN, uY);
  55. SOFF(D3DI_RASTSPAN, pSurface);
  56. SOFF(D3DI_RASTSPAN, pZ);
  57. SOFF(D3DI_RASTSPAN, uZ);
  58. SOFF(D3DI_RASTSPAN, uB);
  59. SOFF(D3DI_RASTSPAN, uG);
  60. SOFF(D3DI_RASTSPAN, uR);
  61. SOFF(D3DI_RASTSPAN, uA);
  62. SOFF(D3DI_RASTSPAN, iIdx);
  63. SOFF(D3DI_RASTSPAN, iIdxA);
  64. SOFF(D3DI_RASTSPAN, uBS);
  65. SOFF(D3DI_RASTSPAN, uGS);
  66. SOFF(D3DI_RASTSPAN, uRS);
  67. SOFF(D3DI_RASTSPAN, uFog);
  68. SOFF(D3DI_RASTSPAN, iDFog);
  69. SOFF(D3DI_RASTSPAN, iW);
  70. SOFF(D3DI_RASTSPAN, iOoW);
  71. SOFF(D3DI_RASTSPAN, iUoW1);
  72. SOFF(D3DI_RASTSPAN, iVoW1);
  73. SOFF(D3DI_RASTSPAN, iUoW2);
  74. SOFF(D3DI_RASTSPAN, iVoW2);
  75. SOFF(D3DI_RASTSPAN, iLOD);
  76. SOFF(D3DI_RASTSPAN, iDLOD);
  77. EQ("SIZEOF_RASTSPAN", sizeof(D3DI_RASTSPAN));
  78. printf("\n");
  79. CSPRE("RASTPRIM");
  80. SOFF(D3DI_RASTPRIM, pNext);
  81. SOFF(D3DI_RASTPRIM, uFlags);
  82. SOFF(D3DI_RASTPRIM, uSpans);
  83. SOFF(D3DI_RASTPRIM, iDZDX);
  84. SOFF(D3DI_RASTPRIM, iDBDX);
  85. SOFF(D3DI_RASTPRIM, iDGDX);
  86. SOFF(D3DI_RASTPRIM, iDRDX);
  87. SOFF(D3DI_RASTPRIM, iDADX);
  88. SOFF(D3DI_RASTPRIM, iDIdxDX);
  89. SOFF(D3DI_RASTPRIM, iDIdxADX);
  90. SOFF(D3DI_RASTPRIM, iDBSDX);
  91. SOFF(D3DI_RASTPRIM, iDGSDX);
  92. SOFF(D3DI_RASTPRIM, iDRSDX);
  93. SOFF(D3DI_RASTPRIM, iDOoWDX);
  94. SOFF(D3DI_RASTPRIM, iDOoWDY);
  95. SOFF(D3DI_RASTPRIM, iDUoW1DX);
  96. SOFF(D3DI_RASTPRIM, iDVoW1DX);
  97. SOFF(D3DI_RASTPRIM, iDUoW1DY);
  98. SOFF(D3DI_RASTPRIM, iDVoW1DY);
  99. SOFF(D3DI_RASTPRIM, iDUoW2DX);
  100. SOFF(D3DI_RASTPRIM, iDVoW2DX);
  101. SOFF(D3DI_RASTPRIM, iDUoW2DY);
  102. SOFF(D3DI_RASTPRIM, iDVoW2DY);
  103. EQ("SIZEOF_RASTPRIM", sizeof(D3DI_RASTPRIM));
  104. printf("\n");
  105. COMMENT("D3DTLVERTEX");
  106. SPRE("TL");
  107. SOFF(D3DTLVERTEX, dvSZ);
  108. SOFF(D3DTLVERTEX, dvRHW);
  109. SOFF(D3DTLVERTEX, dcColor);
  110. SOFF(D3DTLVERTEX, dcSpecular);
  111. SOFF(D3DTLVERTEX, dvTU);
  112. SOFF(D3DTLVERTEX, dvTV);
  113. printf("\n");
  114. COMMENT("RASTCTX");
  115. SPRE("RCTX");
  116. SOFF(D3DI_RASTCTX, pdwRenderState);
  117. SOFF(D3DI_RASTCTX, iSurfaceStep);
  118. SOFF(D3DI_RASTCTX, iZStep);
  119. SOFF(D3DI_RASTCTX, iZBitCount);
  120. SOFF(D3DI_RASTCTX, pTexture);
  121. SOFF(D3DI_RASTCTX, RampBase);
  122. SOFF(D3DI_RASTCTX, RampSize);
  123. SOFF(D3DI_RASTCTX, bRampSpecular);
  124. SOFF(D3DI_RASTCTX, pTexRampMap);
  125. SOFF(D3DI_RASTCTX, pRampMap);
  126. SOFF(D3DI_RASTCTX, pPrim);
  127. SOFF(D3DI_RASTCTX, pSurfaceBits);
  128. SOFF(D3DI_RASTCTX, iSurfaceStride);
  129. SOFF(D3DI_RASTCTX, pZBits);
  130. SOFF(D3DI_RASTCTX, iZStride);
  131. SOFF(D3DI_RASTCTX, pFillParams);
  132. printf("\n");
  133. COMMENT("FILLPARAMS");
  134. SPRE("FPMS");
  135. SOFF(D3DI_FILLPARAMS, dwWrapU);
  136. SOFF(D3DI_FILLPARAMS, dwWrapV);
  137. SOFF(D3DI_FILLPARAMS, dwCullCCW);
  138. SOFF(D3DI_FILLPARAMS, dwCullCW);
  139. printf("\n");
  140. COMMENT("SPANTEX");
  141. SPRE("STEX");
  142. SOFF(D3DI_SPANTEX, iShiftU);
  143. SOFF(D3DI_SPANTEX, iShiftV);
  144. SOFF(D3DI_SPANTEX, uMaskU);
  145. SOFF(D3DI_SPANTEX, uMaskV);
  146. SOFF(D3DI_SPANTEX, pBits);
  147. SOFF(D3DI_SPANTEX, iShiftPitch);
  148. SOFF(D3DI_SPANTEX, iPaletteSize);
  149. SOFF(D3DI_SPANTEX, TransparentColor);
  150. SOFF(D3DI_SPANTEX, pRampmap);
  151. printf("\n");
  152. COMMENT("Flags");
  153. printf("\n");
  154. COMMENT("Miscellaneous defines.");
  155. EQ("D3DI_RASTPRIM_X_DEC", D3DI_RASTPRIM_X_DEC);
  156. EQ("TEX_FINAL_SHIFT", TEX_FINAL_SHIFT);
  157. printf("\n");
  158. COMMENT("FP constants.");
  159. TEXTERN("_g_fOne", "DWORD");
  160. TEXTERN("_g_fOoTwoPow20", "DWORD");
  161. TEXTERN("_g_fTwoPow27", "DWORD");
  162. TEQ("TEX_UVW_TO_FINAL_SCALE", "_g_fOoTwoPow20");
  163. TEQ("TEX_OOW_TO_FINAL_SCALE", "_g_fTwoPow27");
  164. exit(0);
  165. }