add macos workflow, fix filesystem_async max thread count

This commit is contained in:
nillerusr 2023-04-24 16:06:58 +00:00
parent 231c1e16b2
commit f2fa241ae6
12 changed files with 79 additions and 45 deletions

View File

@ -91,3 +91,21 @@ jobs:
- name: Build dedicated linux-amd64 - name: Build dedicated linux-amd64
run: | run: |
scripts/build-ubuntu-amd64.sh -d scripts/build-ubuntu-amd64.sh -d
build-macos-amd64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build macos-amd64
run: |
scripts/build-macos-amd64.sh
build-dedicated-macos-amd64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build dedicated macos-amd64
run: |
scripts/build-macos-amd64.sh -d

View File

@ -21,6 +21,15 @@ jobs:
run: | run: |
scripts/tests-ubuntu-amd64.sh scripts/tests-ubuntu-amd64.sh
tests-macos-amd64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Run tests macos-amd64
run: |
scripts/tests-macos-amd64.sh
tests-windows-i386: tests-windows-i386:
runs-on: windows-2019 runs-on: windows-2019

View File

@ -2224,7 +2224,7 @@ GLMDisplayDB *CSDLMgr::GetDisplayDB( void )
} }
#ifndef OSX #ifndef OSX
# include "glmdisplaydb_linuxwin.inl" #include "glmdisplaydb_linuxwin.inl"
#endif #endif

View File

@ -25,10 +25,9 @@ def build(bld):
'sdlmgr.cpp' 'sdlmgr.cpp'
] ]
if bld.env.DEST_OS == 'darwin': if bld.env.DEST_OS == 'darwin' and bld.env.GL:
source += [ source += ['glmrendererinfo_osx.mm']
'glmrendererinfo_osx.mm'
]
if bld.env.DEST_OS == 'win32': if bld.env.DEST_OS == 'win32':
source += [ source += [

View File

@ -88,14 +88,7 @@ namespace ImageLoader
Assert( IsFormatValidForConversion( imageFormat ) ); Assert( IsFormatValidForConversion( imageFormat ) );
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK ) #ifdef _X360
if ( IsPC() )
{
// running as a win32 tool, data is in expected order
// for conversion code
return;
}
// running on 360 and converting, input data must be x86 order // running on 360 and converting, input data must be x86 order
// swap to ensure conversion code gets valid data // swap to ensure conversion code gets valid data
XGENDIANTYPE xEndian; XGENDIANTYPE xEndian;
@ -137,7 +130,7 @@ namespace ImageLoader
{ {
Assert( IsFormatValidForConversion( imageFormat ) ); Assert( IsFormatValidForConversion( imageFormat ) );
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK ) #ifdef _X360
// It would have been nice to use the 360 D3DFORMAT bit encodings, but the codes // It would have been nice to use the 360 D3DFORMAT bit encodings, but the codes
// are different for win32, and this routine is used by a win32 library to // are different for win32, and this routine is used by a win32 library to
// manipulate 360 data, so there can be no reliance on D3DFORMAT bits // manipulate 360 data, so there can be no reliance on D3DFORMAT bits
@ -201,7 +194,7 @@ namespace ImageLoader
{ {
Assert( IsFormatValidForConversion( imageFormat ) ); Assert( IsFormatValidForConversion( imageFormat ) );
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK ) #ifdef _X360
XGENDIANTYPE xEndian; XGENDIANTYPE xEndian;
switch ( imageFormat ) switch ( imageFormat )
{ {
@ -256,5 +249,4 @@ namespace ImageLoader
} }
#endif #endif
} }
} }

View File

@ -288,13 +288,11 @@ int GetNumMipMapLevels( int width, int height, int depth )
// Turn off warning about FOURCC formats below... // Turn off warning about FOURCC formats below...
#pragma warning (disable:4063) #pragma warning (disable:4063)
#ifdef DX_TO_GL_ABSTRACTION
#ifndef MAKEFOURCC #ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \ #define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
#endif //defined(MAKEFOURCC) #endif //defined(MAKEFOURCC)
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// convert back and forth from D3D format to ImageFormat, regardless of // convert back and forth from D3D format to ImageFormat, regardless of
// whether it's supported or not // whether it's supported or not

View File

@ -659,8 +659,9 @@ void CBaseFileSystem::InitAsync()
Msg( "Async I/O disabled from command line\n" ); Msg( "Async I/O disabled from command line\n" );
return; return;
} }
#ifndef UNITTESTS
if ( VCRGetMode() == VCR_Disabled ) if ( VCRGetMode() == VCR_Disabled )
#endif
{ {
// create the i/o thread pool // create the i/o thread pool
m_pThreadPool = CreateThreadPool(); m_pThreadPool = CreateThreadPool();
@ -668,7 +669,6 @@ void CBaseFileSystem::InitAsync()
ThreadPoolStartParams_t params; ThreadPoolStartParams_t params;
params.iThreadPriority = 0; params.iThreadPriority = 0;
params.bIOThreads = true; params.bIOThreads = true;
params.nThreadsMax = 4; // Limit count of IO threads to a maximum of 4.
if ( IsX360() ) if ( IsX360() )
{ {
// override defaults // override defaults
@ -678,11 +678,10 @@ void CBaseFileSystem::InitAsync()
params.bUseAffinityTable = true; params.bUseAffinityTable = true;
params.iAffinityTable[0] = XBOX_PROCESSOR_3; params.iAffinityTable[0] = XBOX_PROCESSOR_3;
} }
else if( IsPC() ) else
{ {
// override defaults params.nThreadsMax = MIN(params.nThreads, 4); // Limit count of IO threads to a maximum of 4.
// maximum # of async I/O thread on PC is 2 params.nStackSize = 256*1024;
params.nThreads = 1;
} }
if ( !m_pThreadPool->Start( params, "IOJob" ) ) if ( !m_pThreadPool->Start( params, "IOJob" ) )

8
scripts/build-macos-amd64.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
git submodule init && git submodule update
brew install sdl2
./waf configure -T debug --64bits --disable-warns $* &&
./waf build

7
scripts/tests-macos-amd64.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
git submodule init && git submodule update
./waf configure -T release --sanitize=address,undefined --disable-warns --tests -8 --prefix=out/ $* &&
./waf install &&
cd out &&
DYLD_LIBRARY_PATH=bin/ ./unittest || exit 1

View File

@ -12,7 +12,7 @@
#include "materialsystem/imaterial.h" #include "materialsystem/imaterial.h"
#include "tier0/vprof.h" #include "tier0/vprof.h"
#include "tier0/basetypes.h" #include "tier0/basetypes.h"
#ifndef DEDICATED #ifdef DX_TO_GL_ABSTRACTION
#include "togl/rendermechanism.h" #include "togl/rendermechanism.h"
#endif #endif

View File

@ -128,7 +128,7 @@ bool CUnitTestApp::Create()
while ((dir = readdir(d)) != NULL) while ((dir = readdir(d)) != NULL)
{ {
int len = strlen(dir->d_name); int len = strlen(dir->d_name);
if( len > 2 && strcmp(dir->d_name+len-3, ".so") == 0) if( len > 2 && strcmp(dir->d_name+len-strlen(DLL_EXT_STRING), DLL_EXT_STRING) == 0)
{ {
static char path[2048]; static char path[2048];
snprintf(path, sizeof(path), "tests/%s", dir->d_name); snprintf(path, sizeof(path), "tests/%s", dir->d_name);

40
wscript
View File

@ -159,15 +159,17 @@ def define_platform(conf):
conf.env.DEDICATED = conf.options.DEDICATED conf.env.DEDICATED = conf.options.DEDICATED
conf.env.TESTS = conf.options.TESTS conf.env.TESTS = conf.options.TESTS
conf.env.TOGLES = conf.options.TOGLES conf.env.TOGLES = conf.options.TOGLES
conf.env.GL = conf.options.GL conf.env.GL = conf.options.GL and not conf.options.TESTS and not conf.options.DEDICATED
conf.env.OPUS = conf.options.OPUS conf.env.OPUS = conf.options.OPUS
if conf.options.DEDICATED: if conf.options.DEDICATED:
conf.options.SDL = False conf.options.SDL = False
# conf.options.GL = False
conf.define('DEDICATED', 1) conf.define('DEDICATED', 1)
if conf.options.GL and not conf.options.TESTS: if conf.options.TESTS:
conf.define('UNITTESTS', 1)
if conf.env.GL:
conf.env.append_unique('DEFINES', [ conf.env.append_unique('DEFINES', [
'DX_TO_GL_ABSTRACTION', 'DX_TO_GL_ABSTRACTION',
'GL_GLEXT_PROTOTYPES', 'GL_GLEXT_PROTOTYPES',
@ -177,6 +179,9 @@ def define_platform(conf):
if conf.options.TOGLES: if conf.options.TOGLES:
conf.env.append_unique('DEFINES', ['TOGLES']) conf.env.append_unique('DEFINES', ['TOGLES'])
if conf.options.TESTS:
conf.define('UNITTESTS', 1)
if conf.options.SDL and not conf.options.TESTS: if conf.options.SDL and not conf.options.TESTS:
conf.env.SDL = 1 conf.env.SDL = 1
conf.define('USE_SDL', 1) conf.define('USE_SDL', 1)
@ -323,6 +328,20 @@ def check_deps(conf):
for i in a: for i in a:
conf.check_cc(lib = i) conf.check_cc(lib = i)
if conf.env.DEST_OS == "darwin":
conf.check(lib='iconv', uselib_store='ICONV')
conf.env.FRAMEWORK_APPKIT = "AppKit"
conf.env.FRAMEWORK_IOKIT = "IOKit"
conf.env.FRAMEWORK_FOUNDATION = "Foundation"
conf.env.FRAMEWORK_COREFOUNDATION = "CoreFoundation"
conf.env.FRAMEWORK_COREGRAPHICS = "CoreGraphics"
conf.env.FRAMEWORK_OPENGL = "OpenGL"
conf.env.FRAMEWORK_CARBON = "Carbon"
conf.env.FRAMEWORK_APPLICATIONSERVICES = "ApplicationServices"
conf.env.FRAMEWORK_CORESERVICES = "CoreServices"
conf.env.FRAMEWORK_COREAUDIO = "CoreAudio"
conf.env.FRAMEWORK_AUDIOTOOLBOX = "AudioToolbox"
conf.env.FRAMEWORK_SYSTEMCONFIGURATION = "SystemConfiguration"
if conf.options.TESTS: if conf.options.TESTS:
return return
@ -361,21 +380,6 @@ def check_deps(conf):
conf.check(lib='android_support', uselib_store='ANDROID_SUPPORT') conf.check(lib='android_support', uselib_store='ANDROID_SUPPORT')
conf.check(lib='opus', uselib_store='OPUS') conf.check(lib='opus', uselib_store='OPUS')
if conf.env.DEST_OS == "darwin":
conf.check(lib='iconv', uselib_store='ICONV')
conf.env.FRAMEWORK_APPKIT = "AppKit"
conf.env.FRAMEWORK_IOKIT = "IOKit"
conf.env.FRAMEWORK_FOUNDATION = "Foundation"
conf.env.FRAMEWORK_COREFOUNDATION = "CoreFoundation"
conf.env.FRAMEWORK_COREGRAPHICS = "CoreGraphics"
conf.env.FRAMEWORK_OPENGL = "OpenGL"
conf.env.FRAMEWORK_CARBON = "Carbon"
conf.env.FRAMEWORK_APPLICATIONSERVICES = "ApplicationServices"
conf.env.FRAMEWORK_CORESERVICES = "CoreServices"
conf.env.FRAMEWORK_COREAUDIO = "CoreAudio"
conf.env.FRAMEWORK_AUDIOTOOLBOX = "AudioToolbox"
conf.env.FRAMEWORK_SYSTEMCONFIGURATION = "SystemConfiguration"
if conf.env.DEST_OS == 'win32': if conf.env.DEST_OS == 'win32':
conf.check(lib='libz', uselib_store='ZLIB', define_name='USE_ZLIB') conf.check(lib='libz', uselib_store='ZLIB', define_name='USE_ZLIB')
# conf.check(lib='nvtc', uselib_store='NVTC') # conf.check(lib='nvtc', uselib_store='NVTC')