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 */
|
/* Iterate flags */
|
||||||
|
bool threadArg = false;
|
||||||
for (auto it = args.cbegin(); it != args.cend();) {
|
for (auto it = args.cbegin(); it != args.cend();) {
|
||||||
const hecl::SystemString& arg = *it;
|
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('-')) {
|
if (arg.size() < 2 || arg[0] != _SYS_STR('-') || arg[1] == _SYS_STR('-')) {
|
||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
|
@ -208,6 +215,14 @@ int main(int argc, const char** argv)
|
||||||
info.yes = true;
|
info.yes = true;
|
||||||
else if (*chit == _SYS_STR('g'))
|
else if (*chit == _SYS_STR('g'))
|
||||||
info.gui = true;
|
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
|
else
|
||||||
info.flags.push_back(*chit);
|
info.flags.push_back(*chit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9658d1372d36220c2ff94242109bdfb7531fefa6
|
Subproject commit 2135f4e4dc6ee7fa5a2b6398b97632dc5af9c822
|
|
@ -11,6 +11,9 @@
|
||||||
|
|
||||||
namespace hecl {
|
namespace hecl {
|
||||||
|
|
||||||
|
extern int CpuCountOverride;
|
||||||
|
void SetCpuCountOverride(int argc, const SystemChar** argv);
|
||||||
|
|
||||||
class ClientProcess {
|
class ClientProcess {
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
std::condition_variable m_cv;
|
std::condition_variable m_cv;
|
||||||
|
|
|
@ -67,11 +67,12 @@ public:
|
||||||
std::string makeVert() const {
|
std::string makeVert() const {
|
||||||
return m_backend.makeVert(m_tag.getColorCount(), m_tag.getUvCount(), m_tag.getWeightCount(),
|
return m_backend.makeVert(m_tag.getColorCount(), m_tag.getUvCount(), m_tag.getWeightCount(),
|
||||||
m_tag.getSkinSlotCount(), m_extension.texCount, m_extension.texs,
|
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 {
|
std::string makeFrag() const {
|
||||||
return m_backend.makeFrag(m_extension.blockCount, m_extension.blockNames,
|
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_backend.m_blendSrc, m_backend.m_blendDst, m_extension.lighting, m_extension.post,
|
||||||
m_extension.texCount, m_extension.texs);
|
m_extension.texCount, m_extension.texs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "athena/FileReader.hpp"
|
#include "athena/FileReader.hpp"
|
||||||
#include "hecl/Blender/Connection.hpp"
|
#include "hecl/Blender/Connection.hpp"
|
||||||
#include "hecl/MultiProgressPrinter.hpp"
|
#include "hecl/MultiProgressPrinter.hpp"
|
||||||
|
#include "boo/IApplication.hpp"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
@ -18,14 +19,41 @@ static logvisor::Module CP_Log("hecl::ClientProcess");
|
||||||
|
|
||||||
ThreadLocalPtr<ClientProcess::Worker> ClientProcess::ThreadWorker;
|
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() {
|
static int GetCPUCount() {
|
||||||
|
int ret;
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
SYSTEM_INFO sysinfo;
|
SYSTEM_INFO sysinfo;
|
||||||
GetSystemInfo(&sysinfo);
|
GetSystemInfo(&sysinfo);
|
||||||
return sysinfo.dwNumberOfProcessors;
|
ret = sysinfo.dwNumberOfProcessors;
|
||||||
#else
|
#else
|
||||||
return sysconf(_SC_NPROCESSORS_ONLN);
|
ret = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (CpuCountOverride)
|
||||||
|
return std::min(CpuCountOverride, ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientProcess::BufferTransaction::run(blender::Token& btok) {
|
void ClientProcess::BufferTransaction::run(blender::Token& btok) {
|
||||||
|
|
Loading…
Reference in New Issue