mirror of https://github.com/AxioDL/metaforce.git
Add -j argument for hecl cooking
This commit is contained in:
parent
f35285b076
commit
23a6d66a8c
|
@ -192,8 +192,15 @@ int main(int argc, const char** argv)
|
|||
}
|
||||
|
||||
/* Iterate flags */
|
||||
bool threadArg = false;
|
||||
for (auto it = args.cbegin(); it != args.cend();) {
|
||||
const hecl::SystemString& arg = *it;
|
||||
if (threadArg) {
|
||||
threadArg = false;
|
||||
hecl::CpuCountOverride = int(hecl::StrToUl(arg.c_str(), nullptr, 0));
|
||||
it = args.erase(it);
|
||||
continue;
|
||||
}
|
||||
if (arg.size() < 2 || arg[0] != _SYS_STR('-') || arg[1] == _SYS_STR('-')) {
|
||||
++it;
|
||||
continue;
|
||||
|
@ -208,6 +215,14 @@ int main(int argc, const char** argv)
|
|||
info.yes = true;
|
||||
else if (*chit == _SYS_STR('g'))
|
||||
info.gui = true;
|
||||
else if (*chit == _SYS_STR('j')) {
|
||||
++chit;
|
||||
if (*chit)
|
||||
hecl::CpuCountOverride = int(hecl::StrToUl(&*chit, nullptr, 0));
|
||||
else
|
||||
threadArg = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
info.flags.push_back(*chit);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 9658d1372d36220c2ff94242109bdfb7531fefa6
|
||||
Subproject commit 2135f4e4dc6ee7fa5a2b6398b97632dc5af9c822
|
|
@ -11,6 +11,9 @@
|
|||
|
||||
namespace hecl {
|
||||
|
||||
extern int CpuCountOverride;
|
||||
void SetCpuCountOverride(int argc, const SystemChar** argv);
|
||||
|
||||
class ClientProcess {
|
||||
std::mutex m_mutex;
|
||||
std::condition_variable m_cv;
|
||||
|
|
|
@ -67,11 +67,12 @@ public:
|
|||
std::string makeVert() const {
|
||||
return m_backend.makeVert(m_tag.getColorCount(), m_tag.getUvCount(), m_tag.getWeightCount(),
|
||||
m_tag.getSkinSlotCount(), m_extension.texCount, m_extension.texs,
|
||||
m_tag.getReflectionType());
|
||||
m_extension.noReflection ? Backend::ReflectionType::None : m_tag.getReflectionType());
|
||||
}
|
||||
std::string makeFrag() const {
|
||||
return m_backend.makeFrag(m_extension.blockCount, m_extension.blockNames,
|
||||
m_tag.getAlphaTest() || m_extension.forceAlphaTest, m_tag.getReflectionType(),
|
||||
m_tag.getAlphaTest() || m_extension.forceAlphaTest,
|
||||
m_extension.noReflection ? Backend::ReflectionType::None : m_tag.getReflectionType(),
|
||||
m_backend.m_blendSrc, m_backend.m_blendDst, m_extension.lighting, m_extension.post,
|
||||
m_extension.texCount, m_extension.texs);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "athena/FileReader.hpp"
|
||||
#include "hecl/Blender/Connection.hpp"
|
||||
#include "hecl/MultiProgressPrinter.hpp"
|
||||
#include "boo/IApplication.hpp"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
@ -18,14 +19,41 @@ static logvisor::Module CP_Log("hecl::ClientProcess");
|
|||
|
||||
ThreadLocalPtr<ClientProcess::Worker> ClientProcess::ThreadWorker;
|
||||
|
||||
int CpuCountOverride = 0;
|
||||
|
||||
void SetCpuCountOverride(int argc, const SystemChar** argv) {
|
||||
bool threadArg = false;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (threadArg) {
|
||||
if (int count = int(hecl::StrToUl(argv[i], nullptr, 0))) {
|
||||
CpuCountOverride = count;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!hecl::StrNCmp(argv[i], _SYS_STR("-j"), 2)) {
|
||||
if (int count = int(hecl::StrToUl(argv[i] + 2, nullptr, 0))) {
|
||||
CpuCountOverride = count;
|
||||
return;
|
||||
}
|
||||
threadArg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int GetCPUCount() {
|
||||
int ret;
|
||||
#if _WIN32
|
||||
SYSTEM_INFO sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
return sysinfo.dwNumberOfProcessors;
|
||||
ret = sysinfo.dwNumberOfProcessors;
|
||||
#else
|
||||
return sysconf(_SC_NPROCESSORS_ONLN);
|
||||
ret = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
#endif
|
||||
|
||||
if (CpuCountOverride)
|
||||
return std::min(CpuCountOverride, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ClientProcess::BufferTransaction::run(blender::Token& btok) {
|
||||
|
|
Loading…
Reference in New Issue