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.

229 lines
5.2 KiB

  1. // ALL SKIP STATEMENTS THAT AFFECT THIS SHADER!!!
  2. // $TESSELLATION && $VERTEXCOLOR
  3. // ( $DOWATERFOG == 0 ) && ( $DOPIXELFOG && $HARDWAREFOGBLEND )
  4. // ( $DOWATERFOG == 0 ) && ( $HARDWAREFOGBLEND == 0 ) && ( $DOPIXELFOG == 0 )
  5. // defined $LIGHTING_PREVIEW && defined $FASTPATH && $LIGHTING_PREVIEW && $FASTPATH
  6. #include "shaderlib/cshader.h"
  7. class unlitgeneric_vs20_Static_Index
  8. {
  9. private:
  10. int m_nVERTEXCOLOR;
  11. #ifdef _DEBUG
  12. bool m_bVERTEXCOLOR;
  13. #endif
  14. public:
  15. void SetVERTEXCOLOR( int i )
  16. {
  17. Assert( i >= 0 && i <= 1 );
  18. m_nVERTEXCOLOR = i;
  19. #ifdef _DEBUG
  20. m_bVERTEXCOLOR = true;
  21. #endif
  22. }
  23. void SetVERTEXCOLOR( bool i )
  24. {
  25. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  26. m_nVERTEXCOLOR = i ? 1 : 0;
  27. #ifdef _DEBUG
  28. m_bVERTEXCOLOR = true;
  29. #endif
  30. }
  31. private:
  32. int m_nDOPIXELFOG;
  33. #ifdef _DEBUG
  34. bool m_bDOPIXELFOG;
  35. #endif
  36. public:
  37. void SetDOPIXELFOG( int i )
  38. {
  39. Assert( i >= 0 && i <= 1 );
  40. m_nDOPIXELFOG = i;
  41. #ifdef _DEBUG
  42. m_bDOPIXELFOG = true;
  43. #endif
  44. }
  45. void SetDOPIXELFOG( bool i )
  46. {
  47. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  48. m_nDOPIXELFOG = i ? 1 : 0;
  49. #ifdef _DEBUG
  50. m_bDOPIXELFOG = true;
  51. #endif
  52. }
  53. public:
  54. // CONSTRUCTOR
  55. unlitgeneric_vs20_Static_Index( IShaderShadow *pShaderShadow, IMaterialVar **params )
  56. {
  57. #ifdef _DEBUG
  58. m_bVERTEXCOLOR = false;
  59. #endif // _DEBUG
  60. m_nVERTEXCOLOR = 0;
  61. #ifdef _DEBUG
  62. m_bDOPIXELFOG = true;
  63. #endif // _DEBUG
  64. m_nDOPIXELFOG = g_pHardwareConfig->SupportsPixelShaders_2_b() ;
  65. }
  66. int GetIndex()
  67. {
  68. // Asserts to make sure that we aren't using any skipped combinations.
  69. // Asserts to make sure that we are setting all of the combination vars.
  70. #ifdef _DEBUG
  71. bool bAllStaticVarsDefined = m_bVERTEXCOLOR && m_bDOPIXELFOG;
  72. Assert( bAllStaticVarsDefined );
  73. #endif // _DEBUG
  74. return ( 8 * m_nVERTEXCOLOR ) + ( 16 * m_nDOPIXELFOG ) + 0;
  75. }
  76. };
  77. #define shaderStaticTest_unlitgeneric_vs20 vsh_forgot_to_set_static_VERTEXCOLOR + 0
  78. class unlitgeneric_vs20_Dynamic_Index
  79. {
  80. private:
  81. int m_nCOMPRESSED_VERTS;
  82. #ifdef _DEBUG
  83. bool m_bCOMPRESSED_VERTS;
  84. #endif
  85. public:
  86. void SetCOMPRESSED_VERTS( int i )
  87. {
  88. Assert( i >= 0 && i <= 1 );
  89. m_nCOMPRESSED_VERTS = i;
  90. #ifdef _DEBUG
  91. m_bCOMPRESSED_VERTS = true;
  92. #endif
  93. }
  94. void SetCOMPRESSED_VERTS( bool i )
  95. {
  96. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  97. m_nCOMPRESSED_VERTS = i ? 1 : 0;
  98. #ifdef _DEBUG
  99. m_bCOMPRESSED_VERTS = true;
  100. #endif
  101. }
  102. private:
  103. int m_nSKINNING;
  104. #ifdef _DEBUG
  105. bool m_bSKINNING;
  106. #endif
  107. public:
  108. void SetSKINNING( int i )
  109. {
  110. Assert( i >= 0 && i <= 1 );
  111. m_nSKINNING = i;
  112. #ifdef _DEBUG
  113. m_bSKINNING = true;
  114. #endif
  115. }
  116. void SetSKINNING( bool i )
  117. {
  118. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  119. m_nSKINNING = i ? 1 : 0;
  120. #ifdef _DEBUG
  121. m_bSKINNING = true;
  122. #endif
  123. }
  124. private:
  125. int m_nTESSELLATION;
  126. #ifdef _DEBUG
  127. bool m_bTESSELLATION;
  128. #endif
  129. public:
  130. void SetTESSELLATION( int i )
  131. {
  132. Assert( i >= 0 && i <= 0 );
  133. m_nTESSELLATION = i;
  134. #ifdef _DEBUG
  135. m_bTESSELLATION = true;
  136. #endif
  137. }
  138. void SetTESSELLATION( bool i )
  139. {
  140. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 0 );
  141. m_nTESSELLATION = i ? 1 : 0;
  142. #ifdef _DEBUG
  143. m_bTESSELLATION = true;
  144. #endif
  145. }
  146. private:
  147. int m_nDOWATERFOG;
  148. #ifdef _DEBUG
  149. bool m_bDOWATERFOG;
  150. #endif
  151. public:
  152. void SetDOWATERFOG( int i )
  153. {
  154. Assert( i >= 0 && i <= 1 );
  155. m_nDOWATERFOG = i;
  156. #ifdef _DEBUG
  157. m_bDOWATERFOG = true;
  158. #endif
  159. }
  160. void SetDOWATERFOG( bool i )
  161. {
  162. Assert( ( i ? 1 : 0 ) >= 0 && ( i ? 1 : 0 ) <= 1 );
  163. m_nDOWATERFOG = i ? 1 : 0;
  164. #ifdef _DEBUG
  165. m_bDOWATERFOG = true;
  166. #endif
  167. }
  168. public:
  169. // CONSTRUCTOR
  170. unlitgeneric_vs20_Dynamic_Index( IShaderDynamicAPI *pShaderAPI )
  171. {
  172. #ifdef _DEBUG
  173. m_bCOMPRESSED_VERTS = false;
  174. #endif // _DEBUG
  175. m_nCOMPRESSED_VERTS = 0;
  176. #ifdef _DEBUG
  177. m_bSKINNING = false;
  178. #endif // _DEBUG
  179. m_nSKINNING = 0;
  180. #ifdef _DEBUG
  181. m_bTESSELLATION = false;
  182. #endif // _DEBUG
  183. m_nTESSELLATION = 0;
  184. #ifdef _DEBUG
  185. m_bDOWATERFOG = true;
  186. #endif // _DEBUG
  187. m_nDOWATERFOG = ( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z ) ;
  188. }
  189. int GetIndex()
  190. {
  191. // Asserts to make sure that we aren't using any skipped combinations.
  192. // Asserts to make sure that we are setting all of the combination vars.
  193. #ifdef _DEBUG
  194. bool bAllDynamicVarsDefined = m_bCOMPRESSED_VERTS && m_bSKINNING && m_bTESSELLATION && m_bDOWATERFOG;
  195. Assert( bAllDynamicVarsDefined );
  196. #endif // _DEBUG
  197. return ( 1 * m_nCOMPRESSED_VERTS ) + ( 2 * m_nSKINNING ) + ( 4 * m_nTESSELLATION ) + ( 4 * m_nDOWATERFOG ) + 0;
  198. }
  199. };
  200. #define shaderDynamicTest_unlitgeneric_vs20 vsh_forgot_to_set_dynamic_COMPRESSED_VERTS + vsh_forgot_to_set_dynamic_SKINNING + vsh_forgot_to_set_dynamic_TESSELLATION + 0
  201. static const ShaderComboInformation_t s_DynamicComboArray_unlitgeneric_vs20[4] =
  202. {
  203. { "COMPRESSED_VERTS", 0, 1 },
  204. { "SKINNING", 0, 1 },
  205. { "TESSELLATION", 0, 0 },
  206. { "DOWATERFOG", 0, 1 },
  207. };
  208. static const ShaderComboInformation_t s_StaticComboArray_unlitgeneric_vs20[2] =
  209. {
  210. { "VERTEXCOLOR", 0, 1 },
  211. { "DOPIXELFOG", 0, 1 },
  212. };
  213. static const ShaderComboSemantics_t unlitgeneric_vs20_combos =
  214. {
  215. "unlitgeneric_vs20", s_DynamicComboArray_unlitgeneric_vs20, 4, s_StaticComboArray_unlitgeneric_vs20, 2
  216. };
  217. class ConstructMe_unlitgeneric_vs20
  218. {
  219. public:
  220. ConstructMe_unlitgeneric_vs20()
  221. {
  222. GetShaderDLL()->AddShaderComboInformation( &unlitgeneric_vs20_combos );
  223. }
  224. };
  225. static ConstructMe_unlitgeneric_vs20 s_ConstructMe_unlitgeneric_vs20;