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.

122 lines
4.4 KiB

  1. ;TBD check to see if this value is correct.
  2. COLOR_SHIFT equ 8
  3. define(`texblendVars',`
  4. EXTERN MaskOffAlpha:MMWORD
  5. EXTERN ShiftTA:MMWORD
  6. EXTERN Val0x00ff00ff00ff00ff:MMWORD
  7. EXTERN Val0x000000ff00ff00ff:MMWORD
  8. EXTERN Val0X0000000001000000:MMWORD
  9. EXTERN Val0x8000000000000000:MMWORD
  10. EXTERN Val0xC000000000000000:MMWORD
  11. EXTERN AlphaVal128:MMWORD
  12. EXTERN RGBVal128:MMWORD
  13. ')
  14. define(`d_TexBlend_Tex1_None', `
  15. ifelse(`$1', `Monolithic', `; ATTENTION None shouldnt have to do any copying to memory for monolithic.')dnl
  16. ;pCtx->SI.uBB = pS->uB;
  17. ;pCtx->SI.uBG = pS->uG;
  18. ;pCtx->SI.uBR = pS->uR;
  19. ;pCtx->SI.uBA = pS->uA;
  20. movq mm1, XpS(uB)
  21. movq XpCtxSI(uBB), mm1
  22. ')dnl d_TexBlend_Tex1_None define
  23. define(`d_TexBlend_Tex1_Decal', `
  24. ifelse(`$1', `Monolithic', `; ATTENTION shouldnt have to move to and from memory in monolithic case. Use registers. It will get rid of packing stuff below.')
  25. ;pCtx->SI.uBB = (UINT16)(RGBA_GETBLUE(pCtx->SI.TexCol[0]) << COLOR_SHIFT);
  26. ;pCtx->SI.uBG = (UINT16)(RGBA_GETGREEN(pCtx->SI.TexCol[0])<< COLOR_SHIFT);
  27. ;pCtx->SI.uBR = (UINT16)(RGBA_GETRED(pCtx->SI.TexCol[0]) << COLOR_SHIFT);
  28. ;pCtx->SI.uBA = (UINT16)(RGBA_GETALPHA(pCtx->SI.TexCol[0])<< COLOR_SHIFT);
  29. ; TBD need to see if we should extend the TexCol value to a 64 bit
  30. ; value so that I can store full 8.8 8.8 8.8 8.8 color or if I am
  31. ; going to pack when I store it and then unpack here.
  32. ; To keep data type the same, I will do the pack unpack for now.
  33. pxor mm1, mm1
  34. punpcklbw mm1, XpCtxSI(TexCol)
  35. movq XpCtxSI(uBB), mm1
  36. ') dnl d_TexBlend_Tex1_None define
  37. define(`d_TexBlend_Tex1_Modulate', `
  38. ifelse(`$1', `Monolithic', `; ATTENTION shouldnt have to move to and from memory in monolithic case. Use registers')
  39. ;UINT16 uB = pS->uB>>COLOR_SHIFT;
  40. ;UINT16 uG = pS->uG>>COLOR_SHIFT;
  41. ;UINT16 uR = pS->uR>>COLOR_SHIFT;
  42. movq mm1, XpS(uB)
  43. psrlw mm1, COLOR_SHIFT ; COLOR_SHIFT is set to 8.
  44. ; These to instructions will allow pmullw to work
  45. ; and will get uTA shifted by 8.
  46. ; The othere approach would require pand pandn por again.
  47. ; wouldnt need maskoffalpha value if it was zero to begin with.
  48. pand mm1, MMWORD ptr MaskOffAlpha ; = 0x0000ffffffffffff
  49. por mm1, MMWORD ptr ShiftTA ; = 0x0100000000000000
  50. ;UINT16 uTB = (UINT16)(RGBA_GETBLUE(pCtx->SI.TexCol[0]));
  51. ;UINT16 uTG = (UINT16)(RGBA_GETGREEN(pCtx->SI.TexCol[0]));
  52. ;UINT16 uTR = (UINT16)(RGBA_GETRED(pCtx->SI.TexCol[0]));
  53. ;UINT16 uTA = (UINT16)(RGBA_GETALPHA(pCtx->SI.TexCol[0]));
  54. movd mm2, XpCtxSI(TexCol) ; Use unpack to convert from byte to word
  55. punpcklbw mm2, Zero
  56. ; this is a PMULLW, which works on unsigned 16 bit quantities
  57. ;pCtx->SI.uBB = uB*uTB;
  58. ;pCtx->SI.uBG = uG*uTG;
  59. ;pCtx->SI.uBR = uR*uTR;
  60. ;pCtx->SI.uBA = uTA<<COLOR_SHIFT;
  61. pmullw mm1, mm2
  62. movq XpCtxSI(uBB), mm1
  63. ') dnl d_TexBlend_Tex1_Modulate define
  64. define(`d_TexBlend_Tex1_ModulateAlphaOVR', `
  65. ifelse(`$1', `Monolithic', `; ATTENTION None shouldnt have to do any copying to memory for monolithic.')dnl
  66. ; ATTENTION no different from plain Modulate yet, need to get alpha from pS->uA
  67. ;UINT16 uB = pS->uB>>COLOR_SHIFT;
  68. ;UINT16 uG = pS->uG>>COLOR_SHIFT;
  69. ;UINT16 uR = pS->uR>>COLOR_SHIFT;
  70. movq mm1, XpS(uB)
  71. psrlw mm1, COLOR_SHIFT ; COLOR_SHIFT is set to 8.
  72. ;UINT16 uTB = (UINT16)(RGBA_GETBLUE(pCtx->SI.TexCol[0]));
  73. ;UINT16 uTG = (UINT16)(RGBA_GETGREEN(pCtx->SI.TexCol[0]));
  74. ;UINT16 uTR = (UINT16)(RGBA_GETRED(pCtx->SI.TexCol[0]));
  75. ;UINT16 uTA = (UINT16)(RGBA_GETALPHA(pCtx->SI.TexCol[0]));
  76. movd mm2, XpCtxSI(TexCol) ; Use unpack to convert from byte to word
  77. punpcklbw mm2, Zero
  78. ; These to instructions will allow pmullw to work
  79. ; and will get pS->uA shifted by 8.
  80. ; The other approach would require pand pandn por again.
  81. ; wouldnt need maskoffalpha value if it was zero to begin with.
  82. pand mm2, MMWORD ptr MaskOffAlpha ; = 0x0000ffffffffffff
  83. por mm2, MMWORD ptr ShiftTA ; = 0x0100000000000000
  84. ; this is a PMULLW, which works on unsigned 16 bit quantities
  85. ;pCtx->SI.uBB = uB*uTB;
  86. ;pCtx->SI.uBG = uG*uTG;
  87. ;pCtx->SI.uBR = uR*uTR;
  88. ;pCtx->SI.uBA = pS->uA;
  89. pmullw mm1, mm2
  90. movq XpCtxSI(uBB), mm1
  91. ')