Skip to content

Commit 599529d

Browse files
move some stuff from CommonAPI to IApplicationFramework
1 parent e814d2d commit 599529d

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

include/nbl/system/IApplicationFramework.h

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,29 @@
77
#include "nbl/system/declarations.h"
88
#include "nbl/system/definitions.h"
99

10+
#if defined(_NBL_PLATFORM_WINDOWS_)
11+
#include "nbl/system/CColoredStdoutLoggerWin32.h"
12+
#elif defined(_NBL_PLATFORM_ANDROID_)
13+
#include "nbl/system/CStdoutLoggerAndroid.h"
14+
#endif
15+
#include "nbl/system/CSystemAndroid.h"
16+
#include "nbl/system/CSystemLinux.h"
17+
#include "nbl/system/CSystemWin32.h"
1018

1119
namespace nbl::system
1220
{
1321

1422
class IApplicationFramework
1523
{
1624
public:
25+
// this is safe to call multiple times
1726
static void GlobalsInit()
1827
{
1928
#ifdef _NBL_PLATFORM_WINDOWS_
2029
#ifdef NBL_CPACK_PACKAGE_DXC_DLL_DIR
21-
const HRESULT dxcLoad = CSystemWin32::delayLoadDLL("dxcompiler.dll", { system::path(_DXC_DLL_).parent_path(), NBL_CPACK_PACKAGE_DXC_DLL_DIR });
30+
const HRESULT dxcLoad = CSystemWin32::delayLoadDLL("dxcompiler.dll", { path(_DXC_DLL_).parent_path(), NBL_CPACK_PACKAGE_DXC_DLL_DIR });
2231
#else
23-
const HRESULT dxcLoad = CSystemWin32::delayLoadDLL("dxcompiler.dll", { system::path(_DXC_DLL_).parent_path() });
32+
const HRESULT dxcLoad = CSystemWin32::delayLoadDLL("dxcompiler.dll", { path(_DXC_DLL_).parent_path() });
2433
#endif
2534

2635
//assert(SUCCEEDED(dxcLoad)); // no clue why this fails to find the dll
@@ -43,17 +52,28 @@ class IApplicationFramework
4352
#endif
4453
}
4554

55+
static nbl::core::smart_refctd_ptr<ISystem> createSystem()
56+
{
57+
GlobalsInit();
58+
#ifdef _NBL_PLATFORM_WINDOWS_
59+
return nbl::core::make_smart_refctd_ptr<CSystemWin32>();
60+
#elif defined(_NBL_PLATFORM_ANDROID_)
61+
return nbl::core::make_smart_refctd_ptr<CSystemAndroid>(std::move(caller));
62+
#endif
63+
return nullptr;
64+
}
65+
4666
IApplicationFramework(
47-
const system::path& _localInputCWD,
48-
const system::path& _localOutputCWD,
49-
const system::path& _sharedInputCWD,
50-
const system::path& _sharedOutputCWD) :
67+
const path& _localInputCWD,
68+
const path& _localOutputCWD,
69+
const path& _sharedInputCWD,
70+
const path& _sharedOutputCWD) :
5171
localInputCWD(_localInputCWD), localOutputCWD(_localOutputCWD), sharedInputCWD(_sharedInputCWD), sharedOutputCWD(_sharedOutputCWD)
5272
{
5373
GlobalsInit();
5474
}
5575

56-
virtual void setSystem(core::smart_refctd_ptr<nbl::system::ISystem>&& system) = 0;
76+
virtual void setSystem(core::smart_refctd_ptr<ISystem>&& system) = 0;
5777

5878
void onAppInitialized()
5979
{
@@ -90,22 +110,22 @@ class IApplicationFramework
90110
91111
To add files to your assets directory, create an "assets" directory in your app's source directory
92112
*/
93-
system::path localInputCWD;
113+
path localInputCWD;
94114

95115
/*
96116
This is a CWD used to output app-local data e.g. screenshots
97117
*/
98-
system::path localOutputCWD;
118+
path localOutputCWD;
99119

100120
/*
101121
The CWD for input data that can be shared among apps, like the "examples_tests/media" directory for Nabla examples
102122
*/
103-
system::path sharedInputCWD;
123+
path sharedInputCWD;
104124

105125
/*
106126
This CWD is used to output data that can be shared between apps e.g. quantization cache
107127
*/
108-
system::path sharedOutputCWD;
128+
path sharedOutputCWD;
109129
};
110130

111131
}

0 commit comments

Comments
 (0)