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.

99 lines
2.7 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // This file contains color blend functions.
  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 "pch.cpp"
  16. #pragma hdrstop
  17. #include "catest_mh.h"
  18. extern UINT16 g_uDitherTable[16];
  19. dnl
  20. dnl d_DoZWrite
  21. dnl
  22. dnl Inserts conditional Z Defered write code
  23. dnl $1 the function type, $2 is the format of the Z buffer.
  24. dnl
  25. define(`d_DoZWrite', `ifelse(`$1', `NoZWrite', `',
  26. `*((UINT$2*)pS->pZ) = (UINT$2)pCtx->SI.uZDeferred;')')dnl
  27. dnl
  28. dnl d_DoEnd
  29. dnl
  30. dnl $1 is NoStencil or Stencil
  31. dnl
  32. define(`d_DoEnd', `ifelse($1, `NoStencil',
  33. `pCtx->pfnAlphaTestPassEnd(pCtx, pP, pS);',
  34. `if (pCtx->SI.bStencilPass)
  35. {
  36. pCtx->pfnAlphaTestPassEnd(pCtx, pP, pS);
  37. }
  38. else
  39. {
  40. // in the C code this does a return, since this is the
  41. // last bead before write
  42. // pCtx->pfnAlphaTestFailEnd(pCtx, pP, pS);
  43. }')')dnl
  44. dnl
  45. dnl
  46. dnl d_DoAlphaDitherTest
  47. dnl
  48. dnl Inserts conditional AlphaDither Test code
  49. dnl $1 the function type
  50. dnl $2 is the ZWrite type
  51. dnl $3 is the format of the Z buffer
  52. dnl $4 is whether this function do a conditional return based on stencil
  53. dnl
  54. define(`d_DoAlphaDitherTest', `ifelse(`$1', `NoAlphaDither', `', `
  55. INT32 Alpha;
  56. UINT16 uDither = g_uDitherTable[pCtx->SI.uDitherOffset];
  57. if (pCtx->cActTex != 0)
  58. {
  59. Alpha = RGBA_GETALPHA(pCtx->SI.TexCol[0]);
  60. }
  61. else
  62. {
  63. Alpha = pS->uA >> COLOR_SHIFT;
  64. }
  65. if ((Alpha & 0xff) > uDither)
  66. {
  67. d_DoZWrite($2, $3)
  68. d_DoEnd($4)
  69. }')')dnl
  70. define(`d_AlphaHdr', `
  71. void C_AlphaTest_$1_$2_$3_$4_$5(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP, PD3DI_RASTSPAN pS)
  72. {
  73. ifelse(`$1', `NoAlpha',
  74. `d_DoAlphaDitherTest(`$2', `$3', `$4', `$5')', `
  75. if (ACMP(pCtx, pCtx->SI.uBA, pCtx->iARef))
  76. {
  77. ifelse($2, `NoAlphaDither', `
  78. d_DoZWrite(`$3', `$4')
  79. d_DoEnd($5)',
  80. `d_DoAlphaDitherTest(`$2', `$3', `$4', `$5')')
  81. }
  82. else
  83. {
  84. // in the C code this does a return, since this is the
  85. // last bead before write
  86. // pCtx->pfnAlphaTestFailEnd(pCtx, pP, pS);
  87. }')
  88. dnl
  89. }')
  90. dnl
  91. d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_AlphaHdr(AA, BB, CC, DD, EE)',
  92. `AA', `NoAlpha', `Alpha')',
  93. `BB', `NoAlphaDither', `AlphaDither')',
  94. `CC', `NoZWrite', `ZWrite')',
  95. `DD', `16', `32')',
  96. `EE', `NoStencil', `Stencil')