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.

88 lines
2.1 KiB

  1. //===== Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #include "BaseVSShader.h"
  8. #include "screenspaceeffect_vs20.inc"
  9. #include "Bloom_ps20.inc"
  10. #include "Bloom_ps20b.inc"
  11. // NOTE: This has to be the last file included!
  12. #include "tier0/memdbgon.h"
  13. BEGIN_VS_SHADER_FLAGS( Bloom, "Help for Bloom", SHADER_NOT_EDITABLE )
  14. BEGIN_SHADER_PARAMS
  15. SHADER_PARAM( FBTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "_rt_FullFrameFB", "" )
  16. SHADER_PARAM( BLURTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "_rt_SmallHDR0", "" )
  17. END_SHADER_PARAMS
  18. SHADER_INIT
  19. {
  20. if( params[FBTEXTURE]->IsDefined() )
  21. {
  22. LoadTexture( FBTEXTURE );
  23. }
  24. if( params[BLURTEXTURE]->IsDefined() )
  25. {
  26. LoadTexture( BLURTEXTURE );
  27. }
  28. }
  29. SHADER_FALLBACK
  30. {
  31. return 0;
  32. }
  33. SHADER_DRAW
  34. {
  35. SHADOW_STATE
  36. {
  37. pShaderShadow->EnableDepthWrites( false );
  38. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  39. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  40. int fmt = VERTEX_POSITION;
  41. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
  42. // Pre-cache shaders
  43. DECLARE_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  44. SET_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  45. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  46. {
  47. DECLARE_STATIC_PIXEL_SHADER( bloom_ps20b );
  48. SET_STATIC_PIXEL_SHADER( bloom_ps20b );
  49. }
  50. else
  51. {
  52. DECLARE_STATIC_PIXEL_SHADER( bloom_ps20 );
  53. SET_STATIC_PIXEL_SHADER( bloom_ps20 );
  54. }
  55. }
  56. DYNAMIC_STATE
  57. {
  58. BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_NONE, FBTEXTURE, -1 );
  59. BindTexture( SHADER_SAMPLER1, TEXTURE_BINDFLAGS_NONE, BLURTEXTURE, -1 );
  60. DECLARE_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  61. SET_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  62. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  63. {
  64. DECLARE_DYNAMIC_PIXEL_SHADER( bloom_ps20b );
  65. SET_DYNAMIC_PIXEL_SHADER( bloom_ps20b );
  66. }
  67. else
  68. {
  69. DECLARE_DYNAMIC_PIXEL_SHADER( bloom_ps20 );
  70. SET_DYNAMIC_PIXEL_SHADER( bloom_ps20 );
  71. }
  72. }
  73. Draw();
  74. }
  75. END_SHADER