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.

187 lines
3.8 KiB

  1. #include "shaderlib/cshader.h"
  2. class portal_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_nHASALPHAMASK;
  27. #ifdef _DEBUG
  28. bool m_bHASALPHAMASK;
  29. #endif
  30. public:
  31. void SetHASALPHAMASK( int i )
  32. {
  33. Assert( i >= 0 && i <= 1 );
  34. m_nHASALPHAMASK = i;
  35. #ifdef _DEBUG
  36. m_bHASALPHAMASK = true;
  37. #endif
  38. }
  39. void SetHASALPHAMASK( bool i )
  40. {
  41. m_nHASALPHAMASK = i ? 1 : 0;
  42. #ifdef _DEBUG
  43. m_bHASALPHAMASK = true;
  44. #endif
  45. }
  46. private:
  47. int m_nHASSTATICTEXTURE;
  48. #ifdef _DEBUG
  49. bool m_bHASSTATICTEXTURE;
  50. #endif
  51. public:
  52. void SetHASSTATICTEXTURE( int i )
  53. {
  54. Assert( i >= 0 && i <= 1 );
  55. m_nHASSTATICTEXTURE = i;
  56. #ifdef _DEBUG
  57. m_bHASSTATICTEXTURE = true;
  58. #endif
  59. }
  60. void SetHASSTATICTEXTURE( bool i )
  61. {
  62. m_nHASSTATICTEXTURE = i ? 1 : 0;
  63. #ifdef _DEBUG
  64. m_bHASSTATICTEXTURE = true;
  65. #endif
  66. }
  67. public:
  68. portal_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_bHASALPHAMASK = false;
  76. #endif // _DEBUG
  77. m_nHASALPHAMASK = 0;
  78. #ifdef _DEBUG
  79. m_bHASSTATICTEXTURE = false;
  80. #endif // _DEBUG
  81. m_nHASSTATICTEXTURE = 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_bHASALPHAMASK && m_bHASSTATICTEXTURE;
  89. Assert( bAllStaticVarsDefined );
  90. #endif // _DEBUG
  91. return ( 8 * m_nCONVERT_TO_SRGB ) + ( 16 * m_nHASALPHAMASK ) + ( 32 * m_nHASSTATICTEXTURE ) + 0;
  92. }
  93. };
  94. #define shaderStaticTest_portal_ps20b psh_forgot_to_set_static_HASALPHAMASK + psh_forgot_to_set_static_HASSTATICTEXTURE + 0
  95. class portal_ps20b_Dynamic_Index
  96. {
  97. private:
  98. int m_nADDSTATIC;
  99. #ifdef _DEBUG
  100. bool m_bADDSTATIC;
  101. #endif
  102. public:
  103. void SetADDSTATIC( int i )
  104. {
  105. Assert( i >= 0 && i <= 1 );
  106. m_nADDSTATIC = i;
  107. #ifdef _DEBUG
  108. m_bADDSTATIC = true;
  109. #endif
  110. }
  111. void SetADDSTATIC( bool i )
  112. {
  113. m_nADDSTATIC = i ? 1 : 0;
  114. #ifdef _DEBUG
  115. m_bADDSTATIC = true;
  116. #endif
  117. }
  118. private:
  119. int m_nHDRENABLED;
  120. #ifdef _DEBUG
  121. bool m_bHDRENABLED;
  122. #endif
  123. public:
  124. void SetHDRENABLED( int i )
  125. {
  126. Assert( i >= 0 && i <= 1 );
  127. m_nHDRENABLED = i;
  128. #ifdef _DEBUG
  129. m_bHDRENABLED = true;
  130. #endif
  131. }
  132. void SetHDRENABLED( bool i )
  133. {
  134. m_nHDRENABLED = i ? 1 : 0;
  135. #ifdef _DEBUG
  136. m_bHDRENABLED = true;
  137. #endif
  138. }
  139. private:
  140. int m_nPIXELFOGTYPE;
  141. #ifdef _DEBUG
  142. bool m_bPIXELFOGTYPE;
  143. #endif
  144. public:
  145. void SetPIXELFOGTYPE( int i )
  146. {
  147. Assert( i >= 0 && i <= 1 );
  148. m_nPIXELFOGTYPE = i;
  149. #ifdef _DEBUG
  150. m_bPIXELFOGTYPE = true;
  151. #endif
  152. }
  153. void SetPIXELFOGTYPE( bool i )
  154. {
  155. m_nPIXELFOGTYPE = i ? 1 : 0;
  156. #ifdef _DEBUG
  157. m_bPIXELFOGTYPE = true;
  158. #endif
  159. }
  160. public:
  161. portal_ps20b_Dynamic_Index()
  162. {
  163. #ifdef _DEBUG
  164. m_bADDSTATIC = false;
  165. #endif // _DEBUG
  166. m_nADDSTATIC = 0;
  167. #ifdef _DEBUG
  168. m_bHDRENABLED = false;
  169. #endif // _DEBUG
  170. m_nHDRENABLED = 0;
  171. #ifdef _DEBUG
  172. m_bPIXELFOGTYPE = false;
  173. #endif // _DEBUG
  174. m_nPIXELFOGTYPE = 0;
  175. }
  176. int GetIndex()
  177. {
  178. // Asserts to make sure that we aren't using any skipped combinations.
  179. // Asserts to make sure that we are setting all of the combination vars.
  180. #ifdef _DEBUG
  181. bool bAllDynamicVarsDefined = m_bADDSTATIC && m_bHDRENABLED && m_bPIXELFOGTYPE;
  182. Assert( bAllDynamicVarsDefined );
  183. #endif // _DEBUG
  184. return ( 1 * m_nADDSTATIC ) + ( 2 * m_nHDRENABLED ) + ( 4 * m_nPIXELFOGTYPE ) + 0;
  185. }
  186. };
  187. #define shaderDynamicTest_portal_ps20b psh_forgot_to_set_dynamic_ADDSTATIC + psh_forgot_to_set_dynamic_HDRENABLED + psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0