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.1 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( WriteStencil, WriteStencil_DX9 )
  14. BEGIN_VS_SHADER_FLAGS( WriteStencil_DX9, "Help for WriteStencil", 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 "WriteStencil_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 ); // Write ONLY to stencil
  35. pShaderShadow->EnableDepthWrites( false ); //
  36. DECLARE_STATIC_VERTEX_SHADER( writez_vs20 );
  37. SET_STATIC_VERTEX_SHADER( writez_vs20 );
  38. // No pixel shader on Direct3D, doubles fill rate
  39. if ( g_pHardwareConfig->PlatformRequiresNonNullPixelShaders() )
  40. {
  41. DECLARE_STATIC_PIXEL_SHADER( white_ps20 );
  42. SET_STATIC_PIXEL_SHADER( white_ps20 );
  43. }
  44. // Set stream format (note that this shader supports compression)
  45. unsigned int flags = VERTEX_POSITION | VERTEX_FORMAT_COMPRESSED;
  46. int nTexCoordCount = 1;
  47. int userDataSize = 0;
  48. pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, NULL, userDataSize );
  49. }
  50. DYNAMIC_STATE
  51. {
  52. DECLARE_DYNAMIC_VERTEX_SHADER( writez_vs20 );
  53. SET_DYNAMIC_VERTEX_SHADER_COMBO( DOWATERFOG, pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );
  54. SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression );
  55. SET_DYNAMIC_VERTEX_SHADER( writez_vs20 );
  56. // No pixel shader on Direct3D, doubles fill rate
  57. if ( g_pHardwareConfig->PlatformRequiresNonNullPixelShaders() )
  58. {
  59. DECLARE_DYNAMIC_PIXEL_SHADER( white_ps20 );
  60. SET_DYNAMIC_PIXEL_SHADER( white_ps20 );
  61. }
  62. }
  63. Draw();
  64. }
  65. END_SHADER