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.

107 lines
3.2 KiB

  1. //========= Copyright (c) 1996-2005, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #include "BaseVSShader.h"
  8. #include "common_hlsl_cpp_consts.h"
  9. #include "screenspaceeffect_vs20.inc"
  10. #include "accumbuff5sample_ps20.inc"
  11. #include "accumbuff5sample_ps20b.inc"
  12. #include "convar.h"
  13. // NOTE: This has to be the last file included!
  14. #include "tier0/memdbgon.h"
  15. BEGIN_VS_SHADER_FLAGS( accumbuff5sample, "Help for AccumBuff5Sample", SHADER_NOT_EDITABLE )
  16. BEGIN_SHADER_PARAMS
  17. // Four textures to sample
  18. SHADER_PARAM( TEXTURE0, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  19. SHADER_PARAM( TEXTURE1, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  20. SHADER_PARAM( TEXTURE2, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  21. SHADER_PARAM( TEXTURE3, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  22. SHADER_PARAM( TEXTURE4, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  23. // Corresponding weights for the four input textures
  24. SHADER_PARAM( WEIGHTS, SHADER_PARAM_TYPE_VEC4, "", "Weight for Samples" )
  25. END_SHADER_PARAMS
  26. SHADER_INIT
  27. {
  28. LoadTexture( TEXTURE0 );
  29. LoadTexture( TEXTURE1 );
  30. LoadTexture( TEXTURE2 );
  31. LoadTexture( TEXTURE3 );
  32. LoadTexture( TEXTURE4 );
  33. }
  34. SHADER_FALLBACK
  35. {
  36. return 0;
  37. }
  38. SHADER_DRAW
  39. {
  40. SHADOW_STATE
  41. {
  42. pShaderShadow->EnableDepthWrites( false );
  43. pShaderShadow->EnableDepthTest( false );
  44. pShaderShadow->EnableAlphaWrites( true );
  45. pShaderShadow->EnableBlending( false );
  46. pShaderShadow->EnableCulling( false );
  47. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  48. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  49. pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
  50. pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
  51. pShaderShadow->EnableTexture( SHADER_SAMPLER4, true );
  52. int fmt = VERTEX_POSITION;
  53. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
  54. DECLARE_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  55. SET_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  56. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  57. {
  58. DECLARE_STATIC_PIXEL_SHADER( accumbuff5sample_ps20b );
  59. SET_STATIC_PIXEL_SHADER( accumbuff5sample_ps20b );
  60. }
  61. else
  62. {
  63. DECLARE_STATIC_PIXEL_SHADER( accumbuff5sample_ps20 );
  64. SET_STATIC_PIXEL_SHADER( accumbuff5sample_ps20 );
  65. }
  66. }
  67. DYNAMIC_STATE
  68. {
  69. BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_NONE, TEXTURE0, -1 );
  70. BindTexture( SHADER_SAMPLER1, TEXTURE_BINDFLAGS_NONE, TEXTURE1, -1 );
  71. BindTexture( SHADER_SAMPLER2, TEXTURE_BINDFLAGS_NONE, TEXTURE2, -1 );
  72. BindTexture( SHADER_SAMPLER3, TEXTURE_BINDFLAGS_NONE, TEXTURE3, -1 );
  73. BindTexture( SHADER_SAMPLER4, TEXTURE_BINDFLAGS_NONE, TEXTURE4, -1 );
  74. SetPixelShaderConstant( 0, WEIGHTS );
  75. DECLARE_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  76. SET_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  77. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  78. {
  79. DECLARE_DYNAMIC_PIXEL_SHADER( accumbuff5sample_ps20b );
  80. SET_DYNAMIC_PIXEL_SHADER( accumbuff5sample_ps20b );
  81. }
  82. else
  83. {
  84. DECLARE_DYNAMIC_PIXEL_SHADER( accumbuff5sample_ps20 );
  85. SET_DYNAMIC_PIXEL_SHADER( accumbuff5sample_ps20 );
  86. }
  87. }
  88. Draw();
  89. }
  90. END_SHADER