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.

256 lines
12 KiB

  1. dnl ---------------------------------------------------------------------------
  2. dnl
  3. dnl This file contains bead structure creating macros and produces
  4. dnl the structures themselves.
  5. dnl
  6. dnl Copyright (C) Microsoft Corporation, 1997.
  7. dnl
  8. dnl ---------------------------------------------------------------------------
  9. dnl
  10. include(`m4hdr.mh')dnl
  11. dnl
  12. dnl
  13. define(`d_RenderSpansBeads', `d_RepStr(`$1', `$2', RenderSpansAny)')dnl
  14. dnl
  15. define(`d_BeginBeads', `d_RepStr(`$1', `$2', LoopAny)')dnl
  16. dnl
  17. define(`d_TestBeads', `d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', Test_AAAA_BBBB_CCCC_DDDD_EEEE)',
  18. AAAA, 16, 32)',
  19. BBBB, NoZWrite, ZWrite)',
  20. CCCC, NoZDeferred, ZDeferred)',
  21. DDDD, ifelse(eval(d_index(EEEE, `Stencil') == 0), `1',
  22. `ZAll, ZAll, ZAll, ZAll',
  23. `ZNeverAlways, ZLessGreaterEqual, ZEqualNotEqual, ZGreaterLessEqual'))',
  24. EEEE, NoStencil, Stencil)')dnl
  25. dnl
  26. define(`d_TestFailBeads', `d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', TestFail_AAAA_BBBB_CCCC)',
  27. AAAA, Flat, Gouraud)',
  28. BBBB, NoTex, Tex1, PerspTex1, Tex2, PerspTex2)',
  29. CCCC, NoSpecularFog, SpecularFog)')dnl
  30. dnl
  31. define(`d_Tex1AddrBeads', `d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', TexAddr_AAAA_BBBB_CCCC_DDDD)',
  32. AAAA, TexAddrWrapMirror, TexAddrAll)',
  33. BBBB, NoPersp, Persp)',
  34. CCCC, ifelse(DDDD, NoLOD,
  35. `Point, Bilinear, Bilinear',
  36. `Point, Bilinear, MaybeBilinear'))',
  37. DDDD, NoLOD, LOD)')dnl
  38. dnl
  39. define(`d_Tex1AddrMipBeads', `d_RepStr(`$1', `$2', TexAddr_Filt_All_Mip)')dnl
  40. dnl
  41. define(`d_TexAddrWrapperBeads', `d_RepStr(`$1', `$2', TexAddr_Wrapper)')dnl
  42. dnl
  43. define(`d_Tex2AddrBeads', `d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', TexAddr_AAAA_BBBB_CCCC_NoLOD)',
  44. AAAA, TexAddrWrapMirror, TexAddrAll)',
  45. BBBB, NoPersp, Persp)',
  46. CCCC, Point, Bilinear, Bilinear)')dnl
  47. define(`d_TexReadBeads', `d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', TexRead_AAAA_BBBB_CCCC)',
  48. AAAA, B8G8R8, B8G8R8A8, B5G6R5, B5G5R5, Palette4, Palette8,
  49. B5G5R5A1, B4G4R4A4, L8, L8A8, Palette4A, Palette8A)',
  50. BBBB, NoBorder, Border)',
  51. CCCC, NoColorKey, ColorKey)')dnl
  52. dnl
  53. define(`d_TexBlendBeads', `d_RepStr(`d_RepStr(`$1', `$2', TexBlend_AAAA)',
  54. AAAA, Tex1_None, Tex1_Decal, Tex1_Modulate, Tex1_ModulateAlphaOVR, Tex1_Gen, TexM_Gen)')dnl
  55. dnl
  56. define(`d_TexBlendGetColorBeads', `d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', TexBlend_Get_Color_AAAA_BBBB)',
  57. AAAA, Texture, InvTexture, TextureAlpha, InvTextureAlpha)',
  58. BBBB, Diffuse, Input, Factor, InvDiffuse, InvInput, InvFactor,
  59. DiffuseAlpha, InputAlpha, FactorAlpha, InvDiffuseAlpha, InvInputAlpha, InvFactorAlpha,
  60. Specular, InvSpecular, SpecularAlpha, InvSpecularAlpha)')dnl
  61. dnl
  62. define(`d_TexBlendGetAlphaBeads', `d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', TexBlend_Get_Alpha_AAAA_BBBB)',
  63. AAAA, TextureAlpha, InvTextureAlpha)',
  64. BBBB, DiffuseAlpha, InputAlpha, FactorAlpha, InvDiffuseAlpha,
  65. InvInputAlpha, InvFactorAlpha, SpecularAlpha, InvSpecularAlpha)')dnl
  66. dnl
  67. define(`d_TexBlendOpColorBeads', `d_RepStr(`d_RepStr(`$1', `$2', TexBlend_Op_Color_AAAA)',
  68. AAAA, None, CopyArg1, CopyArg2, Modulate, Modulate2, Modulate4, Add, AddSigned,
  69. BlendDiffuseAlpha, BlendTextureAlpha, BlendFactorAlpha, BlendTextureAlphaPM,
  70. AddSigned2, Subtract, AddSmooth, ModulateAlphaAddColor, ModulateColorAddAlpha)')dnl
  71. dnl
  72. define(`d_TexBlendOpAlphaBeads', `d_RepStr(`d_RepStr(`$1', `$2', TexBlend_Op_Alpha_AAAA)',
  73. AAAA, None, CopyArg1, CopyArg2, Modulate, Modulate2, Modulate4, Add, AddSigned,
  74. BlendDiffuseAlpha, BlendTextureAlpha, BlendFactorAlpha, BlendTextureAlphaPM,
  75. AddSigned2, Subtract, AddSmooth)')dnl
  76. dnl
  77. define(`d_ColorGenBeads', `d_RepStr(`d_RepStr(`$1', `$2', AAAA)',
  78. AAAA, NULL, ColorGen_Gouraud_NoSpecular_NoFog_NoMonochrome,
  79. ColorGen_Flat_Specular_NoFog_NoMonochrome, ColorGen_Gouraud_Specular_NoFog_NoMonochrome,
  80. ColorGen_Flat_NoSpecular_VertexFog_NoMonochrome, ColorGen_Gouraud_NoSpecular_VertexFog_NoMonochrome,
  81. ColorGen_Flat_Specular_VertexFog_NoMonochrome, ColorGen_Gouraud_Specular_VertexFog_NoMonochrome,
  82. ColorGen_All_Monochrome, ColorGen_All_Monochrome, ColorGen_All_Monochrome, ColorGen_All_Monochrome, ColorGen_All_Monochrome, ColorGen_All_Monochrome, ColorGen_All_Monochrome, ColorGen_All_Monochrome)')dnl
  83. dnl
  84. define(`d_AlphaTestBeads', `d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`d_RepStr(`$1', `$2', AlphaTest_AAAA_BBBB_CCCC_DDDD_EEEE)',
  85. AAAA, NoAlpha, Alpha)',
  86. BBBB, NoAlphaDither, AlphaDither)',
  87. CCCC, NoZWrite, ZWrite)',
  88. DDDD, 16, 32)',
  89. EEEE, NoStencil, Stencil)')dnl
  90. dnl
  91. define(`d_ColorBlendBeads', `d_RepStr(`d_RepStr(`$1', `$2', AAAA)',
  92. AAAA, NULL, ColorBlend_AllBlend_SrcCopy,
  93. ColorBlend_SrcOne_DestZero_AllROP, ColorBlend_AllBlend_AllROP)')dnl
  94. dnl
  95. define(`d_SrcBlendBeads', `d_RepStr(`d_RepStr(`$1', `$2', SrcBlend_AAAA)',
  96. AAAA, Zero, One, SrcColor, InvSrcColor, SrcAlpha, InvSrcAlpha,
  97. DestAlpha, InvDestAlpha, DestColor, InvDestColor, SrcAlphaSat)')dnl
  98. dnl
  99. define(`d_DestBlendBeads', `d_RepStr(`d_RepStr(`$1', `$2', DestBlend_AAAA)',
  100. AAAA, Zero, One, SrcColor, InvSrcColor, SrcAlpha, InvSrcAlpha,
  101. DestAlpha, InvDestAlpha, DestColor, InvDestColor, SrcAlphaSat)')dnl
  102. dnl
  103. define(`d_BufReadBeads', `d_RepStr(`d_RepStr(`$1', `$2', BufRead_AAAA)',
  104. AAAA, B8G8R8X8, B8G8R8A8, B5G6R5, B5G5R5, B5G5R5A1, B8G8R8, Palette8)')dnl
  105. dnl
  106. define(`d_BufWriteBeads', `d_RepStr(`d_RepStr(`$1', `$2', BufWrite_AAAA)',
  107. AAAA, B8G8R8X8_NoDither, B8G8R8A8_NoDither, B5G6R5_NoDither, B5G5R5_NoDither, B5G5R5A1_NoDither, B8G8R8_NoDither, Palette8_NoDither,
  108. B8G8R8X8_NoDither, B8G8R8A8_NoDither, B5G6R5_Dither, B5G5R5_Dither, B5G5R5A1_Dither, B8G8R8_NoDither, Palette8_NoDither)')dnl
  109. dnl
  110. define(`d_PixelEndBeads', `d_RepStr(`$1', `$2', PixelEndAny)')dnl
  111. dnl
  112. define(`d_SpanEndBeads', `d_RepStr(`$1', `$2', SpanEndAny)')dnl
  113. dnl
  114. dnl
  115. ifelse(`d_BeadMacrosOnly', d_BeadMacrosOnly, `
  116. // indices used to access elements of Test bead table
  117. #define ZFORMAT_NUM 2
  118. #define ZWRITE_NUM 2
  119. #define ZFUNC_NUM 4
  120. #define ZDEFERRED_NUM 2
  121. #define STENCIL_NUM 2
  122. #define ALPHATEST_NUM 2
  123. // indices used to access elements of TestFail bead table
  124. #define SHADEMODE_NUM 2
  125. #define TEXTURE_NUM 5
  126. #define SPECULARFOG_NUM 2
  127. // TexAddr
  128. #define TEXTUREADDRESS_NUM 2
  129. #define TEXTUREPERSPECTIVE_NUM 2
  130. #define TEXTUREFILTER_NUM 3
  131. #define TEXTURELOD_NUM 2
  132. // TexRead
  133. #define TEXTUREFORMAT_NUM 12
  134. #define TEXTUREBORDER_NUM 2
  135. #define COLORKEY_NUM 2
  136. // TexBlend
  137. #define TEXTUREBLEND_NUM 6
  138. #define TEXTUREBLEND_GETALPHA_ARG1_NUM 2
  139. #define TEXTUREBLEND_GETALPHA_ARG2_NUM 8
  140. #define TEXTUREBLEND_OPALPHA_NUM 15
  141. #define TEXTUREBLEND_GETCOLOR_ARG1_NUM 4
  142. #define TEXTUREBLEND_GETCOLOR_ARG2_NUM 16
  143. #define TEXTUREBLEND_OPCOLOR_NUM 17
  144. // ColorGen
  145. #define SPECULAR_NUM 2
  146. #define VERTEXFOG_NUM 2
  147. #define MONO_NUM 2
  148. // SrcBlend
  149. #define SRCBLEND_NUM 11
  150. // DestBlend
  151. #define DESTBLEND_NUM 11
  152. // ColorBlend
  153. #define BLEND_NUM 2
  154. #define BLEND_SRCONEDESTZERO 0
  155. #define BLEND_ALLBLEND 1
  156. #define ROP_NUM 2
  157. #define ROP_SRCCOPY 0
  158. #define ROP_ALLROP 1
  159. // indices used to access elements of Write bead table
  160. #define TARGETPIXELFORMAT_NUM 7
  161. #define DITHERING_NUM 2
  162. dnl
  163. // structures for bead organization
  164. dnl
  165. define(`d_MakeBeadStruct', `
  166. typedef struct tag`'d_UpCase(`$1')`'BEADS
  167. {
  168. $3 pfn`'$1`'$2;
  169. } d_UpCase(`$1')`'BEADS, *P`'d_UpCase(`$1')`'BEADS;')dnl
  170. dnl
  171. d_MakeBeadStruct(RenderSpans, [1],
  172. PFNRENDERSPANS)
  173. d_MakeBeadStruct(Begin, [1],
  174. PFNSPANLAYER)
  175. d_MakeBeadStruct(Test, [STENCIL_NUM][ZFUNC_NUM][ZDEFERRED_NUM][ZWRITE_NUM][ZFORMAT_NUM],
  176. PFNSPANLAYER)
  177. d_MakeBeadStruct(TestFail, [SPECULARFOG_NUM][TEXTURE_NUM][SHADEMODE_NUM],
  178. PFNSPANLAYER)
  179. d_MakeBeadStruct(Tex1Addr, [TEXTURELOD_NUM][TEXTUREFILTER_NUM][TEXTUREPERSPECTIVE_NUM][TEXTUREADDRESS_NUM],
  180. PFNTEXADDRESS)
  181. d_MakeBeadStruct(Tex1AddrMip, [1],
  182. PFNTEXADDRESS)
  183. d_MakeBeadStruct(Tex2Addr, [TEXTUREFILTER_NUM][TEXTUREPERSPECTIVE_NUM][TEXTUREADDRESS_NUM],
  184. PFNTEXADDRESS)
  185. d_MakeBeadStruct(TexAddrWrapper, [1],
  186. PFNSPANLAYER)
  187. d_MakeBeadStruct(TexRead, [COLORKEY_NUM][TEXTUREBORDER_NUM][TEXTUREFORMAT_NUM],
  188. PFNTEXREAD)
  189. d_MakeBeadStruct(TexBlend, [TEXTUREBLEND_NUM],
  190. PFNSPANLAYER)
  191. d_MakeBeadStruct(TexBlendGetColor, [TEXTUREBLEND_GETCOLOR_ARG2_NUM][TEXTUREBLEND_GETCOLOR_ARG1_NUM],
  192. PFNTEXBLENDGET)
  193. d_MakeBeadStruct(TexBlendGetAlpha, [TEXTUREBLEND_GETALPHA_ARG2_NUM][TEXTUREBLEND_GETALPHA_ARG1_NUM],
  194. PFNTEXBLENDGET)
  195. d_MakeBeadStruct(TexBlendOpColor, [TEXTUREBLEND_OPCOLOR_NUM],
  196. PFNTEXBLENDOP)
  197. d_MakeBeadStruct(TexBlendOpAlpha, [TEXTUREBLEND_OPALPHA_NUM],
  198. PFNTEXBLENDOP)
  199. d_MakeBeadStruct(ColorGen, [MONO_NUM][VERTEXFOG_NUM][SPECULAR_NUM][SHADEMODE_NUM],
  200. PFNSPANLAYER)
  201. d_MakeBeadStruct(AlphaTest, [STENCIL_NUM][ZFORMAT_NUM][ZWRITE_NUM][COLORKEY_NUM][ALPHATEST_NUM],
  202. PFNSPANLAYER)
  203. d_MakeBeadStruct(ColorBlend, [ROP_NUM][BLEND_NUM],
  204. PFNSPANLAYER)
  205. d_MakeBeadStruct(SrcBlend, [SRCBLEND_NUM],
  206. PFNBLENDFUNC)
  207. d_MakeBeadStruct(DestBlend, [DESTBLEND_NUM],
  208. PFNBLENDFUNC)
  209. d_MakeBeadStruct(BufRead, [TARGETPIXELFORMAT_NUM],
  210. PFNBUFREAD)
  211. d_MakeBeadStruct(BufWrite, [DITHERING_NUM][TARGETPIXELFORMAT_NUM],
  212. PFNSPANLAYER)
  213. d_MakeBeadStruct(PixelEnd, [1],
  214. PFNSPANLAYER)
  215. d_MakeBeadStruct(SpanEnd, [1],
  216. PFNSPANLAYER)
  217. // Root structure needed for state validation. Contains pointers to function pointer
  218. // tables
  219. typedef struct tagBEADTABLE
  220. {
  221. PRENDERSPANSBEADS pRenderSpansBeads;
  222. PBEGINBEADS pBeginBeads;
  223. PTESTBEADS pTestBeads;
  224. PTESTFAILBEADS pTestFailBeads;
  225. PTEX1ADDRBEADS pTex1AddrBeads;
  226. PTEX1ADDRMIPBEADS pTex1AddrMipBeads;
  227. PTEXADDRWRAPPERBEADS pTexAddrWrapperBeads;
  228. PTEXREADBEADS pTexReadBeads;
  229. PTEX2ADDRBEADS pTex2AddrBeads;
  230. PTEXBLENDBEADS pTexBlendBeads;
  231. PTEXBLENDGETCOLORBEADS pTexBlendGetColorBeads;
  232. PTEXBLENDGETALPHABEADS pTexBlendGetAlphaBeads;
  233. PTEXBLENDOPCOLORBEADS pTexBlendOpColorBeads;
  234. PTEXBLENDOPALPHABEADS pTexBlendOpAlphaBeads;
  235. PCOLORGENBEADS pColorGenBeads;
  236. PALPHATESTBEADS pAlphaTestBeads;
  237. PCOLORBLENDBEADS pColorBlendBeads;
  238. PSRCBLENDBEADS pSrcBlendBeads;
  239. PDESTBLENDBEADS pDestBlendBeads;
  240. PBUFREADBEADS pBufReadBeads;
  241. PBUFWRITEBEADS pBufWriteBeads;
  242. PPIXELENDBEADS pPixelEndBeads;
  243. PSPANENDBEADS pSpanEndBeads;
  244. } BEADTABLE, *PBEADTABLE;
  245. ')