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.

83 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Replaces 360 missing StretchRect() functionality.
  4. //
  5. //=============================================================================
  6. #include "BaseVSShader.h"
  7. #include "rendertargetblit_vs20.inc"
  8. #include "rendertargetblit_ps20.inc"
  9. #include "rendertargetblit_ps20b.inc"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. BEGIN_VS_SHADER_FLAGS( RenderTargetBlit_X360, "", SHADER_NOT_EDITABLE )
  13. BEGIN_SHADER_PARAMS
  14. END_SHADER_PARAMS
  15. SHADER_INIT_PARAMS()
  16. {
  17. if ( !params[BASETEXTURE]->IsDefined() )
  18. {
  19. params[BASETEXTURE]->SetStringValue( "_rt_FullFrameFB" );
  20. }
  21. }
  22. SHADER_INIT
  23. {
  24. LoadTexture( BASETEXTURE );
  25. }
  26. SHADER_DRAW
  27. {
  28. SHADOW_STATE
  29. {
  30. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  31. pShaderShadow->EnableSRGBRead( SHADER_SAMPLER0, false );
  32. pShaderShadow->EnableSRGBWrite( false );
  33. pShaderShadow->EnableDepthWrites( false );
  34. pShaderShadow->DepthFunc( SHADER_DEPTHFUNC_ALWAYS );
  35. pShaderShadow->EnableCulling( false );
  36. pShaderShadow->VertexShaderVertexFormat( VERTEX_POSITION, 1, 0, 0 );
  37. DECLARE_STATIC_VERTEX_SHADER( rendertargetblit_vs20 );
  38. SET_STATIC_VERTEX_SHADER( rendertargetblit_vs20 );
  39. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  40. {
  41. DECLARE_STATIC_PIXEL_SHADER( rendertargetblit_ps20b );
  42. SET_STATIC_PIXEL_SHADER( rendertargetblit_ps20b );
  43. }
  44. else
  45. {
  46. DECLARE_STATIC_PIXEL_SHADER( rendertargetblit_ps20 );
  47. SET_STATIC_PIXEL_SHADER( rendertargetblit_ps20 );
  48. }
  49. }
  50. DYNAMIC_STATE
  51. {
  52. BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME );
  53. DECLARE_DYNAMIC_VERTEX_SHADER( rendertargetblit_vs20 );
  54. SET_DYNAMIC_VERTEX_SHADER( rendertargetblit_vs20 );
  55. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  56. {
  57. DECLARE_DYNAMIC_PIXEL_SHADER( rendertargetblit_ps20b );
  58. SET_DYNAMIC_PIXEL_SHADER( rendertargetblit_ps20b );
  59. }
  60. else
  61. {
  62. DECLARE_DYNAMIC_PIXEL_SHADER( rendertargetblit_ps20 );
  63. SET_DYNAMIC_PIXEL_SHADER( rendertargetblit_ps20 );
  64. }
  65. }
  66. Draw();
  67. }
  68. END_SHADER