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.

81 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "BaseVSShader.h"
  8. #include "writez_vs20.inc"
  9. #include "white_ps20.inc"
  10. #include "white_ps20b.inc"
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include "tier0/memdbgon.h"
  13. DEFINE_FALLBACK_SHADER( WriteZ, WriteZ_DX9 )
  14. BEGIN_VS_SHADER_FLAGS( WriteZ_DX9, "Help for WriteZ", SHADER_NOT_EDITABLE )
  15. BEGIN_SHADER_PARAMS
  16. END_SHADER_PARAMS
  17. SHADER_INIT_PARAMS()
  18. {
  19. }
  20. SHADER_FALLBACK
  21. {
  22. if ( g_pHardwareConfig->GetDXSupportLevel() < 90 )
  23. return "WriteZ_DX8";
  24. return 0;
  25. }
  26. SHADER_INIT
  27. {
  28. }
  29. SHADER_DRAW
  30. {
  31. SHADOW_STATE
  32. {
  33. pShaderShadow->EnableColorWrites( false );
  34. pShaderShadow->EnableAlphaWrites( false );
  35. DECLARE_STATIC_VERTEX_SHADER( writez_vs20 );
  36. SET_STATIC_VERTEX_SHADER( writez_vs20 );
  37. // No pixel shader on Direct3D, doubles fill rate
  38. if ( g_pHardwareConfig->PlatformRequiresNonNullPixelShaders() )
  39. {
  40. DECLARE_STATIC_PIXEL_SHADER( white_ps20 );
  41. SET_STATIC_PIXEL_SHADER( white_ps20 );
  42. }
  43. // Set stream format (note that this shader supports compression)
  44. unsigned int flags = VERTEX_POSITION | VERTEX_FORMAT_COMPRESSED;
  45. int nTexCoordCount = 1;
  46. int userDataSize = 0;
  47. pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, NULL, userDataSize );
  48. }
  49. DYNAMIC_STATE
  50. {
  51. DECLARE_DYNAMIC_VERTEX_SHADER( writez_vs20 );
  52. SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );
  53. SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression );
  54. SET_DYNAMIC_VERTEX_SHADER( writez_vs20 );
  55. // No pixel shader on Direct3D, doubles fill rate
  56. if ( g_pHardwareConfig->PlatformRequiresNonNullPixelShaders() )
  57. {
  58. DECLARE_DYNAMIC_PIXEL_SHADER( white_ps20 );
  59. SET_DYNAMIC_PIXEL_SHADER( white_ps20 );
  60. }
  61. }
  62. Draw();
  63. }
  64. END_SHADER