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.

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