style cleanup: assignment & indentation.

This commit is contained in:
Campbell Barton
2012-06-09 18:56:12 +00:00
parent c6cffe98fa
commit 2c1abe1f58
32 changed files with 500 additions and 484 deletions

View File

@@ -172,8 +172,8 @@ static void display()
static void resize(int width, int height) static void resize(int width, int height)
{ {
options.width= width; options.width = width;
options.height= height; options.height = height;
if(options.session) if(options.session)
options.session->reset(session_buffer_params(), options.session_params.samples); options.session->reset(session_buffer_params(), options.session_params.samples);
@@ -197,8 +197,8 @@ static int files_parse(int argc, const char *argv[])
static void options_parse(int argc, const char **argv) static void options_parse(int argc, const char **argv)
{ {
options.width= 0; options.width = 0;
options.height= 0; options.height = 0;
options.filepath = ""; options.filepath = "";
options.session = NULL; options.session = NULL;
options.quiet = false; options.quiet = false;

View File

@@ -222,14 +222,14 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
} }
if(horizontal_fit) { if(horizontal_fit) {
*aspectratio= xratio/yratio; *aspectratio = xratio/yratio;
xaspect= *aspectratio; xaspect = *aspectratio;
yaspect= 1.0f; yaspect = 1.0f;
} }
else { else {
*aspectratio= yratio/xratio; *aspectratio = yratio/xratio;
xaspect= 1.0f; xaspect = 1.0f;
yaspect= *aspectratio; yaspect = *aspectratio;
} }
/* modify aspect for orthographic scale */ /* modify aspect for orthographic scale */

View File

@@ -46,7 +46,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
float3 *N = attr_N->data_float3(); float3 *N = attr_N->data_float3();
for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v, ++N) for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v, ++N)
*N= get_float3(v->normal()); *N = get_float3(v->normal());
/* create faces */ /* create faces */
BL::Mesh::tessfaces_iterator f; BL::Mesh::tessfaces_iterator f;
@@ -175,7 +175,7 @@ static void create_subd_mesh(Mesh *mesh, BL::Mesh b_mesh, PointerRNA *cmesh, con
for(b_mesh.tessfaces.begin(f); f != b_mesh.tessfaces.end(); ++f) { for(b_mesh.tessfaces.begin(f); f != b_mesh.tessfaces.end(); ++f) {
int4 vi = get_int4(f->vertices_raw()); int4 vi = get_int4(f->vertices_raw());
int n= (vi[3] == 0)? 3: 4; int n = (vi[3] == 0) ? 3: 4;
//int shader = used_shaders[f->material_index()]; //int shader = used_shaders[f->material_index()];
if(n == 4) if(n == 4)

View File

@@ -145,7 +145,7 @@ void BlenderSync::sync_particles(Object *ob, BL::Object b_ob)
for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) { for(b_ob.particle_systems.begin(b_psys); b_psys != b_ob.particle_systems.end(); ++b_psys) {
if (use_particle_system(*b_psys)) { if (use_particle_system(*b_psys)) {
BL::ParticleSystem::particles_iterator b_pa; BL::ParticleSystem::particles_iterator b_pa;
for(b_psys->particles.begin(b_pa), index=0; b_pa != b_psys->particles.end(); ++b_pa, ++index) { for(b_psys->particles.begin(b_pa), index = 0; b_pa != b_psys->particles.end(); ++b_pa, ++index) {
if(use_particle(*b_pa)) { if(use_particle(*b_pa)) {
Particle pa; Particle pa;

View File

@@ -193,7 +193,8 @@ CCLDeviceInfo *compute_device_list(DeviceType type)
foreach(DeviceInfo& info, devices) { foreach(DeviceInfo& info, devices) {
if(info.type == type || if(info.type == type ||
(info.type == DEVICE_MULTI && info.multi_devices[0].type == type)) { (info.type == DEVICE_MULTI && info.multi_devices[0].type == type))
{
CCLDeviceInfo cinfo = {info.id.c_str(), info.description.c_str(), i++}; CCLDeviceInfo cinfo = {info.id.c_str(), info.description.c_str(), i++};
device_list.push_back(cinfo); device_list.push_back(cinfo);
} }
@@ -214,7 +215,7 @@ CCL_NAMESPACE_END
void *CCL_python_module_init() void *CCL_python_module_init()
{ {
PyObject *mod= PyModule_Create(&ccl::module); PyObject *mod = PyModule_Create(&ccl::module);
#ifdef WITH_OSL #ifdef WITH_OSL
PyModule_AddObject(mod, "with_osl", Py_True); PyModule_AddObject(mod, "with_osl", Py_True);

View File

@@ -83,8 +83,8 @@ void BlenderSession::create_session()
SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background); SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background);
/* reset status/progress */ /* reset status/progress */
last_status= ""; last_status = "";
last_progress= -1.0f; last_progress = -1.0f;
/* create scene */ /* create scene */
scene = new Scene(scene_params); scene = new Scene(scene_params);
@@ -292,7 +292,8 @@ void BlenderSession::synchronize()
SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background); SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background);
if(session->params.modified(session_params) || if(session->params.modified(session_params) ||
scene->params.modified(scene_params)) { scene->params.modified(scene_params))
{
free_session(); free_session();
create_session(); create_session();
session->start(); session->start();

View File

@@ -784,7 +784,9 @@ void BlenderSync::sync_lamps()
if(b_lamp->type() == BL::Lamp::type_POINT || if(b_lamp->type() == BL::Lamp::type_POINT ||
b_lamp->type() == BL::Lamp::type_SPOT || b_lamp->type() == BL::Lamp::type_SPOT ||
b_lamp->type() == BL::Lamp::type_AREA) b_lamp->type() == BL::Lamp::type_AREA)
{
strength = 100.0f; strength = 100.0f;
}
closure = graph->add(new EmissionNode()); closure = graph->add(new EmissionNode());
closure->input("Color")->value = get_float3(b_lamp->color()); closure->input("Color")->value = get_float3(b_lamp->color());

View File

@@ -105,10 +105,13 @@ bool BlenderSync::sync_recalc()
BL::BlendData::worlds_iterator b_world; BL::BlendData::worlds_iterator b_world;
for(b_data.worlds.begin(b_world); b_world != b_data.worlds.end(); ++b_world) for(b_data.worlds.begin(b_world); b_world != b_data.worlds.end(); ++b_world) {
if(world_map == b_world->ptr.data && if(world_map == b_world->ptr.data &&
(b_world->is_updated() || (b_world->node_tree() && b_world->node_tree().is_updated()))) (b_world->is_updated() || (b_world->node_tree() && b_world->node_tree().is_updated())))
{
world_recalc = true; world_recalc = true;
}
}
bool recalc = bool recalc =
shader_map.has_recalc() || shader_map.has_recalc() ||

View File

@@ -52,7 +52,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
} }
if(!is_leaf()) if(!is_leaf())
for(int i=0;i<num_children();i++) for(int i = 0; i < num_children(); i++)
cnt += get_child(i)->getSubtreeSize(stat); cnt += get_child(i)->getSubtreeSize(stat);
return cnt; return cnt;
@@ -60,7 +60,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
void BVHNode::deleteSubtree() void BVHNode::deleteSubtree()
{ {
for(int i=0;i<num_children();i++) for(int i = 0; i < num_children(); i++)
if(get_child(i)) if(get_child(i))
get_child(i)->deleteSubtree(); get_child(i)->deleteSubtree();
@@ -71,7 +71,7 @@ float BVHNode::computeSubtreeSAHCost(const BVHParams& p, float probability) cons
{ {
float SAH = probability * p.cost(num_children(), num_triangles()); float SAH = probability * p.cost(num_children(), num_triangles());
for(int i=0;i<num_children();i++) { for(int i = 0; i < num_children(); i++) {
BVHNode *child = get_child(i); BVHNode *child = get_child(i);
SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.safe_area()/m_bounds.safe_area()); SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.safe_area()/m_bounds.safe_area());
} }

View File

@@ -49,9 +49,9 @@ __device void differential_dudv(differential *du, differential *dv, float3 dPdu,
* mainly used for differentials of arbitrary mesh attributes. */ * mainly used for differentials of arbitrary mesh attributes. */
/* find most stable axis to project to 2D */ /* find most stable axis to project to 2D */
float xn= fabsf(Ng.x); float xn = fabsf(Ng.x);
float yn= fabsf(Ng.y); float yn = fabsf(Ng.y);
float zn= fabsf(Ng.z); float zn = fabsf(Ng.z);
if(zn < xn || zn < yn) { if(zn < xn || zn < yn) {
if(yn < xn || yn < zn) { if(yn < xn || yn < zn) {

View File

@@ -137,9 +137,12 @@ __device_inline float path_state_terminate_probability(KernelGlobals *kg, PathSt
(state->diffuse_bounce >= kernel_data.integrator.max_diffuse_bounce) || (state->diffuse_bounce >= kernel_data.integrator.max_diffuse_bounce) ||
(state->glossy_bounce >= kernel_data.integrator.max_glossy_bounce) || (state->glossy_bounce >= kernel_data.integrator.max_glossy_bounce) ||
(state->transmission_bounce >= kernel_data.integrator.max_transmission_bounce)) (state->transmission_bounce >= kernel_data.integrator.max_transmission_bounce))
{
return 0.0f; return 0.0f;
else if(state->bounce <= kernel_data.integrator.min_bounce) }
else if(state->bounce <= kernel_data.integrator.min_bounce) {
return 1.0f; return 1.0f;
}
} }
/* probalistic termination */ /* probalistic termination */

View File

@@ -47,7 +47,7 @@ __device float fresnel_dielectric(float eta, const float3 N,
float cos = dot(N, I), neta; float cos = dot(N, I), neta;
float3 Nn; float3 Nn;
// compute reflection // compute reflection
*R =(2 * cos)* N - I; *R = (2 * cos)* N - I;
#ifdef __RAY_DIFFERENTIALS__ #ifdef __RAY_DIFFERENTIALS__
*dRdx = (2 * dot(N, dIdx)) * N - dIdx; *dRdx = (2 * dot(N, dIdx)) * N - dIdx;
*dRdy = (2 * dot(N, dIdy)) * N - dIdy; *dRdy = (2 * dot(N, dIdy)) * N - dIdy;
@@ -65,18 +65,18 @@ __device float fresnel_dielectric(float eta, const float3 N,
Nn = -N; Nn = -N;
*is_inside = true; *is_inside = true;
} }
*R =(2 * cos)* Nn - I; *R = (2 * cos)* Nn - I;
float arg = 1 -(neta * neta *(1 -(cos * cos))); float arg = 1 -(neta * neta *(1 -(cos * cos)));
if(arg < 0) { if(arg < 0) {
*T= make_float3(0.0f, 0.0f, 0.0f); *T = make_float3(0.0f, 0.0f, 0.0f);
#ifdef __RAY_DIFFERENTIALS__ #ifdef __RAY_DIFFERENTIALS__
*dTdx= make_float3(0.0f, 0.0f, 0.0f); *dTdx = make_float3(0.0f, 0.0f, 0.0f);
*dTdy= make_float3(0.0f, 0.0f, 0.0f); *dTdy = make_float3(0.0f, 0.0f, 0.0f);
#endif #endif
return 1; // total internal reflection return 1; // total internal reflection
} else { } else {
float dnp = sqrtf(arg); float dnp = sqrtf(arg);
float nK =(neta * cos)- dnp; float nK = (neta * cos)- dnp;
*T = -(neta * I)+(nK * Nn); *T = -(neta * I)+(nK * Nn);
#ifdef __RAY_DIFFERENTIALS__ #ifdef __RAY_DIFFERENTIALS__
*dTdx = -(neta * dIdx) + ((neta - neta * neta * cos / dnp) * dot(dIdx, Nn)) * Nn; *dTdx = -(neta * dIdx) + ((neta - neta * neta * cos / dnp) * dot(dIdx, Nn)) * Nn;
@@ -85,8 +85,8 @@ __device float fresnel_dielectric(float eta, const float3 N,
// compute Fresnel terms // compute Fresnel terms
float cosTheta1 = cos; // N.R float cosTheta1 = cos; // N.R
float cosTheta2 = -dot(Nn, *T); float cosTheta2 = -dot(Nn, *T);
float pPara =(cosTheta1 - eta * cosTheta2)/(cosTheta1 + eta * cosTheta2); float pPara = (cosTheta1 - eta * cosTheta2)/(cosTheta1 + eta * cosTheta2);
float pPerp =(eta * cosTheta1 - cosTheta2)/(eta * cosTheta1 + cosTheta2); float pPerp = (eta * cosTheta1 - cosTheta2)/(eta * cosTheta1 + cosTheta2);
return 0.5f * (pPara * pPara + pPerp * pPerp); return 0.5f * (pPara * pPara + pPerp * pPerp);
} }
} }
@@ -99,8 +99,8 @@ __device float fresnel_dielectric_cos(float cosi, float eta)
float g = eta * eta - 1 + c * c; float g = eta * eta - 1 + c * c;
if(g > 0) { if(g > 0) {
g = sqrtf(g); g = sqrtf(g);
float A =(g - c)/(g + c); float A = (g - c)/(g + c);
float B =(c *(g + c)- 1)/(c *(g - c)+ 1); float B = (c *(g + c)- 1)/(c *(g - c)+ 1);
return 0.5f * A * A *(1 + B * B); return 0.5f * A * A *(1 + B * B);
} }
return 1.0f; // TIR(no refracted component) return 1.0f; // TIR(no refracted component)
@@ -110,10 +110,10 @@ __device float fresnel_conductor(float cosi, float eta, float k)
{ {
float tmp_f = eta * eta + k * k; float tmp_f = eta * eta + k * k;
float tmp = tmp_f * cosi * cosi; float tmp = tmp_f * cosi * cosi;
float Rparl2 =(tmp -(2.0f * eta * cosi)+ 1)/ float Rparl2 = (tmp - (2.0f * eta * cosi) + 1)/
(tmp +(2.0f * eta * cosi)+ 1); (tmp + (2.0f * eta * cosi) + 1);
float Rperp2 =(tmp_f -(2.0f * eta * cosi)+ cosi * cosi)/ float Rperp2 = (tmp_f - (2.0f * eta * cosi) + cosi * cosi)/
(tmp_f +(2.0f * eta * cosi)+ cosi * cosi); (tmp_f + (2.0f * eta * cosi) + cosi * cosi);
return(Rparl2 + Rperp2) * 0.5f; return(Rparl2 + Rperp2) * 0.5f;
} }

View File

@@ -24,9 +24,9 @@ __device float svm_gradient(float3 p, NodeGradientType type)
{ {
float x, y, z; float x, y, z;
x= p.x; x = p.x;
y= p.y; y = p.y;
z= p.z; z = p.z;
if(type == NODE_BLEND_LINEAR) { if(type == NODE_BLEND_LINEAR) {
return x; return x;

View File

@@ -34,39 +34,39 @@ __device_noinline float3 svm_magic(float3 p, int n, float distortion)
y *= distortion; y *= distortion;
if(n > 1) { if(n > 1) {
x= cosf(x-y-z); x = cosf(x-y-z);
x *= distortion; x *= distortion;
if(n > 2) { if(n > 2) {
z= sinf(-x-y-z); z = sinf(-x-y-z);
z *= distortion; z *= distortion;
if(n > 3) { if(n > 3) {
x= -cosf(-x+y-z); x = -cosf(-x+y-z);
x *= distortion; x *= distortion;
if(n > 4) { if(n > 4) {
y= -sinf(-x+y+z); y = -sinf(-x+y+z);
y *= distortion; y *= distortion;
if(n > 5) { if(n > 5) {
y= -cosf(-x+y+z); y = -cosf(-x+y+z);
y *= distortion; y *= distortion;
if(n > 6) { if(n > 6) {
x= cosf(x+y+z); x = cosf(x+y+z);
x *= distortion; x *= distortion;
if(n > 7) { if(n > 7) {
z= sinf(x+y-z); z = sinf(x+y-z);
z *= distortion; z *= distortion;
if(n > 8) { if(n > 8) {
x= -cosf(-x-y+z); x = -cosf(-x-y+z);
x *= distortion; x *= distortion;
if(n > 9) { if(n > 9) {
y= -sinf(x-y+z); y = -sinf(x-y+z);
y *= distortion; y *= distortion;
} }
} }

View File

@@ -248,8 +248,8 @@ __device float3 svm_mix_soft(float t, float3 col1, float3 col2)
{ {
float tm = 1.0f - t; float tm = 1.0f - t;
float3 one= make_float3(1.0f, 1.0f, 1.0f); float3 one = make_float3(1.0f, 1.0f, 1.0f);
float3 scr= one - (one - col2)*(one - col1); float3 scr = one - (one - col2)*(one - col1);
return tm*col1 + t*((one - col1)*col2*col1 + col1*scr); return tm*col1 + t*((one - col1)*col2*col1 + col1*scr);
} }
@@ -259,19 +259,19 @@ __device float3 svm_mix_linear(float t, float3 col1, float3 col2)
float3 outcol = col1; float3 outcol = col1;
if(col2.x > 0.5f) if(col2.x > 0.5f)
outcol.x= col1.x + t*(2.0f*(col2.x - 0.5f)); outcol.x = col1.x + t*(2.0f*(col2.x - 0.5f));
else else
outcol.x= col1.x + t*(2.0f*(col2.x) - 1.0f); outcol.x = col1.x + t*(2.0f*(col2.x) - 1.0f);
if(col2.y > 0.5f) if(col2.y > 0.5f)
outcol.y= col1.y + t*(2.0f*(col2.y - 0.5f)); outcol.y = col1.y + t*(2.0f*(col2.y - 0.5f));
else else
outcol.y= col1.y + t*(2.0f*(col2.y) - 1.0f); outcol.y = col1.y + t*(2.0f*(col2.y) - 1.0f);
if(col2.z > 0.5f) if(col2.z > 0.5f)
outcol.z= col1.z + t*(2.0f*(col2.z - 0.5f)); outcol.z = col1.z + t*(2.0f*(col2.z - 0.5f));
else else
outcol.z= col1.z + t*(2.0f*(col2.z) - 1.0f); outcol.z = col1.z + t*(2.0f*(col2.z) - 1.0f);
return outcol; return outcol;
} }

View File

@@ -84,9 +84,9 @@ __device uint phash(int kx, int ky, int kz, int3 p)
__device float floorfrac(float x, int* i) __device float floorfrac(float x, int* i)
{ {
float f = floorf(x); float f = floorf(x);
*i = (int)f; *i = (int)f;
return x - f; return x - f;
} }
__device float fade(float t) __device float fade(float t)
@@ -96,7 +96,7 @@ __device float fade(float t)
__device float nerp(float t, float a, float b) __device float nerp(float t, float a, float b)
{ {
return (1.0f - t) * a + t * b; return (1.0f - t) * a + t * b;
} }
__device float grad(int hash, float x, float y, float z) __device float grad(int hash, float x, float y, float z)

View File

@@ -221,7 +221,7 @@ __device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float o
int i, n; int i, n;
octaves = clamp(octaves, 0.0f, 16.0f); octaves = clamp(octaves, 0.0f, 16.0f);
n= (int)octaves; n = (int)octaves;
for(i = 0; i <= n; i++) { for(i = 0; i <= n; i++) {
float t = noise_basis(fscale*p, basis); float t = noise_basis(fscale*p, basis);

View File

@@ -38,7 +38,7 @@ __device_noinline float4 svm_voronoi(NodeVoronoiColoring coloring, float scale,
} }
else { else {
color = cellnoise_color(pa[0]); color = cellnoise_color(pa[0]);
fac= average(color); fac = average(color);
} }
return make_float4(color.x, color.y, color.z, fac); return make_float4(color.x, color.y, color.z, fac);

View File

@@ -27,9 +27,9 @@ __device_noinline float svm_wave(NodeWaveType type, float3 p, float scale, float
p *= scale; p *= scale;
if(type == NODE_WAVE_BANDS) if(type == NODE_WAVE_BANDS)
n= (p.x + p.y + p.z)*10.0f; n = (p.x + p.y + p.z) * 10.0f;
else /* if(type == NODE_WAVE_RINGS) */ else /* if(type == NODE_WAVE_RINGS) */
n= len(p)*20.0f; n = len(p) * 20.0f;
if(distortion != 0.0f) if(distortion != 0.0f)
n += distortion * noise_turbulence(p*dscale, NODE_NOISE_PERLIN, detail, 0); n += distortion * noise_turbulence(p*dscale, NODE_NOISE_PERLIN, detail, 0);

View File

@@ -74,10 +74,13 @@ bool Attribute::same_storage(TypeDesc a, TypeDesc b)
if(a == TypeDesc::TypeColor || a == TypeDesc::TypePoint || if(a == TypeDesc::TypeColor || a == TypeDesc::TypePoint ||
a == TypeDesc::TypeVector || a == TypeDesc::TypeNormal) a == TypeDesc::TypeVector || a == TypeDesc::TypeNormal)
{
if(b == TypeDesc::TypeColor || b == TypeDesc::TypePoint || if(b == TypeDesc::TypeColor || b == TypeDesc::TypePoint ||
b == TypeDesc::TypeVector || b == TypeDesc::TypeNormal) b == TypeDesc::TypeVector || b == TypeDesc::TypeNormal)
{
return true; return true;
}
}
return false; return false;
} }
@@ -286,10 +289,13 @@ bool AttributeRequestSet::modified(const AttributeRequestSet& other)
for(size_t j = 0; j < requests.size() && !found; j++) for(size_t j = 0; j < requests.size() && !found; j++)
if(requests[i].name == other.requests[j].name && if(requests[i].name == other.requests[j].name &&
requests[i].std == other.requests[j].std) requests[i].std == other.requests[j].std)
{
found = true; found = true;
}
if(!found) if(!found) {
return true; return true;
}
} }
return false; return false;

View File

@@ -117,8 +117,8 @@ void RenderBuffers::reset(Device *device, BufferParams& params_)
uint *init_state = rng_state.resize(params.width, params.height); uint *init_state = rng_state.resize(params.width, params.height);
int x, y, width = params.width, height = params.height; int x, y, width = params.width, height = params.height;
for(x=0; x<width; x++) for(x = 0; x < width; x++)
for(y=0; y<height; y++) for(y = 0; y < height; y++)
init_state[x + y*width] = hash_int_2d(params.full_x+x, params.full_y+y); init_state[x + y*width] = hash_int_2d(params.full_x+x, params.full_y+y);
device->mem_alloc(rng_state, MEM_READ_WRITE); device->mem_alloc(rng_state, MEM_READ_WRITE);

View File

@@ -199,7 +199,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
kcam->bladesrotation = bladesrotation; kcam->bladesrotation = bladesrotation;
/* motion blur */ /* motion blur */
kcam->shuttertime= (need_motion == Scene::MOTION_BLUR)? shuttertime: 0.0f; kcam->shuttertime = (need_motion == Scene::MOTION_BLUR) ? shuttertime: 0.0f;
/* type */ /* type */
kcam->type = type; kcam->type = type;

View File

@@ -78,7 +78,7 @@ public:
bool use_motion; bool use_motion;
/* computed camera parameters */ /* computed camera parameters */
Transform screentoworld; Transform screentoworld;
Transform rastertoworld; Transform rastertoworld;
Transform ndctoworld; Transform ndctoworld;
Transform rastertocamera; Transform rastertocamera;

View File

@@ -73,17 +73,17 @@ static vector<float> filter_table(FilterType type, float width)
/* compute cumulative distribution function */ /* compute cumulative distribution function */
filter_table_cdf[0] = 0.0f; filter_table_cdf[0] = 0.0f;
for(i=0; i<filter_table_size; i++) { for(i = 0; i < filter_table_size; i++) {
float x = i*width*0.5f/(filter_table_size-1); float x = i*width*0.5f/(filter_table_size-1);
float y = filter_func(x, width); float y = filter_func(x, width);
filter_table_cdf[i+1] += filter_table_cdf[i] + fabsf(y); filter_table_cdf[i+1] += filter_table_cdf[i] + fabsf(y);
} }
for(i=0; i<=filter_table_size; i++) for(i = 0; i <= filter_table_size; i++)
filter_table_cdf[i] /= filter_table_cdf[filter_table_size]; filter_table_cdf[i] /= filter_table_cdf[filter_table_size];
/* create importance sampling table */ /* create importance sampling table */
for(i=0; i<=half_size; i++) { for(i = 0; i <= half_size; i++) {
float x = i/(float)half_size; float x = i/(float)half_size;
int index = upper_bound(filter_table_cdf.begin(), filter_table_cdf.end(), x) - filter_table_cdf.begin(); int index = upper_bound(filter_table_cdf.begin(), filter_table_cdf.end(), x) - filter_table_cdf.begin();
float t; float t;

View File

@@ -44,7 +44,7 @@ public:
float3 min, max; float3 min, max;
bool use_minmax; bool use_minmax;
enum Mapping { NONE=0, X=1, Y=2, Z=3 }; enum Mapping { NONE = 0, X = 1, Y = 2, Z = 3 };
Mapping x_mapping, y_mapping, z_mapping; Mapping x_mapping, y_mapping, z_mapping;
enum Projection { FLAT, CUBE, TUBE, SPHERE }; enum Projection { FLAT, CUBE, TUBE, SPHERE };

View File

@@ -56,225 +56,225 @@ typedef struct CUstream_st *CUstream;
typedef struct CUgraphicsResource_st *CUgraphicsResource; typedef struct CUgraphicsResource_st *CUgraphicsResource;
typedef struct CUuuid_st { typedef struct CUuuid_st {
char bytes[16]; char bytes[16];
} CUuuid; } CUuuid;
typedef enum CUctx_flags_enum { typedef enum CUctx_flags_enum {
CU_CTX_SCHED_AUTO = 0, CU_CTX_SCHED_AUTO = 0,
CU_CTX_SCHED_SPIN = 1, CU_CTX_SCHED_SPIN = 1,
CU_CTX_SCHED_YIELD = 2, CU_CTX_SCHED_YIELD = 2,
CU_CTX_SCHED_MASK = 0x3, CU_CTX_SCHED_MASK = 0x3,
CU_CTX_BLOCKING_SYNC = 4, CU_CTX_BLOCKING_SYNC = 4,
CU_CTX_MAP_HOST = 8, CU_CTX_MAP_HOST = 8,
CU_CTX_LMEM_RESIZE_TO_MAX = 16, CU_CTX_LMEM_RESIZE_TO_MAX = 16,
CU_CTX_FLAGS_MASK = 0x1f CU_CTX_FLAGS_MASK = 0x1f
} CUctx_flags; } CUctx_flags;
typedef enum CUevent_flags_enum { typedef enum CUevent_flags_enum {
CU_EVENT_DEFAULT = 0, CU_EVENT_DEFAULT = 0,
CU_EVENT_BLOCKING_SYNC = 1, CU_EVENT_BLOCKING_SYNC = 1,
CU_EVENT_DISABLE_TIMING = 2 CU_EVENT_DISABLE_TIMING = 2
} CUevent_flags; } CUevent_flags;
typedef enum CUarray_format_enum { typedef enum CUarray_format_enum {
CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
CU_AD_FORMAT_SIGNED_INT8 = 0x08, CU_AD_FORMAT_SIGNED_INT8 = 0x08,
CU_AD_FORMAT_SIGNED_INT16 = 0x09, CU_AD_FORMAT_SIGNED_INT16 = 0x09,
CU_AD_FORMAT_SIGNED_INT32 = 0x0a, CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
CU_AD_FORMAT_HALF = 0x10, CU_AD_FORMAT_HALF = 0x10,
CU_AD_FORMAT_FLOAT = 0x20 CU_AD_FORMAT_FLOAT = 0x20
} CUarray_format; } CUarray_format;
typedef enum CUaddress_mode_enum { typedef enum CUaddress_mode_enum {
CU_TR_ADDRESS_MODE_WRAP = 0, CU_TR_ADDRESS_MODE_WRAP = 0,
CU_TR_ADDRESS_MODE_CLAMP = 1, CU_TR_ADDRESS_MODE_CLAMP = 1,
CU_TR_ADDRESS_MODE_MIRROR = 2, CU_TR_ADDRESS_MODE_MIRROR = 2,
CU_TR_ADDRESS_MODE_BORDER = 3 CU_TR_ADDRESS_MODE_BORDER = 3
} CUaddress_mode; } CUaddress_mode;
typedef enum CUfilter_mode_enum { typedef enum CUfilter_mode_enum {
CU_TR_FILTER_MODE_POINT = 0, CU_TR_FILTER_MODE_POINT = 0,
CU_TR_FILTER_MODE_LINEAR = 1 CU_TR_FILTER_MODE_LINEAR = 1
} CUfilter_mode; } CUfilter_mode;
typedef enum CUdevice_attribute_enum { typedef enum CUdevice_attribute_enum {
CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1,
CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2,
CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3,
CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4, CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4,
CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5,
CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6,
CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7, CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7,
CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8, CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8,
CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8,
CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9, CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9,
CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10,
CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11, CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11,
CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12,
CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12,
CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13,
CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14,
CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15, CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15,
CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16,
CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17,
CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, CU_DEVICE_ATTRIBUTE_INTEGRATED = 18,
CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19,
CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28,
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29,
CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30, CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30,
CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31, CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31,
CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32, CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32,
CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33, CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33,
CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34, CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34,
CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35 CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35
} CUdevice_attribute; } CUdevice_attribute;
typedef struct CUdevprop_st { typedef struct CUdevprop_st {
int maxThreadsPerBlock; int maxThreadsPerBlock;
int maxThreadsDim[3]; int maxThreadsDim[3];
int maxGridSize[3]; int maxGridSize[3];
int sharedMemPerBlock; int sharedMemPerBlock;
int totalConstantMemory; int totalConstantMemory;
int SIMDWidth; int SIMDWidth;
int memPitch; int memPitch;
int regsPerBlock; int regsPerBlock;
int clockRate; int clockRate;
int textureAlign; int textureAlign;
} CUdevprop; } CUdevprop;
typedef enum CUfunction_attribute_enum { typedef enum CUfunction_attribute_enum {
CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0,
CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1,
CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2,
CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3,
CU_FUNC_ATTRIBUTE_NUM_REGS = 4, CU_FUNC_ATTRIBUTE_NUM_REGS = 4,
CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, CU_FUNC_ATTRIBUTE_PTX_VERSION = 5,
CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6,
CU_FUNC_ATTRIBUTE_MAX CU_FUNC_ATTRIBUTE_MAX
} CUfunction_attribute; } CUfunction_attribute;
typedef enum CUfunc_cache_enum { typedef enum CUfunc_cache_enum {
CU_FUNC_CACHE_PREFER_NONE = 0x00, CU_FUNC_CACHE_PREFER_NONE = 0x00,
CU_FUNC_CACHE_PREFER_SHARED = 0x01, CU_FUNC_CACHE_PREFER_SHARED = 0x01,
CU_FUNC_CACHE_PREFER_L1 = 0x02 CU_FUNC_CACHE_PREFER_L1 = 0x02
} CUfunc_cache; } CUfunc_cache;
typedef enum CUmemorytype_enum { typedef enum CUmemorytype_enum {
CU_MEMORYTYPE_HOST = 0x01, CU_MEMORYTYPE_HOST = 0x01,
CU_MEMORYTYPE_DEVICE = 0x02, CU_MEMORYTYPE_DEVICE = 0x02,
CU_MEMORYTYPE_ARRAY = 0x03 CU_MEMORYTYPE_ARRAY = 0x03
} CUmemorytype; } CUmemorytype;
typedef enum CUcomputemode_enum { typedef enum CUcomputemode_enum {
CU_COMPUTEMODE_DEFAULT = 0, CU_COMPUTEMODE_DEFAULT = 0,
CU_COMPUTEMODE_EXCLUSIVE = 1, CU_COMPUTEMODE_EXCLUSIVE = 1,
CU_COMPUTEMODE_PROHIBITED = 2 CU_COMPUTEMODE_PROHIBITED = 2
} CUcomputemode; } CUcomputemode;
typedef enum CUjit_option_enum typedef enum CUjit_option_enum
{ {
CU_JIT_MAX_REGISTERS = 0, CU_JIT_MAX_REGISTERS = 0,
CU_JIT_THREADS_PER_BLOCK, CU_JIT_THREADS_PER_BLOCK,
CU_JIT_WALL_TIME, CU_JIT_WALL_TIME,
CU_JIT_INFO_LOG_BUFFER, CU_JIT_INFO_LOG_BUFFER,
CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES,
CU_JIT_ERROR_LOG_BUFFER, CU_JIT_ERROR_LOG_BUFFER,
CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES,
CU_JIT_OPTIMIZATION_LEVEL, CU_JIT_OPTIMIZATION_LEVEL,
CU_JIT_TARGET_FROM_CUCONTEXT, CU_JIT_TARGET_FROM_CUCONTEXT,
CU_JIT_TARGET, CU_JIT_TARGET,
CU_JIT_FALLBACK_STRATEGY CU_JIT_FALLBACK_STRATEGY
} CUjit_option; } CUjit_option;
typedef enum CUjit_target_enum typedef enum CUjit_target_enum
{ {
CU_TARGET_COMPUTE_10 = 0, CU_TARGET_COMPUTE_10 = 0,
CU_TARGET_COMPUTE_11, CU_TARGET_COMPUTE_11,
CU_TARGET_COMPUTE_12, CU_TARGET_COMPUTE_12,
CU_TARGET_COMPUTE_13, CU_TARGET_COMPUTE_13,
CU_TARGET_COMPUTE_20, CU_TARGET_COMPUTE_20,
CU_TARGET_COMPUTE_21, CU_TARGET_COMPUTE_21,
CU_TARGET_COMPUTE_30 CU_TARGET_COMPUTE_30
} CUjit_target; } CUjit_target;
typedef enum CUjit_fallback_enum typedef enum CUjit_fallback_enum
{ {
CU_PREFER_PTX = 0, CU_PREFER_PTX = 0,
CU_PREFER_BINARY CU_PREFER_BINARY
} CUjit_fallback; } CUjit_fallback;
typedef enum CUgraphicsRegisterFlags_enum { typedef enum CUgraphicsRegisterFlags_enum {
CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00 CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00
} CUgraphicsRegisterFlags; } CUgraphicsRegisterFlags;
typedef enum CUgraphicsMapResourceFlags_enum { typedef enum CUgraphicsMapResourceFlags_enum {
CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00,
CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01,
CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02 CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02
} CUgraphicsMapResourceFlags; } CUgraphicsMapResourceFlags;
typedef enum CUarray_cubemap_face_enum { typedef enum CUarray_cubemap_face_enum {
CU_CUBEMAP_FACE_POSITIVE_X = 0x00, CU_CUBEMAP_FACE_POSITIVE_X = 0x00,
CU_CUBEMAP_FACE_NEGATIVE_X = 0x01, CU_CUBEMAP_FACE_NEGATIVE_X = 0x01,
CU_CUBEMAP_FACE_POSITIVE_Y = 0x02, CU_CUBEMAP_FACE_POSITIVE_Y = 0x02,
CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03, CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03,
CU_CUBEMAP_FACE_POSITIVE_Z = 0x04, CU_CUBEMAP_FACE_POSITIVE_Z = 0x04,
CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05 CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05
} CUarray_cubemap_face; } CUarray_cubemap_face;
typedef enum CUlimit_enum { typedef enum CUlimit_enum {
CU_LIMIT_STACK_SIZE = 0x00, CU_LIMIT_STACK_SIZE = 0x00,
CU_LIMIT_PRINTF_FIFO_SIZE = 0x01, CU_LIMIT_PRINTF_FIFO_SIZE = 0x01,
CU_LIMIT_MALLOC_HEAP_SIZE = 0x02 CU_LIMIT_MALLOC_HEAP_SIZE = 0x02
} CUlimit; } CUlimit;
typedef enum cudaError_enum { typedef enum cudaError_enum {
CUDA_SUCCESS = 0, CUDA_SUCCESS = 0,
CUDA_ERROR_INVALID_VALUE = 1, CUDA_ERROR_INVALID_VALUE = 1,
CUDA_ERROR_OUT_OF_MEMORY = 2, CUDA_ERROR_OUT_OF_MEMORY = 2,
CUDA_ERROR_NOT_INITIALIZED = 3, CUDA_ERROR_NOT_INITIALIZED = 3,
CUDA_ERROR_DEINITIALIZED = 4, CUDA_ERROR_DEINITIALIZED = 4,
CUDA_ERROR_NO_DEVICE = 100, CUDA_ERROR_NO_DEVICE = 100,
CUDA_ERROR_INVALID_DEVICE = 101, CUDA_ERROR_INVALID_DEVICE = 101,
CUDA_ERROR_INVALID_IMAGE = 200, CUDA_ERROR_INVALID_IMAGE = 200,
CUDA_ERROR_INVALID_CONTEXT = 201, CUDA_ERROR_INVALID_CONTEXT = 201,
CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202, CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202,
CUDA_ERROR_MAP_FAILED = 205, CUDA_ERROR_MAP_FAILED = 205,
CUDA_ERROR_UNMAP_FAILED = 206, CUDA_ERROR_UNMAP_FAILED = 206,
CUDA_ERROR_ARRAY_IS_MAPPED = 207, CUDA_ERROR_ARRAY_IS_MAPPED = 207,
CUDA_ERROR_ALREADY_MAPPED = 208, CUDA_ERROR_ALREADY_MAPPED = 208,
CUDA_ERROR_NO_BINARY_FOR_GPU = 209, CUDA_ERROR_NO_BINARY_FOR_GPU = 209,
CUDA_ERROR_ALREADY_ACQUIRED = 210, CUDA_ERROR_ALREADY_ACQUIRED = 210,
CUDA_ERROR_NOT_MAPPED = 211, CUDA_ERROR_NOT_MAPPED = 211,
CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212, CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212,
CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213, CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213,
CUDA_ERROR_ECC_UNCORRECTABLE = 214, CUDA_ERROR_ECC_UNCORRECTABLE = 214,
CUDA_ERROR_UNSUPPORTED_LIMIT = 215, CUDA_ERROR_UNSUPPORTED_LIMIT = 215,
CUDA_ERROR_INVALID_SOURCE = 300, CUDA_ERROR_INVALID_SOURCE = 300,
CUDA_ERROR_FILE_NOT_FOUND = 301, CUDA_ERROR_FILE_NOT_FOUND = 301,
CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303, CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303,
CUDA_ERROR_OPERATING_SYSTEM = 304, CUDA_ERROR_OPERATING_SYSTEM = 304,
CUDA_ERROR_INVALID_HANDLE = 400, CUDA_ERROR_INVALID_HANDLE = 400,
CUDA_ERROR_NOT_FOUND = 500, CUDA_ERROR_NOT_FOUND = 500,
CUDA_ERROR_NOT_READY = 600, CUDA_ERROR_NOT_READY = 600,
CUDA_ERROR_LAUNCH_FAILED = 700, CUDA_ERROR_LAUNCH_FAILED = 700,
CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701, CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701,
CUDA_ERROR_LAUNCH_TIMEOUT = 702, CUDA_ERROR_LAUNCH_TIMEOUT = 702,
CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703, CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703,
CUDA_ERROR_UNKNOWN = 999 CUDA_ERROR_UNKNOWN = 999
} CUresult; } CUresult;
#define CU_MEMHOSTALLOC_PORTABLE 0x01 #define CU_MEMHOSTALLOC_PORTABLE 0x01
@@ -282,76 +282,76 @@ typedef enum cudaError_enum {
#define CU_MEMHOSTALLOC_WRITECOMBINED 0x04 #define CU_MEMHOSTALLOC_WRITECOMBINED 0x04
typedef struct CUDA_MEMCPY2D_st { typedef struct CUDA_MEMCPY2D_st {
size_t srcXInBytes; size_t srcXInBytes;
size_t srcY; size_t srcY;
CUmemorytype srcMemoryType; CUmemorytype srcMemoryType;
const void *srcHost; const void *srcHost;
CUdeviceptr srcDevice; CUdeviceptr srcDevice;
CUarray srcArray; CUarray srcArray;
size_t srcPitch; size_t srcPitch;
size_t dstXInBytes; size_t dstXInBytes;
size_t dstY; size_t dstY;
CUmemorytype dstMemoryType; CUmemorytype dstMemoryType;
void *dstHost; void *dstHost;
CUdeviceptr dstDevice; CUdeviceptr dstDevice;
CUarray dstArray; CUarray dstArray;
size_t dstPitch; size_t dstPitch;
size_t WidthInBytes; size_t WidthInBytes;
size_t Height; size_t Height;
} CUDA_MEMCPY2D; } CUDA_MEMCPY2D;
typedef struct CUDA_MEMCPY3D_st { typedef struct CUDA_MEMCPY3D_st {
size_t srcXInBytes; size_t srcXInBytes;
size_t srcY; size_t srcY;
size_t srcZ; size_t srcZ;
size_t srcLOD; size_t srcLOD;
CUmemorytype srcMemoryType; CUmemorytype srcMemoryType;
const void *srcHost; const void *srcHost;
CUdeviceptr srcDevice; CUdeviceptr srcDevice;
CUarray srcArray; CUarray srcArray;
void *reserved0; void *reserved0;
size_t srcPitch; size_t srcPitch;
size_t srcHeight; size_t srcHeight;
size_t dstXInBytes; size_t dstXInBytes;
size_t dstY; size_t dstY;
size_t dstZ; size_t dstZ;
size_t dstLOD; size_t dstLOD;
CUmemorytype dstMemoryType; CUmemorytype dstMemoryType;
void *dstHost; void *dstHost;
CUdeviceptr dstDevice; CUdeviceptr dstDevice;
CUarray dstArray; CUarray dstArray;
void *reserved1; void *reserved1;
size_t dstPitch; size_t dstPitch;
size_t dstHeight; size_t dstHeight;
size_t WidthInBytes; size_t WidthInBytes;
size_t Height; size_t Height;
size_t Depth; size_t Depth;
} CUDA_MEMCPY3D; } CUDA_MEMCPY3D;
typedef struct CUDA_ARRAY_DESCRIPTOR_st typedef struct CUDA_ARRAY_DESCRIPTOR_st
{ {
size_t Width; size_t Width;
size_t Height; size_t Height;
CUarray_format Format; CUarray_format Format;
unsigned int NumChannels; unsigned int NumChannels;
} CUDA_ARRAY_DESCRIPTOR; } CUDA_ARRAY_DESCRIPTOR;
typedef struct CUDA_ARRAY3D_DESCRIPTOR_st typedef struct CUDA_ARRAY3D_DESCRIPTOR_st
{ {
size_t Width; size_t Width;
size_t Height; size_t Height;
size_t Depth; size_t Depth;
CUarray_format Format; CUarray_format Format;
unsigned int NumChannels; unsigned int NumChannels;
unsigned int Flags; unsigned int Flags;
} CUDA_ARRAY3D_DESCRIPTOR; } CUDA_ARRAY3D_DESCRIPTOR;
#define CUDA_ARRAY3D_2DARRAY 0x01 #define CUDA_ARRAY3D_2DARRAY 0x01

View File

@@ -34,14 +34,14 @@ static inline uint hash_int_2d(uint kx, uint ky)
b += ky; b += ky;
c ^= b; c -= rot(b,14); c ^= b; c -= rot(b,14);
a ^= c; a -= rot(c,11); a ^= c; a -= rot(c,11);
b ^= a; b -= rot(a,25); b ^= a; b -= rot(a,25);
c ^= b; c -= rot(b,16); c ^= b; c -= rot(b,16);
a ^= c; a -= rot(c,4); a ^= c; a -= rot(c,4);
b ^= a; b -= rot(a,14); b ^= a; b -= rot(a,14);
c ^= b; c -= rot(b,24); c ^= b; c -= rot(b,24);
return c; return c;
#undef rot #undef rot
} }

View File

@@ -365,7 +365,7 @@ string MD5Hash::get_hex()
finish(digest); finish(digest);
for(int i=0; i<16; i++) for(int i = 0; i < 16; i++)
sprintf(buf + i*2, "%02X", digest[i]); sprintf(buf + i*2, "%02X", digest[i]);
buf[sizeof(buf)-1] = '\0'; buf[sizeof(buf)-1] = '\0';

View File

@@ -44,13 +44,13 @@ public:
bool append_file(const string& filepath); bool append_file(const string& filepath);
string get_hex(); string get_hex();
protected: protected:
void process(const uint8_t *data); void process(const uint8_t *data);
void finish(uint8_t digest[16]); void finish(uint8_t digest[16]);
uint32_t count[2]; /* message length in bits, lsw first */ uint32_t count[2]; /* message length in bits, lsw first */
uint32_t abcd[4]; /* digest buffer */ uint32_t abcd[4]; /* digest buffer */
uint8_t buf[64]; /* accumulate block */ uint8_t buf[64]; /* accumulate block */
}; };
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -13,29 +13,29 @@
#ifndef CLCC_GENERATE_DOCUMENTATION #ifndef CLCC_GENERATE_DOCUMENTATION
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN # define VC_EXTRALEAN
#include <windows.h> # include <windows.h>
typedef HMODULE CLCC_DYNLIB_HANDLE; typedef HMODULE CLCC_DYNLIB_HANDLE;
#define CLCC_DYNLIB_OPEN LoadLibrary # define CLCC_DYNLIB_OPEN LoadLibrary
#define CLCC_DYNLIB_CLOSE FreeLibrary # define CLCC_DYNLIB_CLOSE FreeLibrary
#define CLCC_DYNLIB_IMPORT GetProcAddress # define CLCC_DYNLIB_IMPORT GetProcAddress
#else #else
#include <dlfcn.h> # include <dlfcn.h>
typedef void* CLCC_DYNLIB_HANDLE;
#define CLCC_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL) typedef void* CLCC_DYNLIB_HANDLE;
#define CLCC_DYNLIB_CLOSE dlclose
#define CLCC_DYNLIB_IMPORT dlsym # define CLCC_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL)
# define CLCC_DYNLIB_CLOSE dlclose
# define CLCC_DYNLIB_IMPORT dlsym
#endif #endif
#else #else
//typedef implementation_defined CLCC_DYNLIB_HANDLE; // typedef implementation_defined CLCC_DYNLIB_HANDLE;
//#define CLCC_DYNLIB_OPEN(path) implementation_defined //# define CLCC_DYNLIB_OPEN(path) implementation_defined
//#define CLCC_DYNLIB_CLOSE implementation_defined //# define CLCC_DYNLIB_CLOSE implementation_defined
//#define CLCC_DYNLIB_IMPORT implementation_defined //# define CLCC_DYNLIB_IMPORT implementation_defined
#endif #endif
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@@ -117,12 +117,12 @@ PFNCLGETEXTENSIONFUNCTIONADDRESS __clewGetExtensionFunctionAddress = NULL;
//! \brief Unloads OpenCL dynamic library, should not be called directly //! \brief Unloads OpenCL dynamic library, should not be called directly
static void clewExit(void) static void clewExit(void)
{ {
if (module != NULL) if (module != NULL)
{ {
// Ignore errors // Ignore errors
CLCC_DYNLIB_CLOSE(module); CLCC_DYNLIB_CLOSE(module);
module = NULL; module = NULL;
} }
} }
//! \param path path to dynamic library to load //! \param path path to dynamic library to load
@@ -138,186 +138,186 @@ int clLibraryInit()
#else #else
const char *path = "libOpenCL.so"; const char *path = "libOpenCL.so";
#endif #endif
int error = 0; int error = 0;
// Check if already initialized // Check if already initialized
if (module != NULL) if (module != NULL)
{ {
return 1; return 1;
} }
// Load library // Load library
module = CLCC_DYNLIB_OPEN(path); module = CLCC_DYNLIB_OPEN(path);
// Check for errors // Check for errors
if (module == NULL) if (module == NULL)
{ {
return 0; return 0;
} }
// Set unloading // Set unloading
error = atexit(clewExit); error = atexit(clewExit);
if (error) if (error)
{ {
// Failure queing atexit, shutdown with error // Failure queing atexit, shutdown with error
CLCC_DYNLIB_CLOSE(module); CLCC_DYNLIB_CLOSE(module);
module = NULL; module = NULL;
return 0; return 0;
} }
// Determine function entry-points // Determine function entry-points
__clewGetPlatformIDs = (PFNCLGETPLATFORMIDS )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs"); __clewGetPlatformIDs = (PFNCLGETPLATFORMIDS )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs");
__clewGetPlatformInfo = (PFNCLGETPLATFORMINFO )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo"); __clewGetPlatformInfo = (PFNCLGETPLATFORMINFO )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo");
__clewGetDeviceIDs = (PFNCLGETDEVICEIDS )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs"); __clewGetDeviceIDs = (PFNCLGETDEVICEIDS )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs");
__clewGetDeviceInfo = (PFNCLGETDEVICEINFO )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo"); __clewGetDeviceInfo = (PFNCLGETDEVICEINFO )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo");
__clewCreateContext = (PFNCLCREATECONTEXT )CLCC_DYNLIB_IMPORT(module, "clCreateContext"); __clewCreateContext = (PFNCLCREATECONTEXT )CLCC_DYNLIB_IMPORT(module, "clCreateContext");
__clewCreateContextFromType = (PFNCLCREATECONTEXTFROMTYPE )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType"); __clewCreateContextFromType = (PFNCLCREATECONTEXTFROMTYPE )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType");
__clewRetainContext = (PFNCLRETAINCONTEXT )CLCC_DYNLIB_IMPORT(module, "clRetainContext"); __clewRetainContext = (PFNCLRETAINCONTEXT )CLCC_DYNLIB_IMPORT(module, "clRetainContext");
__clewReleaseContext = (PFNCLRELEASECONTEXT )CLCC_DYNLIB_IMPORT(module, "clReleaseContext"); __clewReleaseContext = (PFNCLRELEASECONTEXT )CLCC_DYNLIB_IMPORT(module, "clReleaseContext");
__clewGetContextInfo = (PFNCLGETCONTEXTINFO )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo"); __clewGetContextInfo = (PFNCLGETCONTEXTINFO )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo");
__clewCreateCommandQueue = (PFNCLCREATECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue"); __clewCreateCommandQueue = (PFNCLCREATECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue");
__clewRetainCommandQueue = (PFNCLRETAINCOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue"); __clewRetainCommandQueue = (PFNCLRETAINCOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue");
__clewReleaseCommandQueue = (PFNCLRELEASECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue"); __clewReleaseCommandQueue = (PFNCLRELEASECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue");
__clewGetCommandQueueInfo = (PFNCLGETCOMMANDQUEUEINFO )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo"); __clewGetCommandQueueInfo = (PFNCLGETCOMMANDQUEUEINFO )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo");
__clewSetCommandQueueProperty = (PFNCLSETCOMMANDQUEUEPROPERTY )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty"); __clewSetCommandQueueProperty = (PFNCLSETCOMMANDQUEUEPROPERTY )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty");
__clewCreateBuffer = (PFNCLCREATEBUFFER )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer"); __clewCreateBuffer = (PFNCLCREATEBUFFER )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer");
__clewCreateImage2D = (PFNCLCREATEIMAGE2D )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D"); __clewCreateImage2D = (PFNCLCREATEIMAGE2D )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D");
__clewCreateImage3D = (PFNCLCREATEIMAGE3D )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D"); __clewCreateImage3D = (PFNCLCREATEIMAGE3D )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D");
__clewRetainMemObject = (PFNCLRETAINMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject"); __clewRetainMemObject = (PFNCLRETAINMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject");
__clewReleaseMemObject = (PFNCLRELEASEMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject"); __clewReleaseMemObject = (PFNCLRELEASEMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject");
__clewGetSupportedImageFormats = (PFNCLGETSUPPORTEDIMAGEFORMATS )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats"); __clewGetSupportedImageFormats = (PFNCLGETSUPPORTEDIMAGEFORMATS )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats");
__clewGetMemObjectInfo = (PFNCLGETMEMOBJECTINFO )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo"); __clewGetMemObjectInfo = (PFNCLGETMEMOBJECTINFO )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo");
__clewGetImageInfo = (PFNCLGETIMAGEINFO )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo"); __clewGetImageInfo = (PFNCLGETIMAGEINFO )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo");
__clewCreateSampler = (PFNCLCREATESAMPLER )CLCC_DYNLIB_IMPORT(module, "clCreateSampler"); __clewCreateSampler = (PFNCLCREATESAMPLER )CLCC_DYNLIB_IMPORT(module, "clCreateSampler");
__clewRetainSampler = (PFNCLRETAINSAMPLER )CLCC_DYNLIB_IMPORT(module, "clRetainSampler"); __clewRetainSampler = (PFNCLRETAINSAMPLER )CLCC_DYNLIB_IMPORT(module, "clRetainSampler");
__clewReleaseSampler = (PFNCLRELEASESAMPLER )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler"); __clewReleaseSampler = (PFNCLRELEASESAMPLER )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler");
__clewGetSamplerInfo = (PFNCLGETSAMPLERINFO )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo"); __clewGetSamplerInfo = (PFNCLGETSAMPLERINFO )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo");
__clewCreateProgramWithSource = (PFNCLCREATEPROGRAMWITHSOURCE )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource"); __clewCreateProgramWithSource = (PFNCLCREATEPROGRAMWITHSOURCE )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource");
__clewCreateProgramWithBinary = (PFNCLCREATEPROGRAMWITHBINARY )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary"); __clewCreateProgramWithBinary = (PFNCLCREATEPROGRAMWITHBINARY )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary");
__clewRetainProgram = (PFNCLRETAINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clRetainProgram"); __clewRetainProgram = (PFNCLRETAINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clRetainProgram");
__clewReleaseProgram = (PFNCLRELEASEPROGRAM )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram"); __clewReleaseProgram = (PFNCLRELEASEPROGRAM )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram");
__clewBuildProgram = (PFNCLBUILDPROGRAM )CLCC_DYNLIB_IMPORT(module, "clBuildProgram"); __clewBuildProgram = (PFNCLBUILDPROGRAM )CLCC_DYNLIB_IMPORT(module, "clBuildProgram");
__clewUnloadCompiler = (PFNCLUNLOADCOMPILER )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler"); __clewUnloadCompiler = (PFNCLUNLOADCOMPILER )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler");
__clewGetProgramInfo = (PFNCLGETPROGRAMINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo"); __clewGetProgramInfo = (PFNCLGETPROGRAMINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo");
__clewGetProgramBuildInfo = (PFNCLGETPROGRAMBUILDINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo"); __clewGetProgramBuildInfo = (PFNCLGETPROGRAMBUILDINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo");
__clewCreateKernel = (PFNCLCREATEKERNEL )CLCC_DYNLIB_IMPORT(module, "clCreateKernel"); __clewCreateKernel = (PFNCLCREATEKERNEL )CLCC_DYNLIB_IMPORT(module, "clCreateKernel");
__clewCreateKernelsInProgram = (PFNCLCREATEKERNELSINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram"); __clewCreateKernelsInProgram = (PFNCLCREATEKERNELSINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram");
__clewRetainKernel = (PFNCLRETAINKERNEL )CLCC_DYNLIB_IMPORT(module, "clRetainKernel"); __clewRetainKernel = (PFNCLRETAINKERNEL )CLCC_DYNLIB_IMPORT(module, "clRetainKernel");
__clewReleaseKernel = (PFNCLRELEASEKERNEL )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel"); __clewReleaseKernel = (PFNCLRELEASEKERNEL )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel");
__clewSetKernelArg = (PFNCLSETKERNELARG )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg"); __clewSetKernelArg = (PFNCLSETKERNELARG )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg");
__clewGetKernelInfo = (PFNCLGETKERNELINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo"); __clewGetKernelInfo = (PFNCLGETKERNELINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo");
__clewGetKernelWorkGroupInfo = (PFNCLGETKERNELWORKGROUPINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo"); __clewGetKernelWorkGroupInfo = (PFNCLGETKERNELWORKGROUPINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo");
__clewWaitForEvents = (PFNCLWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents"); __clewWaitForEvents = (PFNCLWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents");
__clewGetEventInfo = (PFNCLGETEVENTINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo"); __clewGetEventInfo = (PFNCLGETEVENTINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo");
__clewRetainEvent = (PFNCLRETAINEVENT )CLCC_DYNLIB_IMPORT(module, "clRetainEvent"); __clewRetainEvent = (PFNCLRETAINEVENT )CLCC_DYNLIB_IMPORT(module, "clRetainEvent");
__clewReleaseEvent = (PFNCLRELEASEEVENT )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent"); __clewReleaseEvent = (PFNCLRELEASEEVENT )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent");
__clewGetEventProfilingInfo = (PFNCLGETEVENTPROFILINGINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo"); __clewGetEventProfilingInfo = (PFNCLGETEVENTPROFILINGINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo");
__clewFlush = (PFNCLFLUSH )CLCC_DYNLIB_IMPORT(module, "clFlush"); __clewFlush = (PFNCLFLUSH )CLCC_DYNLIB_IMPORT(module, "clFlush");
__clewFinish = (PFNCLFINISH )CLCC_DYNLIB_IMPORT(module, "clFinish"); __clewFinish = (PFNCLFINISH )CLCC_DYNLIB_IMPORT(module, "clFinish");
__clewEnqueueReadBuffer = (PFNCLENQUEUEREADBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer"); __clewEnqueueReadBuffer = (PFNCLENQUEUEREADBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer");
__clewEnqueueWriteBuffer = (PFNCLENQUEUEWRITEBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer"); __clewEnqueueWriteBuffer = (PFNCLENQUEUEWRITEBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer");
__clewEnqueueCopyBuffer = (PFNCLENQUEUECOPYBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer"); __clewEnqueueCopyBuffer = (PFNCLENQUEUECOPYBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer");
__clewEnqueueReadImage = (PFNCLENQUEUEREADIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage"); __clewEnqueueReadImage = (PFNCLENQUEUEREADIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage");
__clewEnqueueWriteImage = (PFNCLENQUEUEWRITEIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage"); __clewEnqueueWriteImage = (PFNCLENQUEUEWRITEIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage");
__clewEnqueueCopyImage = (PFNCLENQUEUECOPYIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage"); __clewEnqueueCopyImage = (PFNCLENQUEUECOPYIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage");
__clewEnqueueCopyImageToBuffer = (PFNCLENQUEUECOPYIMAGETOBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer"); __clewEnqueueCopyImageToBuffer = (PFNCLENQUEUECOPYIMAGETOBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer");
__clewEnqueueCopyBufferToImage = (PFNCLENQUEUECOPYBUFFERTOIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage"); __clewEnqueueCopyBufferToImage = (PFNCLENQUEUECOPYBUFFERTOIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage");
__clewEnqueueMapBuffer = (PFNCLENQUEUEMAPBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer"); __clewEnqueueMapBuffer = (PFNCLENQUEUEMAPBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer");
__clewEnqueueMapImage = (PFNCLENQUEUEMAPIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage"); __clewEnqueueMapImage = (PFNCLENQUEUEMAPIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage");
__clewEnqueueUnmapMemObject = (PFNCLENQUEUEUNMAPMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject"); __clewEnqueueUnmapMemObject = (PFNCLENQUEUEUNMAPMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject");
__clewEnqueueNDRangeKernel = (PFNCLENQUEUENDRANGEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel"); __clewEnqueueNDRangeKernel = (PFNCLENQUEUENDRANGEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel");
__clewEnqueueTask = (PFNCLENQUEUETASK )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask"); __clewEnqueueTask = (PFNCLENQUEUETASK )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask");
__clewEnqueueNativeKernel = (PFNCLENQUEUENATIVEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel"); __clewEnqueueNativeKernel = (PFNCLENQUEUENATIVEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel");
__clewEnqueueMarker = (PFNCLENQUEUEMARKER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker"); __clewEnqueueMarker = (PFNCLENQUEUEMARKER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker");
__clewEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents"); __clewEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
__clewEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier"); __clewEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
__clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress"); __clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
if(__clewGetPlatformIDs == NULL) if(__clewGetPlatformIDs == NULL)
return 0; return 0;
return 1; return 1;
} }
//! \param error CL error code //! \param error CL error code
//! \return a string representation of the error code //! \return a string representation of the error code
const char *clErrorString(cl_int error) const char *clErrorString(cl_int error)
{ {
static const char* strings[] = static const char* strings[] =
{ {
// Error Codes // Error Codes
"CL_SUCCESS" // 0 "CL_SUCCESS" // 0
, "CL_DEVICE_NOT_FOUND" // -1 , "CL_DEVICE_NOT_FOUND" // -1
, "CL_DEVICE_NOT_AVAILABLE" // -2 , "CL_DEVICE_NOT_AVAILABLE" // -2
, "CL_COMPILER_NOT_AVAILABLE" // -3 , "CL_COMPILER_NOT_AVAILABLE" // -3
, "CL_MEM_OBJECT_ALLOCATION_FAILURE" // -4 , "CL_MEM_OBJECT_ALLOCATION_FAILURE" // -4
, "CL_OUT_OF_RESOURCES" // -5 , "CL_OUT_OF_RESOURCES" // -5
, "CL_OUT_OF_HOST_MEMORY" // -6 , "CL_OUT_OF_HOST_MEMORY" // -6
, "CL_PROFILING_INFO_NOT_AVAILABLE" // -7 , "CL_PROFILING_INFO_NOT_AVAILABLE" // -7
, "CL_MEM_COPY_OVERLAP" // -8 , "CL_MEM_COPY_OVERLAP" // -8
, "CL_IMAGE_FORMAT_MISMATCH" // -9 , "CL_IMAGE_FORMAT_MISMATCH" // -9
, "CL_IMAGE_FORMAT_NOT_SUPPORTED" // -10 , "CL_IMAGE_FORMAT_NOT_SUPPORTED" // -10
, "CL_BUILD_PROGRAM_FAILURE" // -11 , "CL_BUILD_PROGRAM_FAILURE" // -11
, "CL_MAP_FAILURE" // -12 , "CL_MAP_FAILURE" // -12
, "" // -13 , "" // -13
, "" // -14 , "" // -14
, "" // -15 , "" // -15
, "" // -16 , "" // -16
, "" // -17 , "" // -17
, "" // -18 , "" // -18
, "" // -19 , "" // -19
, "" // -20 , "" // -20
, "" // -21 , "" // -21
, "" // -22 , "" // -22
, "" // -23 , "" // -23
, "" // -24 , "" // -24
, "" // -25 , "" // -25
, "" // -26 , "" // -26
, "" // -27 , "" // -27
, "" // -28 , "" // -28
, "" // -29 , "" // -29
, "CL_INVALID_VALUE" // -30 , "CL_INVALID_VALUE" // -30
, "CL_INVALID_DEVICE_TYPE" // -31 , "CL_INVALID_DEVICE_TYPE" // -31
, "CL_INVALID_PLATFORM" // -32 , "CL_INVALID_PLATFORM" // -32
, "CL_INVALID_DEVICE" // -33 , "CL_INVALID_DEVICE" // -33
, "CL_INVALID_CONTEXT" // -34 , "CL_INVALID_CONTEXT" // -34
, "CL_INVALID_QUEUE_PROPERTIES" // -35 , "CL_INVALID_QUEUE_PROPERTIES" // -35
, "CL_INVALID_COMMAND_QUEUE" // -36 , "CL_INVALID_COMMAND_QUEUE" // -36
, "CL_INVALID_HOST_PTR" // -37 , "CL_INVALID_HOST_PTR" // -37
, "CL_INVALID_MEM_OBJECT" // -38 , "CL_INVALID_MEM_OBJECT" // -38
, "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR" // -39 , "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR" // -39
, "CL_INVALID_IMAGE_SIZE" // -40 , "CL_INVALID_IMAGE_SIZE" // -40
, "CL_INVALID_SAMPLER" // -41 , "CL_INVALID_SAMPLER" // -41
, "CL_INVALID_BINARY" // -42 , "CL_INVALID_BINARY" // -42
, "CL_INVALID_BUILD_OPTIONS" // -43 , "CL_INVALID_BUILD_OPTIONS" // -43
, "CL_INVALID_PROGRAM" // -44 , "CL_INVALID_PROGRAM" // -44
, "CL_INVALID_PROGRAM_EXECUTABLE" // -45 , "CL_INVALID_PROGRAM_EXECUTABLE" // -45
, "CL_INVALID_KERNEL_NAME" // -46 , "CL_INVALID_KERNEL_NAME" // -46
, "CL_INVALID_KERNEL_DEFINITION" // -47 , "CL_INVALID_KERNEL_DEFINITION" // -47
, "CL_INVALID_KERNEL" // -48 , "CL_INVALID_KERNEL" // -48
, "CL_INVALID_ARG_INDEX" // -49 , "CL_INVALID_ARG_INDEX" // -49
, "CL_INVALID_ARG_VALUE" // -50 , "CL_INVALID_ARG_VALUE" // -50
, "CL_INVALID_ARG_SIZE" // -51 , "CL_INVALID_ARG_SIZE" // -51
, "CL_INVALID_KERNEL_ARGS" // -52 , "CL_INVALID_KERNEL_ARGS" // -52
, "CL_INVALID_WORK_DIMENSION" // -53 , "CL_INVALID_WORK_DIMENSION" // -53
, "CL_INVALID_WORK_GROUP_SIZE" // -54 , "CL_INVALID_WORK_GROUP_SIZE" // -54
, "CL_INVALID_WORK_ITEM_SIZE" // -55 , "CL_INVALID_WORK_ITEM_SIZE" // -55
, "CL_INVALID_GLOBAL_OFFSET" // -56 , "CL_INVALID_GLOBAL_OFFSET" // -56
, "CL_INVALID_EVENT_WAIT_LIST" // -57 , "CL_INVALID_EVENT_WAIT_LIST" // -57
, "CL_INVALID_EVENT" // -58 , "CL_INVALID_EVENT" // -58
, "CL_INVALID_OPERATION" // -59 , "CL_INVALID_OPERATION" // -59
, "CL_INVALID_GL_OBJECT" // -60 , "CL_INVALID_GL_OBJECT" // -60
, "CL_INVALID_BUFFER_SIZE" // -61 , "CL_INVALID_BUFFER_SIZE" // -61
, "CL_INVALID_MIP_LEVEL" // -62 , "CL_INVALID_MIP_LEVEL" // -62
, "CL_INVALID_GLOBAL_WORK_SIZE" // -63 , "CL_INVALID_GLOBAL_WORK_SIZE" // -63
}; };
return strings[-error]; return strings[-error];
} }
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -339,8 +339,8 @@ typedef cl_uint cl_command_type;
typedef cl_uint cl_profiling_info; typedef cl_uint cl_profiling_info;
typedef struct _cl_image_format { typedef struct _cl_image_format {
cl_channel_order image_channel_order; cl_channel_order image_channel_order;
cl_channel_type image_channel_data_type; cl_channel_type image_channel_data_type;
} cl_image_format; } cl_image_format;

View File

@@ -55,7 +55,7 @@ static void view_display_text(int x, int y, const char *text)
glRasterPos3f(x, y, 0); glRasterPos3f(x, y, 0);
for(c=text; *c != '\0'; c++) for(c = text; *c != '\0'; c++)
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, *c); glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, *c);
} }