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.

83 lines
2.1 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 "HDRCombineTo16Bit_ps20.inc"
  10. #include "HDRCombineTo16Bit_ps20b.inc"
  11. #include "HDRCombineTo16Bit_vs20.inc"
  12. #include "convar.h"
  13. BEGIN_VS_SHADER_FLAGS( HDRCombineTo16Bit, "Help for HDRCombineTo16Bit", SHADER_NOT_EDITABLE )
  14. BEGIN_SHADER_PARAMS
  15. SHADER_PARAM( SOURCEMRTRENDERTARGET, SHADER_PARAM_TYPE_TEXTURE, "", "" )
  16. END_SHADER_PARAMS
  17. SHADER_INIT
  18. {
  19. LoadTexture( SOURCEMRTRENDERTARGET );
  20. }
  21. SHADER_FALLBACK
  22. {
  23. // Requires DX9 + above
  24. if (!g_pHardwareConfig->SupportsVertexAndPixelShaders())
  25. {
  26. Assert( 0 );
  27. return "Wireframe";
  28. }
  29. return 0;
  30. }
  31. SHADER_DRAW
  32. {
  33. SHADOW_STATE
  34. {
  35. pShaderShadow->EnableDepthWrites( false );
  36. pShaderShadow->EnableAlphaWrites( false );
  37. pShaderShadow->EnableDepthTest( 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. DECLARE_STATIC_VERTEX_SHADER( hdrcombineto16bit_vs20 );
  43. SET_STATIC_VERTEX_SHADER( hdrcombineto16bit_vs20 );
  44. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  45. {
  46. DECLARE_STATIC_PIXEL_SHADER( hdrcombineto16bit_ps20b );
  47. SET_STATIC_PIXEL_SHADER( hdrcombineto16bit_ps20b );
  48. }
  49. else
  50. {
  51. DECLARE_STATIC_PIXEL_SHADER( hdrcombineto16bit_ps20 );
  52. SET_STATIC_PIXEL_SHADER( hdrcombineto16bit_ps20 );
  53. }
  54. }
  55. DYNAMIC_STATE
  56. {
  57. BindTexture( SHADER_SAMPLER0, SOURCEMRTRENDERTARGET, -1 );
  58. DECLARE_DYNAMIC_VERTEX_SHADER( hdrcombineto16bit_vs20 );
  59. SET_DYNAMIC_VERTEX_SHADER( hdrcombineto16bit_vs20 );
  60. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  61. {
  62. DECLARE_DYNAMIC_PIXEL_SHADER( hdrcombineto16bit_ps20b );
  63. SET_DYNAMIC_PIXEL_SHADER( hdrcombineto16bit_ps20b );
  64. }
  65. else
  66. {
  67. DECLARE_DYNAMIC_PIXEL_SHADER( hdrcombineto16bit_ps20 );
  68. SET_DYNAMIC_PIXEL_SHADER( hdrcombineto16bit_ps20 );
  69. }
  70. }
  71. Draw();
  72. }
  73. END_SHADER