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
run: |
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: |
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:
runs-on: windows-2019

View File

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

View File

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

View File

@ -88,14 +88,7 @@ namespace ImageLoader
Assert( IsFormatValidForConversion( imageFormat ) );
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK )
if ( IsPC() )
{
// running as a win32 tool, data is in expected order
// for conversion code
return;
}
#ifdef _X360
// running on 360 and converting, input data must be x86 order
// swap to ensure conversion code gets valid data
XGENDIANTYPE xEndian;
@ -137,7 +130,7 @@ namespace ImageLoader
{
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
// 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
@ -201,7 +194,7 @@ namespace ImageLoader
{
Assert( IsFormatValidForConversion( imageFormat ) );
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK )
#ifdef _X360
XGENDIANTYPE xEndian;
switch ( imageFormat )
{
@ -256,5 +249,4 @@ namespace ImageLoader
}
#endif
}
}

View File

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

View File

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

View File

@ -128,7 +128,7 @@ bool CUnitTestApp::Create()
while ((dir = readdir(d)) != NULL)
{
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];
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.TESTS = conf.options.TESTS
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
if conf.options.DEDICATED:
conf.options.SDL = False
# conf.options.GL = False
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', [
'DX_TO_GL_ABSTRACTION',
'GL_GLEXT_PROTOTYPES',
@ -177,6 +179,9 @@ def define_platform(conf):
if conf.options.TOGLES:
conf.env.append_unique('DEFINES', ['TOGLES'])
if conf.options.TESTS:
conf.define('UNITTESTS', 1)
if conf.options.SDL and not conf.options.TESTS:
conf.env.SDL = 1
conf.define('USE_SDL', 1)
@ -323,6 +328,20 @@ def check_deps(conf):
for i in a:
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:
return
@ -361,21 +380,6 @@ def check_deps(conf):
conf.check(lib='android_support', uselib_store='ANDROID_SUPPORT')
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':
conf.check(lib='libz', uselib_store='ZLIB', define_name='USE_ZLIB')
# conf.check(lib='nvtc', uselib_store='NVTC')