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.

77 lines
2.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "BaseVSShader.h"
  7. #include "common_hlsl_cpp_consts.h"
  8. #include "ConVar.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. DEFINE_FALLBACK_SHADER( Downsample_nohdr, Downsample_nohdr_DX80 )
  12. BEGIN_VS_SHADER_FLAGS( Downsample_nohdr_DX80, "Help for Downsample_nohdr_DX80", SHADER_NOT_EDITABLE )
  13. BEGIN_SHADER_PARAMS
  14. END_SHADER_PARAMS
  15. SHADER_INIT
  16. {
  17. LoadTexture( BASETEXTURE );
  18. }
  19. SHADER_FALLBACK
  20. {
  21. return 0;
  22. }
  23. SHADER_DRAW
  24. {
  25. SHADOW_STATE
  26. {
  27. pShaderShadow->EnableDepthWrites( false );
  28. pShaderShadow->EnableAlphaWrites( true );
  29. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  30. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  31. pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
  32. pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
  33. pShaderShadow->VertexShaderVertexFormat( VERTEX_POSITION, 1, 0, 0 );
  34. pShaderShadow->SetVertexShader( "Downsample_vs11", 0 );
  35. pShaderShadow->SetPixelShader( "Downsample_nohdr_ps11" );
  36. }
  37. DYNAMIC_STATE
  38. {
  39. BindTexture( SHADER_SAMPLER0, false, BASETEXTURE, -1 );
  40. BindTexture( SHADER_SAMPLER1, false, BASETEXTURE, -1 );
  41. BindTexture( SHADER_SAMPLER2, false, BASETEXTURE, -1 );
  42. BindTexture( SHADER_SAMPLER3, false, BASETEXTURE, -1 );
  43. int width, height;
  44. pShaderAPI->GetBackBufferDimensions( width, height );
  45. float v[4][4];
  46. float dX = 1.0f/width;
  47. float dY = 1.0f/height;
  48. v[0][0] = .5*dX;
  49. v[0][1] = .5*dY;
  50. v[1][0] = 2.5*dX;
  51. v[1][1] = .5*dY;
  52. v[2][0] = .5*dX;
  53. v[2][1] = 2.5*dY;
  54. v[3][0] = 2.5*dX;
  55. v[3][1] = 2.5*dY;
  56. pShaderAPI->SetVertexShaderConstant( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, &v[0][0], 4 );
  57. pShaderAPI->SetVertexShaderIndex( 0 );
  58. pShaderAPI->SetPixelShaderIndex( 0 );
  59. }
  60. Draw();
  61. }
  62. END_SHADER