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.

163 lines
5.2 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // primfns.cpp
  4. //
  5. // Primitive functions for RAMP/RGB/REF.
  6. //
  7. // Copyright (C) Microsoft Corporation, 1998.
  8. //
  9. // WARNING WARNING WARNING
  10. // This cpp file generated from mcp file.
  11. // EDIT THE MCP FILE.
  12. // I warned you.
  13. // WARNING WARNING WARNING
  14. //
  15. //----------------------------------------------------------------------------
  16. include(`m4hdr.mh')dnl
  17. #include "pch.cpp"
  18. #pragma hdrstop
  19. void
  20. RGBRAMP_StoreLastPixelState(LPVOID pCtx, BOOL bStore)
  21. {
  22. ((D3DContext *)pCtx)->StoreLastPixelState(bStore);
  23. }
  24. dnl
  25. HRESULT
  26. RGBRAMP_Dp2SetViewport(LPVOID pCtx, LPD3DHAL_DP2COMMAND pCmd)
  27. {
  28. LPD3DHAL_DP2VIEWPORTINFO pVpt;
  29. // Keep only the last viewport notification
  30. pVpt = (D3DHAL_DP2VIEWPORTINFO *)(pCmd + 1) + (pCmd->wStateCount - 1);
  31. return ((D3DContext *)pCtx)->SetViewport(pVpt);
  32. // return D3D_OK;
  33. }
  34. HRESULT
  35. RGBRAMP_Dp2SetWRange(LPVOID pCtx, LPD3DHAL_DP2COMMAND pCmd)
  36. {
  37. return D3D_OK;
  38. }
  39. HRESULT
  40. RGBRAMP_Dp2SetRenderStates(LPVOID pCtx, DWORD dwFvf, LPD3DHAL_DP2COMMAND pCmd, LPDWORD lpdwRuntimeRStates)
  41. {
  42. return ((D3DContext *)pCtx)->Dp2SetRenderStates(pCmd, lpdwRuntimeRStates);
  43. }
  44. HRESULT
  45. RGBRAMP_Dp2TextureStageState(LPVOID pCtx, DWORD dwFvf, LPD3DHAL_DP2COMMAND pCmd)
  46. {
  47. return ((D3DContext *)pCtx)->Dp2TextureStageState(pCmd, dwFvf);
  48. }
  49. dnl Call RampCheckTexMap if necessary
  50. dnl $1 - RAMP or RGB
  51. dnl $2 - pCtx
  52. dnl $3 - pVtx0
  53. define(`d_CheckRamp',`dnl
  54. ifelse(`$1', `RAMP',`
  55. HRESULT hr;
  56. // Chekc if Rampmap has changed
  57. HR_RET(((D3DContext *)$2)->RampCheckTexMap((LPD3DTLVERTEX)$3));')')dnl
  58. dnl
  59. define(`d_PointFunc',`
  60. HRESULT
  61. $1_Point$2(LPVOID pCtx, PUINT8 pVtx)
  62. {
  63. d_CheckRamp($1, pCtx, pVtx)dnl
  64. ifelse(`$2',`Pack',`dnl
  65. RAST_GENERIC_VERTEX genVtx;
  66. ((D3DContext *)pCtx)->PackGenVertex(pVtx, &genVtx);
  67. return ((D3DContext *)pCtx)->m_PrimProc.Point((LPD3DTLVERTEX)&genVtx, (LPD3DTLVERTEX)&genVtx);', `
  68. return ((D3DContext *)pCtx)->m_PrimProc.Point((LPD3DTLVERTEX)pVtx, (LPD3DTLVERTEX)pVtx);')
  69. }')dnl
  70. dnl
  71. define(`d_LineFunc',`
  72. HRESULT
  73. $1_Line$2(LPVOID pCtx, PUINT8 pVtx0, PUINT8 pVtx1)
  74. {
  75. d_CheckRamp($1, pCtx, pVtx0)dnl
  76. ifelse(`$2',`Pack',`dnl
  77. RAST_GENERIC_VERTEX genVtx0, genVtx1;
  78. ((D3DContext *)pCtx)->PackGenVertex(pVtx0, &genVtx0);
  79. ((D3DContext *)pCtx)->PackGenVertex(pVtx1, &genVtx1);
  80. return ((D3DContext *)pCtx)->m_PrimProc.Line((LPD3DTLVERTEX)&genVtx0,
  81. (LPD3DTLVERTEX)&genVtx1,
  82. (LPD3DTLVERTEX)&genVtx0);', `
  83. return ((D3DContext *)pCtx)->m_PrimProc.Line((LPD3DTLVERTEX)pVtx0,
  84. (LPD3DTLVERTEX)pVtx1,
  85. (LPD3DTLVERTEX)pVtx0);')
  86. }')dnl
  87. dnl
  88. dnl Call different functions for different fill mode
  89. dnl $1 - Point, Wireframe or Solid
  90. dnl $2 - pCtx
  91. dnl $3 - pVtx0
  92. dnl $4 - pVtx1
  93. dnl $5 - pVtx2
  94. dnl $6 - wFlags
  95. dnl $7 - RAMP or RGB
  96. define(`d_CheckFillMode',`
  97. ifelse(`$1', `Solid',`
  98. return ((D3DContext *)$2)->m_PrimProc.Tri($3, $4, $5);',`dnl
  99. ifelse(`$1', `Point',`
  100. ifelse(`$7', `RGB',`HRESULT hr;')
  101. HR_RET(((D3DContext *)$2)->m_PrimProc.Point($3, $3));
  102. HR_RET(((D3DContext *)$2)->m_PrimProc.Point($4, $3));
  103. HR_RET(((D3DContext *)$2)->m_PrimProc.Point($5, $3));
  104. return D3D_OK;', `
  105. if (((D3DContext *)$2)->NotCulled($3, $4, $5))
  106. {
  107. ifelse(`$7', `RGB',`HRESULT hr;')
  108. if ($6 & D3DTRIFLAG_EDGEENABLE1)
  109. {
  110. HR_RET(((D3DContext *)$2)->m_PrimProc.Line($3, $4, $3));
  111. }
  112. if ($6 & D3DTRIFLAG_EDGEENABLE2)
  113. {
  114. HR_RET(((D3DContext *)$2)->m_PrimProc.Line($4, $5, $3));
  115. }
  116. if ($6 & D3DTRIFLAG_EDGEENABLE3)
  117. {
  118. HR_RET(((D3DContext *)$2)->m_PrimProc.Line($5, $3, $3));
  119. }
  120. }
  121. return D3D_OK;')')')dnl
  122. dnl
  123. define(`d_TriFunc',`
  124. HRESULT
  125. $1_Tri$2$3(LPVOID pCtx, PUINT8 pVtx0, PUINT8 pVtx1, PUINT8 pVtx2, WORD wFlags)
  126. {dnl
  127. d_CheckRamp($1, pCtx, pVtx0)dnl
  128. ifelse(`$2',`Pack',`
  129. RAST_GENERIC_VERTEX genVtx0, genVtx1, genVtx2;
  130. ((D3DContext *)pCtx)->PackGenVertex(pVtx0, &genVtx0);
  131. ((D3DContext *)pCtx)->PackGenVertex(pVtx1, &genVtx1);
  132. ((D3DContext *)pCtx)->PackGenVertex(pVtx2, &genVtx2);
  133. d_CheckFillMode($3, pCtx, (LPD3DTLVERTEX)&genVtx0,
  134. (LPD3DTLVERTEX)&genVtx1,
  135. (LPD3DTLVERTEX)&genVtx2, wFlags, $1);', `dnl
  136. d_CheckFillMode($3, pCtx, (LPD3DTLVERTEX)pVtx0,
  137. (LPD3DTLVERTEX)pVtx1,
  138. (LPD3DTLVERTEX)pVtx2, wFlags, $1)')
  139. }')dnl
  140. d_PointFunc(`RAMP', `')
  141. d_RepStr(`d_RepStr(`d_PointFunc(AA, BB)',
  142. `AA', `RGB')',
  143. `BB', `Pack', `NoPack')
  144. d_LineFunc(`RAMP', `')
  145. d_RepStr(`d_RepStr(`d_LineFunc(AA, BB)',
  146. `AA', `RGB')',
  147. `BB', `Pack', `NoPack')
  148. d_RepStr(`d_RepStr(`d_RepStr(`d_TriFunc(AA, BB, CC)',
  149. `AA', `RAMP')',
  150. `BB', `')',
  151. `CC', `Point', `Wireframe', `Solid')
  152. d_RepStr(`d_RepStr(`d_RepStr(`d_TriFunc(AA, BB, CC)',
  153. `AA', `RGB')',
  154. `BB', `Pack', `NoPack')',
  155. `CC', `Point', `Wireframe', `Solid')