mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-06-06 23:53:29 +00:00
Minimized shader hash generation; more compatible MultiProgressPrinter
This commit is contained in:
parent
1eaa57bba2
commit
396790181a
@ -26,12 +26,14 @@ class ToolPackage final : public ToolBase
|
|||||||
{
|
{
|
||||||
if (!hecl::StrCmp(path.getLastComponent().data(), _S("!world.blend")))
|
if (!hecl::StrCmp(path.getLastComponent().data(), _S("!world.blend")))
|
||||||
AddSelectedItem(path);
|
AddSelectedItem(path);
|
||||||
|
#if RUNTIME_ORIGINAL_IDS
|
||||||
else if (!hecl::StrCmp(path.getLastComponent().data(), _S("!original_ids.yaml")))
|
else if (!hecl::StrCmp(path.getLastComponent().data(), _S("!original_ids.yaml")))
|
||||||
{
|
{
|
||||||
auto pathComps = path.getPathComponents();
|
auto pathComps = path.getPathComponents();
|
||||||
if (pathComps.size() == 2 && pathComps[0] != _S("out"))
|
if (pathComps.size() == 2 && pathComps[0] != _S("out"))
|
||||||
AddSelectedItem(path);
|
AddSelectedItem(path);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FindSelectedItems(const hecl::ProjectPath& path, bool checkGeneral)
|
void FindSelectedItems(const hecl::ProjectPath& path, bool checkGeneral)
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "hecl.hpp"
|
#include "hecl.hpp"
|
||||||
|
|
||||||
|
#define RUNTIME_ORIGINAL_IDS 0
|
||||||
|
|
||||||
namespace hecl
|
namespace hecl
|
||||||
{
|
{
|
||||||
class ClientProcess;
|
class ClientProcess;
|
||||||
|
@ -238,11 +238,11 @@ struct IRNode
|
|||||||
IRNode(Kind kind, std::string&& str, IRNode&& node, const SourceLocation& loc)
|
IRNode(Kind kind, std::string&& str, IRNode&& node, const SourceLocation& loc)
|
||||||
: kind(kind), str(std::move(str)), left(new IRNode(std::move(node))), loc(loc) {}
|
: kind(kind), str(std::move(str)), left(new IRNode(std::move(node))), loc(loc) {}
|
||||||
|
|
||||||
std::string toString() const { return fmt(0); }
|
std::string toString(bool stripUVAnims = false) const { return fmt(0, stripUVAnims); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string rep(int n, std::string_view s);
|
static std::string rep(int n, std::string_view s);
|
||||||
std::string fmt(int level) const;
|
std::string fmt(int level, bool stripUVAnims) const;
|
||||||
std::string describe() const;
|
std::string describe() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ struct Action;
|
|||||||
struct Bone;
|
struct Bone;
|
||||||
struct PathMesh;
|
struct PathMesh;
|
||||||
struct Matrix3f;
|
struct Matrix3f;
|
||||||
|
struct Matrix4f;
|
||||||
struct PoolSkinIndex;
|
struct PoolSkinIndex;
|
||||||
|
|
||||||
extern class Token SharedBlenderToken;
|
extern class Token SharedBlenderToken;
|
||||||
|
@ -239,12 +239,14 @@ void IR::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& sz)
|
|||||||
|
|
||||||
IR Frontend::compileSource(std::string_view source, std::string_view diagName)
|
IR Frontend::compileSource(std::string_view source, std::string_view diagName)
|
||||||
{
|
{
|
||||||
Hash hash(source);
|
|
||||||
m_diag.reset(diagName, source);
|
m_diag.reset(diagName, source);
|
||||||
m_parser.reset(source);
|
m_parser.reset(source);
|
||||||
auto insts = m_parser.parse();
|
auto insts = m_parser.parse();
|
||||||
IR ir;
|
IR ir;
|
||||||
ir.m_hash = hash.val64();
|
std::string stripString;
|
||||||
|
if (!insts.empty())
|
||||||
|
stripString = insts.front().toString(true);
|
||||||
|
ir.m_hash = Hash(stripString).val64();
|
||||||
for (auto& inst : insts)
|
for (auto& inst : insts)
|
||||||
ir.addInstruction(inst, 0);
|
ir.addInstruction(inst, 0);
|
||||||
return ir;
|
return ir;
|
||||||
|
@ -26,13 +26,29 @@ std::string IRNode::rep(int n, std::string_view s)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string IRNode::fmt(int level) const
|
std::string IRNode::fmt(int level, bool stripUVAnims) const
|
||||||
{
|
{
|
||||||
std::string buf;
|
std::string buf;
|
||||||
auto indent = rep(level, "\t"sv);
|
auto indent = rep(level, "\t"sv);
|
||||||
switch (kind)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case Kind::Call:
|
case Kind::Call:
|
||||||
|
if (stripUVAnims && (str == "Texture" || str == "TextureN") && children.size() >= 2)
|
||||||
|
{
|
||||||
|
auto it = children.begin();
|
||||||
|
IRNode& uvNode = const_cast<IRNode&>(*++it);
|
||||||
|
if (uvNode.str != "UV" && uvNode.str != "Normal" && uvNode.str != "View")
|
||||||
|
{
|
||||||
|
std::string replacementName(str);
|
||||||
|
if (uvNode.str.back() == 'N' && replacementName.back() != 'N')
|
||||||
|
replacementName += 'N';
|
||||||
|
IRNode replacementNode(Kind::Call, std::move(replacementName),
|
||||||
|
std::move(uvNode.children), loc);
|
||||||
|
auto ret = replacementNode.fmt(level, false);
|
||||||
|
uvNode.children = std::move(replacementNode.children);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
buf.append(indent);
|
buf.append(indent);
|
||||||
buf.append("Call "sv).append(str);
|
buf.append("Call "sv).append(str);
|
||||||
if (!children.empty())
|
if (!children.empty())
|
||||||
@ -40,7 +56,7 @@ std::string IRNode::fmt(int level) const
|
|||||||
buf.append(" {\n"sv);
|
buf.append(" {\n"sv);
|
||||||
for (const IRNode& n : children)
|
for (const IRNode& n : children)
|
||||||
{
|
{
|
||||||
buf.append(n.fmt(level + 1));
|
buf.append(n.fmt(level + 1, stripUVAnims));
|
||||||
buf.append("\n"sv);
|
buf.append("\n"sv);
|
||||||
}
|
}
|
||||||
buf.append(indent);
|
buf.append(indent);
|
||||||
@ -54,15 +70,15 @@ std::string IRNode::fmt(int level) const
|
|||||||
case Kind::Binop:
|
case Kind::Binop:
|
||||||
buf.append(indent);
|
buf.append(indent);
|
||||||
buf.append("Binop "sv).append(OpToStr(op)).append(" {\n"sv);
|
buf.append("Binop "sv).append(OpToStr(op)).append(" {\n"sv);
|
||||||
buf.append(left->fmt(level + 1)).append("\n"sv);
|
buf.append(left->fmt(level + 1, stripUVAnims)).append("\n"sv);
|
||||||
buf.append(right->fmt(level + 1)).append("\n"sv);
|
buf.append(right->fmt(level + 1, stripUVAnims)).append("\n"sv);
|
||||||
buf.append(indent).append("}"sv);
|
buf.append(indent).append("}"sv);
|
||||||
break;
|
break;
|
||||||
case Kind::Swizzle:
|
case Kind::Swizzle:
|
||||||
buf.append(indent);
|
buf.append(indent);
|
||||||
buf.append("Swizzle \""sv).append(str);
|
buf.append("Swizzle \""sv).append(str);
|
||||||
buf.append("\" {\n"sv);
|
buf.append("\" {\n"sv);
|
||||||
buf.append(left->fmt(level + 1)).append("\n"sv);
|
buf.append(left->fmt(level + 1, stripUVAnims)).append("\n"sv);
|
||||||
buf.append(indent).append("}"sv);
|
buf.append(indent).append("}"sv);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#define BOLD "\033[1m"
|
#define BOLD "\033[1m"
|
||||||
#define NORMAL "\033[0m"
|
#define NORMAL "\033[0m"
|
||||||
#define PREV_LINE "\033[%dF"
|
#define PREV_LINE "\r\033[%dA"
|
||||||
#define HIDE_CURSOR "\033[?25l"
|
#define HIDE_CURSOR "\033[?25l"
|
||||||
#define SHOW_CURSOR "\033[?25h"
|
#define SHOW_CURSOR "\033[?25h"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user