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.

137 lines
3.2 KiB

  1. include(`texaddra.mh')dnl for W divide
  2. dnl need to fix up texaddrasm.mh to have W divide functions
  3. dnl and increment function so both pass and fail can use
  4. dnl the same code. It may be better not to though if I
  5. dnl am mixing code in the pass case.
  6. dnl
  7. dnl d_TestFail
  8. dnl
  9. dnl Macro to build test fail term incrementing routines
  10. dnl
  11. dnl $1 is one of Flat Gouraud
  12. dnl $2 is one of NoTex Tex1 PerspTex1 Tex2 PerspTex2
  13. dnl $3 is one of NoSpecularFog SpecularFog
  14. dnl $4 is one of NotMonolithic Monolithic
  15. dnl
  16. define(`d_TestFail', `
  17. ;void TestFail_$1_$2_$3(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP,
  18. ; PD3DI_RASTSPAN pS)
  19. ;{
  20. ifelse(`$4', `NotMonolithic', `
  21. PUBLIC _MMX_TestFail_$1_$2_$3
  22. _MMX_TestFail_$1_$2_$3:
  23. ')
  24. ifelse(`$1', `Gouraud', `
  25. ;pS->uB += pP->iDBDX; pS->uG += pP->iDGDX;
  26. ;pS->uR += pP->iDRDX; pS->uA += pP->iDADX;
  27. movq mm1, XpS(uB)
  28. paddw mm1, XpP(iDBDX)
  29. movq XpS(uB), mm1
  30. ')
  31. ifelse(eval((d_index(`$2', `Tex1') == 0)), `1', `
  32. push edi
  33. mov edi, 0
  34. d_UpdateUoWandVoW()
  35. d_UpdateNonPersp()
  36. pop edi
  37. ')
  38. ifelse(`$2', `Tex2', `
  39. ; edi now is used to store the texture index
  40. push edi
  41. mov edi, 0
  42. LoopSetTexture$1$2$3$4:
  43. cmp edi, dword ptr XpCtx(cActTex)
  44. je DoneSetTexture$1$2$3$4
  45. d_UpdateUoWandVoW()
  46. d_UpdateNonPersp()
  47. inc edi
  48. jmp LoopSetTexture$1$2$3$4
  49. DoneSetTexture$1$2$3$4:
  50. ; Restore edi
  51. pop edi
  52. ')
  53. ifelse(eval((d_index(`$2', `PerspTex1') == 0)), `1', `
  54. d_UpdateLOD()
  55. d_UpdateOoW()
  56. d_WDivide()
  57. push edi
  58. mov edi, 0
  59. d_UpdateUoWandVoW()
  60. d_UoWVoWTimesW()
  61. pop edi
  62. ')
  63. ifelse(`$2', `PerspTex2', `
  64. d_UpdateLOD()
  65. d_UpdateOoW()
  66. d_WDivide()
  67. ; edi now is used to store the texture index
  68. push edi
  69. mov edi, 0
  70. LoopSetTexture$1$2$3$4:
  71. cmp edi, dword ptr XpCtx(cActTex)
  72. je DoneSetTexture$1$2$3$4
  73. d_UoWVoWTimesW()
  74. d_UpdateUoWandVoW()
  75. inc edi
  76. jmp LoopSetTexture$1$2$3$4
  77. DoneSetTexture$1$2$3$4:
  78. ; Restore edi
  79. pop edi
  80. ')
  81. ifelse(`$3', `SpecularFog', `
  82. ;if (pCtx->pdwRenderState[D3DRS_SPECULARENABLE])
  83. ;{
  84. ; 3 options here.
  85. ; either do masked add
  86. ; or always add
  87. ; or make another bead
  88. ;pS->uBS += pP->iDBSDX; pS->uGS += pP->iDGSDX;
  89. ;pS->uRS += pP->iDRSDX;
  90. movq mm1, XpS(uBS)
  91. paddw mm1, XpP(iDBSDX)
  92. movq XpS(uBS), mm1
  93. ;}
  94. ;if (pCtx->pdwRenderState[D3DRS_FOGENABLE])
  95. ;{
  96. ; Same options as above for this if statement.
  97. ;pS->uFog += (INT16)pP->iDFogDX;
  98. ; Fog is actually added in above addition
  99. ;pCtx->SI.uFogB += pCtx->SI.iFogBDX;
  100. ;pCtx->SI.uFogG += pCtx->SI.iFogGDX;
  101. ;pCtx->SI.uFogR += pCtx->SI.iFogRDX;
  102. ; there is a forth value that is being added here
  103. ; but it is not begin used.
  104. movq mm1, XpCtxSI(uFogB)
  105. paddw mm1, XpCtxSI(iFogBDX)
  106. movq XpCtxSI(uFogB), mm1
  107. ;}
  108. ')
  109. ifelse(`$4', `NotMonolithic', `
  110. ;ret
  111. jmp dword ptr XpCtx(pfnPixelEnd)
  112. ;}
  113. ')
  114. ')