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.

86 lines
2.1 KiB

  1. //========= Copyright � 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 "floattoscreen_vanilla_ps20.inc"
  10. #include "floattoscreen_vanilla_ps20b.inc"
  11. #include "floattoscreen_ps20.inc"
  12. #include "floattoscreen_ps20b.inc"
  13. // NOTE: This has to be the last file included!
  14. #include "tier0/memdbgon.h"
  15. BEGIN_VS_SHADER_FLAGS( floattoscreen_vanilla, "Help for floattoscreen_vanilla", SHADER_NOT_EDITABLE )
  16. BEGIN_SHADER_PARAMS
  17. SHADER_PARAM( FBTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  18. END_SHADER_PARAMS
  19. SHADER_INIT
  20. {
  21. if( params[FBTEXTURE]->IsDefined() )
  22. {
  23. LoadTexture( FBTEXTURE );
  24. }
  25. }
  26. SHADER_FALLBACK
  27. {
  28. return 0;
  29. }
  30. SHADER_DRAW
  31. {
  32. SHADOW_STATE
  33. {
  34. pShaderShadow->EnableDepthWrites( false );
  35. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  36. int fmt = VERTEX_POSITION;
  37. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
  38. // convert from linear to gamma on write.
  39. pShaderShadow->EnableSRGBWrite( true );
  40. // Pre-cache shaders
  41. DECLARE_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  42. SET_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  43. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  44. {
  45. DECLARE_STATIC_PIXEL_SHADER( floattoscreen_ps20b );
  46. SET_STATIC_PIXEL_SHADER( floattoscreen_ps20b );
  47. }
  48. else
  49. {
  50. DECLARE_STATIC_PIXEL_SHADER( floattoscreen_ps20 );
  51. SET_STATIC_PIXEL_SHADER( floattoscreen_ps20 );
  52. }
  53. }
  54. DYNAMIC_STATE
  55. {
  56. BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_NONE, FBTEXTURE, -1 );
  57. DECLARE_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  58. SET_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  59. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  60. {
  61. DECLARE_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20b );
  62. SET_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20b );
  63. }
  64. else
  65. {
  66. DECLARE_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20 );
  67. SET_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20 );
  68. }
  69. }
  70. Draw();
  71. }
  72. END_SHADER