fractorium/Source/EmberCL/FinalAccumOpenCLKernelCreator.h
mfeemster eecd3c254f --User changes
-Remove Hue as a saved parameter, as well as animation parameters associated with it. It's now a GUI-only field that is never saved.
 -Make histogram, density filter buffer, and all associated fields always float, even when using double. In that case, only the iteration calculations are now double. Suggested by Thomas Ludwig.
 -Print all three kernels in EmberRender when the --dump_kernel option is specified.
 -Apply variations filter to randoms.

--Bug fixes
 -Fix bug where hue was not being preserved when switching controllers and embers. Very hard to repro bug, but mostly overcome by eliminating hue as a saved parameter.

--Code changes
 -De-templatized DEOpenCLKernelCreator and FinalAccumOpenCLKernelCreator. They now just take a bool as a parameter to specify double precision.
 -To accommodate the buffers being float, introduce a new #define types in EmberCL called real4_bucket, and real4reals_bucket.
 -Density and spatial filtering structs now use this type.
 -ConvertDensityFilter() and ConvertSpatialFilter() no longer return a value, they just assign to the member.
2015-08-10 20:10:23 -07:00

82 lines
3.3 KiB
C++

#pragma once
#include "EmberCLPch.h"
#include "EmberCLStructs.h"
#include "EmberCLFunctions.h"
/// <summary>
/// FinalAccumOpenCLKernelCreator class.
/// </summary>
namespace EmberCLns
{
/// <summary>
/// Class for creating the final accumulation code in OpenCL.
/// There are many conditionals in the CPU code to create the
/// final output image. This class creates many different kernels
/// with all conditionals and unnecessary calculations stripped out.
/// The conditionals are:
/// Early clip/late clip
/// Alpha channel, no alpha channel
/// Alpha with/without transparency
/// </summary>
class EMBERCL_API FinalAccumOpenCLKernelCreator
{
public:
FinalAccumOpenCLKernelCreator(bool doublePrecision);
string GammaCorrectionWithAlphaCalcKernel();
string GammaCorrectionWithAlphaCalcEntryPoint();
string GammaCorrectionWithoutAlphaCalcKernel();
string GammaCorrectionWithoutAlphaCalcEntryPoint();
string FinalAccumEarlyClipKernel();
string FinalAccumEarlyClipEntryPoint();
string FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumKernel();
string FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumEntryPoint();
string FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumKernel();
string FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumEntryPoint();
string FinalAccumLateClipKernel();
string FinalAccumLateClipEntryPoint();
string FinalAccumLateClipWithAlphaCalcWithAlphaAccumKernel();
string FinalAccumLateClipWithAlphaCalcWithAlphaAccumEntryPoint();
string FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel();
string FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumEntryPoint();
string GammaCorrectionEntryPoint(size_t channels, bool transparency);
string GammaCorrectionKernel(size_t channels, bool transparency);
string FinalAccumEntryPoint(bool earlyClip, size_t channels, bool transparency, double& alphaBase, double& alphaScale);
string FinalAccumKernel(bool earlyClip, size_t channels, bool transparency);
private:
string CreateFinalAccumKernelString(bool earlyClip, size_t channels, bool transparency);
string CreateGammaCorrectionKernelString(bool alphaCalc);
string CreateFinalAccumKernelString(bool earlyClip, bool alphaCalc, bool alphaAccum);
string CreateGammaCorrectionFunctionString(bool globalBucket, bool alphaCalc, bool alphaAccum, bool finalOut);
string CreateCalcNewRgbFunctionString(bool globalBucket);
string m_GammaCorrectionWithAlphaCalcKernel;
string m_GammaCorrectionWithAlphaCalcEntryPoint;
string m_GammaCorrectionWithoutAlphaCalcKernel;
string m_GammaCorrectionWithoutAlphaCalcEntryPoint;
string m_FinalAccumEarlyClipKernel;//False, false.
string m_FinalAccumEarlyClipEntryPoint;
string m_FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumKernel;//True, true.
string m_FinalAccumEarlyClipWithAlphaCalcWithAlphaAccumEntryPoint;
string m_FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumKernel;//False, true.
string m_FinalAccumEarlyClipWithoutAlphaCalcWithAlphaAccumEntryPoint;
string m_FinalAccumLateClipKernel;//False, false.
string m_FinalAccumLateClipEntryPoint;
string m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumKernel;//True, true.
string m_FinalAccumLateClipWithAlphaCalcWithAlphaAccumEntryPoint;
string m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumKernel;//False, true.
string m_FinalAccumLateClipWithoutAlphaCalcWithAlphaAccumEntryPoint;
bool m_DoublePrecision;
};
}