Team Fortress 2 Source Code as on 22/4/2020
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.

212 lines
4.7 KiB

  1. #include "shaderlib/cshader.h"
  2. class engine_post_ps20b_Static_Index
  3. {
  4. private:
  5. int m_nCONVERT_TO_SRGB;
  6. #ifdef _DEBUG
  7. bool m_bCONVERT_TO_SRGB;
  8. #endif
  9. public:
  10. void SetCONVERT_TO_SRGB( int i )
  11. {
  12. Assert( i >= 0 && i <= 1 );
  13. m_nCONVERT_TO_SRGB = i;
  14. #ifdef _DEBUG
  15. m_bCONVERT_TO_SRGB = true;
  16. #endif
  17. }
  18. void SetCONVERT_TO_SRGB( bool i )
  19. {
  20. m_nCONVERT_TO_SRGB = i ? 1 : 0;
  21. #ifdef _DEBUG
  22. m_bCONVERT_TO_SRGB = true;
  23. #endif
  24. }
  25. private:
  26. int m_nLINEAR_INPUT;
  27. #ifdef _DEBUG
  28. bool m_bLINEAR_INPUT;
  29. #endif
  30. public:
  31. void SetLINEAR_INPUT( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nLINEAR_INPUT = i;
  35. #ifdef _DEBUG
  36. m_bLINEAR_INPUT = true;
  37. #endif
  38. }
  39. void SetLINEAR_INPUT( bool i )
  40. {
  41. m_nLINEAR_INPUT = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bLINEAR_INPUT = true;
  44. #endif
  45. }
  46. private:
  47. int m_nLINEAR_OUTPUT;
  48. #ifdef _DEBUG
  49. bool m_bLINEAR_OUTPUT;
  50. #endif
  51. public:
  52. void SetLINEAR_OUTPUT( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nLINEAR_OUTPUT = i;
  56. #ifdef _DEBUG
  57. m_bLINEAR_OUTPUT = true;
  58. #endif
  59. }
  60. void SetLINEAR_OUTPUT( bool i )
  61. {
  62. m_nLINEAR_OUTPUT = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bLINEAR_OUTPUT = true;
  65. #endif
  66. }
  67. public:
  68. engine_post_ps20b_Static_Index( )
  69. {
  70. #ifdef _DEBUG
  71. m_bCONVERT_TO_SRGB = true;
  72. #endif // _DEBUG
  73. m_nCONVERT_TO_SRGB = g_pHardwareConfig->NeedsShaderSRGBConversion();
  74. #ifdef _DEBUG
  75. m_bLINEAR_INPUT = false;
  76. #endif // _DEBUG
  77. m_nLINEAR_INPUT = 0;
  78. #ifdef _DEBUG
  79. m_bLINEAR_OUTPUT = false;
  80. #endif // _DEBUG
  81. m_nLINEAR_OUTPUT = 0;
  82. }
  83. int GetIndex()
  84. {
  85. // Asserts to make sure that we aren't using any skipped combinations.
  86. // Asserts to make sure that we are setting all of the combination vars.
  87. #ifdef _DEBUG
  88. bool bAllStaticVarsDefined = m_bCONVERT_TO_SRGB && m_bLINEAR_INPUT && m_bLINEAR_OUTPUT;
  89. Assert( bAllStaticVarsDefined );
  90. #endif // _DEBUG
  91. return ( 40 * m_nCONVERT_TO_SRGB ) + ( 80 * m_nLINEAR_INPUT ) + ( 160 * m_nLINEAR_OUTPUT ) + 0;
  92. }
  93. };
  94. #define shaderStaticTest_engine_post_ps20b psh_forgot_to_set_static_LINEAR_INPUT + psh_forgot_to_set_static_LINEAR_OUTPUT + 0
  95. class engine_post_ps20b_Dynamic_Index
  96. {
  97. private:
  98. int m_nAA_ENABLE;
  99. #ifdef _DEBUG
  100. bool m_bAA_ENABLE;
  101. #endif
  102. public:
  103. void SetAA_ENABLE( int i )
  104. {
  105. Assert( i >= 0 && i <= 1 );
  106. m_nAA_ENABLE = i;
  107. #ifdef _DEBUG
  108. m_bAA_ENABLE = true;
  109. #endif
  110. }
  111. void SetAA_ENABLE( bool i )
  112. {
  113. m_nAA_ENABLE = i ? 1 : 0;
  114. #ifdef _DEBUG
  115. m_bAA_ENABLE = true;
  116. #endif
  117. }
  118. private:
  119. int m_nAA_QUALITY_MODE;
  120. #ifdef _DEBUG
  121. bool m_bAA_QUALITY_MODE;
  122. #endif
  123. public:
  124. void SetAA_QUALITY_MODE( int i )
  125. {
  126. Assert( i >= 0 && i <= 1 );
  127. m_nAA_QUALITY_MODE = i;
  128. #ifdef _DEBUG
  129. m_bAA_QUALITY_MODE = true;
  130. #endif
  131. }
  132. void SetAA_QUALITY_MODE( bool i )
  133. {
  134. m_nAA_QUALITY_MODE = i ? 1 : 0;
  135. #ifdef _DEBUG
  136. m_bAA_QUALITY_MODE = true;
  137. #endif
  138. }
  139. private:
  140. int m_nAA_REDUCE_ONE_PIXEL_LINE_BLUR;
  141. #ifdef _DEBUG
  142. bool m_bAA_REDUCE_ONE_PIXEL_LINE_BLUR;
  143. #endif
  144. public:
  145. void SetAA_REDUCE_ONE_PIXEL_LINE_BLUR( int i )
  146. {
  147. Assert( i >= 0 && i <= 1 );
  148. m_nAA_REDUCE_ONE_PIXEL_LINE_BLUR = i;
  149. #ifdef _DEBUG
  150. m_bAA_REDUCE_ONE_PIXEL_LINE_BLUR = true;
  151. #endif
  152. }
  153. void SetAA_REDUCE_ONE_PIXEL_LINE_BLUR( bool i )
  154. {
  155. m_nAA_REDUCE_ONE_PIXEL_LINE_BLUR = i ? 1 : 0;
  156. #ifdef _DEBUG
  157. m_bAA_REDUCE_ONE_PIXEL_LINE_BLUR = true;
  158. #endif
  159. }
  160. private:
  161. int m_nCOL_CORRECT_NUM_LOOKUPS;
  162. #ifdef _DEBUG
  163. bool m_bCOL_CORRECT_NUM_LOOKUPS;
  164. #endif
  165. public:
  166. void SetCOL_CORRECT_NUM_LOOKUPS( int i )
  167. {
  168. Assert( i >= 0 && i <= 4 );
  169. m_nCOL_CORRECT_NUM_LOOKUPS = i;
  170. #ifdef _DEBUG
  171. m_bCOL_CORRECT_NUM_LOOKUPS = true;
  172. #endif
  173. }
  174. void SetCOL_CORRECT_NUM_LOOKUPS( bool i )
  175. {
  176. m_nCOL_CORRECT_NUM_LOOKUPS = i ? 1 : 0;
  177. #ifdef _DEBUG
  178. m_bCOL_CORRECT_NUM_LOOKUPS = true;
  179. #endif
  180. }
  181. public:
  182. engine_post_ps20b_Dynamic_Index()
  183. {
  184. #ifdef _DEBUG
  185. m_bAA_ENABLE = false;
  186. #endif // _DEBUG
  187. m_nAA_ENABLE = 0;
  188. #ifdef _DEBUG
  189. m_bAA_QUALITY_MODE = false;
  190. #endif // _DEBUG
  191. m_nAA_QUALITY_MODE = 0;
  192. #ifdef _DEBUG
  193. m_bAA_REDUCE_ONE_PIXEL_LINE_BLUR = false;
  194. #endif // _DEBUG
  195. m_nAA_REDUCE_ONE_PIXEL_LINE_BLUR = 0;
  196. #ifdef _DEBUG
  197. m_bCOL_CORRECT_NUM_LOOKUPS = false;
  198. #endif // _DEBUG
  199. m_nCOL_CORRECT_NUM_LOOKUPS = 0;
  200. }
  201. int GetIndex()
  202. {
  203. // Asserts to make sure that we aren't using any skipped combinations.
  204. // Asserts to make sure that we are setting all of the combination vars.
  205. #ifdef _DEBUG
  206. bool bAllDynamicVarsDefined = m_bAA_ENABLE && m_bAA_QUALITY_MODE && m_bAA_REDUCE_ONE_PIXEL_LINE_BLUR && m_bCOL_CORRECT_NUM_LOOKUPS;
  207. Assert( bAllDynamicVarsDefined );
  208. #endif // _DEBUG
  209. return ( 1 * m_nAA_ENABLE ) + ( 2 * m_nAA_QUALITY_MODE ) + ( 4 * m_nAA_REDUCE_ONE_PIXEL_LINE_BLUR ) + ( 8 * m_nCOL_CORRECT_NUM_LOOKUPS ) + 0;
  210. }
  211. };
  212. #define shaderDynamicTest_engine_post_ps20b psh_forgot_to_set_dynamic_AA_ENABLE + psh_forgot_to_set_dynamic_AA_QUALITY_MODE + psh_forgot_to_set_dynamic_AA_REDUCE_ONE_PIXEL_LINE_BLUR + psh_forgot_to_set_dynamic_COL_CORRECT_NUM_LOOKUPS + 0