From c4ef0e90a4e83de5fc7a74eca635e14c6c5cf130 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 1 Aug 2022 00:38:10 +0300 Subject: [PATCH 1/4] fix dedicated build --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++++ datacache/datacache.h | 5 ++--- game/shared/collisionproperty.cpp | 2 +- public/engine/thinktracecounter.h | 2 +- public/tier0/threadtools.h | 17 +---------------- scripts/build-ubuntu-amd64.sh | 2 +- scripts/build-ubuntu-i386.sh | 2 +- tier0/threadtools.cpp | 8 ++------ 8 files changed, 38 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a9ce5aa4d..aa6270d58e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,3 +46,32 @@ jobs: git submodule init && git submodule update ./waf.bat configure -T debug ./waf.bat build + + build-dedicated-windows-i386: + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v2 + - name: Build dedicated windows-i386 + run: | + git submodule init && git submodule update + ./waf.bat configure -T debug -d + ./waf.bat build + + build-dedicated-linux-32: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Build dedicated linux-i386 + run: | + scripts/build-ubuntu-i386.sh -d + + build-dedicated-linux-64: + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Build dedicated linux-amd64 + run: | + scripts/build-ubuntu-amd64.sh -d diff --git a/datacache/datacache.h b/datacache/datacache.h index 2bbc0e45a0..afe6cfad03 100644 --- a/datacache/datacache.h +++ b/datacache/datacache.h @@ -181,10 +181,9 @@ private: DataCacheItem_t *m_pFirst; int m_iThread; }; - typedef CThreadLocal CThreadFrameLock; CDataCacheLRU & m_LRU; - CThreadFrameLock m_ThreadFrameLock; + CTHREADLOCAL(FrameLock_t*) m_ThreadFrameLock; DataCacheStatus_t m_status; DataCacheLimits_t m_limits; IDataCacheClient * m_pClient; @@ -381,4 +380,4 @@ inline void CDataCacheSection::NoteUnlock( int size ) //----------------------------------------------------------------------------- -#endif // DATACACHE_H \ No newline at end of file +#endif // DATACACHE_H diff --git a/game/shared/collisionproperty.cpp b/game/shared/collisionproperty.cpp index d2f1b6c3e2..37a424483d 100644 --- a/game/shared/collisionproperty.cpp +++ b/game/shared/collisionproperty.cpp @@ -78,7 +78,7 @@ private: CTSListWithFreeList m_DirtyEntities; CThreadSpinRWLock m_partitionMutex; uint32 m_partitionWriteId; - CThreadLocalInt<> m_readLockCount; + CTHREADLOCALINT m_readLockCount; }; diff --git a/public/engine/thinktracecounter.h b/public/engine/thinktracecounter.h index 7aee06b147..e696df9244 100644 --- a/public/engine/thinktracecounter.h +++ b/public/engine/thinktracecounter.h @@ -19,7 +19,7 @@ #ifdef THINK_TRACE_COUNTER_COMPILED // create a macro that is true if we are allowed to debug traces during thinks, and compiles out to nothing otherwise. #if defined( _GAMECONSOLE ) || defined( NO_STEAM ) - #define DEBUG_THINK_TRACE_COUNTER_ALLOWED() (!IsCert()) + #define DEBUG_THINK_TRACE_COUNTER_ALLOWED() (false) #else #ifdef THINK_TRACE_COUNTER_COMPILE_FUNCTIONS_ENGINE bool DEBUG_THINK_TRACE_COUNTER_ALLOWED() diff --git a/public/tier0/threadtools.h b/public/tier0/threadtools.h index b99755fafa..aefcb1ec0a 100644 --- a/public/tier0/threadtools.h +++ b/public/tier0/threadtools.h @@ -486,22 +486,7 @@ PLATFORM_INTERFACE void ThreadNotifySyncReleasing(void *p); #ifndef NO_THREAD_LOCAL - -#if ( defined(_LINUX) && defined(DEDICATED) ) && !defined(OSX) -// linux totally supports compiler thread locals, even across dll's. -#define PLAT_COMPILER_SUPPORTED_THREADLOCALS 1 -#define CTHREADLOCALINTEGER( typ ) __thread int -#define CTHREADLOCALINT __thread int -#define CTHREADLOCALPTR( typ ) __thread typ * -#define CTHREADLOCAL( typ ) __thread typ -#define GETLOCAL( x ) ( x ) -#ifndef TIER0_DLL_EXPORT -DLL_IMPORT __thread int g_nThreadID; -#endif -#endif - - -#if defined(WIN32) || defined(OSX) || defined( _PS3 ) || ( defined (_LINUX) && !defined(DEDICATED) ) +#if defined(WIN32) || defined(OSX) || defined( _PS3 ) || ( defined (_LINUX) ) #ifndef __AFXTLS_H__ // not compatible with some Windows headers #if defined(_PS3) diff --git a/scripts/build-ubuntu-amd64.sh b/scripts/build-ubuntu-amd64.sh index 0d4bfa224b..9fb9c3d016 100755 --- a/scripts/build-ubuntu-amd64.sh +++ b/scripts/build-ubuntu-amd64.sh @@ -4,5 +4,5 @@ git submodule init && git submodule update sudo apt-get update sudo apt-get install -f -y libopenal-dev g++-multilib gcc-multilib libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev -./waf configure -T debug --64bits --disable-warns && +./waf configure -T debug --64bits --disable-warns $* && ./waf build diff --git a/scripts/build-ubuntu-i386.sh b/scripts/build-ubuntu-i386.sh index 68a1740d55..2fbce4f1de 100755 --- a/scripts/build-ubuntu-i386.sh +++ b/scripts/build-ubuntu-i386.sh @@ -5,5 +5,5 @@ sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install -f -y libopenal-dev:i386 g++-multilib gcc-multilib libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 libfontconfig1-dev:i386 libcurl4-gnutls-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386 libbz2-dev:i386 -PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T debug --disable-warns && +PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T debug --disable-warns $* && ./waf build diff --git a/tier0/threadtools.cpp b/tier0/threadtools.cpp index ff4ab5a8a4..46e1829874 100644 --- a/tier0/threadtools.cpp +++ b/tier0/threadtools.cpp @@ -94,11 +94,7 @@ const int MAX_THREAD_IDS = 128; static volatile bool s_bThreadIDAllocated[MAX_THREAD_IDS]; -#if defined(_LINUX) && defined(DEDICATED) - -DLL_CLASS_EXPORT __thread int g_nThreadID; - -#elif defined(_PS3) +#if defined(_PS3) #include "tls_ps3.h" #else DLL_CLASS_EXPORT CTHREADLOCALINT g_nThreadID; @@ -1684,7 +1680,7 @@ bool CThreadFullMutex::Release() // //----------------------------------------------------------------------------- -#if defined( WIN32 ) || defined( _PS3 ) || defined( _OSX ) || ( defined (_LINUX) && !defined(DEDICATED) ) +#if defined( WIN32 ) || defined( _PS3 ) || defined( _OSX ) || defined (_LINUX) #if !defined(_PS3) namespace GenericThreadLocals { From 60dcc89289386a734bbf0099ea24ef108f332da1 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 1 Aug 2022 00:41:26 +0300 Subject: [PATCH 2/4] fix ubuntu build --- scripts/build-ubuntu-amd64.sh | 2 +- scripts/build-ubuntu-i386.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build-ubuntu-amd64.sh b/scripts/build-ubuntu-amd64.sh index 9fb9c3d016..e598240dc7 100755 --- a/scripts/build-ubuntu-amd64.sh +++ b/scripts/build-ubuntu-amd64.sh @@ -2,7 +2,7 @@ git submodule init && git submodule update sudo apt-get update -sudo apt-get install -f -y libopenal-dev g++-multilib gcc-multilib libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev +sudo apt-get install -f -y libopenal-dev g++-multilib gcc-multilib libpng-dev libjpeg-dev libfreetype6-dev libfontconfig1-dev libcurl4-gnutls-dev libsdl2-dev zlib1g-dev libbz2-dev libedit-dev ./waf configure -T debug --64bits --disable-warns $* && ./waf build diff --git a/scripts/build-ubuntu-i386.sh b/scripts/build-ubuntu-i386.sh index 2fbce4f1de..feee15b0ea 100755 --- a/scripts/build-ubuntu-i386.sh +++ b/scripts/build-ubuntu-i386.sh @@ -3,7 +3,7 @@ git submodule init && git submodule update sudo dpkg --add-architecture i386 sudo apt-get update -sudo apt-get install -f -y libopenal-dev:i386 g++-multilib gcc-multilib libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 libfontconfig1-dev:i386 libcurl4-gnutls-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386 libbz2-dev:i386 +sudo apt-get install -f -y libopenal-dev:i386 g++-multilib gcc-multilib libpng-dev:i386 libjpeg-dev:i386 libfreetype6-dev:i386 libfontconfig1-dev:i386 libcurl4-gnutls-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386 libbz2-dev:i386 libedit-dev:i386 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig ./waf configure -T debug --disable-warns $* && ./waf build From d7ba172ece0b92683dce76012ed576dd8ab58dc9 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 1 Aug 2022 00:44:54 +0300 Subject: [PATCH 3/4] workflows: rename jobs names --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa6270d58e..45977dfa07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ on: - "*" jobs: - build-linux-32: + build-linux-i386: runs-on: ubuntu-18.04 steps: @@ -18,7 +18,7 @@ jobs: run: | scripts/build-ubuntu-i386.sh - build-linux-64: + build-linux-amd64: runs-on: ubuntu-18.04 steps: @@ -58,7 +58,7 @@ jobs: ./waf.bat configure -T debug -d ./waf.bat build - build-dedicated-linux-32: + build-dedicated-linux-i386: runs-on: ubuntu-18.04 steps: @@ -67,7 +67,7 @@ jobs: run: | scripts/build-ubuntu-i386.sh -d - build-dedicated-linux-64: + build-dedicated-linux-amd64: runs-on: ubuntu-18.04 steps: From 168e52e428105cb09c93951d42eeae13c768ca90 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 1 Aug 2022 01:01:39 +0300 Subject: [PATCH 4/4] engine: fix windows dedicated build --- engine/matsys_interface.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/matsys_interface.cpp b/engine/matsys_interface.cpp index d49235c9e3..e97bb8b7db 100644 --- a/engine/matsys_interface.cpp +++ b/engine/matsys_interface.cpp @@ -269,6 +269,8 @@ static const char *s_pRegistryConVars[] = static CThreadMutex g_VideoConfigMutex; #endif +#ifndef DEDICATED + static int ReadVideoConfigInt( const char *pName, int nDefault ) { #if USE_VIDEOCONFIG_FILE @@ -379,6 +381,8 @@ static void WriteVideoConfigString( const char *pName, const char *pString ) #endif } +#endif + //----------------------------------------------------------------------------- // Scan for video config convars which are overridden on the cmd line, used // for development and automated timedemo regression testing. @@ -685,6 +689,7 @@ static void OverrideMaterialSystemConfigFromCommandLine( MaterialSystem_Config_t //----------------------------------------------------------------------------- void OverrideMaterialSystemConfig( MaterialSystem_Config_t &config ) { +#ifndef DEDICATED // enable/disable flashlight support based on mod (user can also set this explicitly) // FIXME: this is only here because dxsupport_override.cfg is currently broken ConVarRef mat_supportflashlight( "mat_supportflashlight" ); @@ -718,7 +723,8 @@ void OverrideMaterialSystemConfig( MaterialSystem_Config_t &config ) WriteVideoConfigInt( "ScreenWindowed", 1 ); config.SetFlag( MATSYS_VIDCFG_FLAGS_WINDOWED, true ); } -} +#endif +} void HandleServerAllowColorCorrection()