mirror of https://github.com/AxioDL/metaforce.git
Windows build fixes
This commit is contained in:
parent
85bab33ae3
commit
77f814192e
|
@ -167,7 +167,7 @@ public:
|
|||
int run()
|
||||
{
|
||||
hecl::MultiProgressPrinter printer(true);
|
||||
hecl::ClientProcess cp(&printer, m_info.verbosityLevel);
|
||||
hecl::ClientProcess cp(&printer);
|
||||
for (int i=0 ; i<m_spec->m_numCookPasses ; ++i)
|
||||
for (const hecl::ProjectPath& path : m_selectedItems)
|
||||
m_useProj->cookPath(path, printer, m_recursive, m_info.force, m_fast, m_spec, &cp, i);
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
if (continuePrompt())
|
||||
{
|
||||
hecl::MultiProgressPrinter printer(true);
|
||||
hecl::ClientProcess cp(&printer, m_info.verbosityLevel);
|
||||
hecl::ClientProcess cp(&printer);
|
||||
for (const hecl::ProjectPath& path : m_selectedItems)
|
||||
{
|
||||
if (!m_useProj->packagePath(path, printer, m_fast, m_spec, &cp))
|
||||
|
|
|
@ -75,9 +75,6 @@ static void SIGINTHandler(int sig)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/* SIGWINCH should do nothing */
|
||||
static void SIGWINCHHandler(int sig) {}
|
||||
|
||||
static logvisor::Module AthenaLog("Athena");
|
||||
static void AthenaExc(athena::error::Level level, const char* file,
|
||||
const char*, int line, const char* fmt, ...)
|
||||
|
@ -94,6 +91,8 @@ hecl::SystemString ExeDir;
|
|||
#if _WIN32
|
||||
int wmain(int argc, const wchar_t** argv)
|
||||
#else
|
||||
/* SIGWINCH should do nothing */
|
||||
static void SIGWINCHHandler(int sig) {}
|
||||
int main(int argc, const char** argv)
|
||||
#endif
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c5e71f75690426b38c4964a3bc1dcf3d0a464eb8
|
||||
Subproject commit d13e04cbaf4bb6f25ccde9228d9c88f90a2710e9
|
|
@ -1 +1 @@
|
|||
Subproject commit 721d10919b66a6ac04cf8087fecc8177d85662a5
|
||||
Subproject commit 0b77d4a757014fdcb7209e56e839e2256e729350
|
|
@ -13,7 +13,7 @@
|
|||
namespace hecl::Backend
|
||||
{
|
||||
|
||||
struct GX : IBackend
|
||||
struct GX final : IBackend
|
||||
{
|
||||
enum AttrType
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ struct ProgrammableCommon : IBackend
|
|||
std::vector<TexCoordGen> m_tcgs;
|
||||
std::vector<size_t> m_texMtxRefs;
|
||||
|
||||
using IBackend::reset;
|
||||
void reset(const IR& ir, Diagnostics& diag, const char* backendName);
|
||||
|
||||
private:
|
||||
|
|
|
@ -74,7 +74,6 @@ class PyOutStream : public std::ostream
|
|||
{
|
||||
friend class Connection;
|
||||
Connection* m_parent;
|
||||
bool m_deleteOnError;
|
||||
struct StreamBuf : std::streambuf
|
||||
{
|
||||
PyOutStream& m_parent;
|
||||
|
|
|
@ -22,7 +22,6 @@ class ClientProcess
|
|||
const MultiProgressPrinter* m_progPrinter;
|
||||
int m_completedCooks = 0;
|
||||
int m_addedCooks = 0;
|
||||
int m_verbosity;
|
||||
|
||||
public:
|
||||
struct Transaction
|
||||
|
@ -38,7 +37,7 @@ public:
|
|||
virtual void run(blender::Token& btok)=0;
|
||||
Transaction(ClientProcess& parent, Type tp) : m_parent(parent), m_type(tp) {}
|
||||
};
|
||||
struct BufferTransaction : Transaction
|
||||
struct BufferTransaction final : Transaction
|
||||
{
|
||||
ProjectPath m_path;
|
||||
void* m_targetBuf;
|
||||
|
@ -51,7 +50,7 @@ public:
|
|||
m_path(path), m_targetBuf(target),
|
||||
m_maxLen(maxLen), m_offset(offset) {}
|
||||
};
|
||||
struct CookTransaction : Transaction
|
||||
struct CookTransaction final : Transaction
|
||||
{
|
||||
ProjectPath m_path;
|
||||
Database::IDataSpec* m_dataSpec;
|
||||
|
@ -64,7 +63,7 @@ public:
|
|||
: Transaction(parent, Type::Cook), m_path(path), m_dataSpec(spec),
|
||||
m_force(force), m_fast(fast) {}
|
||||
};
|
||||
struct LambdaTransaction : Transaction
|
||||
struct LambdaTransaction final : Transaction
|
||||
{
|
||||
std::function<void(blender::Token&)> m_func;
|
||||
void run(blender::Token& btok);
|
||||
|
@ -91,7 +90,7 @@ private:
|
|||
static ThreadLocalPtr<ClientProcess::Worker> ThreadWorker;
|
||||
|
||||
public:
|
||||
ClientProcess(const MultiProgressPrinter* progPrinter=nullptr, int verbosityLevel=1);
|
||||
ClientProcess(const MultiProgressPrinter* progPrinter=nullptr);
|
||||
~ClientProcess() {shutdown();}
|
||||
std::shared_ptr<const BufferTransaction>
|
||||
addBufferTransaction(const hecl::ProjectPath& path, void* target,
|
||||
|
|
|
@ -80,8 +80,8 @@ private:
|
|||
void increment(UniformBufferPool& pool)
|
||||
{
|
||||
if (useCount.fetch_add(1) == 0)
|
||||
buffer = pool.m_factory->BooNewPoolBuffer(boo::BufferUse::Uniform,
|
||||
pool.m_stride, pool.m_countPerBucket);
|
||||
buffer = pool.m_factory->newPoolBuffer(boo::BufferUse::Uniform,
|
||||
pool.m_stride, pool.m_countPerBucket BooTrace);
|
||||
}
|
||||
|
||||
void decrement(UniformBufferPool& pool)
|
||||
|
|
|
@ -80,8 +80,8 @@ private:
|
|||
void increment(VertexBufferPool& pool)
|
||||
{
|
||||
if (useCount.fetch_add(1) == 0)
|
||||
buffer = pool.m_factory->BooNewPoolBuffer(boo::BufferUse::Vertex,
|
||||
pool.m_stride, pool.m_countPerBucket);
|
||||
buffer = pool.m_factory->newPoolBuffer(boo::BufferUse::Vertex,
|
||||
pool.m_stride, pool.m_countPerBucket BooTrace);
|
||||
}
|
||||
|
||||
void decrement(VertexBufferPool& pool)
|
||||
|
|
|
@ -226,39 +226,7 @@ static inline SystemChar* Getcwd(SystemChar* buf, int maxlen)
|
|||
#endif
|
||||
}
|
||||
|
||||
static SystemString GetcwdStr()
|
||||
{
|
||||
/* http://stackoverflow.com/a/2869667 */
|
||||
//const size_t ChunkSize=255;
|
||||
//const int MaxChunks=10240; // 2550 KiBs of current path are more than enough
|
||||
|
||||
SystemChar stackBuffer[255]; // Stack buffer for the "normal" case
|
||||
if (Getcwd(stackBuffer, 255) != nullptr)
|
||||
return SystemString(stackBuffer);
|
||||
if (errno != ERANGE)
|
||||
{
|
||||
// It's not ERANGE, so we don't know how to handle it
|
||||
LogModule.report(logvisor::Fatal, "Cannot determine the current path.");
|
||||
// Of course you may choose a different error reporting method
|
||||
}
|
||||
// Ok, the stack buffer isn't long enough; fallback to heap allocation
|
||||
for (int chunks=2 ; chunks<10240 ; chunks++)
|
||||
{
|
||||
// With boost use scoped_ptr; in C++0x, use unique_ptr
|
||||
// If you want to be less C++ but more efficient you may want to use realloc
|
||||
std::unique_ptr<SystemChar[]> cwd(new SystemChar[255*chunks]);
|
||||
if (Getcwd(cwd.get(), 255*chunks) != nullptr)
|
||||
return SystemString(cwd.get());
|
||||
if (errno != ERANGE)
|
||||
{
|
||||
// It's not ERANGE, so we don't know how to handle it
|
||||
LogModule.report(logvisor::Fatal, "Cannot determine the current path.");
|
||||
// Of course you may choose a different error reporting method
|
||||
}
|
||||
}
|
||||
LogModule.report(logvisor::Fatal, "Cannot determine the current path; the path is apparently unreasonably long");
|
||||
return SystemString();
|
||||
}
|
||||
SystemString GetcwdStr();
|
||||
|
||||
static inline bool IsAbsolute(SystemStringView path)
|
||||
{
|
||||
|
@ -634,10 +602,8 @@ public:
|
|||
size_t m_fileSz;
|
||||
bool m_isDir;
|
||||
|
||||
private:
|
||||
friend class DirectoryEnumerator;
|
||||
Entry(hecl::SystemString&& path, const hecl::SystemChar* name, size_t sz, bool isDir)
|
||||
: m_path(std::move(path)), m_name(name), m_fileSz(sz), m_isDir(isDir) {}
|
||||
Entry(const hecl::SystemString& path, const hecl::SystemChar* name, size_t sz, bool isDir)
|
||||
: m_path(path), m_name(name), m_fileSz(sz), m_isDir(isDir) {}
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -373,7 +373,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
ComPtr<ID3DBlob> fragBlob;
|
||||
ComPtr<ID3DBlob> pipelineBlob;
|
||||
objOut =
|
||||
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||
static_cast<boo::D3DDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
ReferenceComPtr(vertBlob), ReferenceComPtr(fragBlob), ReferenceComPtr(pipelineBlob),
|
||||
tag.newVertexFormat(ctx),
|
||||
|
@ -469,7 +469,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
return nullptr;
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> ret =
|
||||
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||
static_cast<boo::D3DDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(nullptr, nullptr,
|
||||
ReferenceComPtr(vertBlob), ReferenceComPtr(fragBlob), ReferenceComPtr(pipelineBlob),
|
||||
tag.newVertexFormat(ctx),
|
||||
|
@ -537,7 +537,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
}
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> ret =
|
||||
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||
static_cast<boo::D3DDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(vertSource.c_str(), fragSource.c_str(),
|
||||
ReferenceComPtr(thisPipeBlobs.vert), ReferenceComPtr(thisPipeBlobs.frag), ReferenceComPtr(thisPipeBlobs.pipeline),
|
||||
tag.newVertexFormat(ctx),
|
||||
|
@ -661,7 +661,7 @@ struct HLSLBackendFactory : IShaderBackendFactory
|
|||
}
|
||||
|
||||
boo::ObjToken<boo::IShaderPipeline> ret =
|
||||
static_cast<boo::ID3DDataFactory::Context&>(ctx).
|
||||
static_cast<boo::D3DDataFactory::Context&>(ctx).
|
||||
newShaderPipeline(nullptr, nullptr,
|
||||
ReferenceComPtr(vertBlob), ReferenceComPtr(fragBlob), ReferenceComPtr(pipelineBlob),
|
||||
tag.newVertexFormat(ctx),
|
||||
|
|
|
@ -388,7 +388,7 @@ Connection::Connection(int verbosityLevel)
|
|||
if (!CreateProcessW(blenderBin, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo))
|
||||
{
|
||||
LPWSTR messageBuffer = nullptr;
|
||||
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
|
||||
BlenderLog.report(logvisor::Fatal, L"unable to launch blender from %s: %s", blenderBin, messageBuffer);
|
||||
}
|
||||
|
@ -723,7 +723,6 @@ void Connection::deleteBlend()
|
|||
PyOutStream::PyOutStream(Connection* parent, bool deleteOnError)
|
||||
: std::ostream(&m_sbuf),
|
||||
m_parent(parent),
|
||||
m_deleteOnError(deleteOnError),
|
||||
m_sbuf(*this, deleteOnError)
|
||||
{
|
||||
m_parent->m_pyStreamActive = true;
|
||||
|
|
|
@ -75,9 +75,9 @@ void ClientProcess::Worker::proc()
|
|||
snprintf(thrName, 64, "HECL Client Worker %d", m_idx);
|
||||
logvisor::RegisterThreadName(thrName);
|
||||
|
||||
std::unique_lock<std::mutex> lk(m_proc.m_mutex);
|
||||
while (m_proc.m_running)
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(m_proc.m_mutex);
|
||||
if (!m_didInit)
|
||||
{
|
||||
m_proc.m_initCv.notify_one();
|
||||
|
@ -99,11 +99,12 @@ void ClientProcess::Worker::proc()
|
|||
break;
|
||||
m_proc.m_cv.wait(lk);
|
||||
}
|
||||
lk.unlock();
|
||||
m_blendTok.shutdown();
|
||||
}
|
||||
|
||||
ClientProcess::ClientProcess(const MultiProgressPrinter* progPrinter, int verbosityLevel)
|
||||
: m_progPrinter(progPrinter), m_verbosity(verbosityLevel)
|
||||
ClientProcess::ClientProcess(const MultiProgressPrinter* progPrinter)
|
||||
: m_progPrinter(progPrinter)
|
||||
{
|
||||
#if HECL_MULTIPROCESSOR
|
||||
const int cpuCount = GetCPUCount();
|
||||
|
|
|
@ -141,7 +141,6 @@ ShaderCacheManager::ShaderCacheManager(const FileStoreManager& storeMgr,
|
|||
#endif
|
||||
#if _WIN32
|
||||
case boo::IGraphicsDataFactory::Platform::D3D11:
|
||||
case boo::IGraphicsDataFactory::Platform::D3D12:
|
||||
m_factory.reset(_NewHLSLBackendFactory());
|
||||
break;
|
||||
#endif
|
||||
|
@ -399,7 +398,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, std::string_view source,
|
|||
ShaderCachedData foundData = lookupData(tag);
|
||||
if (foundData)
|
||||
{
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
SCM_Log.report(logvisor::Info, "building cached shader '%s' %016llX", diagName.data(), tag.val64());
|
||||
boo::ObjToken<boo::IShaderPipeline> build = buildFromCache(foundData, ctx);
|
||||
|
@ -409,7 +408,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, std::string_view source,
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} BooTrace);
|
||||
|
||||
if (ret->m_pipelines.size())
|
||||
{
|
||||
|
@ -419,7 +418,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, std::string_view source,
|
|||
SCM_Log.report(logvisor::Warning, "invalid cache read, rebuilding shader '%s'", diagName.data());
|
||||
}
|
||||
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
hecl::Frontend::IR ir = FE.compileSource(source, diagName);
|
||||
SCM_Log.report(logvisor::Info, "building shader '%s' %016llX", diagName.data(), tag.val64());
|
||||
|
@ -428,7 +427,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, std::string_view source,
|
|||
addData(m_factory->buildShaderFromIR(tag, ir, FE.getDiagnostics(), ctx, build));
|
||||
ret->m_pipelines.push_back(build);
|
||||
return true;
|
||||
});
|
||||
} BooTrace);
|
||||
m_pipelineLookup[tag] = ret;
|
||||
return ret;
|
||||
}
|
||||
|
@ -446,7 +445,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, const hecl::Frontend::IR&
|
|||
ShaderCachedData foundData = lookupData(tag);
|
||||
if (foundData)
|
||||
{
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
SCM_Log.report(logvisor::Info, "building cached shader '%s' %016llX", diagName.data(), tag.val64());
|
||||
boo::ObjToken<boo::IShaderPipeline> build = buildFromCache(foundData, ctx);
|
||||
|
@ -456,7 +455,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, const hecl::Frontend::IR&
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} BooTrace);
|
||||
|
||||
if (ret->m_pipelines.size())
|
||||
{
|
||||
|
@ -466,7 +465,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, const hecl::Frontend::IR&
|
|||
SCM_Log.report(logvisor::Warning, "invalid cache read, rebuilding shader '%s'", diagName.data());
|
||||
}
|
||||
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
SCM_Log.report(logvisor::Info, "building shader '%s' %016llX", diagName.data(), tag.val64());
|
||||
FE.getDiagnostics().reset(diagName);
|
||||
|
@ -474,7 +473,7 @@ ShaderCacheManager::buildShader(const ShaderTag& tag, const hecl::Frontend::IR&
|
|||
addData(m_factory->buildShaderFromIR(tag, ir, FE.getDiagnostics(), ctx, build));
|
||||
ret->m_pipelines.push_back(build);
|
||||
return true;
|
||||
});
|
||||
} BooTrace);
|
||||
m_pipelineLookup[tag] = ret;
|
||||
return ret;
|
||||
}
|
||||
|
@ -507,12 +506,12 @@ ShaderCacheManager::buildExtendedShader(const ShaderTag& tag, std::string_view s
|
|||
ShaderCachedData foundData = lookupData(tag);
|
||||
if (foundData)
|
||||
{
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
SCM_Log.report(logvisor::Info, "building cached shader '%s' %016llX", diagName.data(), tag.val64());
|
||||
ret->m_pipelines = buildExtendedFromCache(foundData, ctx);
|
||||
return ret->m_pipelines.size() != 0;
|
||||
});
|
||||
} BooTrace);
|
||||
|
||||
if (ret->m_pipelines.size())
|
||||
{
|
||||
|
@ -524,7 +523,7 @@ ShaderCacheManager::buildExtendedShader(const ShaderTag& tag, std::string_view s
|
|||
|
||||
hecl::Frontend::IR ir = FE.compileSource(source, diagName);
|
||||
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
ret->m_pipelines.reserve(m_extensions.m_extensionSlots.size());
|
||||
FE.getDiagnostics().reset(diagName);
|
||||
|
@ -537,7 +536,7 @@ ShaderCacheManager::buildExtendedShader(const ShaderTag& tag, std::string_view s
|
|||
ret->m_pipelines.size(), m_extensions.m_extensionSlots.size());
|
||||
addData(data);
|
||||
return true;
|
||||
});
|
||||
} BooTrace);
|
||||
m_pipelineLookup[tag] = ret;
|
||||
return ret;
|
||||
}
|
||||
|
@ -555,12 +554,12 @@ ShaderCacheManager::buildExtendedShader(const ShaderTag& tag, const hecl::Fronte
|
|||
ShaderCachedData foundData = lookupData(tag);
|
||||
if (foundData)
|
||||
{
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
SCM_Log.report(logvisor::Info, "building cached shader '%s' %016llX", diagName.data(), tag.val64());
|
||||
ret->m_pipelines = buildExtendedFromCache(foundData, ctx);
|
||||
return ret->m_pipelines.size() != 0;
|
||||
});
|
||||
} BooTrace);
|
||||
|
||||
if (ret->m_pipelines.size() != 0)
|
||||
{
|
||||
|
@ -570,7 +569,7 @@ ShaderCacheManager::buildExtendedShader(const ShaderTag& tag, const hecl::Fronte
|
|||
SCM_Log.report(logvisor::Warning, "invalid cache read, rebuilding shader '%s'", diagName.data());
|
||||
}
|
||||
|
||||
factory.BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
factory.commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
ret->m_pipelines.reserve(m_extensions.m_extensionSlots.size());
|
||||
FE.getDiagnostics().reset(diagName);
|
||||
|
@ -583,7 +582,7 @@ ShaderCacheManager::buildExtendedShader(const ShaderTag& tag, const hecl::Fronte
|
|||
ret->m_pipelines.size(), m_extensions.m_extensionSlots.size());
|
||||
addData(data);
|
||||
return true;
|
||||
});
|
||||
} BooTrace);
|
||||
m_pipelineLookup[tag] = ret;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -147,6 +147,40 @@ void SanitizePath(std::wstring& path)
|
|||
path.pop_back();
|
||||
}
|
||||
|
||||
SystemString GetcwdStr()
|
||||
{
|
||||
/* http://stackoverflow.com/a/2869667 */
|
||||
//const size_t ChunkSize=255;
|
||||
//const int MaxChunks=10240; // 2550 KiBs of current path are more than enough
|
||||
|
||||
SystemChar stackBuffer[255]; // Stack buffer for the "normal" case
|
||||
if (Getcwd(stackBuffer, 255) != nullptr)
|
||||
return SystemString(stackBuffer);
|
||||
if (errno != ERANGE)
|
||||
{
|
||||
// It's not ERANGE, so we don't know how to handle it
|
||||
LogModule.report(logvisor::Fatal, "Cannot determine the current path.");
|
||||
// Of course you may choose a different error reporting method
|
||||
}
|
||||
// Ok, the stack buffer isn't long enough; fallback to heap allocation
|
||||
for (int chunks=2 ; chunks<10240 ; chunks++)
|
||||
{
|
||||
// With boost use scoped_ptr; in C++0x, use unique_ptr
|
||||
// If you want to be less C++ but more efficient you may want to use realloc
|
||||
std::unique_ptr<SystemChar[]> cwd(new SystemChar[255*chunks]);
|
||||
if (Getcwd(cwd.get(), 255*chunks) != nullptr)
|
||||
return SystemString(cwd.get());
|
||||
if (errno != ERANGE)
|
||||
{
|
||||
// It's not ERANGE, so we don't know how to handle it
|
||||
LogModule.report(logvisor::Fatal, "Cannot determine the current path.");
|
||||
// Of course you may choose a different error reporting method
|
||||
}
|
||||
}
|
||||
LogModule.report(logvisor::Fatal, "Cannot determine the current path; the path is apparently unreasonably long");
|
||||
return SystemString();
|
||||
}
|
||||
|
||||
static std::mutex PathsMutex;
|
||||
static std::unordered_map<std::thread::id, ProjectPath> PathsInProgress;
|
||||
|
||||
|
@ -270,7 +304,7 @@ hecl::DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
|
|||
else
|
||||
continue;
|
||||
|
||||
m_entries.push_back(std::move(Entry(std::move(fp), d.cFileName, sz, isDir)));
|
||||
m_entries.emplace_back(fp, d.cFileName, sz, isDir);
|
||||
} while (FindNextFileW(dir, &d));
|
||||
break;
|
||||
case Mode::DirsThenFilesSorted:
|
||||
|
|
|
@ -135,7 +135,7 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
|||
std::shared_ptr<hecl::Runtime::ShaderPipelines> testShaderObj =
|
||||
shaderMgr.buildShader(testShaderTag, testShader, "testShader", *gfxF);
|
||||
|
||||
gfxF->BooCommitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
gfxF->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx)
|
||||
{
|
||||
boo::SWindowRect mainWindowRect = m_mainWindow->getWindowFrame();
|
||||
renderTex = ctx.newRenderTexture(size_t(mainWindowRect.size[0]), size_t(mainWindowRect.size[1]),
|
||||
|
@ -187,7 +187,7 @@ struct HECLApplicationCallback : boo::IApplicationCallback
|
|||
/* Assemble data binding */
|
||||
binding = testData.newShaderDataBindng(ctx, testShaderObj->m_pipelines[0], 1, &vubo, nullptr, 1, &texture);
|
||||
return true;
|
||||
});
|
||||
} BooTrace);
|
||||
|
||||
/* Return control to main thread */
|
||||
innerLk.unlock();
|
||||
|
|
Loading…
Reference in New Issue