2014-07-08 03:11:14 -04:00
|
|
|
#pragma once
|
2014-12-05 21:30:46 -05:00
|
|
|
|
2014-07-08 03:11:14 -04:00
|
|
|
#include "EmberCLPch.h"
|
|
|
|
#include "EmberCLStructs.h"
|
|
|
|
#include "EmberCLFunctions.h"
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// DEOpenCLKernelCreator class.
|
|
|
|
/// </summary>
|
|
|
|
|
2014-11-28 04:37:51 -05:00
|
|
|
//#define ROW_ONLY_DE 1
|
|
|
|
|
2014-07-08 03:11:14 -04:00
|
|
|
namespace EmberCLns
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Kernel creator for density filtering.
|
|
|
|
/// This implements both basic log scale filtering
|
|
|
|
/// as well as the full flam3 density estimation filtering
|
|
|
|
/// in OpenCL.
|
|
|
|
/// Several conditionals are present in the CPU version. They
|
|
|
|
/// are stripped out of the kernels and instead a separate kernel
|
|
|
|
/// is created for every possible case.
|
|
|
|
/// If the filter width is 9 or less, then the entire process can be
|
|
|
|
/// done in shared memory which is very fast.
|
|
|
|
/// However, if the filter width is greater than 9, shared memory is not
|
|
|
|
/// used and all filtering is done directly with main global VRAM. This
|
|
|
|
/// ends up being not much faster than doing it on the CPU.
|
|
|
|
/// String members are kept for the program source and entry points
|
|
|
|
/// for each version of the program.
|
|
|
|
/// </summary>
|
|
|
|
class EMBERCL_API DEOpenCLKernelCreator
|
|
|
|
{
|
|
|
|
public:
|
2015-08-10 23:10:23 -04:00
|
|
|
DEOpenCLKernelCreator(bool doublePrecision, bool nVidia);
|
2014-07-08 03:11:14 -04:00
|
|
|
|
|
|
|
//Accessors.
|
2015-08-12 21:51:07 -04:00
|
|
|
const string& LogScaleAssignDEKernel() const;
|
|
|
|
const string& LogScaleAssignDEEntryPoint() const;
|
|
|
|
const string& GaussianDEKernel(size_t ss, uint filterWidth) const;
|
|
|
|
const string& GaussianDEEntryPoint(size_t ss, uint filterWidth) const;
|
2014-07-08 03:11:14 -04:00
|
|
|
|
|
|
|
//Miscellaneous static functions.
|
2014-12-06 00:05:09 -05:00
|
|
|
static uint MaxDEFilterSize();
|
2016-03-01 20:26:45 -05:00
|
|
|
static double SolveMaxDERad(double desiredFilterSize, double ss);
|
2014-12-06 00:05:09 -05:00
|
|
|
static uint SolveMaxBoxSize(uint localMem);
|
2014-07-08 03:11:14 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
//Kernel creators.
|
|
|
|
string CreateLogScaleAssignDEKernelString();
|
2014-10-14 11:53:15 -04:00
|
|
|
string CreateGaussianDEKernel(size_t ss);
|
|
|
|
string CreateGaussianDEKernelNoLocalCache(size_t ss);
|
2014-12-05 21:30:46 -05:00
|
|
|
|
2014-07-08 03:11:14 -04:00
|
|
|
string m_LogScaleAssignDEKernel;
|
|
|
|
string m_LogScaleAssignDEEntryPoint;
|
|
|
|
|
|
|
|
string m_GaussianDEWithoutSsKernel;
|
|
|
|
string m_GaussianDEWithoutSsEntryPoint;
|
|
|
|
|
|
|
|
string m_GaussianDESsWithScfKernel;
|
|
|
|
string m_GaussianDESsWithScfEntryPoint;
|
|
|
|
|
|
|
|
string m_GaussianDESsWithoutScfKernel;
|
|
|
|
string m_GaussianDESsWithoutScfEntryPoint;
|
|
|
|
|
|
|
|
string m_GaussianDEWithoutSsNoCacheKernel;
|
|
|
|
string m_GaussianDEWithoutSsNoCacheEntryPoint;
|
|
|
|
|
|
|
|
string m_GaussianDESsWithScfNoCacheKernel;
|
|
|
|
string m_GaussianDESsWithScfNoCacheEntryPoint;
|
|
|
|
|
|
|
|
string m_GaussianDESsWithoutScfNoCacheKernel;
|
|
|
|
string m_GaussianDESsWithoutScfNoCacheEntryPoint;
|
|
|
|
|
2015-08-10 23:10:23 -04:00
|
|
|
bool m_DoublePrecision;
|
2014-07-08 03:11:14 -04:00
|
|
|
bool m_NVidia;
|
|
|
|
};
|
|
|
|
}
|