Source code of Windows XP (NT5)
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.

157 lines
4.5 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: mcdpoint.c
  3. *
  4. * Contains the point-rendering routines for the Millenium MCD driver.
  5. *
  6. * Copyright (c) 1996 Microsoft Corporation
  7. \**************************************************************************/
  8. #include "precomp.h"
  9. #include "mcdhw.h"
  10. #include "mcdutil.h"
  11. #include "mcdmath.h"
  12. #define TRUNCCOORD(value, intValue)\
  13. intValue = __MCD_VERTEX_FIXED_TO_INT(__MCD_VERTEX_FLOAT_TO_FIXED(value))
  14. VOID FASTCALL __MCDPointBegin(DEVRC *pRc)
  15. {
  16. BYTE *pjBase = ((PDEV *)pRc->ppdev)->pjBase;
  17. if ((pRc->pEnumClip->c) <= 1) {
  18. CHECK_FIFO_FREE(pjBase, pRc->cFifo, 1);
  19. CP_WRITE(pjBase, DWG_DWGCTL, pRc->hwLineFunc);
  20. } else {
  21. CHECK_FIFO_FREE(pjBase, pRc->cFifo, 9);
  22. CP_WRITE(pjBase, DWG_DWGCTL, pRc->hwLineFunc);
  23. // ?? Theoretically just need to clear y deltas, not both:
  24. CP_WRITE(pjBase, DWG_DR6, 0);
  25. CP_WRITE(pjBase, DWG_DR7, 0);
  26. CP_WRITE(pjBase, DWG_DR10, 0);
  27. CP_WRITE(pjBase, DWG_DR11, 0);
  28. CP_WRITE(pjBase, DWG_DR14, 0);
  29. CP_WRITE(pjBase, DWG_DR15, 0);
  30. CP_WRITE(pjBase, DWG_DR2, 0);
  31. CP_WRITE(pjBase, DWG_DR3, 0);
  32. }
  33. }
  34. VOID FASTCALL __MCDRenderPoint(DEVRC *pRc, MCDVERTEX *a)
  35. {
  36. PDEV *ppdev = pRc->ppdev;
  37. BYTE *pjBase = ppdev->pjBase;
  38. LONG ix, iy;
  39. LONG iRStart, iGStart, iBStart;
  40. LARGE_INTEGER iZStart;
  41. ULONG clipNum;
  42. RECTL *pClip;
  43. MCDCOLOR *ac;
  44. if ((clipNum = pRc->pEnumClip->c) > 1) {
  45. pClip = &pRc->pEnumClip->arcl[0];
  46. (*pRc->HWSetupClipRect)(pRc, pClip++);
  47. }
  48. if (pRc->privateEnables & __MCDENABLE_Z) {
  49. #if _X86_ && ASM_ACCEL
  50. _asm {
  51. mov ecx, a
  52. mov edx, pRc
  53. lea eax, [OFFSET(MCDVERTEX.colors) + ecx]
  54. fld DWORD PTR [OFFSET(DEVRC.rScale)][edx]
  55. fmul DWORD PTR [OFFSET(MCDCOLOR.r)][eax]
  56. fld DWORD PTR [OFFSET(DEVRC.gScale)][edx]
  57. fmul DWORD PTR [OFFSET(MCDCOLOR.g)][eax]
  58. fld DWORD PTR [OFFSET(DEVRC.bScale)][edx]
  59. fmul DWORD PTR [OFFSET(MCDCOLOR.b)][eax]
  60. fld DWORD PTR [OFFSET(MCDVERTEX.windowCoord.z)][ecx]
  61. fmul DWORD PTR [OFFSET(DEVRC.zScale)][edx] // z b g r
  62. fxch ST(3) // r b g z
  63. fistp iRStart
  64. fistp iBStart
  65. fistp iGStart
  66. fistp iZStart
  67. }
  68. #else
  69. ac = &a->colors[0];
  70. iRStart = FTOL(ac->r * pRc->rScale);
  71. iGStart = FTOL(ac->g * pRc->gScale);
  72. iBStart = FTOL(ac->b * pRc->bScale);
  73. iZStart.LowPart = FTOL(a->windowCoord.z * pRc->zScale);
  74. #endif
  75. CHECK_FIFO_FREE(pjBase, pRc->cFifo, 6);
  76. CP_WRITE(pjBase, DWG_DR0, iZStart.LowPart);
  77. } else {
  78. #if _X86_ && ASM_ACCEL
  79. _asm{
  80. mov eax, a
  81. mov edx, pRc
  82. lea eax, [OFFSET(MCDVERTEX.colors) + eax]
  83. fld DWORD PTr [OFFSET(DEVRC.rScale)][edx]
  84. fmul DWORD PTR [OFFSET(MCDCOLOR.r)][eax]
  85. fld DWORD PTr [OFFSET(DEVRC.gScale)][edx]
  86. fmul DWORD PTR [OFFSET(MCDCOLOR.g)][eax]
  87. fld DWORD PTr [OFFSET(DEVRC.bScale)][edx] // b g r
  88. fmul DWORD PTR [OFFSET(MCDCOLOR.b)][eax]
  89. fxch ST(2) // r g b
  90. fistp iRStart
  91. fistp iGStart
  92. fistp iBStart
  93. }
  94. #else
  95. ac = &a->colors[0];
  96. iRStart = FTOL(ac->r * pRc->rScale);
  97. iGStart = FTOL(ac->g * pRc->gScale);
  98. iBStart = FTOL(ac->b * pRc->bScale);
  99. #endif
  100. CHECK_FIFO_FREE(pjBase, pRc->cFifo, 5);
  101. }
  102. TRUNCCOORD(a->windowCoord.x, ix);
  103. TRUNCCOORD(a->windowCoord.y, iy);
  104. CP_WRITE(pjBase, DWG_XDST, (ix + pRc->xOffset) & 0xffff);
  105. CP_WRITE(pjBase, DWG_YDSTLEN, ((iy + pRc->yOffset) << 16) + 1);
  106. CP_WRITE(pjBase, DWG_DR4, iRStart);
  107. CP_WRITE(pjBase, DWG_DR8, iGStart);
  108. CP_START(pjBase, DWG_DR12, iBStart);
  109. while (--clipNum) {
  110. (*pRc->HWSetupClipRect)(pRc, pClip++);
  111. CHECK_FIFO_FREE(pjBase, pRc->cFifo, 2);
  112. CP_WRITE(pjBase, DWG_XDST, (ix + pRc->xOffset) & 0xffff);
  113. CP_START(pjBase, DWG_YDSTLEN, ((iy + pRc->yOffset) << 16) + 1);
  114. }
  115. }
  116. VOID FASTCALL __MCDRenderGenPoint(DEVRC *pRc, MCDVERTEX *pv)
  117. {
  118. MCDBG_PRINT("__MCDRenderGenPoint");
  119. }
  120. VOID FASTCALL __MCDRenderFogPoint(DEVRC *pRc, MCDVERTEX *pv)
  121. {
  122. MCDCOLOR c;
  123. c = pv->colors[0];
  124. __MCDCalcFogColor(pRc, pv, &pv->colors[0], &c);
  125. (*pRc->renderPointX)(pRc, pv);
  126. pv->colors[0] = c;
  127. }