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.

305 lines
7.4 KiB

  1. // rastcap.h - declaration of the CRastCapRecord class
  2. //
  3. // Copyright Microsoft Corporation, 1997.
  4. //
  5. #ifndef _RASTCAP_H_
  6. #define _RASTCAP_H_
  7. // the current size of the rasterizer capability bit vector, in DWORDs.
  8. #define RASTCAPRECORD_SIZE 3
  9. // sets bits in the rasterizer capability bit vector
  10. #define SET_VAL(pos, len, val) ((m_rgdwData[(pos) / 32]) |= \
  11. (((val) & ~(0xFFFFFFFF << (len))) << \
  12. ((pos) % 32)))
  13. // the positions and lengths of fields in the rasterizer capability bit vector
  14. // note: make sure fields do not straddle DWORD boundaries! SET_VAL cannot
  15. // currently handle that
  16. #define ZFUNC_POS 0
  17. #define ZFUNC_LEN 8
  18. #define ZFORMAT_POS 8
  19. #define ZFORMAT_LEN 4
  20. #define ZTEST_POS 12
  21. #define ZTEST_LEN 1
  22. #define ZWRITE_POS 13
  23. #define ZWRITE_LEN 1
  24. #define SHADEMODE_POS 16
  25. #define SHADEMODE_LEN 4
  26. #define SPECULAR_POS 20
  27. #define SPECULAR_LEN 1
  28. #define VERTEXFOG_POS 21
  29. #define VERTEXFOG_LEN 1
  30. #define MONO_POS 22
  31. #define MONO_LEN 1
  32. #define TEXTUREFORMAT_POS 32
  33. #define TEXTUREFORMAT_LEN 8
  34. #define TEXTURE_POS 40
  35. #define TEXTURE_LEN 4
  36. #define TEXTUREBLEND_POS 44
  37. #define TEXTUREBLEND_LEN 4
  38. #define TEXTUREFILTER_POS 48
  39. #define TEXTUREFILTER_LEN 4
  40. #define TEXTUREPERSP_POS 52
  41. #define TEXTUREPERSP_LEN 1
  42. #define TEXTUERBORDER_POS 53
  43. #define TEXTUREBORDER_LEN 1
  44. #define TEXTUREADDR_POS 54
  45. #define TEXTUREADDR_LEN 1
  46. #define TEXTUREMIP_POS 55
  47. #define TEXTUREMIP_LEN 1
  48. #define TEXTURELOD_POS 56
  49. #define TEXTURELOD_LEN 1
  50. #define TEXTURECOLORKEY_POS 57
  51. #define TEXTURECOLORKEY_LEN 1
  52. #define TEXTUREALPHAOVERRIDE_POS 58
  53. #define TEXTUREALPHAOVERRIDE_LEN 1
  54. #define TARGETPIXELFORMAT_POS 64
  55. #define TARGETPIXELFORMAT_LEN 8
  56. #define SRCBLEND_POS 72
  57. #define SRCBLEND_LEN 4
  58. #define DESTBLEND_POS 76
  59. #define DESTBLEND_LEN 4
  60. #define STIPPLE_POS 80
  61. #define STIPPLE_LEN 1
  62. #define DITHER_POS 81
  63. #define DITHER_LEN 1
  64. #define ROP_POS 82
  65. #define ROP_LEN 1
  66. #define BLEND_POS 83
  67. #define BLEND_LEN 1
  68. #define ALPHATEST_POS 84
  69. #define ALPHATEST_LEN 1
  70. #define ALPHABLEND_POS 85
  71. #define ALPHABLEND_LEN 1
  72. #define STENCIL_POS 86
  73. #define STENCIL_LEN 1
  74. class CRastCapRecord {
  75. friend class CRastCollection;
  76. private:
  77. DWORD m_rgdwData[RASTCAPRECORD_SIZE];
  78. public:
  79. CRastCapRecord(void)
  80. {
  81. memset(m_rgdwData,0,RASTCAPRECORD_SIZE * sizeof(DWORD));
  82. return;
  83. }
  84. void Set_ZTest(int iZTest)
  85. {
  86. SET_VAL(ZTEST_POS,ZTEST_LEN,iZTest);
  87. return;
  88. }
  89. void Set_ZFormat(int iZFormat)
  90. {
  91. SET_VAL(ZFORMAT_POS,ZFORMAT_LEN,iZFormat);
  92. return;
  93. }
  94. void Set_ZWrite(int iZWrite)
  95. {
  96. SET_VAL(ZWRITE_POS,ZWRITE_LEN,iZWrite);
  97. return;
  98. }
  99. void Set_ZFunc(int iZFunc)
  100. {
  101. SET_VAL(ZFUNC_POS,ZFUNC_LEN,iZFunc);
  102. return;
  103. }
  104. void Set_Stipple(int iStipple)
  105. {
  106. SET_VAL(STIPPLE_POS,STIPPLE_LEN,iStipple);
  107. return;
  108. }
  109. void Set_AlphaTest(int iAlphaTest)
  110. {
  111. SET_VAL(ALPHATEST_POS,ALPHATEST_LEN,iAlphaTest);
  112. return;
  113. }
  114. void Set_ShadeMode(int iShadeMode)
  115. {
  116. SET_VAL(SHADEMODE_POS,SHADEMODE_LEN,iShadeMode);
  117. return;
  118. }
  119. void Set_Specular(int iSpecular)
  120. {
  121. SET_VAL(SPECULAR_POS,SPECULAR_LEN,iSpecular);
  122. return;
  123. }
  124. void Set_VertexFog(int iVertexFog)
  125. {
  126. SET_VAL(VERTEXFOG_POS,VERTEXFOG_LEN,iVertexFog);
  127. return;
  128. }
  129. void Set_Texture(int iTexture)
  130. {
  131. SET_VAL(TEXTURE_POS,TEXTURE_LEN,iTexture);
  132. return;
  133. }
  134. void Set_TexturePersp(int iTexturePersp)
  135. {
  136. SET_VAL(TEXTUREPERSP_POS,TEXTUREPERSP_LEN,iTexturePersp);
  137. return;
  138. }
  139. void Set_TextureBlend(int iTextureBlend)
  140. {
  141. SET_VAL(TEXTUREBLEND_POS,TEXTUREBLEND_LEN,iTextureBlend);
  142. return;
  143. }
  144. // for now, just capture texture state for the first texture
  145. // and assume monolithics are single textured.
  146. void Set_TextureBorder(int i, int iTextureBorder)
  147. {
  148. if (i == 0)
  149. {
  150. SET_VAL(TEXTUERBORDER_POS,TEXTUREBORDER_LEN,iTextureBorder);
  151. }
  152. return;
  153. }
  154. void Set_TextureAddr(int i, int iTextureAddr)
  155. {
  156. if (i == 0)
  157. {
  158. SET_VAL(TEXTUREADDR_POS,TEXTUREADDR_LEN,iTextureAddr);
  159. }
  160. return;
  161. }
  162. void Set_TextureFilter(int i, int iTextureFilter)
  163. {
  164. if (i == 0)
  165. {
  166. SET_VAL(TEXTUREFILTER_POS,TEXTUREFILTER_LEN,iTextureFilter);
  167. }
  168. return;
  169. }
  170. void Set_TextureMip(int i, int iTextureMip)
  171. {
  172. if (i == 0)
  173. {
  174. SET_VAL(TEXTUREMIP_POS,TEXTUREMIP_LEN,iTextureMip);
  175. }
  176. return;
  177. }
  178. void Set_TextureLOD(int i, int iTextureLOD)
  179. {
  180. if (i == 0)
  181. {
  182. SET_VAL(TEXTURELOD_POS,TEXTURELOD_LEN,iTextureLOD);
  183. }
  184. return;
  185. }
  186. void Set_TextureFormat(int i, int iTextureFormat)
  187. {
  188. if (i == 0)
  189. {
  190. SET_VAL(TEXTUREFORMAT_POS,TEXTUREFORMAT_LEN,iTextureFormat);
  191. }
  192. return;
  193. }
  194. void Set_TextureColorKey(int i, int iTextureColorKey)
  195. {
  196. if (i == 0)
  197. {
  198. SET_VAL(TEXTURECOLORKEY_POS,TEXTURECOLORKEY_LEN,iTextureColorKey);
  199. }
  200. return;
  201. }
  202. void Set_TextureAlphaOverride(int i, int iTextureAlphaOverride)
  203. {
  204. if (i == 0)
  205. {
  206. SET_VAL(TEXTUREALPHAOVERRIDE_POS,TEXTUREALPHAOVERRIDE_LEN,iTextureAlphaOverride);
  207. }
  208. return;
  209. }
  210. void Set_Mono(int iMono)
  211. {
  212. SET_VAL(MONO_POS,MONO_LEN,iMono);
  213. return;
  214. }
  215. void Set_AlphaBlend(int iAlphaBlend)
  216. {
  217. SET_VAL(ALPHABLEND_POS,ALPHABLEND_LEN,iAlphaBlend);
  218. return;
  219. }
  220. void Set_Blend(int iBlend)
  221. {
  222. SET_VAL(BLEND_POS,BLEND_LEN,iBlend);
  223. return;
  224. }
  225. void Set_ROP(int iROP)
  226. {
  227. SET_VAL(ROP_POS,ROP_LEN,iROP);
  228. return;
  229. }
  230. void Set_SrcBlend(int iSrcBlend)
  231. {
  232. SET_VAL(SRCBLEND_POS,SRCBLEND_LEN,iSrcBlend);
  233. return;
  234. }
  235. void Set_DestBlend(int iDestBlend)
  236. {
  237. SET_VAL(DESTBLEND_POS,DESTBLEND_LEN,iDestBlend);
  238. return;
  239. }
  240. void Set_TargetPixelFormat(int iTargetPixelFormat)
  241. {
  242. SET_VAL(TARGETPIXELFORMAT_POS,TARGETPIXELFORMAT_LEN,iTargetPixelFormat);
  243. return;
  244. }
  245. void Set_Dither(int iDither)
  246. {
  247. SET_VAL(DITHER_POS,DITHER_LEN,iDither);
  248. return;
  249. }
  250. void Set_Stencil(int iStencil)
  251. {
  252. SET_VAL(STENCIL_POS,STENCIL_LEN,iStencil);
  253. return;
  254. }
  255. #if DBG
  256. DWORD GetCapDWord(int iNum)
  257. {
  258. return m_rgdwData[iNum];
  259. }
  260. #endif
  261. };
  262. #endif // _RASTCAP_H_