Counter Strike : Global Offensive Source Code
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.

79 lines
2.0 KiB

  1. //========= Copyright � 1996-2005, 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. return 0;
  23. }
  24. SHADER_INIT
  25. {
  26. SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING );
  27. }
  28. SHADER_DRAW
  29. {
  30. SHADOW_STATE
  31. {
  32. pShaderShadow->EnableColorWrites( false ); //
  33. pShaderShadow->EnableAlphaWrites( false ); // Write ONLY to stencil
  34. pShaderShadow->EnableDepthWrites( 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( COMPRESSED_VERTS, (int)vertexCompression );
  53. SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 );
  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