--Bug fixes

-Attempt to fix several OpenCL build errors that were occurring on Mac.

--Code changes
 -Improve the coloring code during final accum by getting rid of the last remnants of unnecessary scaling to 255 from flam3.
 -Begin work of supporting 16bpc on the GPU.
This commit is contained in:
Person
2017-07-04 23:08:06 -07:00
parent 562ab9b01a
commit 2adf9f3ff9
16 changed files with 292 additions and 232 deletions

View File

@ -2112,9 +2112,9 @@ public:
"\t\t z = 2 / pow(rad, " << exponentZ << ") - 1;\n"
"\t\t\n"
"\t\t if (" << exponentZ << " <= 2)\n"
"\t\t angZ = M_PI - acos((z / (SQR(x) + SQR(y) + SQR(z))));\n"
"\t\t angZ = MPI - acos((z / (SQR(x) + SQR(y) + SQR(z))));\n"
"\t\t else\n"
"\t\t angZ = M_PI - atan2(Sqr(SQR(x) + SQR(y)), z);\n"
"\t\t angZ = MPI - atan2(Sqr(SQR(x) + SQR(y)), z);\n"
"\t\t}\n"
"\t\telse\n"
"\t\t{\n"
@ -2136,8 +2136,8 @@ public:
"\t\t }\n"
"\t\t else\n"
"\t\t {\n"
"\t\t angTmp = (M_PI - angZ) / Zeps(" << angHoleComp << " * " << angHoleTemp << " - M_PI_2);\n"
"\t\t angZ -= M_PI_2;\n"
"\t\t angTmp = (MPI - angZ) / Zeps(" << angHoleComp << " * " << angHoleTemp << " - MPI2);\n"
"\t\t angZ -= MPI2;\n"
"\t\t fac = cos(angTmp) / cos(angZ);\n"
"\t\t x *= fac;\n"
"\t\t y *= fac;\n"
@ -2157,8 +2157,8 @@ public:
"\t\t }\n"
"\t\t else\n"
"\t\t {\n"
"\t\t angTmp = M_PI - angZ / Zeps(" << angHoleComp << " * " << angHoleTemp << " - M_PI_2);\n"
"\t\t angZ -= M_PI_2;\n"
"\t\t angTmp = MPI - angZ / Zeps(" << angHoleComp << " * " << angHoleTemp << " - MPI2);\n"
"\t\t angZ -= MPI2;\n"
"\t\t fac = cos(angTmp) / cos(angZ);\n"
"\t\t x *= fac;\n"
"\t\t y *= fac;\n"
@ -2169,7 +2169,7 @@ public:
"\t\t}\n"
"\t\telse\n"
"\t\t{\n"
"\t\t if ((angZ > " << angHoleTemp << ") || (angZ < (M_PI - " << angHoleTemp << ")))\n"
"\t\t if ((angZ > " << angHoleTemp << ") || (angZ < (MPI - " << angHoleTemp << ")))\n"
"\t\t {\n"
"\t\t if ((" << modusBlur << " == 0) || (" << exponentZ << " != 1))\n"
"\t\t {\n"
@ -2180,11 +2180,11 @@ public:
"\t\t else\n"
"\t\t {\n"
"\t\t if (angZ > " << angHoleTemp << ")\n"
"\t\t angTmp = (M_PI - angZ) / " << angHoleComp << " * (M_PI - 2 * " << angHoleComp << ") + " << angHoleComp << " - M_PI_2;\n"
"\t\t angTmp = (MPI - angZ) / " << angHoleComp << " * (MPI - 2 * " << angHoleComp << ") + " << angHoleComp << " - MPI2;\n"
"\t\t else\n"
"\t\t angTmp = M_PI_2 - (angZ / " << angHoleComp << " * (M_PI - 2 * " << angHoleComp << ") + " << angHoleComp << ");\n"
"\t\t angTmp = MPI2 - (angZ / " << angHoleComp << " * (MPI - 2 * " << angHoleComp << ") + " << angHoleComp << ");\n"
"\n"
"\t\t angZ -= M_PI_2;\n"
"\t\t angZ -= MPI2;\n"
"\t\t fac = cos(angTmp) / cos(angZ);\n"
"\t\t x *= fac;\n"
"\t\t y *= fac;\n"
@ -2861,7 +2861,7 @@ public:
<< "\n"
<< "\t\tcase MODE_BLUR_LEGACY:\n"
<< "\t\t radius = (MwcNext01(mwc) + MwcNext01(mwc) + 0.002 * MwcNext01(mwc)) / 2.002;\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - M_PI;\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
<< "\t\t Vx = radius * sin(theta);\n"
<< "\t\t Vy = radius * cos(theta);\n"
<< "\t\t radius = pow(Zeps(radius * radius), " << synthPower << " / 2);\n"
@ -2873,7 +2873,7 @@ public:
<< "\n"
<< "\t\tcase MODE_BLUR_NEW:\n"
<< "\t\t radius = 0.5 * (MwcNext01(mwc) + MwcNext01(mwc));\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - M_PI;\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
<< "\t\t radius = pow(Zeps(SQR(radius)), -" << synthPower << " / 2);\n"
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
<< "\t\t radius = Interpolate(radius, thetaFactor, synthSmooth);\n"
@ -2887,7 +2887,7 @@ public:
<< "\t\t theta = 2 * asin((MwcNext01(mwc) - 0.5) * 2);\n"
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
<< "\t\t Vy = Interpolate(Vy, thetaFactor, synthSmooth);\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (theta / M_PI);\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * (theta / MPI);\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * (Vy - 1);\n"
<< "\t\t break;\n"
<< "\n"
@ -2980,7 +2980,7 @@ public:
<< "\t\t theta = precalcAtanxy / 2;\n"
<< "\n"
<< "\t\t if (MwcNext01(mwc) < 0.5)\n"
<< "\t\t theta += M_PI;\n"
<< "\t\t theta += MPI;\n"
<< "\n"
<< "\t\t SynthSinCos(&synth, theta, &s, &c, synthSmooth);\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * radius * c;\n"
@ -2990,8 +2990,8 @@ public:
<< "\t\tcase MODE_DISC:\n"
<< "\t\t Vx = vIn.x;\n"
<< "\t\t Vy = vIn.y;\n"
<< "\t\t theta = precalcAtanxy / M_PI;\n"
<< "\t\t radius = M_PI * pow(Zeps(precalcSumSquares), " << synthPower << " / 2);\n"
<< "\t\t theta = precalcAtanxy / MPI;\n"
<< "\t\t radius = MPI * pow(Zeps(precalcSumSquares), " << synthPower << " / 2);\n"
<< "\t\t SynthSinCos(&synth, radius, &s, &c, synthSmooth);\n"
<< "\t\t vOut.x = xform->m_VariationWeights[" << varIndex << "] * s * theta;\n"
<< "\t\t vOut.y = xform->m_VariationWeights[" << varIndex << "] * c * theta;\n"
@ -3020,7 +3020,7 @@ public:
<< "\n"
<< "\t\tcase MODE_BLUR_RING:\n"
<< "\t\t radius = 1 + 0.1 * (MwcNext01(mwc) + MwcNext01(mwc) - 1) * " << synthPower << ";\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - M_PI;\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
<< "\t\t thetaFactor = SynthValue(&synth, theta);\n"
<< "\t\t radius = Interpolate(radius, thetaFactor, synthSmooth);\n"
<< "\t\t s = sincos(theta, &c);\n"
@ -3029,7 +3029,7 @@ public:
<< "\t\t break;\n"
<< "\n"
<< "\t\tcase MODE_BLUR_RING2:\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - M_PI;\n"
<< "\t\t theta = M_2PI * MwcNext01(mwc) - MPI;\n"
<< "\t\t radius = pow(Zeps(MwcNext01(mwc)), " << synthPower << ");\n"
<< "\t\t radius = SynthValue(&synth, theta) + 0.1 * radius;\n"
<< "\t\t s = sincos(theta, &c);\n"
@ -3354,11 +3354,11 @@ public:
" {\n"
" case SINCOS_MULTIPLY:\n"
" *s = *s * SynthValue(synth, theta);\n"
" *c = *c * SynthValue(synth, theta + M_PI / 2);\n"
" *c = *c * SynthValue(synth, theta + MPI / 2);\n"
" break;\n"
" case SINCOS_MIXIN:\n"
" *s = (1 - synth->SynthMix) * *s + (SynthValue(synth, theta) - 1);\n"
" *c = (1 - synth->SynthMix) * *c + (SynthValue(synth, theta + M_PI / 2) - 1);\n"
" *c = (1 - synth->SynthMix) * *c + (SynthValue(synth, theta + MPI / 2) - 1);\n"
" break;\n"
" }\n"
"\n"
@ -4206,7 +4206,7 @@ public:
<< "\t\t else\n"
<< "\t\t {\n"
<< "\t\t real_t x, s, c;\n"
<< "\t\t x = ((int)(MwcNext01(mwc) * 2)) ? " << workpower << " + (MwcNext01(mwc) * " << scatter << " + " << offset << " + edge) * M_PI : -(MwcNext01(mwc) * " << scatter << " + " << offset << " + edge) * M_PI;\n"
<< "\t\t x = ((int)(MwcNext01(mwc) * 2)) ? " << workpower << " + (MwcNext01(mwc) * " << scatter << " + " << offset << " + edge) * MPI : -(MwcNext01(mwc) * " << scatter << " + " << offset << " + edge) * MPI;\n"
<< "\t\t s = sincos(x, &c);\n"
<< "\n"
<< "\t\t if (" << staticc << " > 1 || " << staticc << " == -1)\n"
@ -4236,7 +4236,7 @@ public:
<< "\t\t }\n"
<< "\t\t else\n"
<< "\t\t {\n"
<< "\t\t real_t xang = (ang + M_PI) / " << alpha << ";\n"
<< "\t\t real_t xang = (ang + MPI) / " << alpha << ";\n"
<< "\t\t xang = xang - (int)xang;\n"
<< "\t\t xang = (xang < 0.5) ? xang : 1 - xang;\n"
<< "\t\t coeff = 1 / cos(xang * " << alpha << ");\n"
@ -4641,10 +4641,10 @@ public:
<< "\t\treal_t r = precalcSqrtSumSquares;\n"
<< "\t\treal_t a2 = a + " << angle << ";\n"
<< "\n"
<< "\t\tif (a2 < -M_PI)\n"
<< "\t\tif (a2 < -MPI)\n"
<< "\t\t a2 += M_2PI;\n"
<< "\n"
<< "\t\tif (a2 > M_PI)\n"
<< "\t\tif (a2 > MPI)\n"
<< "\t\t a2 -= M_2PI;\n"
<< "\n"
<< "\t\treal_t s, c;\n"
@ -4654,7 +4654,7 @@ public:
<< "\n"
<< "\t\tif (" << hypergon << " != 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = fmod(fabs(a), (real_t)M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
<< "\t\t temp1 = fmod(fabs(a), (real_t)M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
<< "\n"
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
@ -4669,13 +4669,13 @@ public:
<< "\n"
<< "\t\tif (" << star << "!= 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), (real_t)M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), (real_t)M_2PI / " << starN << ") - MPI / " << starN << "));\n"
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << lituus << " != 0)\n"
<< "\t\t{\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / MPI + 1), " << invLituusA << ");\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << super << " != 0)\n"
@ -4689,7 +4689,7 @@ public:
<< "\t\t{\n"
<< "\t\t if (" << hypergon << " != 0.0)\n"
<< "\t\t {\n"
<< "\t\t temp1 = fmod(fabs(a2), (real_t)M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
<< "\t\t temp1 = fmod(fabs(a2), (real_t)M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
<< "\n"
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
@ -4704,13 +4704,13 @@ public:
<< "\n"
<< "\t\t if (" << star << " != 0)\n"
<< "\t\t {\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a2), (real_t)M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a2), (real_t)M_2PI / " << starN << ") - MPI / " << starN << "));\n"
<< "\t\t total2 += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
<< "\t\t }\n"
<< "\n"
<< "\t\t if (" << lituus << " != 0)\n"
<< "\t\t {\n"
<< "\t\t total2 += " << lituus << " * pow(fabs(a2 / M_PI + 1), " << invLituusA << ");\n"
<< "\t\t total2 += " << lituus << " * pow(fabs(a2 / MPI + 1), " << invLituusA << ");\n"
<< "\t\t }\n"
<< "\n"
<< "\t\t if (" << super << " != 0)\n"
@ -4895,7 +4895,7 @@ public:
<< "\n"
<< "\t\tif (" << hypergon << " != 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
<< "\n"
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
@ -4910,13 +4910,13 @@ public:
<< "\n"
<< "\t\tif (" << star << " != 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << lituus << " != 0)\n"
<< "\t\t{\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / MPI + 1), " << invLituusA << ");\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << super << " != 0)\n"
@ -5092,7 +5092,7 @@ public:
<< "\n"
<< "\t\tif (" << hypergon << " != 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
<< "\n"
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
@ -5107,13 +5107,13 @@ public:
<< "\n"
<< "\t\tif (" << star << " != 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << lituus << " != 0)\n"
<< "\t\t{\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / MPI + 1), " << invLituusA << ");\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << super << " != 0)\n"
@ -5290,7 +5290,7 @@ public:
<< "\n"
<< "\t\tif (" << hypergon << " != 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - M_PI / " << hypergonN << ";\n"
<< "\t\t temp1 = fmod(fabs(a), M_2PI / " << hypergonN << ") - MPI / " << hypergonN << ";\n"
<< "\t\t temp2 = Sqr(tan(temp1)) + 1;\n"
<< "\n"
<< "\t\t if (temp2 >= Sqr(" << hypergonD << "))\n"
@ -5305,13 +5305,13 @@ public:
<< "\n"
<< "\t\tif (" << star << " != 0)\n"
<< "\t\t{\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - M_PI / " << starN << "));\n"
<< "\t\t temp1 = tan(fabs(fmod(fabs(a), M_2PI / " << starN << ") - MPI / " << starN << "));\n"
<< "\t\t total += " << star << " * sqrt(Sqr(" << tanStarSlope << ") * (1 + Sqr(temp1)) / Sqr(temp1 + " << tanStarSlope << "));\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << lituus << " != 0)\n"
<< "\t\t{\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / M_PI + 1), " << invLituusA << ");\n"
<< "\t\t total += " << lituus << " * pow(fabs(a / MPI + 1), " << invLituusA << ");\n"
<< "\t\t}\n"
<< "\n"
<< "\t\tif (" << super << " != 0)\n"