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.

77 lines
2.2 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 "matest_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 d_DoAlphaDitherTest
  28. dnl
  29. dnl Inserts conditional AlphaDither Test code
  30. dnl $1 the function type, $2 is the ZWrite type,
  31. dnl and $3 is the format of the Z buffer.
  32. dnl
  33. define(`d_DoAlphaDitherTest', `ifelse(`$1', `NoAlphaDither', `', `
  34. INT32 Alpha;
  35. UINT16 uDither = g_uDitherTable[pCtx->SI.uDitherOffset];
  36. if (pCtx->cActTex != 0)
  37. {
  38. Alpha = RGBA_GETALPHA(pCtx->SI.TexCol[0]);
  39. }
  40. else
  41. {
  42. Alpha = pS->uA >> COLOR_SHIFT;
  43. }
  44. if ((Alpha & 0xff) > uDither)
  45. {
  46. d_DoZWrite($2, $3)
  47. pCtx->pfnAlphaTestPassEnd(pCtx, pP, pS);
  48. }')')dnl
  49. define(`d_AlphaHdr', `
  50. void CMMX_AlphaTest_$1_$2_$3_$4(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP, PD3DI_RASTSPAN pS)
  51. {
  52. ifelse(`$1', `NoAlpha',
  53. `d_DoAlphaDitherTest(`$2', `$3', `$4')', `
  54. if (ACMP(pCtx, pCtx->SI.uBA, pCtx->iARef))
  55. {
  56. ifelse($2, `NoAlphaDither', `
  57. d_DoZWrite(`$3', `$4')
  58. pCtx->pfnAlphaTestPassEnd(pCtx, pP, pS);',
  59. `d_DoAlphaDitherTest(`$2', `$3', `$4')')
  60. }
  61. else
  62. {
  63. // in the C code this does a return, since this is the
  64. // last bead before write
  65. // pCtx->pfnAlphaTestFailEnd(pCtx, pP, pS);
  66. }')
  67. dnl
  68. }')
  69. dnl
  70. d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_AlphaHdr(AA, BB, CC, DD)',
  71. `AA', `NoAlpha', `Alpha')',
  72. `BB', `NoAlphaDither', `AlphaDither')',
  73. `CC', `NoZWrite', `ZWrite')',
  74. `DD', `16', `32')