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.

310 lines
6.9 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  3. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  4. // ( $FLATTEN_STATIC_CONTROL_FLOW == 0 )&& ( $NUM_LIGHTS > 0 ) [PC]
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. #include "shaderlib/cshader.h"
  7. class cloak_vs20_Static_Index
  8. {
  9. private:
  10. int m_nMODEL;
  11. #ifdef _DEBUG
  12. bool m_bMODEL;
  13. #endif
  14. public:
  15. void SetMODEL( int i )
  16. {
  17. Assert( i >= 0 && i <= 1 );
  18. m_nMODEL = i;
  19. #ifdef _DEBUG
  20. m_bMODEL = true;
  21. #endif
  22. }
  23. void SetMODEL( bool i )
  24. {
  25. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  26. m_nMODEL = i ? 1 : 0;
  27. #ifdef _DEBUG
  28. m_bMODEL = true;
  29. #endif
  30. }
  31. private:
  32. int m_nFLATTEN_STATIC_CONTROL_FLOW;
  33. #ifdef _DEBUG
  34. bool m_bFLATTEN_STATIC_CONTROL_FLOW;
  35. #endif
  36. public:
  37. void SetFLATTEN_STATIC_CONTROL_FLOW( int i )
  38. {
  39. Assert( i >= 0 && i <= 1 );
  40. m_nFLATTEN_STATIC_CONTROL_FLOW = i;
  41. #ifdef _DEBUG
  42. m_bFLATTEN_STATIC_CONTROL_FLOW = true;
  43. #endif
  44. }
  45. void SetFLATTEN_STATIC_CONTROL_FLOW( bool i )
  46. {
  47. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  48. m_nFLATTEN_STATIC_CONTROL_FLOW = i ? 1 : 0;
  49. #ifdef _DEBUG
  50. m_bFLATTEN_STATIC_CONTROL_FLOW = true;
  51. #endif
  52. }
  53. private:
  54. int m_nDOPIXELFOG;
  55. #ifdef _DEBUG
  56. bool m_bDOPIXELFOG;
  57. #endif
  58. public:
  59. void SetDOPIXELFOG( int i )
  60. {
  61. Assert( i >= 0 && i <= 1 );
  62. m_nDOPIXELFOG = i;
  63. #ifdef _DEBUG
  64. m_bDOPIXELFOG = true;
  65. #endif
  66. }
  67. void SetDOPIXELFOG( bool i )
  68. {
  69. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  70. m_nDOPIXELFOG = i ? 1 : 0;
  71. #ifdef _DEBUG
  72. m_bDOPIXELFOG = true;
  73. #endif
  74. }
  75. private:
  76. int m_nHARDWAREFOGBLEND;
  77. #ifdef _DEBUG
  78. bool m_bHARDWAREFOGBLEND;
  79. #endif
  80. public:
  81. void SetHARDWAREFOGBLEND( int i )
  82. {
  83. Assert( i >= 0 && i <= 1 );
  84. m_nHARDWAREFOGBLEND = i;
  85. #ifdef _DEBUG
  86. m_bHARDWAREFOGBLEND = true;
  87. #endif
  88. }
  89. void SetHARDWAREFOGBLEND( bool i )
  90. {
  91. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  92. m_nHARDWAREFOGBLEND = i ? 1 : 0;
  93. #ifdef _DEBUG
  94. m_bHARDWAREFOGBLEND = true;
  95. #endif
  96. }
  97. public:
  98. // CONSTRUCTOR
  99. cloak_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  100. {
  101. #ifdef _DEBUG
  102. m_bMODEL = false;
  103. #endif // _DEBUG
  104. m_nMODEL = 0;
  105. #ifdef _DEBUG
  106. m_bFLATTEN_STATIC_CONTROL_FLOW = false;
  107. #endif // _DEBUG
  108. m_nFLATTEN_STATIC_CONTROL_FLOW = 0;
  109. #ifdef _DEBUG
  110. m_bDOPIXELFOG = true;
  111. #endif // _DEBUG
  112. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  113. #ifdef _DEBUG
  114. m_bHARDWAREFOGBLEND = true;
  115. #endif // _DEBUG
  116. m_nHARDWAREFOGBLEND = !g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  117. }
  118. int GetIndex()
  119. {
  120. // Asserts to make sure that we aren't using any skipped combinations.
  121. // Asserts to make sure that we are setting all of the combination vars.
  122. #ifdef _DEBUG
  123. bool bAllStaticVarsDefined = m_bMODEL && m_bFLATTEN_STATIC_CONTROL_FLOW && m_bDOPIXELFOG && m_bHARDWAREFOGBLEND;
  124. Assert( bAllStaticVarsDefined );
  125. #endif // _DEBUG
  126. return ( 24 * m_nMODEL ) + ( 48 * m_nFLATTEN_STATIC_CONTROL_FLOW ) + ( 96 * m_nDOPIXELFOG ) + ( 192 * m_nHARDWAREFOGBLEND ) + 0;
  127. }
  128. };
  129. #define shaderStaticTest_cloak_vs20 vsh_forgot_to_set_static_MODEL + vsh_forgot_to_set_static_FLATTEN_STATIC_CONTROL_FLOW + 0
  130. class cloak_vs20_Dynamic_Index
  131. {
  132. private:
  133. int m_nCOMPRESSED_VERTS;
  134. #ifdef _DEBUG
  135. bool m_bCOMPRESSED_VERTS;
  136. #endif
  137. public:
  138. void SetCOMPRESSED_VERTS( int i )
  139. {
  140. Assert( i >= 0 && i <= 1 );
  141. m_nCOMPRESSED_VERTS = i;
  142. #ifdef _DEBUG
  143. m_bCOMPRESSED_VERTS = true;
  144. #endif
  145. }
  146. void SetCOMPRESSED_VERTS( bool i )
  147. {
  148. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  149. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  150. #ifdef _DEBUG
  151. m_bCOMPRESSED_VERTS = true;
  152. #endif
  153. }
  154. private:
  155. int m_nDOWATERFOG;
  156. #ifdef _DEBUG
  157. bool m_bDOWATERFOG;
  158. #endif
  159. public:
  160. void SetDOWATERFOG( int i )
  161. {
  162. Assert( i >= 0 && i <= 1 );
  163. m_nDOWATERFOG = i;
  164. #ifdef _DEBUG
  165. m_bDOWATERFOG = true;
  166. #endif
  167. }
  168. void SetDOWATERFOG( bool i )
  169. {
  170. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  171. m_nDOWATERFOG = i ? 1 : 0;
  172. #ifdef _DEBUG
  173. m_bDOWATERFOG = true;
  174. #endif
  175. }
  176. private:
  177. int m_nSKINNING;
  178. #ifdef _DEBUG
  179. bool m_bSKINNING;
  180. #endif
  181. public:
  182. void SetSKINNING( int i )
  183. {
  184. Assert( i >= 0 && i <= 1 );
  185. m_nSKINNING = i;
  186. #ifdef _DEBUG
  187. m_bSKINNING = true;
  188. #endif
  189. }
  190. void SetSKINNING( bool i )
  191. {
  192. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  193. m_nSKINNING = i ? 1 : 0;
  194. #ifdef _DEBUG
  195. m_bSKINNING = true;
  196. #endif
  197. }
  198. private:
  199. int m_nMORPHING;
  200. #ifdef _DEBUG
  201. bool m_bMORPHING;
  202. #endif
  203. public:
  204. void SetMORPHING( int i )
  205. {
  206. Assert( i >= 0 && i <= 0 );
  207. m_nMORPHING = i;
  208. #ifdef _DEBUG
  209. m_bMORPHING = true;
  210. #endif
  211. }
  212. void SetMORPHING( bool i )
  213. {
  214. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  215. m_nMORPHING = i ? 1 : 0;
  216. #ifdef _DEBUG
  217. m_bMORPHING = true;
  218. #endif
  219. }
  220. private:
  221. int m_nNUM_LIGHTS;
  222. #ifdef _DEBUG
  223. bool m_bNUM_LIGHTS;
  224. #endif
  225. public:
  226. void SetNUM_LIGHTS( int i )
  227. {
  228. Assert( i >= 0 && i <= 2 );
  229. m_nNUM_LIGHTS = i;
  230. #ifdef _DEBUG
  231. m_bNUM_LIGHTS = true;
  232. #endif
  233. }
  234. void SetNUM_LIGHTS( bool i )
  235. {
  236. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  237. m_nNUM_LIGHTS = i ? 1 : 0;
  238. #ifdef _DEBUG
  239. m_bNUM_LIGHTS = true;
  240. #endif
  241. }
  242. public:
  243. // CONSTRUCTOR
  244. cloak_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  245. {
  246. #ifdef _DEBUG
  247. m_bCOMPRESSED_VERTS = false;
  248. #endif // _DEBUG
  249. m_nCOMPRESSED_VERTS = 0;
  250. #ifdef _DEBUG
  251. m_bDOWATERFOG = true;
  252. #endif // _DEBUG
  253. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  254. #ifdef _DEBUG
  255. m_bSKINNING = false;
  256. #endif // _DEBUG
  257. m_nSKINNING = 0;
  258. #ifdef _DEBUG
  259. m_bMORPHING = true;
  260. #endif // _DEBUG
  261. m_nMORPHING = false ;
  262. #ifdef _DEBUG
  263. m_bNUM_LIGHTS = false;
  264. #endif // _DEBUG
  265. m_nNUM_LIGHTS = 0;
  266. }
  267. int GetIndex()
  268. {
  269. // Asserts to make sure that we aren't using any skipped combinations.
  270. // Asserts to make sure that we are setting all of the combination vars.
  271. #ifdef _DEBUG
  272. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bDOWATERFOG && m_bSKINNING && m_bMORPHING && m_bNUM_LIGHTS;
  273. Assert( bAllDynamicVarsDefined );
  274. #endif // _DEBUG
  275. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nDOWATERFOG ) + ( 4 * m_nSKINNING ) + ( 8 * m_nMORPHING ) + ( 8 * m_nNUM_LIGHTS ) + 0;
  276. }
  277. };
  278. #define shaderDynamicTest_cloak_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_NUM_LIGHTS + 0
  279. static const ShaderComboInformation_t s_DynamicComboArray_cloak_vs20[5] =
  280. {
  281. { "COMPRESSED_VERTS", 0, 1 },
  282. { "DOWATERFOG", 0, 1 },
  283. { "SKINNING", 0, 1 },
  284. { "MORPHING", 0, 0 },
  285. { "NUM_LIGHTS", 0, 2 },
  286. };
  287. static const ShaderComboInformation_t s_StaticComboArray_cloak_vs20[4] =
  288. {
  289. { "MODEL", 0, 1 },
  290. { "FLATTEN_STATIC_CONTROL_FLOW", 0, 1 },
  291. { "DOPIXELFOG", 0, 1 },
  292. { "HARDWAREFOGBLEND", 0, 1 },
  293. };
  294. static const ShaderComboSemantics_t cloak_vs20_combos =
  295. {
  296. "cloak_vs20", s_DynamicComboArray_cloak_vs20, 5, s_StaticComboArray_cloak_vs20, 4
  297. };
  298. class ConstructMe_cloak_vs20
  299. {
  300. public:
  301. ConstructMe_cloak_vs20()
  302. {
  303. GetShaderDLL()->AddShaderComboInformation( &cloak_vs20_combos );
  304. }
  305. };
  306. static ConstructMe_cloak_vs20 s_ConstructMe_cloak_vs20;