mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-22 05:30:06 -05:00
6ba16888e3
-Add new variations: crackle, dc_perlin. -Make default palette interp mode be linear instead of step. -Make summary tab the selected one in the Info tab. -Allow for highlight power of up to 10. It was previously limited to 2. --Bug fixes -Direct color calculations were wrong. -Flattening was not applied to final xform. -Fix "pure virtual function call" error on shutdown. --Code changes -Allow for array precalc params in variations by adding a size member to the ParamWithName class. -In IterOpenCLKernelCreator, memcpy precalc params instead of a direct assign since they can now be of variable length. -Add new file VarFuncs to consolidate some functions that are common to multiple variations. This also contains texture data for crackle and dc_perlin. -Place OpenCL versions of these functions in the FunctionMapper class in the EmberCL project. -Add new Singleton class that uses CRTP, is thread safe, and deletes after the last reference goes away. This fixes the usual "delete after main()" problem with singletons that use the static local function variable pattern. -Began saving files with AStyle autoformatter turned on. This will eventually touch all files as they are worked on. -Add missing backslash to CUDA include and library paths for builds on Nvidia systems. -Add missing gl.h include for Windows. -Remove glew include paths from Fractorium, it's not used. -Remove any Nvidia specific #defines and build targets, they are no longer needed with OpenCL 1.2. -Fix bad paths on linux build. -General cleanup.
83 lines
2.9 KiB
C++
83 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#include "EmberCLPch.h"
|
|
#include "EmberCLStructs.h"
|
|
#include "EmberCLFunctions.h"
|
|
#include "FunctionMapper.h"
|
|
|
|
/// <summary>
|
|
/// IterOpenCLKernelCreator class.
|
|
/// </summary>
|
|
|
|
namespace EmberCLns
|
|
{
|
|
/// <summary>
|
|
/// Class for creating the main iteration code in OpenCL.
|
|
/// It uses the Cuburn method of iterating where all conditionals
|
|
/// are stripped out and a specific kernel is compiled at run-time.
|
|
/// It uses a very sophisticated method for randomization that avoids
|
|
/// the problem of warp/wavefront divergence that would occur if every
|
|
/// thread selected a random xform to apply.
|
|
/// This only works with embers of type float, double is not supported.
|
|
/// </summary>
|
|
template <typename T>
|
|
class EMBERCL_API IterOpenCLKernelCreator
|
|
{
|
|
public:
|
|
IterOpenCLKernelCreator();
|
|
const string& ZeroizeKernel() const;
|
|
const string& ZeroizeEntryPoint() const;
|
|
const string& SumHistKernel() const;
|
|
const string& SumHistEntryPoint() const;
|
|
const string& IterEntryPoint() const;
|
|
string CreateIterKernelString(const Ember<T>& ember, const string& parVarDefines, const string& globalSharedDefines, bool lockAccum = false, bool doAccum = true);
|
|
string GlobalFunctionsString(const Ember<T>& ember);
|
|
static void ParVarIndexDefines(const Ember<T>& ember, pair<string, vector<T>>& params, bool doVals = true, bool doString = true);
|
|
static void SharedDataIndexDefines(const Ember<T>& ember, pair<string, vector<T>>& params, bool doVals = true, bool doString = true);
|
|
static string VariationStateString(const Ember<T>& ember);
|
|
static string VariationStateInitString(const Ember<T>& ember);
|
|
static bool IsBuildRequired(const Ember<T>& ember1, const Ember<T>& ember2);
|
|
|
|
private:
|
|
string CreateZeroizeKernelString() const;
|
|
string CreateSumHistKernelString() const;
|
|
string CreateProjectionString(const Ember<T>& ember) const;
|
|
|
|
string m_IterEntryPoint;
|
|
string m_ZeroizeKernel;
|
|
string m_ZeroizeEntryPoint;
|
|
string m_SumHistKernel;
|
|
string m_SumHistEntryPoint;
|
|
FunctionMapper m_FunctionMapper;
|
|
};
|
|
|
|
#ifdef OPEN_CL_TEST_AREA
|
|
typedef void (*KernelFuncPointer) (size_t gridWidth, size_t gridHeight, size_t blockWidth, size_t blockHeight,
|
|
size_t BLOCK_ID_X, size_t BLOCK_ID_Y, size_t THREAD_ID_X, size_t THREAD_ID_Y);
|
|
|
|
static void OpenCLSim(size_t gridWidth, size_t gridHeight, size_t blockWidth, size_t blockHeight, KernelFuncPointer func)
|
|
{
|
|
cout << "OpenCLSim(): " << endl;
|
|
cout << " Params: " << endl;
|
|
cout << " gridW: " << gridWidth << endl;
|
|
cout << " gridH: " << gridHeight << endl;
|
|
cout << " blockW: " << blockWidth << endl;
|
|
cout << " blockH: " << blockHeight << endl;
|
|
|
|
for (size_t i = 0; i < gridHeight; i += blockHeight)
|
|
{
|
|
for (size_t j = 0; j < gridWidth; j += blockWidth)
|
|
{
|
|
for (size_t k = 0; k < blockHeight; k++)
|
|
{
|
|
for (size_t l = 0; l < blockWidth; l++)
|
|
{
|
|
func(gridWidth, gridHeight, blockWidth, blockHeight, j / blockWidth, i / blockHeight, l, k);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
}
|