Skip to content

Commit f315ed8

Browse files
committed
Merge branch 'master' into descriptor_lifetime_tracking
2 parents d65ffd5 + fe8b443 commit f315ed8

File tree

8 files changed

+250
-193
lines changed

8 files changed

+250
-193
lines changed

include/nbl/system/IApplicationFramework.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ namespace nbl::system
1414
class IApplicationFramework
1515
{
1616
public:
17-
IApplicationFramework(
18-
const system::path& _localInputCWD,
19-
const system::path& _localOutputCWD,
20-
const system::path& _sharedInputCWD,
21-
const system::path& _sharedOutputCWD) :
22-
localInputCWD(_localInputCWD), localOutputCWD(_localOutputCWD), sharedInputCWD(_sharedInputCWD), sharedOutputCWD(_sharedOutputCWD)
23-
{
17+
static void GlobalsInit()
18+
{
2419
#ifdef _NBL_PLATFORM_WINDOWS_
2520
// TODO: @AnastaZIuk also provide define constants for DXC install dir!
2621
const HRESULT dxcLoad = CSystemWin32::delayLoadDLL("dxcompiler.dll",{system::path(_DXC_DLL_).parent_path()});
@@ -31,7 +26,19 @@ class IApplicationFramework
3126
const HRESULT nablaLoad = CSystemWin32::delayLoadDLL(_NABLA_DLL_NAME_,{_NABLA_OUTPUT_DIR_,_NABLA_INSTALL_DIR_});
3227
assert(SUCCEEDED(nablaLoad));
3328
#endif
29+
#else
30+
// nothing else needs to be done cause we have RPath
3431
#endif
32+
}
33+
34+
IApplicationFramework(
35+
const system::path& _localInputCWD,
36+
const system::path& _localOutputCWD,
37+
const system::path& _sharedInputCWD,
38+
const system::path& _sharedOutputCWD) :
39+
localInputCWD(_localInputCWD), localOutputCWD(_localOutputCWD), sharedInputCWD(_sharedInputCWD), sharedOutputCWD(_sharedOutputCWD)
40+
{
41+
GlobalsInit();
3542
}
3643

3744
virtual void setSystem(core::smart_refctd_ptr<nbl::system::ISystem>&& system) = 0;
@@ -47,6 +54,8 @@ class IApplicationFramework
4754

4855
virtual void workLoopBody() = 0;
4956
virtual bool keepRunning() = 0;
57+
58+
// TODO: refactor/hide
5059
std::vector<std::string> argv;
5160

5261
protected:

include/nbl/system/IFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class IFile : public IFileBase, private ISystem::IFutureManipulator
1414
{
1515
const IFileBase* constThis = this;
1616
const auto* ptr = reinterpret_cast<const std::byte*>(constThis->getMappedPointer());
17-
if (ptr)
17+
if (ptr || sizeToRead==0ull)
1818
{
1919
const size_t size = getSize();
2020
if (offset+sizeToRead>size)
@@ -28,7 +28,7 @@ class IFile : public IFileBase, private ISystem::IFutureManipulator
2828
inline void write(ISystem::future_t<size_t>& fut, const void* buffer, size_t offset, size_t sizeToWrite)
2929
{
3030
auto* ptr = reinterpret_cast<std::byte*>(getMappedPointer());
31-
if (ptr)
31+
if (ptr || sizeToWrite==0ull)
3232
{
3333
// TODO: growable mappings
3434
if (offset+sizeToWrite>getSize())

include/nbl/system/ILogger.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ILogger : public core::IReferenceCounted
3131
ELL_ERROR = 16
3232
};
3333

34-
void log(const std::string_view& fmtString, E_LOG_LEVEL logLevel = ELL_DEBUG, ...)
34+
inline void log(const std::string_view& fmtString, E_LOG_LEVEL logLevel = ELL_DEBUG, ...)
3535
{
3636
if (logLevel & m_logLevelMask.value)
3737
{
@@ -48,12 +48,12 @@ class ILogger : public core::IReferenceCounted
4848
}
4949

5050
protected:
51-
static core::bitflag<E_LOG_LEVEL> defaultLogMask();
51+
NBL_API2 static core::bitflag<E_LOG_LEVEL> defaultLogMask();
5252

5353
ILogger(core::bitflag<E_LOG_LEVEL> logLevelMask) : m_logLevelMask(logLevelMask) {}
5454

5555
virtual void log_impl(const std::string_view& fmtString, E_LOG_LEVEL logLevel, va_list args) = 0;
56-
virtual std::string constructLogString(const std::string_view& fmtString, E_LOG_LEVEL logLevel, va_list l)
56+
inline virtual std::string constructLogString(const std::string_view& fmtString, E_LOG_LEVEL logLevel, va_list l)
5757
{
5858
using namespace std::literals;
5959
using namespace std::chrono;
@@ -115,38 +115,38 @@ class ILogger : public core::IReferenceCounted
115115
class logger_opt_ptr final
116116
{
117117
public:
118-
logger_opt_ptr(ILogger* const _logger) : logger(_logger) {}
119-
~logger_opt_ptr() = default;
118+
inline logger_opt_ptr(ILogger* const _logger) : logger(_logger) {}
119+
inline ~logger_opt_ptr() = default;
120120

121121
template<typename... Args>
122-
void log(const std::string_view& fmtString, ILogger::E_LOG_LEVEL logLevel = ILogger::ELL_DEBUG, Args&&... args) const
122+
inline void log(const std::string_view& fmtString, ILogger::E_LOG_LEVEL logLevel = ILogger::ELL_DEBUG, Args&&... args) const
123123
{
124124
if (logger != nullptr)
125125
return logger->log(fmtString, logLevel, std::forward<Args>(args)...);
126126
}
127127

128-
ILogger* get() const { return logger; }
128+
inline ILogger* get() const { return logger; }
129129
private:
130130
mutable ILogger* logger;
131131
};
132132

133133
class logger_opt_smart_ptr final
134134
{
135135
public:
136-
logger_opt_smart_ptr(core::smart_refctd_ptr<ILogger>&& _logger) : logger(std::move(_logger)) {}
137-
logger_opt_smart_ptr(std::nullptr_t t) : logger(nullptr) {}
138-
~logger_opt_smart_ptr() = default;
136+
inline logger_opt_smart_ptr(core::smart_refctd_ptr<ILogger>&& _logger) : logger(std::move(_logger)) {}
137+
inline logger_opt_smart_ptr(std::nullptr_t t) : logger(nullptr) {}
138+
inline ~logger_opt_smart_ptr() = default;
139139

140140
template<typename... Args>
141-
void log(const std::string_view& fmtString, ILogger::E_LOG_LEVEL logLevel = ILogger::ELL_DEBUG, Args&&... args) const
141+
inline void log(const std::string_view& fmtString, ILogger::E_LOG_LEVEL logLevel = ILogger::ELL_DEBUG, Args&&... args) const
142142
{
143143
if (logger.get() != nullptr)
144144
return logger->log(fmtString, logLevel, std::forward<Args>(args)...);
145145
}
146146

147-
ILogger* getRaw() const { return logger.get(); }
148-
logger_opt_ptr getOptRawPtr() const { return logger_opt_ptr(logger.get()); }
149-
const core::smart_refctd_ptr<ILogger>& get() const { return logger; }
147+
inline ILogger* getRaw() const { return logger.get(); }
148+
inline logger_opt_ptr getOptRawPtr() const { return logger_opt_ptr(logger.get()); }
149+
inline const core::smart_refctd_ptr<ILogger>& get() const { return logger; }
150150

151151
private:
152152
mutable core::smart_refctd_ptr<ILogger> logger;

0 commit comments

Comments
 (0)