mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-02-01 18:40:12 -05:00
--User changes
-Add new options to EmberGenome to better help assess which variations have certain characteristics. The options are: --sumvars: Display the names of all regular variations which have the default behavior of summing their outputs and exit. --assignvars: Display the names of all regular variations which have the non-standard behavior of assigning their outputs and exit. --ppsumvars: Display the names of all pre/post variations which have the non-standard behavior of summing their outputs and exit. --ppassignvars: Display the names of all pre/post variations which have the default behavior of assigning their outputs and exit. --dcvars: Display the names of all variations which use direct coloring and exit. --parvars: Display the names of all variations which have parameters and exit. --nonparvars: Display the names of all variations which do not have parameters (weight only) and exit. --Code changes -Make VariationList vectors have const elements since no callers should ever change them. -Add new function to VariationList to retrieve a const ref to the parametric variations. -Move some search functions out of EmberTester and into EmberCommon.h. -General code cleanup.
This commit is contained in:
parent
5b6c62b95d
commit
5aec58b4a2
@ -83,7 +83,6 @@ void Renderer<T, bucketT>::ComputeBounds()
|
||||
//It also prevents the renderer from only performing filtering or final accum based on a filter parameter change, since that
|
||||
//change may have changed the gutter.
|
||||
//By using a fixed gutter, a filter change can be applied without fully restarting iteration.
|
||||
//m_GutterWidth = 10;
|
||||
m_GutterWidth = 10 * Supersample();//Should be enough to fully accommodate most spatial and density filter widths.
|
||||
m_SuperRasW = (Supersample() * FinalRasW()) + (2 * m_GutterWidth);
|
||||
m_SuperRasH = (Supersample() * FinalRasH()) + (2 * m_GutterWidth);
|
||||
|
@ -357,13 +357,14 @@ VariationList<T>::VariationList()
|
||||
ADDPREPOSTREGVAR(DCTriangle)
|
||||
ADDPREPOSTREGVAR(DCZTransl)
|
||||
|
||||
for (auto var : m_Variations) var->Precalc();
|
||||
for (auto var : m_Variations) const_cast<Variation<T>*>(var)->Precalc();//Modify once here, then const after this.
|
||||
|
||||
std::sort(m_Variations.begin(), m_Variations.end(), [&](const Variation<T>* var1, const Variation<T>* var2) { return var1->VariationId() < var2->VariationId(); });
|
||||
m_RegVariations.reserve(m_Variations.size() / 3);
|
||||
m_PreVariations.reserve(m_Variations.size() / 3);
|
||||
m_PostVariations.reserve(m_Variations.size() / 3);
|
||||
m_ParametricVariations.reserve(size_t(m_Variations.size() * .90));//This is a rough guess at how many are parametric.
|
||||
m_NonParametricVariations.reserve(size_t(m_Variations.size() * 0.20));//This is a rough guess at how many are not parametric. These don't add to 1 just to allow extra padding.
|
||||
|
||||
//Place pointers to variations in vectors specific to their type.
|
||||
//Many of the elements in m_ParametricVariations will be present in the reg, pre and post vectors.
|
||||
@ -377,8 +378,10 @@ VariationList<T>::VariationList()
|
||||
else if (var->VarType() == eVariationType::VARTYPE_POST)
|
||||
m_PostVariations.push_back(var);
|
||||
|
||||
if (auto parVar = dynamic_cast<ParametricVariation<T>*>(var))
|
||||
if (auto parVar = dynamic_cast<const ParametricVariation<T>*>(var))
|
||||
m_ParametricVariations.push_back(parVar);
|
||||
else
|
||||
m_NonParametricVariations.push_back(var);
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,10 +546,13 @@ template <typename T> size_t VariationList<T>::RegSize() const { return m_RegVar
|
||||
template <typename T> size_t VariationList<T>::PreSize() const { return m_PreVariations.size(); }
|
||||
template <typename T> size_t VariationList<T>::PostSize() const { return m_PostVariations.size(); }
|
||||
template <typename T> size_t VariationList<T>::ParametricSize() const { return m_ParametricVariations.size(); }
|
||||
template <typename T> const vector<Variation<T>*>& VariationList<T>::AllVars() const { return m_Variations; }
|
||||
template <typename T> const vector<Variation<T>*>& VariationList<T>::RegVars() const { return m_RegVariations; }
|
||||
template <typename T> const vector<Variation<T>*>& VariationList<T>::PreVars() const { return m_PreVariations; }
|
||||
template <typename T> const vector<Variation<T>*>& VariationList<T>::PostVars() const { return m_PostVariations; }
|
||||
template <typename T> size_t VariationList<T>::NonParametricSize() const { return m_NonParametricVariations.size(); }
|
||||
template <typename T> const vector<const Variation<T>*>& VariationList<T>::AllVars() const { return m_Variations; }
|
||||
template <typename T> const vector<const Variation<T>*>& VariationList<T>::RegVars() const { return m_RegVariations; }
|
||||
template <typename T> const vector<const Variation<T>*>& VariationList<T>::PreVars() const { return m_PreVariations; }
|
||||
template <typename T> const vector<const Variation<T>*>& VariationList<T>::PostVars() const { return m_PostVariations; }
|
||||
template <typename T> const vector<const Variation<T>*>& VariationList<T>::NonParametricVariations() const { return m_NonParametricVariations; }
|
||||
template <typename T> const vector<const ParametricVariation<T>*>& VariationList<T>::ParametricVariations() const { return m_ParametricVariations; }
|
||||
|
||||
/// <summary>
|
||||
/// Make a dyncamically allocated copy of a variation and assign it a specified weight.
|
||||
|
@ -38,11 +38,14 @@ public:
|
||||
size_t PreSize() const;
|
||||
size_t PostSize() const;
|
||||
size_t ParametricSize() const;
|
||||
size_t NonParametricSize() const;
|
||||
|
||||
const vector<Variation<T>*>& AllVars() const;
|
||||
const vector<Variation<T>*>& RegVars() const;
|
||||
const vector<Variation<T>*>& PreVars() const;
|
||||
const vector<Variation<T>*>& PostVars() const;
|
||||
const vector<const Variation<T>*>& AllVars() const;
|
||||
const vector<const Variation<T>*>& RegVars() const;
|
||||
const vector<const Variation<T>*>& PreVars() const;
|
||||
const vector<const Variation<T>*>& PostVars() const;
|
||||
const vector<const Variation<T>*>& NonParametricVariations() const;
|
||||
const vector<const ParametricVariation<T>*>& ParametricVariations() const;
|
||||
|
||||
SINGLETON_DERIVED_DECL(VariationList<T>);
|
||||
|
||||
@ -50,10 +53,11 @@ private:
|
||||
VariationList();
|
||||
Variation<T>* MakeCopyWithWeight(const Variation<T>* var, T weight) const;
|
||||
|
||||
vector<Variation<T>*> m_Variations;//A list of pointers to dynamically allocated variation objects.
|
||||
vector<Variation<T>*> m_RegVariations;
|
||||
vector<Variation<T>*> m_PreVariations;
|
||||
vector<Variation<T>*> m_PostVariations;
|
||||
vector<ParametricVariation<T>*> m_ParametricVariations;//A list of pointers to elements in m_Variations which are derived from ParametricVariation.
|
||||
vector<const Variation<T>*> m_Variations;//A list of pointers to dynamically allocated variation objects.
|
||||
vector<const Variation<T>*> m_RegVariations;
|
||||
vector<const Variation<T>*> m_PreVariations;
|
||||
vector<const Variation<T>*> m_PostVariations;
|
||||
vector<const Variation<T>*> m_NonParametricVariations;
|
||||
vector<const ParametricVariation<T>*> m_ParametricVariations;//A list of pointers to elements in m_Variations which are derived from ParametricVariation.
|
||||
};
|
||||
}
|
||||
|
@ -4109,16 +4109,16 @@ public:
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cz = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string r = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cz = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string c2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string s2x = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string s2y = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string s2z = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
@ -4298,8 +4298,8 @@ public:
|
||||
int i = 0;
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string zscale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string vpi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string zscale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string vpi = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t c0 = vIn.x * " << vpi << ";\n"
|
||||
<< "\t\treal_t c1 = vIn.y * " << vpi << ";\n"
|
||||
@ -4371,14 +4371,14 @@ public:
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string t3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string t2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string t1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string tc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string bc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string t3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string t2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string t1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string tc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b3 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b1 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string bc = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t xsqr = vIn.x * vIn.x;\n"
|
||||
<< "\t\treal_t ysqr = vIn.y * vIn.y;\n"
|
||||
@ -4474,16 +4474,16 @@ public:
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string frequency = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string velocity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string amplitude = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centerx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centery = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string phase = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string f = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string frequency = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string velocity = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string amplitude = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centerx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centery = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string phase = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string scale = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string f = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string p = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string s = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string is = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string vxp = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
@ -4604,13 +4604,13 @@ public:
|
||||
intmax_t i = 0;
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string shiftX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string shiftY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string sx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string sy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string ax = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string ay = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string shiftX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string shiftY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string sx = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string sy = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string ax = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string ay = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string vv = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t c0 = " << ax << " / (1 + exp(" << sx << " * vIn.x));\n"
|
||||
<< "\t\treal_t c1 = " << ay << " / (1 + exp(" << sy << " * vIn.y));\n"
|
||||
|
@ -1143,11 +1143,11 @@ public:
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string strength = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string offset = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centerX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centerY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string s2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string strength = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string offset = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centerX = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string centerY = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string s2 = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t sx = vIn.x - " << centerX << ";\n"
|
||||
<< "\t\treal_t sy = vIn.y - " << centerY << ";\n"
|
||||
@ -1221,12 +1221,12 @@ public:
|
||||
intmax_t i = 0, varIndex = IndexInXform();
|
||||
ss2 << "_" << XformIndexInEmber() << "]";
|
||||
string index = ss2.str();
|
||||
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string sep = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string absN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string n = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string a = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string b = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string sep = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string absN = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
string cn = "parVars[" + ToUpper(m_Params[i++].Name()) + index;
|
||||
ss << "\t{\n"
|
||||
<< "\t\treal_t jun = Zeps(fabs(" << n << "));\n"
|
||||
<< "\n"
|
||||
@ -2033,7 +2033,7 @@ public:
|
||||
<< "\t\tconst int esc = rad > " << radius << ";\n"
|
||||
<< "\t\tconst int cr0 = (int)" << zero << ";\n"
|
||||
<< "\n"
|
||||
<< "\t\tif (cr0 && esc)\n"
|
||||
<< "\t\tif (cr0 && esc)\n"
|
||||
<< "\t\t{\n"
|
||||
<< "\t\t vOut.x = vOut.y = 0;\n";
|
||||
|
||||
|
@ -80,6 +80,8 @@ public:
|
||||
|
||||
if (!m_Init)
|
||||
{
|
||||
//This list is for variation params which are incorrect, but their parent variation name may or may not be correct.
|
||||
//This has some overlap with the list below since some of these have parent variation names that are incorrect.
|
||||
m_BadParamNames = unordered_map<string, string>
|
||||
{
|
||||
{ "swtin_distort" , "stwin_distort" },//stwin.
|
||||
@ -215,7 +217,7 @@ public:
|
||||
"post_rotate_y",
|
||||
"curl3D_cz",
|
||||
};
|
||||
//This is a vector of the param names as they are in the legacy, badly named flam3/Apophysis code.
|
||||
//This is a vector of the incorrect variation names and their param names as they are in the legacy, badly named flam3/Apophysis code.
|
||||
vector<string> badParams =
|
||||
{
|
||||
"bwraps7_cellsize",
|
||||
|
@ -532,6 +532,103 @@ static size_t VerifyStrips(size_t height, size_t strips,
|
||||
return strips;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search the variation's OpenCL string to determine whether it contains any of the search strings in stringVec.
|
||||
/// This is useful for finding variations with certain characteristics since it's not possible
|
||||
/// to query the CPU C++ code at runtime.
|
||||
/// </summary>
|
||||
/// <param name="var">The variation whose OpenCL string will be searched</param>
|
||||
/// <param name="stringVec">The vector of strings to search for</param>
|
||||
/// <param name="matchAll">True to find all variations which match any strings, false to break after the first match is found.</param>
|
||||
/// <returns>True if there was at least one match, else false.</returns>
|
||||
template <typename T>
|
||||
bool SearchVar(const Variation<T>* var, const vector<string>& stringVec, bool matchAll)
|
||||
{
|
||||
bool ret = false;
|
||||
size_t i;
|
||||
auto cl = var->OpenCLFuncsString() + "\n" + var->OpenCLString();
|
||||
|
||||
if (matchAll)
|
||||
{
|
||||
for (i = 0; i < stringVec.size(); i++)
|
||||
if (cl.find(stringVec[i]) == std::string::npos)
|
||||
break;
|
||||
|
||||
ret = (i == stringVec.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < stringVec.size(); i++)
|
||||
{
|
||||
if (cl.find(stringVec[i]) != std::string::npos)
|
||||
{
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find all variations whose OpenCL string contains any of the search strings in stringVec.
|
||||
/// This is useful for finding variations with certain characteristics since it's not possible
|
||||
/// to query the CPU C++ code at runtime.
|
||||
/// </summary>
|
||||
/// <param name="stringVec">The vector of variation pointers to search</param>
|
||||
/// <param name="stringVec">The vector of strings to search for</param>
|
||||
/// <param name="findAll">True to find all variations which match any strings, false to break after the first match is found.</param>
|
||||
/// <returns>A vector of pointers to variations whose OpenCL string matched at least one string in stringVec</returns>
|
||||
template <typename T>
|
||||
static vector<const Variation<T>*> FindVarsWith(const vector<const Variation<T>*>& vars, const vector<string>& stringVec, bool findAll = true)
|
||||
{
|
||||
vector<const Variation<T>*> vec;
|
||||
auto vl = VariationList<T>::Instance();
|
||||
|
||||
for (auto& v : vars)
|
||||
{
|
||||
if (SearchVar<T>(v, stringVec, false))
|
||||
{
|
||||
vec.push_back(v);
|
||||
|
||||
if (!findAll)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find all variations whose OpenCL string does not contain any of the search strings in stringVec.
|
||||
/// This is useful for finding variations without certain characteristics since it's not possible
|
||||
/// to query the CPU C++ code at runtime.
|
||||
/// </summary>
|
||||
/// <param name="stringVec">The vector of variation pointers to search</param>
|
||||
/// <param name="stringVec">The vector of strings to search for</param>
|
||||
/// <param name="findAll">True to find all variations which don't match any strings, false to break after the first non-match is found.</param>
|
||||
/// <returns>A vector of pointers to variations whose OpenCL string did not match any string in stringVec</returns>
|
||||
template <typename T>
|
||||
static vector<const Variation<T>*> FindVarsWithout(const vector<const Variation<T>*>& vars, const vector<string>& stringVec, bool findAll = true)
|
||||
{
|
||||
vector<const Variation<T>*> vec;
|
||||
auto vl = VariationList<T>::Instance();
|
||||
|
||||
for (auto& v : vars)
|
||||
{
|
||||
if (!SearchVar<T>(v, stringVec, false))
|
||||
{
|
||||
vec.push_back(v);
|
||||
|
||||
if (!findAll)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simple macro to print a string if the --verbose options has been specified.
|
||||
/// </summary>
|
||||
|
@ -39,6 +39,13 @@ enum class eOptionIDs : et
|
||||
OPT_REG_VARS,
|
||||
OPT_PRE_VARS,
|
||||
OPT_POST_VARS,
|
||||
OPT_SUM_VARS,
|
||||
OPT_ASSIGN_VARS,
|
||||
OPT_PPSUM_VARS,
|
||||
OPT_PPASSIGN_VARS,
|
||||
OPT_DC_VARS,
|
||||
OPT_PAR_VARS,
|
||||
OPT_NON_PAR_VARS,
|
||||
|
||||
//Boolean args.
|
||||
OPT_OPENCL,
|
||||
@ -292,7 +299,7 @@ public:
|
||||
/// </summary>
|
||||
EmberOptions()
|
||||
{
|
||||
const size_t size = 30;
|
||||
const size_t size = 40;
|
||||
m_BoolArgs.reserve(size);
|
||||
m_IntArgs.reserve(size);
|
||||
m_UintArgs.reserve(size);
|
||||
@ -306,6 +313,13 @@ public:
|
||||
INITBOOLOPTION(RegVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_REG_VARS, _T("--regvars"), false, SO_NONE, "\t--regvars Display the names of all supported regular variations and exit.\n"));
|
||||
INITBOOLOPTION(PreVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_PRE_VARS, _T("--prevars"), false, SO_NONE, "\t--prevars Display the names of all supported pre variations and exit.\n"));
|
||||
INITBOOLOPTION(PostVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_POST_VARS, _T("--postvars"), false, SO_NONE, "\t--postvars Display the names of all supported post variations and exit.\n"));
|
||||
INITBOOLOPTION(SumVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_SUM_VARS, _T("--sumvars"), false, SO_NONE, "\t--sumvars Display the names of all regular variations which have the default behavior of summing their output, and exit.\n"));
|
||||
INITBOOLOPTION(AssignVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_ASSIGN_VARS, _T("--assignvars"), false, SO_NONE, "\t--assignvars Display the names of all regular variations which have the non-standard behavior of assigning their output, and exit.\n"));
|
||||
INITBOOLOPTION(PpSumVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_PPSUM_VARS, _T("--ppsumvars"), false, SO_NONE, "\t--ppsumvars Display the names of all pre/post variations which have the non-standard behavior of summing their output, and exit.\n"));
|
||||
INITBOOLOPTION(PpAssignVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_PPASSIGN_VARS, _T("--ppassignvars"), false, SO_NONE, "\t--ppassignvars Display the names of all pre/post variations which have the default behavior of assigning their output, and exit.\n"));
|
||||
INITBOOLOPTION(DcVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_DC_VARS, _T("--dcvars"), false, SO_NONE, "\t--dcvars Display the names of all variations which alter the color index and exit.\n"));
|
||||
INITBOOLOPTION(ParVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_PAR_VARS, _T("--parvars"), false, SO_NONE, "\t--parvars Display the names of all variations which have parameters and exit.\n"));
|
||||
INITBOOLOPTION(NonParVars, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_NON_PAR_VARS, _T("--nonparvars"), false, SO_NONE, "\t--nonparvars Display the names of all variations which do not have parameters (weight only) and exit.\n"));
|
||||
//Diagnostic bools.
|
||||
INITBOOLOPTION(Verbose, Eob(eOptionUse::OPT_USE_ALL, eOptionIDs::OPT_VERBOSE, _T("--verbose"), false, SO_NONE, "\t--verbose Verbose output [default: false].\n"));
|
||||
INITBOOLOPTION(Debug, Eob(eOptionUse::OPT_USE_GENOME, eOptionIDs::OPT_DEBUG, _T("--debug"), false, SO_NONE, "\t--debug Debug output [default: false].\n"));
|
||||
@ -449,6 +463,13 @@ public:
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_REG_VARS, RegVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_PRE_VARS, PreVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_POST_VARS, PostVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_SUM_VARS, SumVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_ASSIGN_VARS, AssignVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_PPSUM_VARS, PpSumVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_PPASSIGN_VARS, PpAssignVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_DC_VARS, DcVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_PAR_VARS, ParVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_NON_PAR_VARS, NonParVars);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_OPENCL, EmberCL);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_SP, Sp);
|
||||
PARSEBOOLOPTION(eOptionIDs::OPT_EARLYCLIP, EarlyClip);
|
||||
@ -721,6 +742,13 @@ public:
|
||||
Eob RegVars;
|
||||
Eob PreVars;
|
||||
Eob PostVars;
|
||||
Eob SumVars;
|
||||
Eob AssignVars;
|
||||
Eob PpSumVars;
|
||||
Eob PpAssignVars;
|
||||
Eob DcVars;
|
||||
Eob ParVars;
|
||||
Eob NonParVars;
|
||||
|
||||
Eob EmberCL;//Value bool.
|
||||
Eob Sp;
|
||||
|
@ -66,7 +66,9 @@ bool EmberGenome(EmberOptions& opt)
|
||||
|
||||
auto varList = VariationList<T>::Instance();
|
||||
|
||||
if (opt.AllVars() || opt.RegVars() || opt.PreVars() || opt.PostVars())
|
||||
if (opt.AllVars() || opt.SumVars() || opt.AssignVars() || opt.PpSumVars() || opt.PpAssignVars() ||
|
||||
opt.DcVars() || opt.ParVars() || opt.NonParVars() ||
|
||||
opt.RegVars() || opt.PreVars() || opt.PostVars())
|
||||
{
|
||||
if (opt.AllVars())
|
||||
{
|
||||
@ -75,9 +77,76 @@ bool EmberGenome(EmberOptions& opt)
|
||||
for (auto& v : vars)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else if (opt.SumVars())
|
||||
{
|
||||
auto& reg = varList->RegVars();
|
||||
auto matches = FindVarsWithout<T>(varList->RegVars(), vector<string> { "outPoint->m_X =", "outPoint->m_Y =", "outPoint->m_Z =",
|
||||
"outPoint->m_X=", "outPoint->m_Y=", "outPoint->m_Z="
|
||||
});
|
||||
|
||||
for (auto& v : matches)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else if (opt.AssignVars())
|
||||
{
|
||||
auto matches = FindVarsWith<T>(varList->RegVars(), vector<string> { "outPoint->m_X =", "outPoint->m_Y =", "outPoint->m_Z =",
|
||||
"outPoint->m_X=", "outPoint->m_Y=", "outPoint->m_Z="
|
||||
});
|
||||
|
||||
for (auto& v : matches)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else if (opt.PpSumVars())
|
||||
{
|
||||
auto& pre = varList->PreVars();
|
||||
auto& post = varList->PostVars();
|
||||
|
||||
for (auto& v : pre)
|
||||
if (v->AssignType() == eVariationAssignType::ASSIGNTYPE_SUM)
|
||||
cout << v->Name() << "\n";
|
||||
|
||||
for (auto& v : post)
|
||||
if (v->AssignType() == eVariationAssignType::ASSIGNTYPE_SUM)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else if (opt.PpAssignVars())
|
||||
{
|
||||
auto& pre = varList->PreVars();
|
||||
auto& post = varList->PostVars();
|
||||
|
||||
for (auto& v : pre)
|
||||
if (v->AssignType() == eVariationAssignType::ASSIGNTYPE_SET)
|
||||
cout << v->Name() << "\n";
|
||||
|
||||
for (auto& v : post)
|
||||
if (v->AssignType() == eVariationAssignType::ASSIGNTYPE_SET)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else if (opt.DcVars())
|
||||
{
|
||||
auto& all = varList->AllVars();
|
||||
auto matches = FindVarsWith<T>(all, vector<string> { "m_ColorX" });
|
||||
|
||||
for (auto& v : matches)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else if (opt.ParVars())
|
||||
{
|
||||
auto& par = varList->ParametricVariations();
|
||||
|
||||
for (auto& v : par)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else if (opt.NonParVars())
|
||||
{
|
||||
auto& par = varList->NonParametricVariations();
|
||||
|
||||
for (auto& v : par)
|
||||
cout << v->Name() << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
vector<Variation<T>*> vars;
|
||||
vector<const Variation<T>*> vars;
|
||||
|
||||
if (opt.RegVars())
|
||||
vars.insert(vars.end(), varList->RegVars().begin(), varList->RegVars().end());
|
||||
|
@ -299,65 +299,6 @@ void TestAtomicAdd()
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool SearchVar(const Variation<T>* var, vector<string>& stringVec, bool matchAll)
|
||||
{
|
||||
bool ret = false;
|
||||
size_t i;
|
||||
auto cl = var->OpenCLFuncsString() + "\n" + var->OpenCLString();
|
||||
|
||||
if (matchAll)
|
||||
{
|
||||
for (i = 0; i < stringVec.size(); i++)
|
||||
{
|
||||
if (cl.find(stringVec[i]) == std::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ret = (i == stringVec.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < stringVec.size(); i++)
|
||||
{
|
||||
if (cl.find(stringVec[i]) != std::string::npos)
|
||||
{
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static vector<Variation<T>*> FindVarsWith(vector<string>& stringVec, bool findAll = true)
|
||||
{
|
||||
int index = 0;
|
||||
auto vl = VariationList<T>::Instance();
|
||||
vector<Variation<T>*> vec;
|
||||
|
||||
while (index < vl->RegSize())
|
||||
{
|
||||
auto regVar = vl->GetVariation(index, eVariationType::VARTYPE_REG);
|
||||
|
||||
if (SearchVar(regVar, stringVec, false))
|
||||
{
|
||||
vec.push_back(regVar->Copy());
|
||||
|
||||
if (!findAll)
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
return vec;
|
||||
}
|
||||
|
||||
bool TestVarCounts()
|
||||
{
|
||||
auto vlf(VariationList<float>::Instance());
|
||||
@ -1306,7 +1247,8 @@ void TestVarTime()
|
||||
void TestCasting()
|
||||
{
|
||||
vector<string> stringVec;
|
||||
vector<Variation<float>*> varVec;
|
||||
auto varList = VariationList<float>::Instance();
|
||||
auto& vars = varList->AllVars();
|
||||
stringVec.push_back("T(");
|
||||
stringVec.push_back(".0f");
|
||||
stringVec.push_back(".1f");
|
||||
@ -1318,21 +1260,20 @@ void TestCasting()
|
||||
stringVec.push_back(".7f");
|
||||
stringVec.push_back(".8f");
|
||||
stringVec.push_back(".9f");
|
||||
varVec = FindVarsWith<float>(stringVec);
|
||||
auto varVec = FindVarsWith<float>(vars, stringVec);
|
||||
|
||||
for (auto& it : varVec)
|
||||
{
|
||||
cout << "Variation " << it->Name() << " contained an improper float cast." << endl;
|
||||
}
|
||||
|
||||
ClearVec<Variation<float>>(varVec);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void TestOperations()
|
||||
{
|
||||
vector<string> stringVec;
|
||||
vector<Variation<T>*> varVec;
|
||||
auto varList = VariationList<T>::Instance();
|
||||
auto& vars = varList->AllVars();
|
||||
//stringVec.push_back("%");
|
||||
//varVec = FindVarsWith<T>(Vec);
|
||||
//
|
||||
@ -1345,7 +1286,7 @@ void TestOperations()
|
||||
//ClearVec<Variation<T>>(varVec);
|
||||
stringVec.push_back("MwcNext(mwc) %");
|
||||
stringVec.push_back("MwcNext(mwc)%");
|
||||
varVec = FindVarsWith<T>(stringVec);
|
||||
auto varVec = FindVarsWith<T>(vars, stringVec);
|
||||
|
||||
for (size_t i = 0; i < varVec.size(); i++)
|
||||
{
|
||||
@ -1353,7 +1294,6 @@ void TestOperations()
|
||||
}
|
||||
|
||||
stringVec.clear();
|
||||
ClearVec<Variation<T>>(varVec);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -430,6 +430,9 @@ bool FractoriumEmberController<T>::Render()
|
||||
if (m_UndoList.size() >= UNDO_SIZE)
|
||||
m_UndoList.pop_front();
|
||||
}
|
||||
|
||||
//else
|
||||
// qDebug() << "Mouse was down, not adding to undo list.";
|
||||
}
|
||||
else if (!m_LastEditWasUndoRedo && m_UndoIndex < m_UndoList.size() - 1)//They were anywhere but the end of the undo list, then did a manual edit, so clear the undo list.
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user