Team Fortress 2 Source Code as on 22/4/2020
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 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. BEGIN_VS_SHADER_FLAGS( floattoscreen_vanilla, "Help for floattoscreen_vanilla", SHADER_NOT_EDITABLE )
  14. BEGIN_SHADER_PARAMS
  15. SHADER_PARAM( FBTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  16. END_SHADER_PARAMS
  17. SHADER_INIT
  18. {
  19. if( params[FBTEXTURE]->IsDefined() )
  20. {
  21. LoadTexture( FBTEXTURE );
  22. }
  23. }
  24. SHADER_FALLBACK
  25. {
  26. // Requires DX9 + above
  27. if ( g_pHardwareConfig->GetDXSupportLevel() < 90 )
  28. {
  29. Assert( 0 );
  30. return "Wireframe";
  31. }
  32. return 0;
  33. }
  34. SHADER_DRAW
  35. {
  36. SHADOW_STATE
  37. {
  38. pShaderShadow->EnableDepthWrites( false );
  39. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  40. int fmt = VERTEX_POSITION;
  41. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
  42. // convert from linear to gamma on write.
  43. pShaderShadow->EnableSRGBWrite( true );
  44. // Pre-cache shaders
  45. DECLARE_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  46. SET_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  47. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  48. {
  49. DECLARE_STATIC_PIXEL_SHADER( floattoscreen_ps20b );
  50. SET_STATIC_PIXEL_SHADER( floattoscreen_ps20b );
  51. }
  52. else
  53. {
  54. DECLARE_STATIC_PIXEL_SHADER( floattoscreen_ps20 );
  55. SET_STATIC_PIXEL_SHADER( floattoscreen_ps20 );
  56. }
  57. }
  58. DYNAMIC_STATE
  59. {
  60. BindTexture( SHADER_SAMPLER0, FBTEXTURE, -1 );
  61. DECLARE_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  62. SET_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  63. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  64. {
  65. DECLARE_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20b );
  66. SET_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20b );
  67. }
  68. else
  69. {
  70. DECLARE_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20 );
  71. SET_DYNAMIC_PIXEL_SHADER( floattoscreen_vanilla_ps20 );
  72. }
  73. }
  74. Draw();
  75. }
  76. END_SHADER