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.

71 lines
2.2 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // This file contains color generation 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 "mcrgn_mh.h"
  18. define(`d_ColorGen', `
  19. void CMMX_ColorGen_$1_$2_$3_$4(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP,
  20. PD3DI_RASTSPAN pS)
  21. {
  22. ifelse(`$1', `Gouraud', `
  23. pS->uB += pP->iDBDX; pS->uG += pP->iDGDX;
  24. pS->uR += pP->iDRDX; pS->uA += pP->iDADX;')
  25. ifelse(`$2', `Specular', `
  26. // This is an add with saturate in MMX
  27. // ATTENTION if we really care, one could argue that saturation after fog is better
  28. pCtx->SI.uBB = (UINT16)min((UINT32)pCtx->SI.uBB + (UINT32)pS->uBS, 0xffff);
  29. pCtx->SI.uBG = (UINT16)min((UINT32)pCtx->SI.uBG + (UINT32)pS->uGS, 0xffff);
  30. pCtx->SI.uBR = (UINT16)min((UINT32)pCtx->SI.uBR + (UINT32)pS->uRS, 0xffff);
  31. pS->uBS += pP->iDBSDX; pS->uGS += pP->iDGSDX;
  32. pS->uRS += pP->iDRSDX;')
  33. ifelse(`$3', `VertexFog', `
  34. UINT16 uFog = pS->uFog >> 8; // 0.8
  35. pCtx->SI.uBB = (pCtx->SI.uBB>>8)*uFog; // 8.0 * 0.8 = 8.8
  36. pCtx->SI.uBG = (pCtx->SI.uBG>>8)*uFog;
  37. pCtx->SI.uBR = (pCtx->SI.uBR>>8)*uFog;
  38. pCtx->SI.uBB += pCtx->SI.uFogB;
  39. pCtx->SI.uBG += pCtx->SI.uFogG;
  40. pCtx->SI.uBR += pCtx->SI.uFogR;
  41. pS->uFog += (INT16)pS->iDFog;
  42. pCtx->SI.uFogB += pCtx->SI.iFogBDX;
  43. pCtx->SI.uFogG += pCtx->SI.iFogGDX;
  44. pCtx->SI.uFogR += pCtx->SI.iFogRDX;')
  45. pCtx->pfnColorGenEnd(pCtx, pP, pS);
  46. }')dnl
  47. dnl
  48. d_RepStr(`d_RepStr(`d_RepStr(`d_ColorGen(AA, BB, CC, NoMonochrome)',
  49. `AA', `Flat', `Gouraud')',
  50. `BB', `NoSpecular', `Specular')',
  51. `CC', `NoFog', `VertexFog')
  52. void CMMX_ColorGen_All_Monochrome(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP,
  53. PD3DI_RASTSPAN pS)
  54. {
  55. // ATTENTION, need to implement this
  56. // ATTENTION, fix DPFs
  57. // DPF(0, "ColorGen_All_Monochrome unimplemented");
  58. DDASSERT(0);
  59. }