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.

237 lines
4.7 KiB

  1. #include "shaderlib/cshader.h"
  2. class sprite_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_nVERTEXCOLOR;
  27. #ifdef _DEBUG
  28. bool m_bVERTEXCOLOR;
  29. #endif
  30. public:
  31. void SetVERTEXCOLOR( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nVERTEXCOLOR = i;
  35. #ifdef _DEBUG
  36. m_bVERTEXCOLOR = true;
  37. #endif
  38. }
  39. void SetVERTEXCOLOR( bool i )
  40. {
  41. m_nVERTEXCOLOR = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bVERTEXCOLOR = true;
  44. #endif
  45. }
  46. private:
  47. int m_nCONSTANTCOLOR;
  48. #ifdef _DEBUG
  49. bool m_bCONSTANTCOLOR;
  50. #endif
  51. public:
  52. void SetCONSTANTCOLOR( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nCONSTANTCOLOR = i;
  56. #ifdef _DEBUG
  57. m_bCONSTANTCOLOR = true;
  58. #endif
  59. }
  60. void SetCONSTANTCOLOR( bool i )
  61. {
  62. m_nCONSTANTCOLOR = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bCONSTANTCOLOR = true;
  65. #endif
  66. }
  67. private:
  68. int m_nHDRTYPE;
  69. #ifdef _DEBUG
  70. bool m_bHDRTYPE;
  71. #endif
  72. public:
  73. void SetHDRTYPE( int i )
  74. {
  75. Assert( i >= 0 && i <= 2 );
  76. m_nHDRTYPE = i;
  77. #ifdef _DEBUG
  78. m_bHDRTYPE = true;
  79. #endif
  80. }
  81. void SetHDRTYPE( bool i )
  82. {
  83. m_nHDRTYPE = i ? 1 : 0;
  84. #ifdef _DEBUG
  85. m_bHDRTYPE = true;
  86. #endif
  87. }
  88. private:
  89. int m_nSRGB;
  90. #ifdef _DEBUG
  91. bool m_bSRGB;
  92. #endif
  93. public:
  94. void SetSRGB( int i )
  95. {
  96. Assert( i >= 0 && i <= 1 );
  97. m_nSRGB = i;
  98. #ifdef _DEBUG
  99. m_bSRGB = true;
  100. #endif
  101. }
  102. void SetSRGB( bool i )
  103. {
  104. m_nSRGB = i ? 1 : 0;
  105. #ifdef _DEBUG
  106. m_bSRGB = true;
  107. #endif
  108. }
  109. private:
  110. int m_nSRGB_OUTPUT_ADAPTER;
  111. #ifdef _DEBUG
  112. bool m_bSRGB_OUTPUT_ADAPTER;
  113. #endif
  114. public:
  115. void SetSRGB_OUTPUT_ADAPTER( int i )
  116. {
  117. Assert( i >= 0 && i <= 1 );
  118. m_nSRGB_OUTPUT_ADAPTER = i;
  119. #ifdef _DEBUG
  120. m_bSRGB_OUTPUT_ADAPTER = true;
  121. #endif
  122. }
  123. void SetSRGB_OUTPUT_ADAPTER( bool i )
  124. {
  125. m_nSRGB_OUTPUT_ADAPTER = i ? 1 : 0;
  126. #ifdef _DEBUG
  127. m_bSRGB_OUTPUT_ADAPTER = true;
  128. #endif
  129. }
  130. public:
  131. sprite_ps20b_Static_Index( )
  132. {
  133. #ifdef _DEBUG
  134. m_bCONVERT_TO_SRGB = true;
  135. #endif // _DEBUG
  136. m_nCONVERT_TO_SRGB = g_pHardwareConfig->NeedsShaderSRGBConversion();
  137. #ifdef _DEBUG
  138. m_bVERTEXCOLOR = false;
  139. #endif // _DEBUG
  140. m_nVERTEXCOLOR = 0;
  141. #ifdef _DEBUG
  142. m_bCONSTANTCOLOR = false;
  143. #endif // _DEBUG
  144. m_nCONSTANTCOLOR = 0;
  145. #ifdef _DEBUG
  146. m_bHDRTYPE = false;
  147. #endif // _DEBUG
  148. m_nHDRTYPE = 0;
  149. #ifdef _DEBUG
  150. m_bSRGB = false;
  151. #endif // _DEBUG
  152. m_nSRGB = 0;
  153. #ifdef _DEBUG
  154. m_bSRGB_OUTPUT_ADAPTER = false;
  155. #endif // _DEBUG
  156. m_nSRGB_OUTPUT_ADAPTER = 0;
  157. }
  158. int GetIndex()
  159. {
  160. // Asserts to make sure that we aren't using any skipped combinations.
  161. // Asserts to make sure that we are setting all of the combination vars.
  162. #ifdef _DEBUG
  163. bool bAllStaticVarsDefined = m_bCONVERT_TO_SRGB && m_bVERTEXCOLOR && m_bCONSTANTCOLOR && m_bHDRTYPE && m_bSRGB && m_bSRGB_OUTPUT_ADAPTER;
  164. Assert( bAllStaticVarsDefined );
  165. #endif // _DEBUG
  166. return ( 4 * m_nCONVERT_TO_SRGB ) + ( 8 * m_nVERTEXCOLOR ) + ( 16 * m_nCONSTANTCOLOR ) + ( 32 * m_nHDRTYPE ) + ( 96 * m_nSRGB ) + ( 192 * m_nSRGB_OUTPUT_ADAPTER ) + 0;
  167. }
  168. };
  169. #define shaderStaticTest_sprite_ps20b psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_CONSTANTCOLOR + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_SRGB + psh_forgot_to_set_static_SRGB_OUTPUT_ADAPTER + 0
  170. class sprite_ps20b_Dynamic_Index
  171. {
  172. private:
  173. int m_nHDRENABLED;
  174. #ifdef _DEBUG
  175. bool m_bHDRENABLED;
  176. #endif
  177. public:
  178. void SetHDRENABLED( int i )
  179. {
  180. Assert( i >= 0 && i <= 1 );
  181. m_nHDRENABLED = i;
  182. #ifdef _DEBUG
  183. m_bHDRENABLED = true;
  184. #endif
  185. }
  186. void SetHDRENABLED( bool i )
  187. {
  188. m_nHDRENABLED = i ? 1 : 0;
  189. #ifdef _DEBUG
  190. m_bHDRENABLED = true;
  191. #endif
  192. }
  193. private:
  194. int m_nPIXELFOGTYPE;
  195. #ifdef _DEBUG
  196. bool m_bPIXELFOGTYPE;
  197. #endif
  198. public:
  199. void SetPIXELFOGTYPE( int i )
  200. {
  201. Assert( i >= 0 && i <= 1 );
  202. m_nPIXELFOGTYPE = i;
  203. #ifdef _DEBUG
  204. m_bPIXELFOGTYPE = true;
  205. #endif
  206. }
  207. void SetPIXELFOGTYPE( bool i )
  208. {
  209. m_nPIXELFOGTYPE = i ? 1 : 0;
  210. #ifdef _DEBUG
  211. m_bPIXELFOGTYPE = true;
  212. #endif
  213. }
  214. public:
  215. sprite_ps20b_Dynamic_Index()
  216. {
  217. #ifdef _DEBUG
  218. m_bHDRENABLED = false;
  219. #endif // _DEBUG
  220. m_nHDRENABLED = 0;
  221. #ifdef _DEBUG
  222. m_bPIXELFOGTYPE = false;
  223. #endif // _DEBUG
  224. m_nPIXELFOGTYPE = 0;
  225. }
  226. int GetIndex()
  227. {
  228. // Asserts to make sure that we aren't using any skipped combinations.
  229. // Asserts to make sure that we are setting all of the combination vars.
  230. #ifdef _DEBUG
  231. bool bAllDynamicVarsDefined = m_bHDRENABLED && m_bPIXELFOGTYPE;
  232. Assert( bAllDynamicVarsDefined );
  233. #endif // _DEBUG
  234. return ( 1 * m_nHDRENABLED ) + ( 2 * m_nPIXELFOGTYPE ) + 0;
  235. }
  236. };
  237. #define shaderDynamicTest_sprite_ps20b psh_forgot_to_set_dynamic_HDRENABLED + psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0