diff --git a/Data/dark.qss b/Data/dark.qss index b034dbe..92a114c 100644 --- a/Data/dark.qss +++ b/Data/dark.qss @@ -87,7 +87,7 @@ QDoubleSpinBox padding-right: 0px; color: darkgray; selection-background-color: darkgray; - font: 9pt "Segoe UI";/*For some reason the font changes if you set any style. Set this to whatever font is the default on your system*/ + font: 8pt "MS Shell Dlg 2";/*For some reason the font changes if you set any style. Set this to whatever font is the default on your system*/ } QCheckBox diff --git a/Source/Ember/Variations04.h b/Source/Ember/Variations04.h index 7a9d468..96dfecc 100644 --- a/Source/Ember/Variations04.h +++ b/Source/Ember/Variations04.h @@ -3126,7 +3126,7 @@ public: T c = std::cos(helper.In.x); T sh = std::sinh(absV); T ch = std::cosh(absV); - T d = m_Weight * c * sh / absV; + T d = m_Weight * c * sh / Zeps(absV); helper.Out.x = m_Weight * s * ch; helper.Out.y = d * helper.In.y; helper.Out.z = d * helper.In.z; @@ -3142,7 +3142,7 @@ public: << "\t\treal_t c = cos(vIn.x);\n" << "\t\treal_t sh = sinh(absV);\n" << "\t\treal_t ch = cosh(absV);\n" - << "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * c * sh / absV;\n" + << "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * c * sh / Zeps(absV);\n" << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * s * ch;\n" << "\t\tvOut.y = d * vIn.y;\n" @@ -3153,7 +3153,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3175,7 +3175,7 @@ public: T c = std::cos(absV); T sh = std::sinh(helper.In.x); T ch = std::cosh(helper.In.x); - T d = m_Weight * ch * s / absV; + T d = m_Weight * ch * s / Zeps(absV); helper.Out.x = m_Weight * sh * c; helper.Out.y = d * helper.In.y; helper.Out.z = d * helper.In.z; @@ -3191,7 +3191,7 @@ public: << "\t\treal_t c = cos(absV);\n" << "\t\treal_t sh = sinh(vIn.x);\n" << "\t\treal_t ch = cosh(vIn.x);\n" - << "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * ch * s / absV;\n" + << "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * ch * s / Zeps(absV);\n" << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * sh * c;\n" << "\t\tvOut.y = d * vIn.y;\n" @@ -3202,7 +3202,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3220,12 +3220,12 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T absV = VarFuncs::Hypot(helper.In.y, helper.In.z); - T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z)); + T ni = m_Weight / Zeps(helper.m_PrecalcSumSquares + SQR(helper.In.z)); T s = std::sin(-helper.In.x); T c = std::cos(-helper.In.x); T sh = std::sinh(absV); T ch = std::cosh(absV); - T d = ni * s * sh / absV; + T d = ni * s * sh / Zeps(absV); helper.Out.x = c * ch * ni; helper.Out.y = -(d * helper.In.y); helper.Out.z = -(d * helper.In.z); @@ -3237,12 +3237,12 @@ public: intmax_t varIndex = IndexInXform(); ss << "\t{\n" << "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n" - << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (precalcSumSquares + SQR(vIn.z));\n" + << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares + SQR(vIn.z));\n" << "\t\treal_t s = sin(-vIn.x);\n" << "\t\treal_t c = cos(-vIn.x);\n" << "\t\treal_t sh = sinh(absV);\n" << "\t\treal_t ch = cosh(absV);\n" - << "\t\treal_t d = ni * s * sh / absV;\n" + << "\t\treal_t d = ni * s * sh / Zeps(absV);\n" << "\n" << "\t\tvOut.x = c * ch * ni;\n" << "\t\tvOut.y = -(d * vIn.y);\n" @@ -3253,7 +3253,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3271,12 +3271,12 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T absV = VarFuncs::Hypot(helper.In.y, helper.In.z); - T ni = m_Weight / (helper.m_PrecalcSumSquares + SQR(helper.In.z)); + T ni = m_Weight / Zeps(helper.m_PrecalcSumSquares + SQR(helper.In.z)); T s = std::sin(absV); T c = std::cos(absV); T sh = std::sinh(helper.In.x); T ch = std::cosh(helper.In.x); - T d = ni * sh * s / absV; + T d = ni * sh * s / Zeps(absV); helper.Out.x = ch * c * ni; helper.Out.y = -(d * helper.In.y); helper.Out.z = -(d * helper.In.z); @@ -3288,7 +3288,7 @@ public: intmax_t varIndex = IndexInXform(); ss << "\t{\n" << "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n" - << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (precalcSumSquares + SQR(vIn.z));\n" + << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(precalcSumSquares + SQR(vIn.z));\n" << "\t\treal_t s = sin(absV);\n" << "\t\treal_t c = cos(absV);\n" << "\t\treal_t sh = sinh(vIn.x);\n" @@ -3304,7 +3304,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3323,13 +3323,13 @@ public: { T sysz = SQR(helper.In.y) + SQR(helper.In.z); T absV = std::sqrt(sysz); - T ni = m_Weight / (SQR(helper.In.x) + sysz); + T ni = m_Weight / Zeps(SQR(helper.In.x) + sysz); T s = std::sin(helper.In.x); T c = std::cos(helper.In.x); T sh = std::sinh(absV); T ch = std::cosh(absV); - T d = c * sh / absV; - T b = -s * sh / absV; + T d = c * sh / Zeps(absV); + T b = -s * sh / Zeps(absV); T stcv = s * ch; T nstcv = -stcv; T ctcv = c * ch; @@ -3345,13 +3345,13 @@ public: ss << "\t{\n" << "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n" << "\t\treal_t absV = sqrt(sysz);\n" - << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (SQR(vIn.x) + sysz);\n" + << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(SQR(vIn.x) + sysz);\n" << "\t\treal_t s = sin(vIn.x);\n" << "\t\treal_t c = cos(vIn.x);\n" << "\t\treal_t sh = sinh(absV);\n" << "\t\treal_t ch = cosh(absV);\n" - << "\t\treal_t d = c * sh / absV;\n" - << "\t\treal_t b = -s * sh / absV;\n" + << "\t\treal_t d = c * sh / Zeps(absV);\n" + << "\t\treal_t b = -s * sh / Zeps(absV);\n" << "\t\treal_t stcv = s * ch;\n" << "\t\treal_t nstcv = -stcv;\n" << "\t\treal_t ctcv = c * ch;\n" @@ -3362,6 +3362,11 @@ public: << "\t}\n"; return ss.str(); } + + virtual vector OpenCLGlobalFuncNames() const override + { + return vector { "Zeps" }; + } }; /// @@ -3379,13 +3384,13 @@ public: { T sysz = SQR(helper.In.y) + SQR(helper.In.z); T absV = std::sqrt(sysz); - T ni = m_Weight / (SQR(helper.In.x) + sysz); + T ni = m_Weight / Zeps(SQR(helper.In.x) + sysz); T s = std::sin(absV); T c = std::cos(absV); T sh = std::sinh(helper.In.x); T ch = std::cosh(helper.In.x); - T d = ch * s / absV; - T b = sh * s / absV; + T d = ch * s / Zeps(absV); + T b = sh * s / Zeps(absV); T stcv = sh * c; T nstcv = -stcv; T ctcv = c * ch; @@ -3401,13 +3406,13 @@ public: ss << "\t{\n" << "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n" << "\t\treal_t absV = sqrt(sysz);\n" - << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (SQR(vIn.x) + sysz);\n" + << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(SQR(vIn.x) + sysz);\n" << "\t\treal_t s = sin(absV);\n" << "\t\treal_t c = cos(absV);\n" << "\t\treal_t sh = sinh(vIn.x);\n" << "\t\treal_t ch = cosh(vIn.x);\n" - << "\t\treal_t d = ch * s / absV;\n" - << "\t\treal_t b = sh * s / absV;\n" + << "\t\treal_t d = ch * s / Zeps(absV);\n" + << "\t\treal_t b = sh * s / Zeps(absV);\n" << "\t\treal_t stcv = sh * c;\n" << "\t\treal_t nstcv = -stcv;\n" << "\t\treal_t ctcv = c * ch;\n" @@ -3418,6 +3423,11 @@ public: << "\t}\n"; return ss.str(); } + + virtual vector OpenCLGlobalFuncNames() const override + { + return vector { "Zeps" }; + } }; /// @@ -3438,7 +3448,7 @@ public: T c = std::cos(helper.In.x); T sh = std::sinh(absV); T ch = std::cosh(absV); - T d = -m_Weight * s * sh / absV; + T d = -m_Weight * s * sh / Zeps(absV); helper.Out.x = m_Weight * c * ch; helper.Out.y = d * helper.In.y; helper.Out.z = d * helper.In.z; @@ -3454,7 +3464,7 @@ public: << "\t\treal_t c = cos(vIn.x);\n" << "\t\treal_t sh = sinh(absV);\n" << "\t\treal_t ch = cosh(absV);\n" - << "\t\treal_t d = -xform->m_VariationWeights[" << varIndex << "] * s * sh / absV;\n" + << "\t\treal_t d = -xform->m_VariationWeights[" << varIndex << "] * s * sh / Zeps(absV);\n" << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * c * ch;\n" << "\t\tvOut.y = d * vIn.y;\n" @@ -3465,7 +3475,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3487,7 +3497,7 @@ public: T c = std::cos(absV); T sh = std::sinh(helper.In.x); T ch = std::cosh(helper.In.x); - T d = -m_Weight * sh * s / absV; + T d = m_Weight * sh * s / Zeps(absV); helper.Out.x = m_Weight * c * ch; helper.Out.y = d * helper.In.y; helper.Out.z = d * helper.In.z; @@ -3503,7 +3513,7 @@ public: << "\t\treal_t c = cos(absV);\n" << "\t\treal_t sh = sinh(vIn.x);\n" << "\t\treal_t ch = cosh(vIn.x);\n" - << "\t\treal_t d = -xform->m_VariationWeights[" << varIndex << "] * sh * s / absV;\n" + << "\t\treal_t d = xform->m_VariationWeights[" << varIndex << "] * sh * s / Zeps(absV);\n" << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * c * ch;\n" << "\t\tvOut.y = d * vIn.y;\n" @@ -3514,7 +3524,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3533,13 +3543,13 @@ public: { T sysz = SQR(helper.In.y) + SQR(helper.In.z); T absV = std::sqrt(sysz); - T ni = m_Weight / (SQR(helper.In.x) + sysz); + T ni = m_Weight / Zeps(SQR(helper.In.x) + sysz); T s = std::sin(helper.In.x); T c = std::cos(helper.In.x); T sh = std::sinh(absV); T ch = std::cosh(absV); - T d = c * sh / absV; - T b = -s * sh / absV; + T d = c * sh / Zeps(absV); + T b = -s * sh / Zeps(absV); T stcv = s * ch; T nstcv = -stcv; T ctcv = c * ch; @@ -3555,13 +3565,13 @@ public: ss << "\t{\n" << "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n" << "\t\treal_t absV = sqrt(sysz);\n" - << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (SQR(vIn.x) + sysz);\n" + << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(SQR(vIn.x) + sysz);\n" << "\t\treal_t s = sin(vIn.x);\n" << "\t\treal_t c = cos(vIn.x);\n" << "\t\treal_t sh = sinh(absV);\n" << "\t\treal_t ch = cosh(absV);\n" - << "\t\treal_t d = c * sh / absV;\n" - << "\t\treal_t b = -s * sh / absV;\n" + << "\t\treal_t d = c * sh / Zeps(absV);\n" + << "\t\treal_t b = -s * sh / Zeps(absV);\n" << "\t\treal_t stcv = s * ch;\n" << "\t\treal_t nstcv = -stcv;\n" << "\t\treal_t ctcv = c * ch;\n" @@ -3572,6 +3582,11 @@ public: << "\t}\n"; return ss.str(); } + + virtual vector OpenCLGlobalFuncNames() const override + { + return vector { "Zeps" }; + } }; /// @@ -3589,19 +3604,19 @@ public: { T sysz = SQR(helper.In.y) + SQR(helper.In.z); T absV = std::sqrt(sysz); - T ni = m_Weight / (SQR(helper.In.x) + sysz); + T ni = m_Weight / Zeps(Sqr(SQR(helper.In.x) + sysz)); T s = std::sin(absV); T c = std::cos(absV); T sh = std::sinh(helper.In.x); T ch = std::cosh(helper.In.x); - T d = ch * s / absV; - T b = sh * s / absV; + T d = ch * s / Zeps(absV); + T b = sh * s / Zeps(absV); T stcv = sh * c; T nstcv = -stcv; T ctcv = ch * c; - helper.Out.x = (stcv * ctcv + d * b * sysz) * ni; - helper.Out.y = -(nstcv * b * helper.In.y + d * helper.In.y * ctcv) * ni; - helper.Out.z = -(nstcv * b * helper.In.z + d * helper.In.z * ctcv) * ni; + helper.Out.x = (stcv * ctcv + d * b * sysz) * ni; + helper.Out.y = (nstcv * b * helper.In.y + d * helper.In.y * ctcv) * ni; + helper.Out.z = (nstcv * b * helper.In.z + d * helper.In.z * ctcv) * ni; } virtual string OpenCLString() const override @@ -3611,23 +3626,28 @@ public: ss << "\t{\n" << "\t\treal_t sysz = SQR(vIn.y) + SQR(vIn.z);\n" << "\t\treal_t absV = sqrt(sysz);\n" - << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / (SQR(vIn.x) + sysz);\n" + << "\t\treal_t ni = xform->m_VariationWeights[" << varIndex << "] / Zeps(Sqr(SQR(vIn.x) + sysz));\n" << "\t\treal_t s = sin(absV);\n" << "\t\treal_t c = cos(absV);\n" << "\t\treal_t sh = sinh(vIn.x);\n" << "\t\treal_t ch = cosh(vIn.x);\n" - << "\t\treal_t d = ch * s / absV;\n" - << "\t\treal_t b = sh * s / absV;\n" + << "\t\treal_t d = ch * s / Zeps(absV);\n" + << "\t\treal_t b = sh * s / Zeps(absV);\n" << "\t\treal_t stcv = sh * c;\n" << "\t\treal_t nstcv = -stcv;\n" << "\t\treal_t ctcv = ch * c;\n" << "\n" - << "\t\tvOut.x = (stcv * ctcv + d * b * sysz) * ni;\n" - << "\t\tvOut.y = -(nstcv * b * vIn.y + d * vIn.y * ctcv) * ni;\n" - << "\t\tvOut.z = -(nstcv * b * vIn.z + d * vIn.z * ctcv) * ni;\n" + << "\t\tvOut.x = (stcv * ctcv + d * b * sysz) * ni;\n" + << "\t\tvOut.y = (nstcv * b * vIn.y + d * vIn.y * ctcv) * ni;\n" + << "\t\tvOut.z = (nstcv * b * vIn.z + d * vIn.z * ctcv) * ni;\n" << "\t}\n"; return ss.str(); } + + virtual vector OpenCLGlobalFuncNames() const override + { + return vector { "Zeps", "Sqr" }; + } }; /// @@ -3649,7 +3669,7 @@ public: T c = std::cos(helper.In.x); T sh = std::sinh(absV); T ch = std::cosh(absV); - T d = ni * c * sh / absV; + T d = ni * c * sh / Zeps(absV); helper.Out.x = s * ch * ni; helper.Out.y = -(d * helper.In.y); helper.Out.z = -(d * helper.In.z); @@ -3666,7 +3686,7 @@ public: << "\t\treal_t c = cos(vIn.x);\n" << "\t\treal_t sh = sinh(absV);\n" << "\t\treal_t ch = cosh(absV);\n" - << "\t\treal_t d = ni * c * sh / absV;\n" + << "\t\treal_t d = ni * c * sh / Zeps(absV);\n" << "\n" << "\t\tvOut.x = s * ch * ni;\n" << "\t\tvOut.y = -(d * vIn.y);\n" @@ -3677,7 +3697,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3700,7 +3720,7 @@ public: T c = std::cos(absV); T sh = std::sinh(helper.In.x); T ch = std::cosh(helper.In.x); - T d = ni * ch * s / absV; + T d = ni * ch * s / Zeps(absV); helper.Out.x = sh * c * ni; helper.Out.y = -(d * helper.In.y); helper.Out.z = -(d * helper.In.z); @@ -3717,7 +3737,7 @@ public: << "\t\treal_t c = cos(absV);\n" << "\t\treal_t sh = sinh(vIn.x);\n" << "\t\treal_t ch = cosh(vIn.x);\n" - << "\t\treal_t d = ni * ch * s / absV;\n" + << "\t\treal_t d = ni * ch * s / Zeps(absV);\n" << "\n" << "\t\tvOut.x = sh * c * ni;\n" << "\t\tvOut.y = -(d * vIn.y);\n" @@ -3728,7 +3748,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3749,7 +3769,7 @@ public: T e = std::exp(helper.In.x); T s = std::sin(absV); T c = std::cos(absV); - T a = e * s / absV; + T a = e * s / Zeps(absV); helper.Out.x = m_Weight * e * c; helper.Out.y = m_Weight * a * helper.In.y; helper.Out.z = m_Weight * a * helper.In.z; @@ -3764,7 +3784,7 @@ public: << "\t\treal_t e = exp(vIn.x);\n" << "\t\treal_t s = sin(absV);\n" << "\t\treal_t c = cos(absV);\n" - << "\t\treal_t a = e * s / absV;\n" + << "\t\treal_t a = e * s / Zeps(absV);\n" << "\n" << "\t\tvOut.x = xform->m_VariationWeights[" << varIndex << "] * e * c;\n" << "\t\tvOut.y = xform->m_VariationWeights[" << varIndex << "] * a * vIn.y;\n" @@ -3775,7 +3795,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } }; @@ -3796,7 +3816,7 @@ public: virtual void Func(IteratorHelper& helper, Point& outPoint, QTIsaac& rand) override { T absV = VarFuncs::Hypot(helper.In.y, helper.In.z); - T c = m_Weight * std::atan2(absV, helper.In.x) / absV; + T c = m_Weight * std::atan2(absV, helper.In.x) / Zeps(absV); helper.Out.x = std::log(SQR(helper.In.x) + SQR(absV)) * m_Denom; helper.Out.y = c * helper.In.y; helper.Out.z = c * helper.In.z; @@ -3812,7 +3832,7 @@ public: string denom = "parVars[" + ToUpper(m_Params[i++].Name()) + index; ss << "\t{\n" << "\t\treal_t absV = Hypot(vIn.y, vIn.z);\n" - << "\t\treal_t c = xform->m_VariationWeights[" << varIndex << "] * atan2(absV, vIn.x) / absV;\n" + << "\t\treal_t c = xform->m_VariationWeights[" << varIndex << "] * atan2(absV, vIn.x) / Zeps(absV);\n" << "\n" << "\t\tvOut.x = log(SQR(vIn.x) + SQR(absV)) * " << denom << ";\n" << "\t\tvOut.y = c * vIn.y;\n" @@ -3823,7 +3843,7 @@ public: virtual vector OpenCLGlobalFuncNames() const override { - return vector { "Hypot" }; + return vector { "Hypot", "Zeps" }; } virtual void Precalc() override diff --git a/Source/Ember/Xform.h b/Source/Ember/Xform.h index f16c2bc..51e2bfc 100644 --- a/Source/Ember/Xform.h +++ b/Source/Ember/Xform.h @@ -681,6 +681,10 @@ public: } outPoint->m_ColorX = iterHelper.m_Color.x + m_DirectColor * (outPoint->m_ColorX - iterHelper.m_Color.x); + + if (std::isnan(outPoint->m_ColorX)) + outPoint->m_ColorX = 0; + //Has the trajectory of x or y gone either to infinity, or too close to zero? return BadVal(outPoint->m_X) || BadVal(outPoint->m_Y)/* || BadVal(outPoint->m_Z)*/; } diff --git a/Source/EmberAnimate/EmberAnimate.cpp b/Source/EmberAnimate/EmberAnimate.cpp index 6d54ff4..57cbe33 100644 --- a/Source/EmberAnimate/EmberAnimate.cpp +++ b/Source/EmberAnimate/EmberAnimate.cpp @@ -476,6 +476,8 @@ int _tmain(int argc, _TCHAR* argv[]) #else putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); #endif + _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); + _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_ANIMATE)) { diff --git a/Source/EmberCL/IterOpenCLKernelCreator.cpp b/Source/EmberCL/IterOpenCLKernelCreator.cpp index c9dde72..883f8ba 100644 --- a/Source/EmberCL/IterOpenCLKernelCreator.cpp +++ b/Source/EmberCL/IterOpenCLKernelCreator.cpp @@ -203,6 +203,8 @@ string IterOpenCLKernelCreator::CreateIterKernelString(const Ember& ember, } xformFuncs << "\toutPoint->m_ColorX = tempColor + xform->m_DirectColor * (outPoint->m_ColorX - tempColor);\n"; + xformFuncs << "\tif (isnan(outPoint->m_ColorX))\n"; + xformFuncs << "\t outPoint->m_ColorX = 0.0; \n"; xformFuncs << "}\n" << "\n"; i++; diff --git a/Source/EmberCL/OpenCLWrapper.cpp b/Source/EmberCL/OpenCLWrapper.cpp index 25a0ba1..e7aa7a9 100644 --- a/Source/EmberCL/OpenCLWrapper.cpp +++ b/Source/EmberCL/OpenCLWrapper.cpp @@ -1027,9 +1027,9 @@ bool OpenCLWrapper::CreateSPK(const string& name, const string& program, const s spk.m_Program = cl::Program(m_Context, spk.m_Source); if (doublePrecision) - err = spk.m_Program.build(m_DeviceVec, "-cl-mad-enable");//Tinker with other options later. + err = spk.m_Program.build(m_DeviceVec, "-cl-mad-enable -cl-no-signed-zeros -cl-denorms-are-zero");//Tinker with other options later. else - err = spk.m_Program.build(m_DeviceVec, "-cl-mad-enable -cl-no-signed-zeros -cl-single-precision-constant"); + err = spk.m_Program.build(m_DeviceVec, "-cl-mad-enable -cl-no-signed-zeros -cl-single-precision-constant -cl-denorms-are-zero"); //err = spk.m_Program.build(m_DeviceVec, "-cl-single-precision-constant"); //err = spk.m_Program.build(m_DeviceVec, "-cl-mad-enable -cl-single-precision-constant"); diff --git a/Source/EmberCL/RendererCL.cpp b/Source/EmberCL/RendererCL.cpp index d6e31af..0eff759 100644 --- a/Source/EmberCL/RendererCL.cpp +++ b/Source/EmberCL/RendererCL.cpp @@ -977,7 +977,7 @@ bool RendererCL::RunIter(size_t iterCount, size_t temporalSample, si if (m_Devices.size() >= launches) { launches = m_Devices.size(); - adjustedIterCountPerKernel = size_t(ceil(ceil(double(iterCount) / m_Devices.size()) / IterGridKernelCount())); + adjustedIterCountPerKernel = size_t(std::ceil(std::ceil(double(iterCount) / m_Devices.size()) / IterGridKernelCount())); } size_t fuseFreq = Renderer::SubBatchSize() / adjustedIterCountPerKernel;//Use the base sbs to determine when to fuse. diff --git a/Source/EmberGenome/EmberGenome.cpp b/Source/EmberGenome/EmberGenome.cpp index 67e44b4..171ece4 100644 --- a/Source/EmberGenome/EmberGenome.cpp +++ b/Source/EmberGenome/EmberGenome.cpp @@ -859,6 +859,8 @@ int _tmain(int argc, _TCHAR* argv[]) #else putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); #endif + _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); + _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_GENOME)) { diff --git a/Source/EmberRender/EmberRender.cpp b/Source/EmberRender/EmberRender.cpp index d2d34bc..72ca9ef 100644 --- a/Source/EmberRender/EmberRender.cpp +++ b/Source/EmberRender/EmberRender.cpp @@ -367,6 +367,8 @@ int _tmain(int argc, _TCHAR* argv[]) #else putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); #endif + _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); + _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); if (!opt.Populate(argc, argv, eOptionUse::OPT_USE_RENDER)) { diff --git a/Source/EmberTester/EmberTester.cpp b/Source/EmberTester/EmberTester.cpp index 45819e5..670c6c4 100644 --- a/Source/EmberTester/EmberTester.cpp +++ b/Source/EmberTester/EmberTester.cpp @@ -93,23 +93,23 @@ void MakeTestAllVarsRegPrePost(vector>& embers) paletteList->Add("flam3-palettes.xml"); Timing t; Ember emberNoVars; - emberNoVars.m_FinalRasW = 640; - emberNoVars.m_FinalRasH = 480; + emberNoVars.m_FinalRasW = 1024; + emberNoVars.m_FinalRasH = 1024; emberNoVars.m_Quality = 100; Xform xform1(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); Xform xform2(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); Xform xform3(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform4(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform5(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform6(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform7(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //Xform xform4(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //Xform xform5(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //Xform xform6(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //Xform xform7(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); emberNoVars.AddXform(xform1); emberNoVars.AddXform(xform2); emberNoVars.AddXform(xform3); - emberNoVars.AddXform(xform4); - emberNoVars.AddXform(xform5); - emberNoVars.AddXform(xform6); - emberNoVars.AddXform(xform7); + //emberNoVars.AddXform(xform4); + //emberNoVars.AddXform(xform5); + //emberNoVars.AddXform(xform6); + //emberNoVars.AddXform(xform7); ss << "NoVars"; emberNoVars.m_Name = ss.str(); ss.str(""); @@ -126,53 +126,51 @@ void MakeTestAllVarsRegPrePost(vector>& embers) */ Ember ember1; unique_ptr> regVar(varList->GetVariationCopy(index, eVariationType::VARTYPE_REG)); - unique_ptr> preVar(varList->GetVariationCopy("pre_" + regVar->Name())); - unique_ptr> postVar(varList->GetVariationCopy("post_" + regVar->Name())); - ember1.m_FinalRasW = 640; - ember1.m_FinalRasH = 480; - ember1.m_Quality = 100; + //unique_ptr> preVar(varList->GetVariationCopy("pre_" + regVar->Name())); + //unique_ptr> postVar(varList->GetVariationCopy("post_" + regVar->Name())); + ember1.m_FinalRasW = 1024; + ember1.m_FinalRasH = 1024; + ember1.m_Quality = 500; Xform xform1(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); Xform xform2(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); Xform xform3(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform4(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform5(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform6(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - Xform xform7(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); - - if (preVar.get() && postVar.get()) - { - xform1.AddVariation(preVar->Copy()); - xform2.AddVariation(regVar->Copy()); - xform3.AddVariation(postVar->Copy()); - xform4.AddVariation(preVar->Copy()); - xform4.AddVariation(regVar->Copy()); - xform5.AddVariation(preVar->Copy()); - xform5.AddVariation(postVar->Copy()); - xform6.AddVariation(regVar->Copy()); - xform6.AddVariation(postVar->Copy()); - xform7.AddVariation(preVar->Copy()); - xform7.AddVariation(regVar->Copy()); - xform7.AddVariation(postVar->Copy()); - ember1.AddXform(xform1); - ember1.AddXform(xform2); - ember1.AddXform(xform3); - ember1.AddXform(xform4); - ember1.AddXform(xform5); - ember1.AddXform(xform6); - ember1.AddXform(xform7); - } - else + //Xform xform4(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //Xform xform5(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //Xform xform6(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //Xform xform7(0.25f, rand.Frand01(), rand.Frand11(), 1, rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11(), rand.Frand11()); + //if (preVar.get() && postVar.get()) + //{ + //xform1.AddVariation(preVar->Copy()); + //xform2.AddVariation(regVar->Copy()); + //xform3.AddVariation(postVar->Copy()); + //xform4.AddVariation(preVar->Copy()); + //xform4.AddVariation(regVar->Copy()); + //xform5.AddVariation(preVar->Copy()); + //xform5.AddVariation(postVar->Copy()); + //xform6.AddVariation(regVar->Copy()); + //xform6.AddVariation(postVar->Copy()); + //xform7.AddVariation(preVar->Copy()); + //xform7.AddVariation(regVar->Copy()); + //xform7.AddVariation(postVar->Copy()); + //ember1.AddXform(xform1); + //ember1.AddXform(xform2); + //ember1.AddXform(xform3); + //ember1.AddXform(xform4); + //ember1.AddXform(xform5); + //ember1.AddXform(xform6); + //ember1.AddXform(xform7); + //} + //else { xform1.AddVariation(regVar->Copy()); xform2.AddVariation(regVar->Copy()); xform3.AddVariation(regVar->Copy()); - xform4.AddVariation(regVar->Copy()); + //xform4.AddVariation(regVar->Copy()); ember1.AddXform(xform1); ember1.AddXform(xform2); ember1.AddXform(xform3); - ember1.AddXform(xform4); + //ember1.AddXform(xform4); } - ss << index << "_" << regVar->Name(); ember1.m_Name = ss.str(); ss.str(""); @@ -189,7 +187,7 @@ void MakeTestAllVarsRegPrePostComboFile(const string& filename) EmberToXml writer; vector> embers; MakeTestAllVarsRegPrePost(embers); - writer.Save(filename, embers, 0, true, false, true); + writer.Save(filename, embers, 0, true, true, false); } void TestAtomicAdd() @@ -1933,17 +1931,19 @@ int _tmain(int argc, _TCHAR* argv[]) vector> dv; list> fl; list> dl; - string line = "title=\"cj_aerie\" smooth=no", delim = " =\""; - auto vec = Split(line, delim, true); + _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); + _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); + /* string line = "title=\"cj_aerie\" smooth=no", delim = " =\""; + auto vec = Split(line, delim, true); - for (auto& s : vec) cout << s << endl; + for (auto& s : vec) cout << s << endl; - line = "index=0 color=2177354", delim = " ="; - vec = Split(line, delim, true); + line = "index=0 color=2177354", delim = " ="; + vec = Split(line, delim, true); + + for (auto& s : vec) cout << s << endl; - for (auto& s : vec) cout << s << endl; - /* EmberContainerTester::TestEmberContainer(fv); EmberContainerTester::TestEmberContainer(dv); EmberContainerTester::TestEmberContainer(fl); @@ -1957,9 +1957,10 @@ int _tmain(int argc, _TCHAR* argv[]) /* TestRotate(); TestRotate(); return 1; - MakeTestAllVarsRegPrePostComboFile("testallvarsout.flame"); - return 0; - + */ + MakeTestAllVarsRegPrePostComboFile("testallvarsout.flame"); + return 0; + /* TestThreadedKernel(); @@ -1972,8 +1973,8 @@ int _tmain(int argc, _TCHAR* argv[]) for (int i = 0; i < 10; i++) { - cout << "log10(" << d << ") = " << std::max(1u, uint(std::log10(d)) + 1u) << endl; - d *= 10; + cout << "log10(" << d << ") = " << std::max(1u, uint(std::log10(d)) + 1u) << endl; + d *= 10; } return 0;*/ diff --git a/Source/Fractorium/FinalRenderDialog.ui b/Source/Fractorium/FinalRenderDialog.ui index 79e463b..7fea84b 100644 --- a/Source/Fractorium/FinalRenderDialog.ui +++ b/Source/Fractorium/FinalRenderDialog.ui @@ -259,6 +259,12 @@ 91 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -470,6 +476,12 @@ 45 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -679,6 +691,12 @@ 199 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui index f9e97e1..4202860 100644 --- a/Source/Fractorium/Fractorium.ui +++ b/Source/Fractorium/Fractorium.ui @@ -206,6 +206,12 @@ 88 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -407,6 +413,12 @@ 22 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -488,6 +500,12 @@ 22 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -569,6 +587,12 @@ 22 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -672,6 +696,12 @@ 22 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -782,6 +812,12 @@ 264 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -1114,6 +1150,12 @@ 110 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -1314,6 +1356,12 @@ 154 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -1559,6 +1607,12 @@ 22 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -1656,6 +1710,12 @@ 110 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -1907,6 +1967,8 @@ + MS Shell Dlg 2 + 8 true @@ -2060,6 +2122,12 @@ 21 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -2175,6 +2243,12 @@ + + + MS Shell Dlg 2 + 8 + + Qt::StrongFocus @@ -2277,6 +2351,12 @@ 67 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -2944,6 +3024,8 @@ + MS Shell Dlg 2 + 8 true @@ -3131,6 +3213,8 @@ + MS Shell Dlg 2 + 8 true @@ -3461,7 +3545,8 @@ - true + MS Shell Dlg 2 + 8 @@ -3791,6 +3876,12 @@ 90 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -4588,6 +4679,12 @@ 90 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -5514,6 +5611,12 @@ 0 + + + MS Shell Dlg 2 + 8 + + true @@ -6011,6 +6114,12 @@ 126 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -6149,6 +6258,12 @@ 0 + + + MS Shell Dlg 2 + 8 + + QFrame::Plain @@ -6520,6 +6635,8 @@ + MS Shell Dlg 2 + 8 true @@ -6961,6 +7078,12 @@ Qt::Vertical + + + MS Shell Dlg 2 + 8 + + Qt::WheelFocus @@ -7617,6 +7740,12 @@ 0 + + + MS Shell Dlg 2 + 8 + + Qt::WheelFocus diff --git a/Source/Fractorium/Main.cpp b/Source/Fractorium/Main.cpp index 73cbd5c..4609fc3 100644 --- a/Source/Fractorium/Main.cpp +++ b/Source/Fractorium/Main.cpp @@ -20,6 +20,8 @@ int main(int argc, char* argv[]) QMessageBox::critical(QApplication::desktop(), "Error", "Fractorium cannot be run in test mode, undefine ISAAC_FLAM3_DEBUG first."); return 1; #endif + _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); + _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); auto vf = VarFuncs::Instance();//Create instances that will stay alive until the program exits. auto vlf = VariationList::Instance(); auto palf = PaletteList::Instance(); diff --git a/Source/Fractorium/OptionsDialog.ui b/Source/Fractorium/OptionsDialog.ui index e1617d5..b7d5886 100644 --- a/Source/Fractorium/OptionsDialog.ui +++ b/Source/Fractorium/OptionsDialog.ui @@ -189,6 +189,12 @@ 91 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -466,6 +472,12 @@ in interactive mode for each mouse movement 67 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus @@ -659,6 +671,12 @@ in interactive mode for each mouse movement 67 + + + MS Shell Dlg 2 + 8 + + Qt::NoFocus diff --git a/Source/Fractorium/PaletteEditor.ui b/Source/Fractorium/PaletteEditor.ui index 4b3407b..c3c660c 100644 --- a/Source/Fractorium/PaletteEditor.ui +++ b/Source/Fractorium/PaletteEditor.ui @@ -6,8 +6,8 @@ 0 0 - 942 - 542 + 859 + 540 @@ -27,10 +27,13 @@ 6 - + 4 + + QLayout::SetDefaultConstraint + @@ -50,10 +53,29 @@ - + + + + 365 + 16777215 + + + + + + 365 + 16777215 + + + + + MS Shell Dlg 2 + 8 + + QFrame::Panel diff --git a/Source/Fractorium/PaletteEditor/PaletteEditor.cpp b/Source/Fractorium/PaletteEditor/PaletteEditor.cpp index 46b6762..b367a84 100644 --- a/Source/Fractorium/PaletteEditor/PaletteEditor.cpp +++ b/Source/Fractorium/PaletteEditor/PaletteEditor.cpp @@ -1,4 +1,4 @@ -#include "FractoriumPch.h" +#include "FractoriumPch.h" #include "PaletteEditor.h" /// @@ -578,4 +578,6 @@ void PaletteEditor::EnablePaletteControls() ui->RemoveColorButton->setEnabled(b); ui->ResetColorsButton->setEnabled(b); ui->ArrowsSpinBox->setEnabled(b); + ui->CreatePaletteFromImageButton->setEnabled(b); + ui->CreatePaletteAgainFromImageButton->setEnabled(b); } \ No newline at end of file diff --git a/Source/Fractorium/VariationsDialog.ui b/Source/Fractorium/VariationsDialog.ui index 1ddf399..7391636 100644 --- a/Source/Fractorium/VariationsDialog.ui +++ b/Source/Fractorium/VariationsDialog.ui @@ -41,6 +41,12 @@ + + + MS Shell Dlg 2 + 8 + + false