--User changes

-Add post_smartcrop.

--Bug fixes
 -Fix bug in crackle.
 -Wrong point assignment in hexaplay3D, hexnix3D.
 -Improper Z assignment in rblur.
 -Fix inconsistency with original in circlecrop.
 -Put EMBER_ROOT bakc to ./../../../ in default.pri. This is TBD.

--Code changes
 -Convert all enums to class enum to be consistent with C++11 style.
 -Convert some if/else statements in filter classes to case statements.
 -Add overloaded stream operators to print various enums.
 -Optimize crob, nBlur.
 -Fix weird assignment statement in falloff3.
 -Cleanup in VarFuncs::SimplexNoise3D().
 -Replace fabs() with std::abs().
 -General cleanup.
This commit is contained in:
mfeemster
2016-01-12 20:42:12 -08:00
parent a8688e87b5
commit a3ecbbf690
22 changed files with 1402 additions and 1546 deletions

View File

@ -120,15 +120,12 @@ FunctionMapper::FunctionMapper()
m_GlobalMap["Vratio"] =
"inline real_t Vratio(real2* p, real2* q, real2* u)\n"
"{\n"
" real_t pmQx, pmQy;\n"
" real2 pmq = *p - *q;\n"
"\n"
" pmQx = (*p).x - (*q).x;\n"
" pmQy = (*p).y - (*q).y;\n"
"\n"
" if (pmQx == 0 && pmQy == 0)\n"
" if (pmq.x == 0 && pmq.y == 0)\n"
" return 1.0;\n"
"\n"
" return 2 * (((*u).x - (*q).x) * pmQx + ((*u).y - (*q).y) * pmQy) / (pmQx * pmQx + pmQy * pmQy);\n"
" return 2 * (((*u).x - (*q).x) * pmq.x + ((*u).y - (*q).y) * pmq.y) / (SQR(pmq.x) + SQR(pmq.y));\n"
"}\n";
m_GlobalMap["Closest"] =
"inline int Closest(real2* p, int n, real2* u)\n"
@ -177,11 +174,11 @@ FunctionMapper::FunctionMapper()
" real_t n = 0;\n"
" int gi[4];\n"
" real_t t;\n"
" real_t skewIn = ((*v).x + (*v).y + (*v).z) * 0.3333;\n"
" real_t skewIn = ((*v).x + (*v).y + (*v).z) * 0.333333;\n"
" int i = (int)floor((*v).x + skewIn);\n"
" int j = (int)floor((*v).y + skewIn);\n"
" int k = (int)floor((*v).z + skewIn);\n"
" t = (i + j + k) * 0.16666;\n"
" t = (i + j + k) * 0.1666666;\n"
" real_t x0 = i - t;\n"
" real_t y0 = j - t;\n"
" real_t z0 = k - t;\n"
@ -228,15 +225,15 @@ FunctionMapper::FunctionMapper()
" }\n"
" }\n"
"\n"
" c[1].x = c[0].x - i1 + 0.16666;\n"
" c[1].y = c[0].y - j1 + 0.16666;\n"
" c[1].z = c[0].z - k1 + 0.16666;\n"
" c[2].x = c[0].x - i2 + 2 * 0.16666;\n"
" c[2].y = c[0].y - j2 + 2 * 0.16666;\n"
" c[2].z = c[0].z - k2 + 2 * 0.16666;\n"
" c[3].x = c[0].x - 1 + 3 * 0.16666;\n"
" c[3].y = c[0].y - 1 + 3 * 0.16666;\n"
" c[3].z = c[0].z - 1 + 3 * 0.16666;\n"
" c[1].x = c[0].x - i1 + 0.1666666;\n"
" c[1].y = c[0].y - j1 + 0.1666666;\n"
" c[1].z = c[0].z - k1 + 0.1666666;\n"
" c[2].x = c[0].x - i2 + 2 * 0.1666666;\n"
" c[2].y = c[0].y - j2 + 2 * 0.1666666;\n"
" c[2].z = c[0].z - k2 + 2 * 0.1666666;\n"
" c[3].x = c[0].x - 1 + 3 * 0.1666666;\n"
" c[3].y = c[0].y - 1 + 3 * 0.1666666;\n"
" c[3].z = c[0].z - 1 + 3 * 0.1666666;\n"
" int ii = i & 0x3ff;\n"
" int jj = j & 0x3ff;\n"
" int kk = k & 0x3ff;\n"
@ -246,7 +243,7 @@ FunctionMapper::FunctionMapper()
" gi[3] = (int)p[ii + 1 + (int)p[jj + 1 + (int)p[kk + 1]]];\n"
" for (uint corner = 0; corner < 4; corner++)\n"
" {\n"
" t = 0.6 - c[corner].x * c[corner].x - c[corner].y * c[corner].y - c[corner].z * c[corner].z;\n"
" t = 0.6 - Sqr(c[corner].x) - Sqr(c[corner].y) - Sqr(c[corner].z);\n"
"\n"
" if (t > 0)\n"
" {\n"
@ -267,7 +264,7 @@ FunctionMapper::FunctionMapper()
"\n"
" for (i = 0; i < octaves; i++)\n"
" {\n"
" n += SimplexNoise3D(&u, p, grad) / a;\n"
" n += SimplexNoise3D(&u, p, grad) / Zeps(a);\n"
" a *= aScale;\n"
" u.x *= fScale;\n"
" u.y *= fScale;\n"

View File

@ -651,11 +651,8 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(const Ember<T>& ember, pair<
{
for (auto l = 0; l < elements; l++)
params.second.push_back(*(parVar->Params()[k].Param() + l));
//params.second.push_back(parVar->Params()[k].ParamVal());
}
//size++;
size += elements;
}
}

View File

@ -979,6 +979,7 @@ bool OpenCLWrapper::CreateSPK(const string& name, const string& program, const s
//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");
//err = spk.m_Program.build(m_DeviceVec, "-cl-mad-enable -cl-no-signed-zeros -cl-fast-relaxed-math -cl-single-precision-constant");//This can cause some rounding.
//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-mad-enable -cl-single-precision-constant");
if (m_Info->CheckCL(err, "cl::Program::build()"))