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.

103 lines
2.9 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 "accumbuff4sample_ps20.inc"
  11. #include "accumbuff4sample_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( accumbuff4sample, "Help for AccumBuff4Sample", 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. // Corresponding weights for the four input textures
  23. SHADER_PARAM( WEIGHTS, SHADER_PARAM_TYPE_VEC4, "", "Weight for Samples" )
  24. END_SHADER_PARAMS
  25. SHADER_INIT
  26. {
  27. LoadTexture( TEXTURE0 );
  28. LoadTexture( TEXTURE1 );
  29. LoadTexture( TEXTURE2 );
  30. LoadTexture( TEXTURE3 );
  31. }
  32. SHADER_FALLBACK
  33. {
  34. return 0;
  35. }
  36. SHADER_DRAW
  37. {
  38. SHADOW_STATE
  39. {
  40. pShaderShadow->EnableDepthWrites( false );
  41. pShaderShadow->EnableDepthTest( false );
  42. pShaderShadow->EnableAlphaWrites( true );
  43. pShaderShadow->EnableBlending( false );
  44. pShaderShadow->EnableCulling( false );
  45. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  46. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  47. pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
  48. pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
  49. int fmt = VERTEX_POSITION;
  50. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
  51. DECLARE_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  52. SET_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  53. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  54. {
  55. DECLARE_STATIC_PIXEL_SHADER( accumbuff4sample_ps20b );
  56. SET_STATIC_PIXEL_SHADER( accumbuff4sample_ps20b );
  57. }
  58. else
  59. {
  60. DECLARE_STATIC_PIXEL_SHADER( accumbuff4sample_ps20 );
  61. SET_STATIC_PIXEL_SHADER( accumbuff4sample_ps20 );
  62. }
  63. }
  64. DYNAMIC_STATE
  65. {
  66. BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_NONE, TEXTURE0, -1 );
  67. BindTexture( SHADER_SAMPLER1, TEXTURE_BINDFLAGS_NONE, TEXTURE1, -1 );
  68. BindTexture( SHADER_SAMPLER2, TEXTURE_BINDFLAGS_NONE, TEXTURE2, -1 );
  69. BindTexture( SHADER_SAMPLER3, TEXTURE_BINDFLAGS_NONE, TEXTURE3, -1 );
  70. SetPixelShaderConstant( 0, WEIGHTS );
  71. DECLARE_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  72. SET_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  73. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  74. {
  75. DECLARE_DYNAMIC_PIXEL_SHADER( accumbuff4sample_ps20b );
  76. SET_DYNAMIC_PIXEL_SHADER( accumbuff4sample_ps20b );
  77. }
  78. else
  79. {
  80. DECLARE_DYNAMIC_PIXEL_SHADER( accumbuff4sample_ps20 );
  81. SET_DYNAMIC_PIXEL_SHADER( accumbuff4sample_ps20 );
  82. }
  83. }
  84. Draw();
  85. }
  86. END_SHADER