Counter Strike : Global Offensive Source Code
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
5.8 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // $TESSELLATION && $VERTEXCOLOR
  3. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  4. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. #include "shaderlib/cshader.h"
  7. class unlitgeneric_vs20_Static_Index
  8. {
  9. private:
  10. int m_nVERTEXCOLOR;
  11. #ifdef _DEBUG
  12. bool m_bVERTEXCOLOR;
  13. #endif
  14. public:
  15. void SetVERTEXCOLOR( int i )
  16. {
  17. Assert( i >= 0 && i <= 1 );
  18. m_nVERTEXCOLOR = i;
  19. #ifdef _DEBUG
  20. m_bVERTEXCOLOR = true;
  21. #endif
  22. }
  23. void SetVERTEXCOLOR( bool i )
  24. {
  25. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  26. m_nVERTEXCOLOR = i ? 1 : 0;
  27. #ifdef _DEBUG
  28. m_bVERTEXCOLOR = true;
  29. #endif
  30. }
  31. private:
  32. int m_nDOPIXELFOG;
  33. #ifdef _DEBUG
  34. bool m_bDOPIXELFOG;
  35. #endif
  36. public:
  37. void SetDOPIXELFOG( int i )
  38. {
  39. Assert( i >= 0 && i <= 1 );
  40. m_nDOPIXELFOG = i;
  41. #ifdef _DEBUG
  42. m_bDOPIXELFOG = true;
  43. #endif
  44. }
  45. void SetDOPIXELFOG( bool i )
  46. {
  47. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  48. m_nDOPIXELFOG = i ? 1 : 0;
  49. #ifdef _DEBUG
  50. m_bDOPIXELFOG = true;
  51. #endif
  52. }
  53. private:
  54. int m_nHARDWAREFOGBLEND;
  55. #ifdef _DEBUG
  56. bool m_bHARDWAREFOGBLEND;
  57. #endif
  58. public:
  59. void SetHARDWAREFOGBLEND( int i )
  60. {
  61. Assert( i >= 0 && i <= 0 );
  62. m_nHARDWAREFOGBLEND = i;
  63. #ifdef _DEBUG
  64. m_bHARDWAREFOGBLEND = true;
  65. #endif
  66. }
  67. void SetHARDWAREFOGBLEND( bool i )
  68. {
  69. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  70. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  71. #ifdef _DEBUG
  72. m_bHARDWAREFOGBLEND = true;
  73. #endif
  74. }
  75. public:
  76. // CONSTRUCTOR
  77. unlitgeneric_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  78. {
  79. #ifdef _DEBUG
  80. m_bVERTEXCOLOR = false;
  81. #endif // _DEBUG
  82. m_nVERTEXCOLOR = 0;
  83. #ifdef _DEBUG
  84. m_bDOPIXELFOG = true;
  85. #endif // _DEBUG
  86. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  87. #ifdef _DEBUG
  88. m_bHARDWAREFOGBLEND = true;
  89. #endif // _DEBUG
  90. m_nHARDWAREFOGBLEND = 0 ;
  91. }
  92. int GetIndex()
  93. {
  94. // Asserts to make sure that we aren't using any skipped combinations.
  95. // Asserts to make sure that we are setting all of the combination vars.
  96. #ifdef _DEBUG
  97. bool bAllStaticVarsDefined = m_bVERTEXCOLOR && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  98. Assert( bAllStaticVarsDefined );
  99. #endif // _DEBUG
  100. return ( 8 * m_nVERTEXCOLOR ) + ( 16 * m_nDOPIXELFOG ) + ( 32 * m_nHARDWAREFOGBLEND ) + 0;
  101. }
  102. };
  103. #define shaderStaticTest_unlitgeneric_vs20 vsh_forgot_to_set_static_VERTEXCOLOR + 0
  104. class unlitgeneric_vs20_Dynamic_Index
  105. {
  106. private:
  107. int m_nCOMPRESSED_VERTS;
  108. #ifdef _DEBUG
  109. bool m_bCOMPRESSED_VERTS;
  110. #endif
  111. public:
  112. void SetCOMPRESSED_VERTS( int i )
  113. {
  114. Assert( i >= 0 && i <= 1 );
  115. m_nCOMPRESSED_VERTS = i;
  116. #ifdef _DEBUG
  117. m_bCOMPRESSED_VERTS = true;
  118. #endif
  119. }
  120. void SetCOMPRESSED_VERTS( bool i )
  121. {
  122. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  123. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  124. #ifdef _DEBUG
  125. m_bCOMPRESSED_VERTS = true;
  126. #endif
  127. }
  128. private:
  129. int m_nSKINNING;
  130. #ifdef _DEBUG
  131. bool m_bSKINNING;
  132. #endif
  133. public:
  134. void SetSKINNING( int i )
  135. {
  136. Assert( i >= 0 && i <= 1 );
  137. m_nSKINNING = i;
  138. #ifdef _DEBUG
  139. m_bSKINNING = true;
  140. #endif
  141. }
  142. void SetSKINNING( bool i )
  143. {
  144. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  145. m_nSKINNING = i ? 1 : 0;
  146. #ifdef _DEBUG
  147. m_bSKINNING = true;
  148. #endif
  149. }
  150. private:
  151. int m_nTESSELLATION;
  152. #ifdef _DEBUG
  153. bool m_bTESSELLATION;
  154. #endif
  155. public:
  156. void SetTESSELLATION( int i )
  157. {
  158. Assert( i >= 0 && i <= 0 );
  159. m_nTESSELLATION = i;
  160. #ifdef _DEBUG
  161. m_bTESSELLATION = true;
  162. #endif
  163. }
  164. void SetTESSELLATION( bool i )
  165. {
  166. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  167. m_nTESSELLATION = i ? 1 : 0;
  168. #ifdef _DEBUG
  169. m_bTESSELLATION = true;
  170. #endif
  171. }
  172. private:
  173. int m_nDOWATERFOG;
  174. #ifdef _DEBUG
  175. bool m_bDOWATERFOG;
  176. #endif
  177. public:
  178. void SetDOWATERFOG( int i )
  179. {
  180. Assert( i >= 0 && i <= 1 );
  181. m_nDOWATERFOG = i;
  182. #ifdef _DEBUG
  183. m_bDOWATERFOG = true;
  184. #endif
  185. }
  186. void SetDOWATERFOG( bool i )
  187. {
  188. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  189. m_nDOWATERFOG = i ? 1 : 0;
  190. #ifdef _DEBUG
  191. m_bDOWATERFOG = true;
  192. #endif
  193. }
  194. public:
  195. // CONSTRUCTOR
  196. unlitgeneric_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  197. {
  198. #ifdef _DEBUG
  199. m_bCOMPRESSED_VERTS = false;
  200. #endif // _DEBUG
  201. m_nCOMPRESSED_VERTS = 0;
  202. #ifdef _DEBUG
  203. m_bSKINNING = false;
  204. #endif // _DEBUG
  205. m_nSKINNING = 0;
  206. #ifdef _DEBUG
  207. m_bTESSELLATION = false;
  208. #endif // _DEBUG
  209. m_nTESSELLATION = 0;
  210. #ifdef _DEBUG
  211. m_bDOWATERFOG = true;
  212. #endif // _DEBUG
  213. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  214. }
  215. int GetIndex()
  216. {
  217. // Asserts to make sure that we aren't using any skipped combinations.
  218. // Asserts to make sure that we are setting all of the combination vars.
  219. #ifdef _DEBUG
  220. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bSKINNING && m_bTESSELLATION && m_bDOWATERFOG;
  221. Assert( bAllDynamicVarsDefined );
  222. #endif // _DEBUG
  223. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nSKINNING ) + ( 4 * m_nTESSELLATION ) + ( 4 * m_nDOWATERFOG ) + 0;
  224. }
  225. };
  226. #define shaderDynamicTest_unlitgeneric_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_TESSELLATION + 0
  227. static const ShaderComboInformation_t s_DynamicComboArray_unlitgeneric_vs20[4] =
  228. {
  229. { "COMPRESSED_VERTS", 0, 1 },
  230. { "SKINNING", 0, 1 },
  231. { "TESSELLATION", 0, 0 },
  232. { "DOWATERFOG", 0, 1 },
  233. };
  234. static const ShaderComboInformation_t s_StaticComboArray_unlitgeneric_vs20[3] =
  235. {
  236. { "VERTEXCOLOR", 0, 1 },
  237. { "DOPIXELFOG", 0, 1 },
  238. { "HARDWAREFOGBLEND", 0, 0 },
  239. };
  240. static const ShaderComboSemantics_t unlitgeneric_vs20_combos =
  241. {
  242. "unlitgeneric_vs20", s_DynamicComboArray_unlitgeneric_vs20, 4, s_StaticComboArray_unlitgeneric_vs20, 3
  243. };
  244. class ConstructMe_unlitgeneric_vs20
  245. {
  246. public:
  247. ConstructMe_unlitgeneric_vs20()
  248. {
  249. GetShaderDLL()->AddShaderComboInformation( &unlitgeneric_vs20_combos );
  250. }
  251. };
  252. static ConstructMe_unlitgeneric_vs20 s_ConstructMe_unlitgeneric_vs20;