mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 05:46:06 -04:00
--User changes
-Support 4k monitors, and in general, properly scale any monitor that is not HD. -Allow for a spatial filter of radius zero, which means do not use a spatial filter. -Add new variations: concentric, cpow3, helicoid, helix, rand_cubes, sphereblur. -Use a new method for computing elliptic which is more precise. Developed by Discord user Claude. -Remove the 8 variation per xform limitation on the GPU. -Allow for loading the last flame file on startup, rather than randoms. -Use two different default quality values in the interactive renderer, one each for CPU and GPU. -Creating linked xforms was using non-standard behavior. Make it match Apo and also support creating multiple linked xforms at once. --Bug fixes -No variations in an xform used to have the same behavior as a single linear variation with weight 1. While sensible, this breaks backward compatibility. No variations now sets the output point to zeroes. -Prevent crashing the program when adjusting a value on the main window while a final render is in progress. -The xaos table was inverted. --Code changes -Convert projects to Visual Studio 2017. -Change bad vals from +- 1e10 to +-1e20. -Reintroduce the symmetry tag in xforms for legacy support in programs that do not use color_speed. -Compiler will not let us use default values in templated member functions anymore.
This commit is contained in:
@ -72,7 +72,7 @@ static string ConstantDefinesString(bool doublePrecision)
|
||||
"#define COLORMAP_LENGTH 256u\n"
|
||||
"#define COLORMAP_LENGTH_MINUS_1 255\n"
|
||||
"#define DE_THRESH 100u\n"
|
||||
"#define BadVal(x) (((x) != (x)) || ((x) > 1e10) || ((x) < -1e10))\n"
|
||||
"#define BadVal(x) (((x) != (x)) || ((x) > 1e20) || ((x) < -1e20))\n"
|
||||
"#define SQR(x) ((x) * (x))\n"
|
||||
"#define CUBE(x) ((x) * (x) * (x))\n"
|
||||
"#define MPI ((real_t)M_PI)\n"
|
||||
@ -158,9 +158,6 @@ static const char* PointCLStructString =
|
||||
"} Point;\n"
|
||||
"\n";
|
||||
|
||||
#define MAX_CL_VARS 8//These must always match.
|
||||
#define MAX_CL_VARS_STRING "8"
|
||||
|
||||
/// <summary>
|
||||
/// A structure on the host used to hold all of the needed information for an xform used on the device to iterate in OpenCL.
|
||||
/// Template argument expected to be float or double.
|
||||
@ -169,12 +166,11 @@ template <typename T>
|
||||
struct ALIGN XformCL
|
||||
{
|
||||
T m_A, m_B, m_C, m_D, m_E, m_F;//24 (48)
|
||||
T m_VariationWeights[MAX_CL_VARS];//56 (112)
|
||||
T m_PostA, m_PostB, m_PostC, m_PostD, m_PostE, m_PostF;//80 (160)
|
||||
T m_DirectColor;//84 (168)
|
||||
T m_ColorSpeedCache;//88 (176)
|
||||
T m_OneMinusColorCache;//92 (184)
|
||||
T m_Opacity;//96 (192)
|
||||
T m_PostA, m_PostB, m_PostC, m_PostD, m_PostE, m_PostF;//48 (96)
|
||||
T m_DirectColor;//52 (104)
|
||||
T m_ColorSpeedCache;//56 (112)
|
||||
T m_OneMinusColorCache;//60 (120)
|
||||
T m_Opacity;//64 (128)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@ -184,7 +180,6 @@ static const char* XformCLStructString =
|
||||
"typedef struct __attribute__ " ALIGN_CL " _XformCL\n"
|
||||
"{\n"
|
||||
" real_t m_A, m_B, m_C, m_D, m_E, m_F;\n"
|
||||
" real_t m_VariationWeights[" MAX_CL_VARS_STRING "];\n"
|
||||
" real_t m_PostA, m_PostB, m_PostC, m_PostD, m_PostE, m_PostF;\n"
|
||||
" real_t m_DirectColor;\n"
|
||||
" real_t m_ColorSpeedCache;\n"
|
||||
|
@ -125,6 +125,16 @@ FunctionMapper::FunctionMapper()
|
||||
" *val1 = *val2;\n"
|
||||
" *val2 = tmp;\n"
|
||||
"}\n";
|
||||
s_GlobalMap["Hash"] =
|
||||
"inline real_t Hash(int a)\n"
|
||||
"{\n"
|
||||
" a = (a ^ 61) ^ (a >> 16);\n"
|
||||
" a = a + (a << 3);\n"
|
||||
" a = a ^ (a >> 4);\n"
|
||||
" a = a * 0x27d4eb2d;\n"
|
||||
" a = a ^ (a >> 15);\n"
|
||||
" return (real_t)a / INT_MAX;\n"
|
||||
"}\n";
|
||||
s_GlobalMap["Vratio"] =
|
||||
"inline real_t Vratio(real2* p, real2* q, real2* u)\n"
|
||||
"{\n"
|
||||
|
@ -96,9 +96,9 @@ string IterOpenCLKernelCreator<T>::CreateIterKernelString(const Ember<T>& ember,
|
||||
if (xform->PreVariationCount() + xform->VariationCount() == 0)
|
||||
{
|
||||
xformFuncs <<
|
||||
" outPoint->m_X = (xform->m_A * inPoint->m_X) + (xform->m_B * inPoint->m_Y) + xform->m_C;\n" <<
|
||||
" outPoint->m_Y = (xform->m_D * inPoint->m_X) + (xform->m_E * inPoint->m_Y) + xform->m_F;\n" <<
|
||||
" outPoint->m_Z = inPoint->m_Z;\n";
|
||||
" outPoint->m_X = 0;\n"
|
||||
" outPoint->m_Y = 0;\n"
|
||||
" outPoint->m_Z = 0;\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -577,7 +577,7 @@ string IterOpenCLKernelCreator<T>::GlobalFunctionsString(const Ember<T>& ember)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an OpenCL string of #defines and a corresponding host side vector for parametric variation values.
|
||||
/// Create an OpenCL string of #defines and a corresponding host side vector for variation weights and parametric variation values.
|
||||
/// Parametric variations present a special problem in the iteration code.
|
||||
/// The values can't be passed in with the array of other xform values because
|
||||
/// the length of the parametric values is unknown.
|
||||
@ -609,6 +609,7 @@ string IterOpenCLKernelCreator<T>::GlobalFunctionsString(const Ember<T>& ember)
|
||||
/// The variations use these #defines by first looking up the index of the
|
||||
/// xform they belong to in the parent ember and generating the OpenCL string based on that
|
||||
/// in their overridden OpenCLString() functions.
|
||||
/// Note that variation weights are also included in this buffer and are looked up in a similar manner.
|
||||
/// Template argument expected to be float or double.
|
||||
/// </summary>
|
||||
/// <param name="ember">The ember to create the values from</param>
|
||||
@ -618,7 +619,7 @@ string IterOpenCLKernelCreator<T>::GlobalFunctionsString(const Ember<T>& ember)
|
||||
template <typename T>
|
||||
void IterOpenCLKernelCreator<T>::ParVarIndexDefines(const Ember<T>& ember, pair<string, vector<T>>& params, bool doVals, bool doString)
|
||||
{
|
||||
size_t i = 0, j, k, size = 0;
|
||||
size_t i = 0, size = 0;
|
||||
ostringstream os;
|
||||
|
||||
if (doVals)
|
||||
@ -626,13 +627,19 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(const Ember<T>& ember, pair<
|
||||
|
||||
while (auto xform = ember.GetTotalXform(i))
|
||||
{
|
||||
size_t varCount = xform->TotalVariationCount();
|
||||
size_t j = 0;
|
||||
|
||||
for (j = 0; j < varCount; j++)
|
||||
while (auto var = xform->GetVariation(j))
|
||||
{
|
||||
if (auto parVar = dynamic_cast<ParametricVariation<T>*>(xform->GetVariation(j)))
|
||||
if (doString)
|
||||
os << "#define WEIGHT_" << i << "_" << j << " " << size++ << "\n";//Uniquely identify the weight of this variation in this xform.
|
||||
|
||||
if (doVals)
|
||||
params.second.push_back(var->m_Weight);
|
||||
|
||||
if (auto parVar = dynamic_cast<ParametricVariation<T>*>(var))
|
||||
{
|
||||
for (k = 0; k < parVar->ParamCount(); k++)
|
||||
for (size_t k = 0; k < parVar->ParamCount(); k++)
|
||||
{
|
||||
if (!parVar->Params()[k].IsState())
|
||||
{
|
||||
@ -651,6 +658,8 @@ void IterOpenCLKernelCreator<T>::ParVarIndexDefines(const Ember<T>& ember, pair<
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
i++;
|
||||
|
@ -1772,9 +1772,6 @@ void RendererCL<T, bucketT>::ConvertEmber(Ember<T>& ember, EmberCL<T>& emberCL,
|
||||
xformsCL[i].m_ColorSpeedCache = xform->ColorSpeedCache();
|
||||
xformsCL[i].m_OneMinusColorCache = xform->OneMinusColorCache();
|
||||
xformsCL[i].m_Opacity = xform->m_Opacity;
|
||||
|
||||
for (size_t varIndex = 0; varIndex < xform->TotalVariationCount() && varIndex < MAX_CL_VARS; varIndex++)//Assign all variation weights for this xform, with a max of MAX_CL_VARS.
|
||||
xformsCL[i].m_VariationWeights[varIndex] = xform->GetVariation(varIndex)->m_Weight;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user