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.

297 lines
7.9 KiB

  1. ;-----------------------------------------------------------------------------
  2. ;
  3. ; This file contains x86 assembly attribute adders.
  4. ;
  5. ; Copyright (C) Microsoft Corporation, 1997.
  6. ;
  7. ; WARNING WARNING WARNING
  8. ; This assembly file generated from mas file.
  9. ; EDIT THE MAS FILE.
  10. ; I warned you.
  11. ; WARNING WARNING WARNING
  12. ;
  13. ;-----------------------------------------------------------------------------
  14. include(`m4hdr.mh')dnl
  15. include(`attrsx86.mh')dnl
  16. .386p
  17. .MODEL FLAT
  18. INCLUDE offs_acp.inc
  19. INCLUDE profile.inc
  20. .CODE
  21. dnl
  22. dnl d_AddAttrs
  23. dnl
  24. dnl Macro to build attribute adders.
  25. dnl
  26. dnl $1 is one of Z_Diff, Z_Diff_Spec, Z_Diff_Tex, Z_Diff_Spec_Tex,
  27. dnl Z_DIdx, Z_DIdx_Tex, Z_Tex.
  28. dnl
  29. define(`d_AddAttrs', `
  30. @AddFloatAttrs_$1@12 PROC SYSCALL PUBLIC,
  31. pStpCtx:DWORD
  32. PROF_ENTRY
  33. d_AddFloatAttrsBody(`$1')dnl
  34. ret 4
  35. @AddFloatAttrs_$1@12 ENDP
  36. IFDEF STEP_FIXED
  37. @AddFixedAttrs_$1@12 PROC SYSCALL PUBLIC,
  38. pStpCtx:DWORD
  39. PROF_ENTRY
  40. d_AddFixedAttrsBody(`$1')dnl
  41. ret 4
  42. @AddFixedAttrs_$1@12 ENDP
  43. ENDIF
  44. ')dnl
  45. dnl
  46. d_RepStr(`d_AddAttrs(AA)', `AA',
  47. `Z_Diff', `Z_Diff_Spec',
  48. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  49. `Z_DIdx', `Z_DIdx_Tex', `Z_Tex')dnl
  50. dnl
  51. dnl d_AddScaledAttrs
  52. dnl
  53. dnl Macro to build attribute scaled adder.
  54. dnl
  55. dnl $1 is one of Z_Diff, Z_Diff_Spec, Z_Diff_Tex, Z_Diff_Spec_Tex,
  56. dnl Z_DIdx, Z_DIdx_Tex, Z_Tex.
  57. dnl
  58. define(`d_AddScaledAttrs', `
  59. @AddScaledFloatAttrs_$1@16 PROC SYSCALL PUBLIC USES ebx,
  60. pStpCtx:DWORD, iScale:DWORD
  61. LOCAL fScaleVal:DWORD
  62. PROF_ENTRY
  63. fild iScale
  64. ; Save edx around multiply.
  65. mov ebx, edx
  66. ; Add surface pointers.
  67. mov eax, [edx+ATTRSET_ipSurface]
  68. imul eax, iScale
  69. fstp fScaleVal
  70. add eax, [ecx+ATTRSET_pSurface]
  71. mov [ecx+ATTRSET_pSurface], eax
  72. mov eax, [ebx+ATTRSET_ipZ]
  73. imul eax, iScale
  74. add eax, [ecx+ATTRSET_pZ]
  75. mov [ecx+ATTRSET_pZ], eax
  76. mov edx, ebx
  77. ifelse(eval(d_index(`$1', `Pwl') >= 0), `1',
  78. `
  79. ; Retrieve precomputed next values.
  80. mov ebx, pStpCtx
  81. mov eax, [ebx+SCTX_fNextOoW]
  82. mov [ecx+ATTRSET_fOoW], eax
  83. mov eax, [ebx+SCTX_fNextUoW1]
  84. mov [ecx+ATTRSET_fUoW1], eax
  85. mov eax, [ebx+SCTX_fNextVoW1]
  86. mov [ecx+ATTRSET_fVoW1], eax
  87. ')dnl
  88. ; Do FP scaled additions.
  89. ifelse(`$1', `Z_Diff',
  90. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fB',
  91. `ATTRSET_fG', `ATTRSET_fR',
  92. `ATTRSET_fA')dnl
  93. ')dnl
  94. ifelse(`$1', `Z_Diff_Spec',
  95. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fB',
  96. `ATTRSET_fG', `ATTRSET_fR')dnl
  97. d_AddScaledAttrsCode(`ATTRSET_fA', `ATTRSET_fBS',
  98. `ATTRSET_fGS', `ATTRSET_fRS')dnl
  99. ')dnl
  100. ifelse(`$1', `Z_Diff_Tex',
  101. `ifelse(eval(d_index(`$1', `Pwl') < 0), `1',
  102. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fOoW')dnl
  103. d_AddScaledUVowCode($1)
  104. ')dnl
  105. d_AddScaledAttrsCode(`ATTRSET_fB', `ATTRSET_fG',
  106. `ATTRSET_fR', `ATTRSET_fA')dnl
  107. ')dnl
  108. ifelse(`$1', `Z_Diff_Spec_Tex',
  109. `ifelse(eval(d_index(`$1', `Pwl') < 0), `1',
  110. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fOoW',
  111. `ATTRSET_fB', `ATTRSET_fG')dnl
  112. d_AddScaledUVowCode($1)
  113. d_AddScaledAttrsCode(`ATTRSET_fR', `ATTRSET_fA',
  114. `ATTRSET_fBS', `ATTRSET_fGS',
  115. `ATTRSET_fRS')dnl
  116. ',
  117. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fB',
  118. `ATTRSET_fG', `ATTRSET_fR')dnl
  119. d_AddScaledAttrsCode(`ATTRSET_fA', `ATTRSET_fBS',
  120. `ATTRSET_fGS', `ATTRSET_fRS')dnl
  121. ')dnl
  122. ')dnl
  123. ifelse(`$1', `Z_DIdx',
  124. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fDIdx',
  125. `ATTRSET_fDIdxA')dnl
  126. ')dnl
  127. ifelse(`$1', `Z_DIdx_Tex',
  128. `ifelse(eval(d_index(`$1', `Pwl') < 0), `1',
  129. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fOoW',
  130. `ATTRSET_fDIdx', `ATTRSET_fDIdxA')dnl
  131. d_AddScaledUVowCode($1)
  132. ',
  133. `d_AddScaledAttrsCode(`ATTRSET_fZ',
  134. `ATTRSET_fDIdx', `ATTRSET_fDIdxA')dnl
  135. ')dnl
  136. ')dnl
  137. ifelse(`$1', `Z_Tex',
  138. `ifelse(eval(d_index(`$1', `Pwl') < 0), `1',
  139. `d_AddScaledAttrsCode(`ATTRSET_fZ', `ATTRSET_fOoW')dnl
  140. d_AddScaledUVowCode($1)
  141. ',
  142. `d_AddScaledAttrsCode(`ATTRSET_fZ')dnl
  143. ')dnl
  144. ')dnl
  145. ret 8
  146. dnl
  147. ifelse(eval(d_index(`$1', `Pwl') < 0), `1',
  148. `
  149. ; Avoid warning
  150. mov eax, [pStpCtx]
  151. ')dnl
  152. @AddScaledFloatAttrs_$1@16 ENDP
  153. ')dnl
  154. dnl
  155. d_RepStr(`d_AddScaledAttrs(AA)', `AA',
  156. `Z_Diff', `Z_Diff_Spec',
  157. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  158. `Z_DIdx', `Z_DIdx_Tex', `Z_Tex')dnl
  159. dnl
  160. dnl d_FillSpanAttrs
  161. dnl
  162. dnl Macro to build attribute span store routines.
  163. dnl
  164. dnl $1 contains substrings Z, Diff, Spec, DIdx, Tex in any mix.
  165. dnl
  166. define(`d_FillSpanAttrs', `
  167. @FillSpanFloatAttrs_$1@16 PROC SYSCALL PUBLIC,
  168. pStpCtx:DWORD, cPix:DWORD
  169. ifelse(eval(d_index(`$1', `Diff') >= 0 || d_index(`$1', `Spec') >= 0), `1',
  170. `
  171. LOCAL iVal:DWORD
  172. ')dnl
  173. PROF_ENTRY
  174. d_FillSpanFloatAttrsBody(`$1')dnl
  175. ret 8
  176. ; Avoid warning
  177. mov eax, pStpCtx
  178. mov eax, cPix
  179. @FillSpanFloatAttrs_$1@16 ENDP
  180. IFDEF STEP_FIXED
  181. @FillSpanFixedAttrs_$1@16 PROC SYSCALL PUBLIC,
  182. pStpCtx:DWORD, cPix:DWORD
  183. PROF_ENTRY
  184. d_FillSpanFixedAttrsBody(`$1')dnl
  185. ret 8
  186. ; Avoid warning
  187. mov eax, pStpCtx
  188. mov eax, cPix
  189. @FillSpanFixedAttrs_$1@16 ENDP
  190. ENDIF
  191. ')dnl
  192. d_RepStr(`d_FillSpanAttrs(AA)', `AA',
  193. `Z_Diff', `Z_Diff_Spec',
  194. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  195. `Z_DIdx', `Z_DIdx_Tex', `Z_Tex')dnl
  196. dnl
  197. dnl d_FloatAttrsToFixed
  198. dnl
  199. dnl Macro to build attribute converter routine.
  200. dnl Attributes are converted in cache order.
  201. dnl
  202. dnl $1 contains substrings Z, Diff, Spec, Tex in any mix.
  203. dnl
  204. define(`d_FloatAttrsToFixed', `
  205. IFDEF STEP_FIXED
  206. @FloatAttrsToFixed_$1@12 PROC SYSCALL PUBLIC,
  207. pStpCtx:DWORD
  208. PROF_ENTRY
  209. ; Set surface pointers.
  210. mov eax, [ecx+ATTRSET_pSurface]
  211. mov [edx+ATTRSET_pSurface], eax
  212. mov eax, [ecx+ATTRSET_pZ]
  213. mov [edx+ATTRSET_pZ], eax
  214. ifelse(eval(d_index(`$1', `Z') >= 0), `1',
  215. `
  216. fld DWORD PTR [ecx+ATTRSET_fZ]
  217. fistp DWORD PTR [edx+ATTRSET_uZ]
  218. ')dnl
  219. ifelse(eval(d_index(`$1', `Tex') >= 0), `1',
  220. `
  221. fld DWORD PTR [ecx+ATTRSET_fOoW]
  222. fistp DWORD PTR [edx+ATTRSET_iOoW]
  223. ; Just in case ebx is used
  224. push ebx
  225. mov ebx, pStpCtx
  226. mov ebx, [ebx + SCTX_pCtx]
  227. xor eax, eax
  228. Loop$1:
  229. cmp eax, DWORD PTR[ebx + RCTX_cActTex]
  230. je Done$1
  231. fld DWORD PTR [ecx+ATTRSET_fUoW + 4 * eax]
  232. fistp DWORD PTR [edx+ATTRSET_iUoW + 4 * eax]
  233. fld DWORD PTR [ecx+ATTRSET_fVoW + 4 * eax]
  234. fistp DWORD PTR [edx+ATTRSET_iVoW + 4 * eax]
  235. inc eax
  236. jmp Loop$1
  237. Done$1:
  238. pop ebx
  239. ')dnl
  240. ifelse(eval(d_index(`$1', `Diff') >= 0), `1',
  241. `
  242. fld DWORD PTR [ecx+ATTRSET_fB]
  243. fistp DWORD PTR [edx+ATTRSET_iB]
  244. fld DWORD PTR [ecx+ATTRSET_fG]
  245. fistp DWORD PTR [edx+ATTRSET_iG]
  246. fld DWORD PTR [ecx+ATTRSET_fR]
  247. fistp DWORD PTR [edx+ATTRSET_iR]
  248. fld DWORD PTR [ecx+ATTRSET_fA]
  249. fistp DWORD PTR [edx+ATTRSET_iA]
  250. ')dnl
  251. ifelse(eval(d_index(`$1', `Spec') >= 0), `1',
  252. `
  253. fld DWORD PTR [ecx+ATTRSET_fBS]
  254. fistp DWORD PTR [edx+ATTRSET_iBS]
  255. fld DWORD PTR [ecx+ATTRSET_fGS]
  256. fistp DWORD PTR [edx+ATTRSET_iGS]
  257. fld DWORD PTR [ecx+ATTRSET_fRS]
  258. fistp DWORD PTR [edx+ATTRSET_iRS]
  259. ')dnl
  260. ret 4
  261. @FloatAttrsToFixed_$1@12 ENDP
  262. ENDIF
  263. ')dnl
  264. d_RepStr(`d_FloatAttrsToFixed(AA)', `AA',
  265. `Z_Diff', `Z_Diff_Spec',
  266. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  267. `Z_Tex')dnl
  268. END