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.

82 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #include "BaseVSShader.h"
  8. #include "common_hlsl_cpp_consts.h"
  9. #include "HDRSelectRange_ps20.inc"
  10. #include "HDRSelectRange_ps20b.inc"
  11. BEGIN_VS_SHADER_FLAGS( HDRSelectRange, "Help for HDRSelectRange", SHADER_NOT_EDITABLE )
  12. BEGIN_SHADER_PARAMS
  13. SHADER_PARAM( SOURCEMRTRENDERTARGET, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  14. END_SHADER_PARAMS
  15. SHADER_INIT
  16. {
  17. LoadTexture( SOURCEMRTRENDERTARGET );
  18. }
  19. SHADER_FALLBACK
  20. {
  21. // Requires DX9 + above
  22. if (!g_pHardwareConfig->SupportsVertexAndPixelShaders())
  23. {
  24. Assert( 0 );
  25. return "Wireframe";
  26. }
  27. return 0;
  28. }
  29. SHADER_DRAW
  30. {
  31. SHADOW_STATE
  32. {
  33. pShaderShadow->EnableDepthWrites( false );
  34. pShaderShadow->EnableAlphaWrites( false );
  35. pShaderShadow->EnableDepthTest( false );
  36. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  37. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  38. int fmt = VERTEX_POSITION;
  39. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
  40. pShaderShadow->SetVertexShader( "HDRSelectRange_vs20", 0 );
  41. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  42. {
  43. DECLARE_STATIC_PIXEL_SHADER( hdrselectrange_ps20b );
  44. SET_STATIC_PIXEL_SHADER( hdrselectrange_ps20b );
  45. }
  46. else
  47. {
  48. DECLARE_STATIC_PIXEL_SHADER( hdrselectrange_ps20 );
  49. SET_STATIC_PIXEL_SHADER( hdrselectrange_ps20 );
  50. }
  51. }
  52. DYNAMIC_STATE
  53. {
  54. BindTexture( SHADER_SAMPLER0, SOURCEMRTRENDERTARGET, -1 );
  55. pShaderAPI->SetVertexShaderIndex( 0 );
  56. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  57. {
  58. DECLARE_DYNAMIC_PIXEL_SHADER( hdrselectrange_ps20b );
  59. SET_DYNAMIC_PIXEL_SHADER( hdrselectrange_ps20b );
  60. }
  61. else
  62. {
  63. DECLARE_DYNAMIC_PIXEL_SHADER( hdrselectrange_ps20 );
  64. SET_DYNAMIC_PIXEL_SHADER( hdrselectrange_ps20 );
  65. }
  66. }
  67. Draw();
  68. }
  69. END_SHADER