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.

318 lines
8.3 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // This file contains C++ attribute adders.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997.
  6. //
  7. // WARNING WARNING WARNING
  8. // This cpp file generated from mcp file.
  9. // EDIT THE MCP FILE.
  10. // I warned you.
  11. // WARNING WARNING WARNING
  12. //
  13. //-----------------------------------------------------------------------------
  14. include(`m4hdr.mh')dnl
  15. #include "rgb_pch.h"
  16. #include "attrs_mh.h"
  17. #pragma hdrstop
  18. dnl
  19. dnl d_AddAttrs
  20. dnl
  21. dnl Macro to build attribute adder.
  22. dnl
  23. dnl $1 contains substrings Z, Diff, Spec, DIdx, Tex in any mix.
  24. dnl
  25. define(`d_AddAttrs', `
  26. void FASTCALL
  27. AddFloatAttrs_$1(PATTRSET pAttr, PATTRSET pDelta, PSETUPCTX pStpCtx)
  28. {
  29. pAttr->pSurface += pDelta->ipSurface;
  30. pAttr->pZ += pDelta->ipZ;
  31. ifelse(eval(d_index(`$1', `Z') >= 0), `1',
  32. `
  33. pAttr->fZ += pDelta->fZ;
  34. ')dnl
  35. ifelse(eval(d_index(`$1', `Tex') >= 0), `1',
  36. `
  37. pAttr->fOoW += pDelta->fOoW;
  38. for (INT32 i = 0; i < (INT32)pStpCtx->pCtx->cActTex; i ++)
  39. {
  40. pAttr->fUoW[i] += pDelta->fUoW[i];
  41. pAttr->fVoW[i] += pDelta->fVoW[i];
  42. }
  43. ')dnl
  44. ifelse(eval(d_index(`$1', `Diff') >= 0), `1',
  45. `
  46. pAttr->fB += pDelta->fB;
  47. pAttr->fG += pDelta->fG;
  48. pAttr->fR += pDelta->fR;
  49. pAttr->fA += pDelta->fA;
  50. ')dnl
  51. ifelse(eval(d_index(`$1', `Spec') >= 0), `1',
  52. `
  53. pAttr->fBS += pDelta->fBS;
  54. pAttr->fGS += pDelta->fGS;
  55. pAttr->fRS += pDelta->fRS;
  56. ')dnl
  57. ifelse(eval(d_index(`$1', `DIdx') >= 0), `1',
  58. `
  59. pAttr->fDIdx += pDelta->fDIdx;
  60. pAttr->fDIdxA += pDelta->fDIdxA;
  61. ')dnl
  62. }
  63. #ifdef STEP_FIXED
  64. void FASTCALL
  65. AddFixedAttrs_$1(PATTRSET pAttr, PATTRSET pDelta)
  66. {
  67. pAttr->pSurface += pDelta->ipSurface;
  68. pAttr->pZ += pDelta->ipZ;
  69. ifelse(eval(d_index(`$1', `Z') >= 0), `1',
  70. `
  71. pAttr->uZ += pDelta->iZ;
  72. ')dnl
  73. ifelse(eval(d_index(`$1', `Tex') >= 0), `1',
  74. `
  75. pAttr->iOoW += pDelta->iOoW;
  76. for (INT32 i = 0; i < (INT32)pStpCtx->pCtx->cActTex; i ++)
  77. {
  78. pAttr->iUoW[i] += pDelta->iUoW[i];
  79. pAttr->iVoW[i] += pDelta->iVoW[i];
  80. }
  81. ')dnl
  82. ifelse(eval(d_index(`$1', `Diff') >= 0), `1',
  83. `
  84. pAttr->uB += pDelta->iB;
  85. pAttr->uG += pDelta->iG;
  86. pAttr->uR += pDelta->iR;
  87. pAttr->uA += pDelta->iA;
  88. ')dnl
  89. ifelse(eval(d_index(`$1', `Spec') >= 0), `1',
  90. `
  91. pAttr->uBS += pDelta->iBS;
  92. pAttr->uGS += pDelta->iGS;
  93. pAttr->uRS += pDelta->iRS;
  94. ')dnl
  95. ifelse(eval(d_index(`$1', `DIdx') >= 0), `1',
  96. `
  97. pAttr->uDIdx += pDelta->iDIdx;
  98. pAttr->uDIdxA += pDelta->iDIdxA;
  99. ')dnl
  100. }
  101. #endif
  102. ')dnl
  103. dnl
  104. d_RepStr(`d_AddAttrs(AA)', `AA',
  105. `Z_Diff', `Z_Diff_Spec',
  106. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  107. `Z_DIdx', `Z_DIdx_Tex', `Z_Tex')dnl
  108. dnl
  109. dnl d_AddScaledAttrs
  110. dnl
  111. dnl Macro to build scaled attribute adder.
  112. dnl
  113. dnl $1 contains substrings Z, Diff, Spec, DIdx, Tex in any mix.
  114. dnl
  115. define(`d_AddScaledAttrs', `
  116. void FASTCALL
  117. AddScaledFloatAttrs_$1(PATTRSET pAttr, PATTRSET pDelta,
  118. PSETUPCTX pStpCtx, INT iScale)
  119. {
  120. FLOAT fScale = (FLOAT)iScale;
  121. pAttr->pSurface += pDelta->ipSurface * iScale;
  122. pAttr->pZ += pDelta->ipZ * iScale;
  123. ifelse(eval(d_index(`$1', `Z') >= 0), `1',
  124. `
  125. pAttr->fZ += pDelta->fZ * fScale;
  126. ')dnl
  127. ifelse(eval(d_index(`$1', `Tex') >= 0), `1',
  128. `ifelse(eval(d_index(`$1', `Pwl') >= 0), `1',
  129. `
  130. pAttr->fOoW = pStpCtx->fNextOoW;
  131. pAttr->fUoW1 = pStpCtx->fNextUoW1;
  132. pAttr->fVoW1 = pStpCtx->fNextVoW1;
  133. ',
  134. `
  135. pAttr->fOoW += pDelta->fOoW * fScale;
  136. for (INT32 i = 0; i < (INT32)pStpCtx->pCtx->cActTex; i ++)
  137. {
  138. pAttr->fUoW[i] += pDelta->fUoW[i] * fScale;
  139. pAttr->fVoW[i] += pDelta->fVoW[i] * fScale;
  140. }
  141. ')dnl
  142. ')dnl
  143. ifelse(eval(d_index(`$1', `Diff') >= 0), `1',
  144. `
  145. pAttr->fB += pDelta->fB * fScale;
  146. pAttr->fG += pDelta->fG * fScale;
  147. pAttr->fR += pDelta->fR * fScale;
  148. pAttr->fA += pDelta->fA * fScale;
  149. ')dnl
  150. ifelse(eval(d_index(`$1', `Spec') >= 0), `1',
  151. `
  152. pAttr->fBS += pDelta->fBS * fScale;
  153. pAttr->fGS += pDelta->fGS * fScale;
  154. pAttr->fRS += pDelta->fRS * fScale;
  155. ')dnl
  156. ifelse(eval(d_index(`$1', `DIdx') >= 0), `1',
  157. `
  158. pAttr->fDIdx += pDelta->fDIdx * fScale;
  159. pAttr->fDIdxA += pDelta->fDIdxA * fScale;
  160. ')dnl
  161. }
  162. ')dnl
  163. dnl
  164. d_RepStr(`d_AddScaledAttrs(AA)', `AA',
  165. `Z_Diff', `Z_Diff_Spec',
  166. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  167. `Z_DIdx', `Z_DIdx_Tex', `Z_Tex')dnl
  168. dnl
  169. dnl d_FillSpanAttrs
  170. dnl
  171. dnl Macro to build attribute span store routine.
  172. dnl
  173. dnl $1 contains substrings Z, Diff, Spec, DIdx, Tex in any mix.
  174. dnl
  175. define(`d_FillSpanAttrs', `
  176. void FASTCALL
  177. FillSpanFloatAttrs_$1(PATTRSET pAttrs, PD3DI_RASTSPAN pSpan, PSETUPCTX pStpCtx,
  178. INT cPix)
  179. {
  180. pSpan->pSurface = pAttrs->pSurface;
  181. pSpan->pZ = pAttrs->pZ;
  182. ifelse(eval(d_index(`$1', `Z') >= 0), `1',
  183. `
  184. pSpan->uZ = FTOI(pAttrs->fZ);
  185. ')dnl
  186. ifelse(eval(d_index(`$1', `Tex') >= 0), `1',
  187. `
  188. pSpan->iOoW = FTOI(pAttrs->fOoW);
  189. pSpan->iW = FTOI(OOW_W_SCALE / pAttrs->fOoW);
  190. pSpan->iLOD = 0;
  191. pSpan->iDLOD = 0;
  192. for (INT32 i = 0; i < (INT32)pStpCtx->pCtx->cActTex; i ++)
  193. {
  194. pSpan->UVoW[i].iUoW = FTOI(pAttrs->fUoW[i]);
  195. pSpan->UVoW[i].iVoW = FTOI(pAttrs->fVoW[i]);
  196. }
  197. ')dnl
  198. ifelse(eval(d_index(`$1', `Diff') >= 0), `1',
  199. `
  200. pSpan->uB = (UINT16)FTOI(pAttrs->fB);
  201. pSpan->uG = (UINT16)FTOI(pAttrs->fG);
  202. pSpan->uR = (UINT16)FTOI(pAttrs->fR);
  203. pSpan->uA = (UINT16)FTOI(pAttrs->fA);
  204. ')dnl
  205. ifelse(eval(d_index(`$1', `Spec') >= 0), `1',
  206. `
  207. pSpan->uBS = (UINT16)FTOI(pAttrs->fBS);
  208. pSpan->uGS = (UINT16)FTOI(pAttrs->fGS);
  209. pSpan->uRS = (UINT16)FTOI(pAttrs->fRS);
  210. ')dnl
  211. ifelse(eval(d_index(`$1', `DIdx') >= 0), `1',
  212. `
  213. pSpan->iIdx = FTOI(pAttrs->fDIdx);
  214. pSpan->iIdxA = FTOI(pAttrs->fDIdx);
  215. ')dnl
  216. }
  217. #ifdef STEP_FIXED
  218. void FASTCALL
  219. FillSpanFixedAttrs_$1(PATTRSET pAttrs, PD3DI_RASTSPAN pSpan, PSETUPCTX pStpCtx,
  220. INT cPix)
  221. {
  222. pSpan->pSurface = pAttrs->pSurface;
  223. pSpan->pZ = pAttrs->pZ;
  224. ifelse(eval(d_index(`$1', `Z') >= 0), `1',
  225. `
  226. pSpan->uZ = pAttrs->uZ;
  227. ')dnl
  228. ifelse(eval(d_index(`$1', `Tex') >= 0), `1',
  229. `
  230. pSpan->iOoW = pAttrs->iOoW;
  231. pSpan->iW = FTOI(OOW_W_SCALE / (FLOAT)pAttrs->iOoW);
  232. pSpan->iLOD = 0;
  233. pSpan->iDLOD = 0;
  234. for (INT32 i = 0; i < (INT32)pStpCtx->pCtx->cActTex; i ++)
  235. {
  236. pSpan->UVoW[i].iUoW = pAttrs->iUoW[i];
  237. pSpan->UVoW[i].iVoW = pAttrs->iVoW[i];
  238. }
  239. ')dnl
  240. ifelse(eval(d_index(`$1', `Diff') >= 0), `1',
  241. `
  242. pSpan->uB = (UINT16)pAttrs->uB;
  243. pSpan->uG = (UINT16)pAttrs->uG;
  244. pSpan->uR = (UINT16)pAttrs->uR;
  245. pSpan->uA = (UINT16)pAttrs->uA;
  246. ')dnl
  247. ifelse(eval(d_index(`$1', `Spec') >= 0), `1',
  248. `
  249. pSpan->uBS = (UINT16)pAttrs->uBS;
  250. pSpan->uGS = (UINT16)pAttrs->uGS;
  251. pSpan->uRS = (UINT16)pAttrs->uRS;
  252. ')dnl
  253. }
  254. #endif
  255. ')dnl
  256. d_RepStr(`d_FillSpanAttrs(AA)', `AA',
  257. `Z_Diff', `Z_Diff_Spec',
  258. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  259. `Z_DIdx', `Z_DIdx_Tex', `Z_Tex')dnl
  260. dnl
  261. dnl d_FloatAttrsToFixed
  262. dnl
  263. dnl Macro to build attribute conversion routine.
  264. dnl
  265. dnl $1 contains substrings Z, Diff, Spec, Tex in any mix.
  266. dnl
  267. define(`d_FloatAttrsToFixed', `
  268. #ifdef STEP_FIXED
  269. void FASTCALL
  270. FloatAttrsToFixed_$1(PATTRSET pfAttrs, PATTRSET piAttrs, PSETUPCTX pStpCtx)
  271. {
  272. piAttrs->pSurface = pfAttrs->pSurface;
  273. piAttrs->pZ = pfAttrs->pZ;
  274. ifelse(eval(d_index(`$1', `Z') >= 0), `1',
  275. `
  276. piAttrs->uZ = FTOI(pfAttrs->fZ);
  277. ')dnl
  278. ifelse(eval(d_index(`$1', `Tex') >= 0), `1',
  279. `
  280. piAttrs->iOoW = FTOI(pfAttrs->fOoW);
  281. for (INT32 i = 0; i < (INT32)pStpCtx->pCtx->cActTex; i ++)
  282. {
  283. piAttrs->iUoW[i] = FTOI(pfAttrs->fUoW[i]);
  284. piAttrs->iVoW[i] = FTOI(pfAttrs->fVoW[i]);
  285. }
  286. ')dnl
  287. ifelse(eval(d_index(`$1', `Diff') >= 0), `1',
  288. `
  289. piAttrs->uB = (UINT16)FTOI(pfAttrs->fB);
  290. piAttrs->uG = (UINT16)FTOI(pfAttrs->fG);
  291. piAttrs->uR = (UINT16)FTOI(pfAttrs->fR);
  292. piAttrs->uA = (UINT16)FTOI(pfAttrs->fA);
  293. ')dnl
  294. ifelse(eval(d_index(`$1', `Spec') >= 0), `1',
  295. `
  296. piAttrs->uBS = (UINT16)FTOI(pfAttrs->fBS);
  297. piAttrs->uGS = (UINT16)FTOI(pfAttrs->fGS);
  298. piAttrs->uRS = (UINT16)FTOI(pfAttrs->fRS);
  299. ')dnl
  300. }
  301. #endif
  302. ')dnl
  303. d_RepStr(`d_FloatAttrsToFixed(AA)', `AA',
  304. `Z_Diff', `Z_Diff_Spec',
  305. `Z_Diff_Tex', `Z_Diff_Spec_Tex',
  306. `Z_Tex')dnl