This is commit of Simon Detheridge's pull request "osx-opencl" with a few modifications.

-If we change OpenCLWrapper to capture build log errors, we don't need to manually concat them in RendererCL because the overridden ErrorReport() function already concatenates the errors from both classes.

-Do not define T in OpenCL programs. We already have real_t to handle this.

-Do keep the casting to real_t. However this should not be necessary because there is a command line option to do this automatically which we already use: -cl-single-precision-constant. The only reason we do this is because the Apple OpenCL compiler does not follow the standard and obviously ignores this option. Absolutely awful.

-Fix a few improper casts in the CircleTrans1 and GlynnSim1 variations.

-Add an automated OpenCL program build tester to EmberTester, as well as a cast checker.
This commit is contained in:
mfeemster
2015-03-22 12:46:10 -07:00
parent fa6ec63447
commit ef01380e6d
8 changed files with 193 additions and 126 deletions

View File

@ -2096,8 +2096,8 @@ protected:
m_Params.clear();
m_Params.push_back(ParamWithName<T>(&m_Slices, prefix + "pie_slices", 6, INTEGER_NONZERO, 1));
m_Params.push_back(ParamWithName<T>(&m_Rotation, prefix + "pie_rotation", T(0.5), REAL_CYCLIC, 0, M_2PI));
m_Params.push_back(ParamWithName<T>(&m_Thickness, prefix + "pie_thickness", T(0.5), REAL, 0, 1));
m_Params.push_back(ParamWithName<T>(&m_Rotation, prefix + "pie_rotation", T(0.5), REAL_CYCLIC, 0, M_2PI));
m_Params.push_back(ParamWithName<T>(&m_Thickness, prefix + "pie_thickness", T(0.5), REAL, 0, 1));
}
private:

View File

@ -528,7 +528,7 @@ public:
return
"void GlynnSim1Circle(__constant real_t* radius1, __constant real_t* thickness, __constant real_t* x1, __constant real_t* y1, uint2* mwc, real_t* x, real_t* y)\n"
"{\n"
" real_t r = *radius1 * (*thickness + (T(1.0) - *thickness) * MwcNext01(mwc));\n"
" real_t r = *radius1 * (*thickness + ((real_t)(1.0) - *thickness) * MwcNext01(mwc));\n"
" real_t phi = M_2PI * MwcNext01(mwc);\n"
" real_t sinPhi = sin(phi);\n"
" real_t cosPhi = cos(phi);\n"

View File

@ -485,8 +485,8 @@ public:
"\n"
"void CircleTrans1Trans(real_t a, real_t b, real_t x, real_t y, real_t* x1, real_t* y1)\n"
"{\n"
" *x1 = (x - a) * T(0.5) + a;\n"
" *y1 = (y - b) * T(0.5) + b;\n"
" *x1 = (x - a) * (real_t)(0.5) + a;\n"
" *y1 = (y - b) * (real_t)(0.5) + b;\n"
"}\n"
"\n"
"void CircleTrans1CircleR(real_t mx, real_t my, real_t sc, real_t seed, real_t dens, real_t* ux, real_t* vy, uint2* mwc)\n"
@ -498,10 +498,10 @@ public:
" {\n"
" x = fabs(mx) * (1 - 2 * MwcNext01(mwc));\n"
" y = fabs(my) * (1 - 2 * MwcNext01(mwc));\n"
" m = (int)floor(T(0.5) * x / sc);\n"
" n = (int)floor(T(0.5) * y / sc);\n"
" m = (int)floor((real_t)(0.5) * x / sc);\n"
" n = (int)floor((real_t)(0.5) * y / sc);\n"
" alpha = M_2PI * MwcNext01(mwc);\n"
" u = T(0.3) + T(0.7) * CircleTrans1DiscreteNoise2(m + 10, n + 3);\n"
" u = (real_t)(0.3) + (real_t)(0.7) * CircleTrans1DiscreteNoise2(m + 10, n + 3);\n"
" x = u * cos(alpha);\n"
" y = u * sin(alpha);\n"
"\n"