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.

75 lines
1.8 KiB

  1. //===== Copyright � 1996-2008, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #include "BaseVSShader.h"
  8. #include "sfm_screenspace_vs30.inc"
  9. #include "sfm_shape_ps30.inc"
  10. // NOTE: This has to be the last file included!
  11. #include "tier0/memdbgon.h"
  12. BEGIN_VS_SHADER_FLAGS( sfm_shape_shader, "Help for SFM shape", SHADER_NOT_EDITABLE )
  13. BEGIN_SHADER_PARAMS
  14. END_SHADER_PARAMS
  15. SHADER_INIT
  16. {
  17. if( params[BASETEXTURE]->IsDefined() )
  18. {
  19. LoadTexture( BASETEXTURE );
  20. }
  21. }
  22. SHADER_FALLBACK
  23. {
  24. // Requires 30 shaders
  25. if ( g_pHardwareConfig->GetDXSupportLevel() < 95 )
  26. {
  27. Assert( 0 );
  28. return "Wireframe";
  29. }
  30. return 0;
  31. }
  32. SHADER_DRAW
  33. {
  34. SHADOW_STATE
  35. {
  36. pShaderShadow->EnableDepthWrites( false );
  37. pShaderShadow->EnableDepthTest( false );
  38. pShaderShadow->EnableAlphaWrites( true );
  39. pShaderShadow->EnableBlending( false );
  40. pShaderShadow->EnableCulling( false );
  41. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  42. int fmt = VERTEX_POSITION;
  43. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 ); // TODO: remove tex coords
  44. DECLARE_STATIC_VERTEX_SHADER( sfm_screenspace_vs30 );
  45. SET_STATIC_VERTEX_SHADER( sfm_screenspace_vs30 );
  46. DECLARE_STATIC_PIXEL_SHADER( sfm_shape_ps30 );
  47. SET_STATIC_PIXEL_SHADER( sfm_shape_ps30 );
  48. }
  49. DYNAMIC_STATE
  50. {
  51. BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_NONE, BASETEXTURE, -1 );
  52. DECLARE_DYNAMIC_VERTEX_SHADER( sfm_screenspace_vs30 );
  53. SET_DYNAMIC_VERTEX_SHADER( sfm_screenspace_vs30 );
  54. DECLARE_DYNAMIC_PIXEL_SHADER( sfm_shape_ps30 );
  55. SET_DYNAMIC_PIXEL_SHADER( sfm_shape_ps30 );
  56. // Set constant to enable translation of VPOS to render target coordinates in ps_3_0
  57. pShaderAPI->SetScreenSizeForVPOS();
  58. }
  59. Draw();
  60. }
  61. END_SHADER