diff --git a/Source/EmberCL/EmberCLFunctions.h b/Source/EmberCL/EmberCLFunctions.h index dddf748..a5f0d0f 100644 --- a/Source/EmberCL/EmberCLFunctions.h +++ b/Source/EmberCL/EmberCLFunctions.h @@ -14,7 +14,7 @@ namespace EmberCLns /// /// OpenCL equivalent of Palette::RgbToHsv(). /// -static const char* RgbToHsvFunctionString = +static constexpr char RgbToHsvFunctionString[] = //rgb 0 - 1, //h 0 - 6, s 0 - 1, v 0 - 1 "static inline void RgbToHsv(real4_bucket* rgb, real4_bucket* hsv)\n" @@ -84,7 +84,7 @@ static const char* RgbToHsvFunctionString = /// /// OpenCL equivalent of Palette::HsvToRgb(). /// -static const char* HsvToRgbFunctionString = +static constexpr char HsvToRgbFunctionString[] = //h 0 - 6, s 0 - 1, v 0 - 1 //rgb 0 - 1 "static inline void HsvToRgb(real4_bucket* hsv, real4_bucket* rgb)\n" @@ -120,7 +120,7 @@ static const char* HsvToRgbFunctionString = /// /// OpenCL equivalent of Palette::CalcAlpha(). /// -static const char* CalcAlphaFunctionString = +static constexpr char CalcAlphaFunctionString[] = "static inline real_t CalcAlpha(real_bucket_t density, real_bucket_t gamma, real_bucket_t linrange)\n"//Not the slightest clue what this is doing.//DOC "{\n" " real_bucket_t frac, alpha, funcval = pow(linrange, gamma);\n" @@ -148,7 +148,7 @@ static const char* CalcAlphaFunctionString = /// Only use float here instead of real_t because the output will be passed to write_imagef() /// during final accumulation, which only takes floats. /// -static const char* CurveAdjustFunctionString = +static constexpr char CurveAdjustFunctionString[] = "static inline void CurveAdjust(__global real4reals_bucket* csa, float* a, uint index)\n" "{\n" " uint tempIndex = (uint)clamp(*a * CURVES_LENGTH_M1, 0.0f, CURVES_LENGTH_M1);\n" @@ -163,7 +163,7 @@ static const char* CurveAdjustFunctionString = /// random numbers in OpenCL, instead of ISAAC which was used /// for CPU rendering. /// -static const char* RandFunctionString = +static constexpr char RandFunctionString[] = "enum { MWC64X_A = 4294883355u };\n\n" "inline uint MwcNext(uint2* s)\n" "{\n" @@ -219,7 +219,7 @@ static const char* RandFunctionString = /// /// OpenCL equivalent Renderer::AddToAccum(). /// -static const char* AddToAccumWithCheckFunctionString = +static constexpr char AddToAccumWithCheckFunctionString[] = "inline bool AccumCheck(int superRasW, int superRasH, int i, int ii, int j, int jj)\n" "{\n" " return (j + jj >= 0 && j + jj < superRasH && i + ii >= 0 && i + ii < superRasW);\n" @@ -230,7 +230,7 @@ static const char* AddToAccumWithCheckFunctionString = /// OpenCL equivalent various CarToRas member functions. /// Normaly would subtract m_RasLlX and m_RasLlY, but they were negated in RendererCL before being passed in, so they could be used with fma(). /// -static const char* CarToRasFunctionString = +static constexpr char CarToRasFunctionString[] = "inline void CarToRasConvertPointToSingle(__constant CarToRasCL* carToRas, Point* point, uint* singleBufferIndex)\n" "{\n" #ifdef USEFMA @@ -275,4 +275,4 @@ static string AtomicString() "}\n"; return os.str(); } -} \ No newline at end of file +} diff --git a/Source/EmberCL/EmberCLStructs.h b/Source/EmberCL/EmberCLStructs.h index df8cc1e..d1e4fad 100644 --- a/Source/EmberCL/EmberCLStructs.h +++ b/Source/EmberCL/EmberCLStructs.h @@ -154,7 +154,7 @@ struct ALIGN PointCL /// It might seem better to use float4, however 2D palettes and even 3D coordinates may eventually /// be supported, which will make it more than 4 members. /// -static const char* PointCLStructString = +static constexpr char PointCLStructString[] = "typedef struct __attribute__ " ALIGN_CL " _Point\n" "{\n" " real_t m_X;\n" @@ -183,7 +183,7 @@ struct ALIGN XformCL /// /// The xform structure used to iterate in OpenCL. /// -static const char* XformCLStructString = +static constexpr 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" @@ -220,7 +220,7 @@ struct ALIGN EmberCL /// /// The ember structure used to iterate in OpenCL. /// -static const char* EmberCLStructString = +static constexpr char EmberCLStructString[] = "typedef struct __attribute__ " ALIGN_CL " _EmberCL\n" "{\n" " real_t m_RandPointRange;\n" @@ -264,7 +264,7 @@ struct ALIGN CarToRasCL /// /// The cartesian to raster structure used to iterate in OpenCL. /// -static const char* CarToRasCLStructString = +static constexpr char CarToRasCLStructString[] = "typedef struct __attribute__ " ALIGN_CL " _CarToRasCL\n" "{\n" " real_t m_PixPerImageUnitW, m_RasLlX;\n" @@ -299,7 +299,7 @@ struct ALIGN DensityFilterCL /// The density filtering structure used to iterate in OpenCL. /// Note that the actual filter buffer is held elsewhere. /// -static const char* DensityFilterCLStructString = +static constexpr char DensityFilterCLStructString[] = "typedef struct __attribute__ " ALIGN_CL " _DensityFilterCL\n" "{\n" " real_bucket_t m_Curve;\n" @@ -341,7 +341,7 @@ struct ALIGN SpatialFilterCL /// The spatial filtering structure used to iterate in OpenCL. /// Note that the actual filter buffer is held elsewhere. /// -static const char* SpatialFilterCLStructString = +static constexpr char SpatialFilterCLStructString[] = "typedef struct __attribute__ ((aligned (16))) _SpatialFilterCL\n" "{\n" " uint m_SuperRasW;\n" @@ -365,7 +365,7 @@ static const char* SpatialFilterCLStructString = /// their members as a buffer is not natively supported. /// Declaring them in a union with a buffer resolves this problem. /// -static const char* UnionCLStructString = +static constexpr char UnionCLStructString[] = "typedef union\n" "{\n" " uchar3 m_Uchar3;\n"