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.

115 lines
3.0 KiB

  1. //===== Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #include "render_pch.h"
  9. #include "gl_shader.h"
  10. #include "const.h"
  11. #include "gl_cvars.h"
  12. #include "gl_lightmap.h"
  13. #include "decal_private.h"
  14. #include "gl_model_private.h"
  15. #include "r_local.h"
  16. #include "materialproxyfactory.h"
  17. #include "enginestats.h"
  18. #include "editor_sendcommand.h"
  19. #include "gl_matsysiface.h"
  20. #include "vmodes.h"
  21. #include "materialsystem/imaterialsystemhardwareconfig.h"
  22. #include "tier1/strtools.h"
  23. #include "filesystem.h"
  24. #include "traceinit.h"
  25. #include "sys_dll.h"
  26. #include "tier0/icommandline.h"
  27. #include "materialsystem/idebugtextureinfo.h"
  28. #include "common.h"
  29. #include "iregistry.h"
  30. #include "materialsystem/materialsystem_config.h"
  31. #include "ivideomode.h"
  32. #include "modes.h"
  33. #include "ivideomode.h"
  34. #include "tier2/tier2.h"
  35. #include "igame.h"
  36. // memdbgon must be the last include file in a .cpp file!!!
  37. #include "tier0/memdbgon.h"
  38. static CMaterialProxyFactory s_MaterialProxyFactory;
  39. //-----------------------------------------------------------------------------
  40. // Connects to other
  41. //-----------------------------------------------------------------------------
  42. static void Shader_ConnectOtherMatSysInterfaces( )
  43. {
  44. // NOTE: These two interfaces have been connected in the tier2 library
  45. if ( !g_pMaterialSystemHardwareConfig )
  46. {
  47. Shader_Disconnect();
  48. Sys_Error( "Could not get the material system hardware config interface! (2)" );
  49. }
  50. if ( !g_pMaterialSystemDebugTextureInfo )
  51. {
  52. Shader_Disconnect();
  53. Sys_Error( "Could not get the debug texture info interface!" );
  54. }
  55. }
  56. //-----------------------------------------------------------------------------
  57. // Connect to interfaces we need
  58. //-----------------------------------------------------------------------------
  59. bool Shader_Connect( bool bSetProxyFactory )
  60. {
  61. if ( !materials )
  62. return false;
  63. int nAdapter = CommandLine()->ParmValue( "-adapter", 0 );
  64. int nModeFlags = MATERIAL_INIT_ALLOCATE_FULLSCREEN_TEXTURE;
  65. if ( CommandLine()->FindParm( "-ref" ) )
  66. {
  67. nModeFlags |= MATERIAL_INIT_REFERENCE_RASTERIZER;
  68. }
  69. materials->SetAdapter( nAdapter, nModeFlags );
  70. if ( bSetProxyFactory )
  71. materials->SetMaterialProxyFactory( &s_MaterialProxyFactory );
  72. Shader_ConnectOtherMatSysInterfaces( );
  73. return g_pMaterialSystemHardwareConfig && g_pMaterialSystemDebugTextureInfo;
  74. }
  75. //-----------------------------------------------------------------------------
  76. // Connect to interfaces we need
  77. //-----------------------------------------------------------------------------
  78. void Shader_Disconnect( void )
  79. {
  80. }
  81. #ifndef DEDICATED
  82. void Shader_SwapBuffers( void )
  83. {
  84. assert( materials );
  85. materials->SwapBuffers();
  86. }
  87. //-----------------------------------------------------------------------------
  88. // Purpose:
  89. //-----------------------------------------------------------------------------
  90. void Shader_BeginRendering ( void )
  91. {
  92. // FIXME:
  93. // vid.width = window_rect.width;
  94. // vid.height = window_rect.height;
  95. }
  96. #endif