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.

481 lines
12 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // ( $CONVERT_FROM_LINEAR == 0 ) && ( $CONVERT_TO_LINEAR == 1 )
  3. // ( $TOOL_MODE == 0 ) && ( $CONVERT_FROM_LINEAR == 1 )
  4. // ( $TOOL_MODE == 0 ) && ( $CONVERT_TO_LINEAR == 1 )
  5. // ( $CONVERT_FROM_LINEAR == 1 ) && ( $LINEAR_INPUT == 1 )
  6. // ( $CONVERT_TO_LINEAR == 1 ) && ( $LINEAR_OUTPUT == 1 )
  7. // ( $LOCAL_CONTRAST_ENABLE == 0 ) && ( $BLURRED_VIGNETTE_ENABLE == 1 )
  8. // ( $TOOL_MODE == 0 ) && $TV_GAMMA
  9. // ( $TOOL_MODE == 0 ) && $DESATURATEENABLE
  10. // defined $PIXELFOGTYPE && defined $WRITEWATERFOGTODESTALPHA && ( $PIXELFOGTYPE != 1 ) && $WRITEWATERFOGTODESTALPHA
  11. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPTINT && $LIGHTING_PREVIEW && $FASTPATHENVMAPTINT
  12. // defined $LIGHTING_PREVIEW && defined $FASTPATHENVMAPCONTRAST && $LIGHTING_PREVIEW && $FASTPATHENVMAPCONTRAST
  13. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  14. // ($FLASHLIGHT || $FLASHLIGHTSHADOWS) && $LIGHTING_PREVIEW
  15. #include "shaderlib/cshader.h"
  16. class engine_post_ps20b_Static_Index
  17. {
  18. private:
  19. int m_nTOOL_MODE;
  20. #ifdef _DEBUG
  21. bool m_bTOOL_MODE;
  22. #endif
  23. public:
  24. void SetTOOL_MODE( int i )
  25. {
  26. Assert( i >= 0 && i <= 1 );
  27. m_nTOOL_MODE = i;
  28. #ifdef _DEBUG
  29. m_bTOOL_MODE = true;
  30. #endif
  31. }
  32. void SetTOOL_MODE( bool i )
  33. {
  34. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  35. m_nTOOL_MODE = i ? 1 : 0;
  36. #ifdef _DEBUG
  37. m_bTOOL_MODE = true;
  38. #endif
  39. }
  40. private:
  41. int m_nDEPTH_BLUR_ENABLE;
  42. #ifdef _DEBUG
  43. bool m_bDEPTH_BLUR_ENABLE;
  44. #endif
  45. public:
  46. void SetDEPTH_BLUR_ENABLE( int i )
  47. {
  48. Assert( i >= 0 && i <= 1 );
  49. m_nDEPTH_BLUR_ENABLE = i;
  50. #ifdef _DEBUG
  51. m_bDEPTH_BLUR_ENABLE = true;
  52. #endif
  53. }
  54. void SetDEPTH_BLUR_ENABLE( bool i )
  55. {
  56. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  57. m_nDEPTH_BLUR_ENABLE = i ? 1 : 0;
  58. #ifdef _DEBUG
  59. m_bDEPTH_BLUR_ENABLE = true;
  60. #endif
  61. }
  62. private:
  63. int m_nLINEAR_INPUT;
  64. #ifdef _DEBUG
  65. bool m_bLINEAR_INPUT;
  66. #endif
  67. public:
  68. void SetLINEAR_INPUT( int i )
  69. {
  70. Assert( i >= 0 && i <= 0 );
  71. m_nLINEAR_INPUT = i;
  72. #ifdef _DEBUG
  73. m_bLINEAR_INPUT = true;
  74. #endif
  75. }
  76. void SetLINEAR_INPUT( bool i )
  77. {
  78. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  79. m_nLINEAR_INPUT = i ? 1 : 0;
  80. #ifdef _DEBUG
  81. m_bLINEAR_INPUT = true;
  82. #endif
  83. }
  84. private:
  85. int m_nLINEAR_OUTPUT;
  86. #ifdef _DEBUG
  87. bool m_bLINEAR_OUTPUT;
  88. #endif
  89. public:
  90. void SetLINEAR_OUTPUT( int i )
  91. {
  92. Assert( i >= 0 && i <= 0 );
  93. m_nLINEAR_OUTPUT = i;
  94. #ifdef _DEBUG
  95. m_bLINEAR_OUTPUT = true;
  96. #endif
  97. }
  98. void SetLINEAR_OUTPUT( bool i )
  99. {
  100. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  101. m_nLINEAR_OUTPUT = i ? 1 : 0;
  102. #ifdef _DEBUG
  103. m_bLINEAR_OUTPUT = true;
  104. #endif
  105. }
  106. public:
  107. // CONSTRUCTOR
  108. engine_post_ps20b_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  109. {
  110. #ifdef _DEBUG
  111. m_bTOOL_MODE = false;
  112. #endif // _DEBUG
  113. m_nTOOL_MODE = 0;
  114. #ifdef _DEBUG
  115. m_bDEPTH_BLUR_ENABLE = false;
  116. #endif // _DEBUG
  117. m_nDEPTH_BLUR_ENABLE = 0;
  118. #ifdef _DEBUG
  119. m_bLINEAR_INPUT = false;
  120. #endif // _DEBUG
  121. m_nLINEAR_INPUT = 0;
  122. #ifdef _DEBUG
  123. m_bLINEAR_OUTPUT = false;
  124. #endif // _DEBUG
  125. m_nLINEAR_OUTPUT = 0;
  126. }
  127. int GetIndex()
  128. {
  129. // Asserts to make sure that we aren't using any skipped combinations.
  130. // Asserts to make sure that we are setting all of the combination vars.
  131. #ifdef _DEBUG
  132. bool bAllStaticVarsDefined = m_bTOOL_MODE && m_bDEPTH_BLUR_ENABLE && m_bLINEAR_INPUT && m_bLINEAR_OUTPUT;
  133. Assert( bAllStaticVarsDefined );
  134. #endif // _DEBUG
  135. return ( 384 * m_nTOOL_MODE ) + ( 768 * m_nDEPTH_BLUR_ENABLE ) + ( 1536 * m_nLINEAR_INPUT ) + ( 1536 * m_nLINEAR_OUTPUT ) + 0;
  136. }
  137. };
  138. #define shaderStaticTest_engine_post_ps20b psh_forgot_to_set_static_TOOL_MODE + psh_forgot_to_set_static_DEPTH_BLUR_ENABLE + psh_forgot_to_set_static_LINEAR_INPUT + psh_forgot_to_set_static_LINEAR_OUTPUT + 0
  139. class engine_post_ps20b_Dynamic_Index
  140. {
  141. private:
  142. int m_nAA_ENABLE;
  143. #ifdef _DEBUG
  144. bool m_bAA_ENABLE;
  145. #endif
  146. public:
  147. void SetAA_ENABLE( int i )
  148. {
  149. Assert( i >= 0 && i <= 1 );
  150. m_nAA_ENABLE = i;
  151. #ifdef _DEBUG
  152. m_bAA_ENABLE = true;
  153. #endif
  154. }
  155. void SetAA_ENABLE( bool i )
  156. {
  157. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  158. m_nAA_ENABLE = i ? 1 : 0;
  159. #ifdef _DEBUG
  160. m_bAA_ENABLE = true;
  161. #endif
  162. }
  163. private:
  164. int m_nCOL_CORRECT_NUM_LOOKUPS;
  165. #ifdef _DEBUG
  166. bool m_bCOL_CORRECT_NUM_LOOKUPS;
  167. #endif
  168. public:
  169. void SetCOL_CORRECT_NUM_LOOKUPS( int i )
  170. {
  171. Assert( i >= 0 && i <= 3 );
  172. m_nCOL_CORRECT_NUM_LOOKUPS = i;
  173. #ifdef _DEBUG
  174. m_bCOL_CORRECT_NUM_LOOKUPS = true;
  175. #endif
  176. }
  177. void SetCOL_CORRECT_NUM_LOOKUPS( bool i )
  178. {
  179. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 3 );
  180. m_nCOL_CORRECT_NUM_LOOKUPS = i ? 1 : 0;
  181. #ifdef _DEBUG
  182. m_bCOL_CORRECT_NUM_LOOKUPS = true;
  183. #endif
  184. }
  185. private:
  186. int m_nCONVERT_FROM_LINEAR;
  187. #ifdef _DEBUG
  188. bool m_bCONVERT_FROM_LINEAR;
  189. #endif
  190. public:
  191. void SetCONVERT_FROM_LINEAR( int i )
  192. {
  193. Assert( i >= 0 && i <= 0 );
  194. m_nCONVERT_FROM_LINEAR = i;
  195. #ifdef _DEBUG
  196. m_bCONVERT_FROM_LINEAR = true;
  197. #endif
  198. }
  199. void SetCONVERT_FROM_LINEAR( bool i )
  200. {
  201. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  202. m_nCONVERT_FROM_LINEAR = i ? 1 : 0;
  203. #ifdef _DEBUG
  204. m_bCONVERT_FROM_LINEAR = true;
  205. #endif
  206. }
  207. private:
  208. int m_nCONVERT_TO_LINEAR;
  209. #ifdef _DEBUG
  210. bool m_bCONVERT_TO_LINEAR;
  211. #endif
  212. public:
  213. void SetCONVERT_TO_LINEAR( int i )
  214. {
  215. Assert( i >= 0 && i <= 0 );
  216. m_nCONVERT_TO_LINEAR = i;
  217. #ifdef _DEBUG
  218. m_bCONVERT_TO_LINEAR = true;
  219. #endif
  220. }
  221. void SetCONVERT_TO_LINEAR( bool i )
  222. {
  223. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  224. m_nCONVERT_TO_LINEAR = i ? 1 : 0;
  225. #ifdef _DEBUG
  226. m_bCONVERT_TO_LINEAR = true;
  227. #endif
  228. }
  229. private:
  230. int m_nFADE_TO_BLACK;
  231. #ifdef _DEBUG
  232. bool m_bFADE_TO_BLACK;
  233. #endif
  234. public:
  235. void SetFADE_TO_BLACK( int i )
  236. {
  237. Assert( i >= 0 && i <= 1 );
  238. m_nFADE_TO_BLACK = i;
  239. #ifdef _DEBUG
  240. m_bFADE_TO_BLACK = true;
  241. #endif
  242. }
  243. void SetFADE_TO_BLACK( bool i )
  244. {
  245. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  246. m_nFADE_TO_BLACK = i ? 1 : 0;
  247. #ifdef _DEBUG
  248. m_bFADE_TO_BLACK = true;
  249. #endif
  250. }
  251. private:
  252. int m_nFADE_TYPE;
  253. #ifdef _DEBUG
  254. bool m_bFADE_TYPE;
  255. #endif
  256. public:
  257. void SetFADE_TYPE( int i )
  258. {
  259. Assert( i >= 0 && i <= 2 );
  260. m_nFADE_TYPE = i;
  261. #ifdef _DEBUG
  262. m_bFADE_TYPE = true;
  263. #endif
  264. }
  265. void SetFADE_TYPE( bool i )
  266. {
  267. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 2 );
  268. m_nFADE_TYPE = i ? 1 : 0;
  269. #ifdef _DEBUG
  270. m_bFADE_TYPE = true;
  271. #endif
  272. }
  273. private:
  274. int m_nNOISE_ENABLE;
  275. #ifdef _DEBUG
  276. bool m_bNOISE_ENABLE;
  277. #endif
  278. public:
  279. void SetNOISE_ENABLE( int i )
  280. {
  281. Assert( i >= 0 && i <= 0 );
  282. m_nNOISE_ENABLE = i;
  283. #ifdef _DEBUG
  284. m_bNOISE_ENABLE = true;
  285. #endif
  286. }
  287. void SetNOISE_ENABLE( bool i )
  288. {
  289. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  290. m_nNOISE_ENABLE = i ? 1 : 0;
  291. #ifdef _DEBUG
  292. m_bNOISE_ENABLE = true;
  293. #endif
  294. }
  295. private:
  296. int m_nVIGNETTE_ENABLE;
  297. #ifdef _DEBUG
  298. bool m_bVIGNETTE_ENABLE;
  299. #endif
  300. public:
  301. void SetVIGNETTE_ENABLE( int i )
  302. {
  303. Assert( i >= 0 && i <= 1 );
  304. m_nVIGNETTE_ENABLE = i;
  305. #ifdef _DEBUG
  306. m_bVIGNETTE_ENABLE = true;
  307. #endif
  308. }
  309. void SetVIGNETTE_ENABLE( bool i )
  310. {
  311. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  312. m_nVIGNETTE_ENABLE = i ? 1 : 0;
  313. #ifdef _DEBUG
  314. m_bVIGNETTE_ENABLE = true;
  315. #endif
  316. }
  317. private:
  318. int m_nLOCAL_CONTRAST_ENABLE;
  319. #ifdef _DEBUG
  320. bool m_bLOCAL_CONTRAST_ENABLE;
  321. #endif
  322. public:
  323. void SetLOCAL_CONTRAST_ENABLE( int i )
  324. {
  325. Assert( i >= 0 && i <= 1 );
  326. m_nLOCAL_CONTRAST_ENABLE = i;
  327. #ifdef _DEBUG
  328. m_bLOCAL_CONTRAST_ENABLE = true;
  329. #endif
  330. }
  331. void SetLOCAL_CONTRAST_ENABLE( bool i )
  332. {
  333. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  334. m_nLOCAL_CONTRAST_ENABLE = i ? 1 : 0;
  335. #ifdef _DEBUG
  336. m_bLOCAL_CONTRAST_ENABLE = true;
  337. #endif
  338. }
  339. private:
  340. int m_nBLURRED_VIGNETTE_ENABLE;
  341. #ifdef _DEBUG
  342. bool m_bBLURRED_VIGNETTE_ENABLE;
  343. #endif
  344. public:
  345. void SetBLURRED_VIGNETTE_ENABLE( int i )
  346. {
  347. Assert( i >= 0 && i <= 1 );
  348. m_nBLURRED_VIGNETTE_ENABLE = i;
  349. #ifdef _DEBUG
  350. m_bBLURRED_VIGNETTE_ENABLE = true;
  351. #endif
  352. }
  353. void SetBLURRED_VIGNETTE_ENABLE( bool i )
  354. {
  355. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  356. m_nBLURRED_VIGNETTE_ENABLE = i ? 1 : 0;
  357. #ifdef _DEBUG
  358. m_bBLURRED_VIGNETTE_ENABLE = true;
  359. #endif
  360. }
  361. private:
  362. int m_nVOMIT_ENABLE;
  363. #ifdef _DEBUG
  364. bool m_bVOMIT_ENABLE;
  365. #endif
  366. public:
  367. void SetVOMIT_ENABLE( int i )
  368. {
  369. Assert( i >= 0 && i <= 0 );
  370. m_nVOMIT_ENABLE = i;
  371. #ifdef _DEBUG
  372. m_bVOMIT_ENABLE = true;
  373. #endif
  374. }
  375. void SetVOMIT_ENABLE( bool i )
  376. {
  377. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  378. m_nVOMIT_ENABLE = i ? 1 : 0;
  379. #ifdef _DEBUG
  380. m_bVOMIT_ENABLE = true;
  381. #endif
  382. }
  383. public:
  384. // CONSTRUCTOR
  385. engine_post_ps20b_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  386. {
  387. #ifdef _DEBUG
  388. m_bAA_ENABLE = false;
  389. #endif // _DEBUG
  390. m_nAA_ENABLE = 0;
  391. #ifdef _DEBUG
  392. m_bCOL_CORRECT_NUM_LOOKUPS = false;
  393. #endif // _DEBUG
  394. m_nCOL_CORRECT_NUM_LOOKUPS = 0;
  395. #ifdef _DEBUG
  396. m_bCONVERT_FROM_LINEAR = false;
  397. #endif // _DEBUG
  398. m_nCONVERT_FROM_LINEAR = 0;
  399. #ifdef _DEBUG
  400. m_bCONVERT_TO_LINEAR = false;
  401. #endif // _DEBUG
  402. m_nCONVERT_TO_LINEAR = 0;
  403. #ifdef _DEBUG
  404. m_bFADE_TO_BLACK = false;
  405. #endif // _DEBUG
  406. m_nFADE_TO_BLACK = 0;
  407. #ifdef _DEBUG
  408. m_bFADE_TYPE = false;
  409. #endif // _DEBUG
  410. m_nFADE_TYPE = 0;
  411. #ifdef _DEBUG
  412. m_bNOISE_ENABLE = false;
  413. #endif // _DEBUG
  414. m_nNOISE_ENABLE = 0;
  415. #ifdef _DEBUG
  416. m_bVIGNETTE_ENABLE = false;
  417. #endif // _DEBUG
  418. m_nVIGNETTE_ENABLE = 0;
  419. #ifdef _DEBUG
  420. m_bLOCAL_CONTRAST_ENABLE = false;
  421. #endif // _DEBUG
  422. m_nLOCAL_CONTRAST_ENABLE = 0;
  423. #ifdef _DEBUG
  424. m_bBLURRED_VIGNETTE_ENABLE = false;
  425. #endif // _DEBUG
  426. m_nBLURRED_VIGNETTE_ENABLE = 0;
  427. #ifdef _DEBUG
  428. m_bVOMIT_ENABLE = false;
  429. #endif // _DEBUG
  430. m_nVOMIT_ENABLE = 0;
  431. }
  432. int GetIndex()
  433. {
  434. // Asserts to make sure that we aren't using any skipped combinations.
  435. // Asserts to make sure that we are setting all of the combination vars.
  436. #ifdef _DEBUG
  437. bool bAllDynamicVarsDefined = m_bAA_ENABLE && m_bCOL_CORRECT_NUM_LOOKUPS && m_bCONVERT_FROM_LINEAR && m_bCONVERT_TO_LINEAR && m_bFADE_TO_BLACK && m_bFADE_TYPE && m_bNOISE_ENABLE && m_bVIGNETTE_ENABLE && m_bLOCAL_CONTRAST_ENABLE && m_bBLURRED_VIGNETTE_ENABLE && m_bVOMIT_ENABLE;
  438. Assert( bAllDynamicVarsDefined );
  439. #endif // _DEBUG
  440. return ( 1 * m_nAA_ENABLE ) + ( 2 * m_nCOL_CORRECT_NUM_LOOKUPS ) + ( 8 * m_nCONVERT_FROM_LINEAR ) + ( 8 * m_nCONVERT_TO_LINEAR ) + ( 8 * m_nFADE_TO_BLACK ) + ( 16 * m_nFADE_TYPE ) + ( 48 * m_nNOISE_ENABLE ) + ( 48 * m_nVIGNETTE_ENABLE ) + ( 96 * m_nLOCAL_CONTRAST_ENABLE ) + ( 192 * m_nBLURRED_VIGNETTE_ENABLE ) + ( 384 * m_nVOMIT_ENABLE ) + 0;
  441. }
  442. };
  443. #define shaderDynamicTest_engine_post_ps20b psh_forgot_to_set_dynamic_AA_ENABLE + psh_forgot_to_set_dynamic_COL_CORRECT_NUM_LOOKUPS + psh_forgot_to_set_dynamic_CONVERT_FROM_LINEAR + psh_forgot_to_set_dynamic_CONVERT_TO_LINEAR + psh_forgot_to_set_dynamic_FADE_TO_BLACK + psh_forgot_to_set_dynamic_FADE_TYPE + psh_forgot_to_set_dynamic_NOISE_ENABLE + psh_forgot_to_set_dynamic_VIGNETTE_ENABLE + psh_forgot_to_set_dynamic_LOCAL_CONTRAST_ENABLE + psh_forgot_to_set_dynamic_BLURRED_VIGNETTE_ENABLE + psh_forgot_to_set_dynamic_VOMIT_ENABLE + 0
  444. static const ShaderComboInformation_t s_DynamicComboArray_Engine_Post_ps20b[11] =
  445. {
  446. { "AA_ENABLE", 0, 1 },
  447. { "COL_CORRECT_NUM_LOOKUPS", 0, 3 },
  448. { "CONVERT_FROM_LINEAR", 0, 0 },
  449. { "CONVERT_TO_LINEAR", 0, 0 },
  450. { "FADE_TO_BLACK", 0, 1 },
  451. { "FADE_TYPE", 0, 2 },
  452. { "NOISE_ENABLE", 0, 0 },
  453. { "VIGNETTE_ENABLE", 0, 1 },
  454. { "LOCAL_CONTRAST_ENABLE", 0, 1 },
  455. { "BLURRED_VIGNETTE_ENABLE", 0, 1 },
  456. { "VOMIT_ENABLE", 0, 0 },
  457. };
  458. static const ShaderComboInformation_t s_StaticComboArray_Engine_Post_ps20b[4] =
  459. {
  460. { "TOOL_MODE", 0, 1 },
  461. { "DEPTH_BLUR_ENABLE", 0, 1 },
  462. { "LINEAR_INPUT", 0, 0 },
  463. { "LINEAR_OUTPUT", 0, 0 },
  464. };
  465. static const ShaderComboSemantics_t Engine_Post_ps20b_combos =
  466. {
  467. "Engine_Post_ps20b", s_DynamicComboArray_Engine_Post_ps20b, 11, s_StaticComboArray_Engine_Post_ps20b, 4
  468. };
  469. class ConstructMe_Engine_Post_ps20b
  470. {
  471. public:
  472. ConstructMe_Engine_Post_ps20b()
  473. {
  474. GetShaderDLL()->AddShaderComboInformation( &Engine_Post_ps20b_combos );
  475. }
  476. };
  477. static ConstructMe_Engine_Post_ps20b s_ConstructMe_Engine_Post_ps20b;