summaryrefslogtreecommitdiff
path: root/engine/gl_shader.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/gl_shader.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'engine/gl_shader.cpp')
-rw-r--r--engine/gl_shader.cpp115
1 files changed, 115 insertions, 0 deletions
diff --git a/engine/gl_shader.cpp b/engine/gl_shader.cpp
new file mode 100644
index 0000000..091d65c
--- /dev/null
+++ b/engine/gl_shader.cpp
@@ -0,0 +1,115 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//===========================================================================//
+
+
+#include "render_pch.h"
+#include "gl_shader.h"
+#include "const.h"
+#include "gl_cvars.h"
+#include "gl_lightmap.h"
+#include "decal_private.h"
+#include "gl_model_private.h"
+#include "r_local.h"
+#include "materialproxyfactory.h"
+#include "enginestats.h"
+#include "editor_sendcommand.h"
+#include "gl_matsysiface.h"
+#include "vmodes.h"
+#include "materialsystem/imaterialsystemhardwareconfig.h"
+#include "tier1/strtools.h"
+#include "filesystem.h"
+#include "traceinit.h"
+#include "sys_dll.h"
+#include "tier0/icommandline.h"
+#include "materialsystem/idebugtextureinfo.h"
+#include "common.h"
+#include "iregistry.h"
+#include "materialsystem/materialsystem_config.h"
+#include "ivideomode.h"
+#include "modes.h"
+#include "ivideomode.h"
+#include "tier2/tier2.h"
+
+#include "igame.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+static CMaterialProxyFactory s_MaterialProxyFactory;
+
+
+//-----------------------------------------------------------------------------
+// Connects to other
+//-----------------------------------------------------------------------------
+static void Shader_ConnectOtherMatSysInterfaces( )
+{
+ // NOTE: These two interfaces have been connected in the tier2 library
+ if ( !g_pMaterialSystemHardwareConfig )
+ {
+ Shader_Disconnect();
+ Sys_Error( "Could not get the material system hardware config interface! (2)" );
+ }
+ if ( !g_pMaterialSystemDebugTextureInfo )
+ {
+ Shader_Disconnect();
+ Sys_Error( "Could not get the debug texture info interface!" );
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+// Connect to interfaces we need
+//-----------------------------------------------------------------------------
+bool Shader_Connect( bool bSetProxyFactory )
+{
+ if ( !materials )
+ return false;
+
+ int nAdapter = CommandLine()->ParmValue( "-adapter", 0 );
+ int nModeFlags = MATERIAL_INIT_ALLOCATE_FULLSCREEN_TEXTURE;
+ if ( CommandLine()->FindParm( "-ref" ) )
+ {
+ nModeFlags |= MATERIAL_INIT_REFERENCE_RASTERIZER;
+ }
+
+ materials->SetAdapter( nAdapter, nModeFlags );
+ if ( bSetProxyFactory )
+ materials->SetMaterialProxyFactory( &s_MaterialProxyFactory );
+
+ Shader_ConnectOtherMatSysInterfaces( );
+ return g_pMaterialSystemHardwareConfig && g_pMaterialSystemDebugTextureInfo;
+}
+
+
+//-----------------------------------------------------------------------------
+// Connect to interfaces we need
+//-----------------------------------------------------------------------------
+void Shader_Disconnect( void )
+{
+}
+
+
+
+#ifndef SWDS
+
+void Shader_SwapBuffers( void )
+{
+ assert( materials );
+ materials->SwapBuffers();
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void Shader_BeginRendering ( void )
+{
+ // FIXME:
+// vid.width = window_rect.width;
+// vid.height = window_rect.height;
+}
+#endif