From 2c1abe1f5861330315a1fc58e7dfe298b8356449 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Jun 2012 18:56:12 +0000 Subject: [PATCH] style cleanup: assignment & indentation. --- intern/cycles/app/cycles_test.cpp | 8 +- intern/cycles/blender/blender_camera.cpp | 12 +- intern/cycles/blender/blender_mesh.cpp | 4 +- intern/cycles/blender/blender_particles.cpp | 2 +- intern/cycles/blender/blender_python.cpp | 5 +- intern/cycles/blender/blender_session.cpp | 7 +- intern/cycles/blender/blender_shader.cpp | 2 + intern/cycles/blender/blender_sync.cpp | 7 +- intern/cycles/bvh/bvh_node.cpp | 6 +- intern/cycles/kernel/kernel_differential.h | 6 +- intern/cycles/kernel/kernel_path.h | 5 +- intern/cycles/kernel/svm/bsdf.h | 28 +- intern/cycles/kernel/svm/svm_gradient.h | 6 +- intern/cycles/kernel/svm/svm_magic.h | 18 +- intern/cycles/kernel/svm/svm_mix.h | 16 +- intern/cycles/kernel/svm/svm_noise.h | 8 +- intern/cycles/kernel/svm/svm_texture.h | 2 +- intern/cycles/kernel/svm/svm_voronoi.h | 2 +- intern/cycles/kernel/svm/svm_wave.h | 4 +- intern/cycles/render/attribute.cpp | 10 +- intern/cycles/render/buffers.cpp | 4 +- intern/cycles/render/camera.cpp | 2 +- intern/cycles/render/camera.h | 2 +- intern/cycles/render/filter.cpp | 6 +- intern/cycles/render/nodes.h | 2 +- intern/cycles/util/util_cuda.h | 416 ++++++++++---------- intern/cycles/util/util_hash.h | 14 +- intern/cycles/util/util_md5.cpp | 2 +- intern/cycles/util/util_md5.h | 8 +- intern/cycles/util/util_opencl.cpp | 364 ++++++++--------- intern/cycles/util/util_opencl.h | 4 +- intern/cycles/util/util_view.cpp | 2 +- 32 files changed, 500 insertions(+), 484 deletions(-) diff --git a/intern/cycles/app/cycles_test.cpp b/intern/cycles/app/cycles_test.cpp index 0b8853d7036..f5890998adc 100644 --- a/intern/cycles/app/cycles_test.cpp +++ b/intern/cycles/app/cycles_test.cpp @@ -172,8 +172,8 @@ static void display() static void resize(int width, int height) { - options.width= width; - options.height= height; + options.width = width; + options.height = height; if(options.session) 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) { - options.width= 0; - options.height= 0; + options.width = 0; + options.height = 0; options.filepath = ""; options.session = NULL; options.quiet = false; diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index cffc533f87b..122d0bd7c17 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -222,14 +222,14 @@ static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height, } if(horizontal_fit) { - *aspectratio= xratio/yratio; - xaspect= *aspectratio; - yaspect= 1.0f; + *aspectratio = xratio/yratio; + xaspect = *aspectratio; + yaspect = 1.0f; } else { - *aspectratio= yratio/xratio; - xaspect= 1.0f; - yaspect= *aspectratio; + *aspectratio = yratio/xratio; + xaspect = 1.0f; + yaspect = *aspectratio; } /* modify aspect for orthographic scale */ diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index f3266435040..16e4ceded89 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -46,7 +46,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< float3 *N = attr_N->data_float3(); 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 */ 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) { 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()]; if(n == 4) diff --git a/intern/cycles/blender/blender_particles.cpp b/intern/cycles/blender/blender_particles.cpp index 2b19009989a..f591aaa6d83 100644 --- a/intern/cycles/blender/blender_particles.cpp +++ b/intern/cycles/blender/blender_particles.cpp @@ -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) { if (use_particle_system(*b_psys)) { 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)) { Particle pa; diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 6e892095387..4560c2f8543 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -193,7 +193,8 @@ CCLDeviceInfo *compute_device_list(DeviceType type) foreach(DeviceInfo& info, devices) { 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++}; device_list.push_back(cinfo); } @@ -214,7 +215,7 @@ CCL_NAMESPACE_END void *CCL_python_module_init() { - PyObject *mod= PyModule_Create(&ccl::module); + PyObject *mod = PyModule_Create(&ccl::module); #ifdef WITH_OSL PyModule_AddObject(mod, "with_osl", Py_True); diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index be0c2686713..12d7d00fb61 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -83,8 +83,8 @@ void BlenderSession::create_session() SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background); /* reset status/progress */ - last_status= ""; - last_progress= -1.0f; + last_status = ""; + last_progress = -1.0f; /* create scene */ scene = new Scene(scene_params); @@ -292,7 +292,8 @@ void BlenderSession::synchronize() SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background); if(session->params.modified(session_params) || - scene->params.modified(scene_params)) { + scene->params.modified(scene_params)) + { free_session(); create_session(); session->start(); diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index f9331fc1b14..35fe4c67673 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -784,7 +784,9 @@ void BlenderSync::sync_lamps() if(b_lamp->type() == BL::Lamp::type_POINT || b_lamp->type() == BL::Lamp::type_SPOT || b_lamp->type() == BL::Lamp::type_AREA) + { strength = 100.0f; + } closure = graph->add(new EmissionNode()); closure->input("Color")->value = get_float3(b_lamp->color()); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index a9714d6d72f..13040e551bd 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -105,10 +105,13 @@ bool BlenderSync::sync_recalc() 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 && - (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; + } + } bool recalc = shader_map.has_recalc() || diff --git a/intern/cycles/bvh/bvh_node.cpp b/intern/cycles/bvh/bvh_node.cpp index 4edfb4b70a4..7cc9bd333b0 100644 --- a/intern/cycles/bvh/bvh_node.cpp +++ b/intern/cycles/bvh/bvh_node.cpp @@ -52,7 +52,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const } if(!is_leaf()) - for(int i=0;igetSubtreeSize(stat); return cnt; @@ -60,7 +60,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const void BVHNode::deleteSubtree() { - for(int i=0;ideleteSubtree(); @@ -71,7 +71,7 @@ float BVHNode::computeSubtreeSAHCost(const BVHParams& p, float probability) cons { float SAH = probability * p.cost(num_children(), num_triangles()); - for(int i=0;icomputeSubtreeSAHCost(p, probability * child->m_bounds.safe_area()/m_bounds.safe_area()); } diff --git a/intern/cycles/kernel/kernel_differential.h b/intern/cycles/kernel/kernel_differential.h index 5b4290a7722..04027523ea5 100644 --- a/intern/cycles/kernel/kernel_differential.h +++ b/intern/cycles/kernel/kernel_differential.h @@ -49,9 +49,9 @@ __device void differential_dudv(differential *du, differential *dv, float3 dPdu, * mainly used for differentials of arbitrary mesh attributes. */ /* find most stable axis to project to 2D */ - float xn= fabsf(Ng.x); - float yn= fabsf(Ng.y); - float zn= fabsf(Ng.z); + float xn = fabsf(Ng.x); + float yn = fabsf(Ng.y); + float zn = fabsf(Ng.z); if(zn < xn || zn < yn) { if(yn < xn || yn < zn) { diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 16fd0499b00..8dbf66c108c 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -137,9 +137,12 @@ __device_inline float path_state_terminate_probability(KernelGlobals *kg, PathSt (state->diffuse_bounce >= kernel_data.integrator.max_diffuse_bounce) || (state->glossy_bounce >= kernel_data.integrator.max_glossy_bounce) || (state->transmission_bounce >= kernel_data.integrator.max_transmission_bounce)) + { return 0.0f; - else if(state->bounce <= kernel_data.integrator.min_bounce) + } + else if(state->bounce <= kernel_data.integrator.min_bounce) { return 1.0f; + } } /* probalistic termination */ diff --git a/intern/cycles/kernel/svm/bsdf.h b/intern/cycles/kernel/svm/bsdf.h index ba78a93f54f..1a90eab0cd1 100644 --- a/intern/cycles/kernel/svm/bsdf.h +++ b/intern/cycles/kernel/svm/bsdf.h @@ -47,7 +47,7 @@ __device float fresnel_dielectric(float eta, const float3 N, float cos = dot(N, I), neta; float3 Nn; // compute reflection - *R =(2 * cos)* N - I; + *R = (2 * cos)* N - I; #ifdef __RAY_DIFFERENTIALS__ *dRdx = (2 * dot(N, dIdx)) * N - dIdx; *dRdy = (2 * dot(N, dIdy)) * N - dIdy; @@ -65,18 +65,18 @@ __device float fresnel_dielectric(float eta, const float3 N, Nn = -N; *is_inside = true; } - *R =(2 * cos)* Nn - I; + *R = (2 * cos)* Nn - I; float arg = 1 -(neta * neta *(1 -(cos * cos))); if(arg < 0) { - *T= make_float3(0.0f, 0.0f, 0.0f); + *T = make_float3(0.0f, 0.0f, 0.0f); #ifdef __RAY_DIFFERENTIALS__ - *dTdx= make_float3(0.0f, 0.0f, 0.0f); - *dTdy= 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); #endif return 1; // total internal reflection } else { float dnp = sqrtf(arg); - float nK =(neta * cos)- dnp; + float nK = (neta * cos)- dnp; *T = -(neta * I)+(nK * Nn); #ifdef __RAY_DIFFERENTIALS__ *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 float cosTheta1 = cos; // N.R float cosTheta2 = -dot(Nn, *T); - float pPara =(cosTheta1 - eta * cosTheta2)/(cosTheta1 + eta * cosTheta2); - float pPerp =(eta * cosTheta1 - cosTheta2)/(eta * cosTheta1 + cosTheta2); + float pPara = (cosTheta1 - eta * cosTheta2)/(cosTheta1 + eta * cosTheta2); + float pPerp = (eta * cosTheta1 - cosTheta2)/(eta * cosTheta1 + cosTheta2); 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; if(g > 0) { g = sqrtf(g); - float A =(g - c)/(g + c); - float B =(c *(g + c)- 1)/(c *(g - c)+ 1); + float A = (g - c)/(g + c); + float B = (c *(g + c)- 1)/(c *(g - c)+ 1); return 0.5f * A * A *(1 + B * B); } 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 = tmp_f * cosi * cosi; - float Rparl2 =(tmp -(2.0f * eta * cosi)+ 1)/ - (tmp +(2.0f * eta * cosi)+ 1); - float Rperp2 =(tmp_f -(2.0f * eta * cosi)+ cosi * cosi)/ - (tmp_f +(2.0f * eta * cosi)+ cosi * cosi); + float Rparl2 = (tmp - (2.0f * eta * cosi) + 1)/ + (tmp + (2.0f * eta * cosi) + 1); + float Rperp2 = (tmp_f - (2.0f * eta * cosi) + cosi * cosi)/ + (tmp_f + (2.0f * eta * cosi) + cosi * cosi); return(Rparl2 + Rperp2) * 0.5f; } diff --git a/intern/cycles/kernel/svm/svm_gradient.h b/intern/cycles/kernel/svm/svm_gradient.h index b29abed4edc..7fad1175c49 100644 --- a/intern/cycles/kernel/svm/svm_gradient.h +++ b/intern/cycles/kernel/svm/svm_gradient.h @@ -24,9 +24,9 @@ __device float svm_gradient(float3 p, NodeGradientType type) { float x, y, z; - x= p.x; - y= p.y; - z= p.z; + x = p.x; + y = p.y; + z = p.z; if(type == NODE_BLEND_LINEAR) { return x; diff --git a/intern/cycles/kernel/svm/svm_magic.h b/intern/cycles/kernel/svm/svm_magic.h index 65d37937e1e..fdded813784 100644 --- a/intern/cycles/kernel/svm/svm_magic.h +++ b/intern/cycles/kernel/svm/svm_magic.h @@ -34,39 +34,39 @@ __device_noinline float3 svm_magic(float3 p, int n, float distortion) y *= distortion; if(n > 1) { - x= cosf(x-y-z); + x = cosf(x-y-z); x *= distortion; if(n > 2) { - z= sinf(-x-y-z); + z = sinf(-x-y-z); z *= distortion; if(n > 3) { - x= -cosf(-x+y-z); + x = -cosf(-x+y-z); x *= distortion; if(n > 4) { - y= -sinf(-x+y+z); + y = -sinf(-x+y+z); y *= distortion; if(n > 5) { - y= -cosf(-x+y+z); + y = -cosf(-x+y+z); y *= distortion; if(n > 6) { - x= cosf(x+y+z); + x = cosf(x+y+z); x *= distortion; if(n > 7) { - z= sinf(x+y-z); + z = sinf(x+y-z); z *= distortion; if(n > 8) { - x= -cosf(-x-y+z); + x = -cosf(-x-y+z); x *= distortion; if(n > 9) { - y= -sinf(x-y+z); + y = -sinf(x-y+z); y *= distortion; } } diff --git a/intern/cycles/kernel/svm/svm_mix.h b/intern/cycles/kernel/svm/svm_mix.h index e2274a2e691..6b455e713c2 100644 --- a/intern/cycles/kernel/svm/svm_mix.h +++ b/intern/cycles/kernel/svm/svm_mix.h @@ -248,8 +248,8 @@ __device float3 svm_mix_soft(float t, float3 col1, float3 col2) { float tm = 1.0f - t; - float3 one= make_float3(1.0f, 1.0f, 1.0f); - float3 scr= one - (one - col2)*(one - col1); + float3 one = make_float3(1.0f, 1.0f, 1.0f); + float3 scr = one - (one - col2)*(one - col1); 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; 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 - 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) - outcol.y= col1.y + t*(2.0f*(col2.y - 0.5f)); + outcol.y = col1.y + t*(2.0f*(col2.y - 0.5f)); 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) - outcol.z= col1.z + t*(2.0f*(col2.z - 0.5f)); + outcol.z = col1.z + t*(2.0f*(col2.z - 0.5f)); 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; } diff --git a/intern/cycles/kernel/svm/svm_noise.h b/intern/cycles/kernel/svm/svm_noise.h index 22f3187943c..dfaf43acbd4 100644 --- a/intern/cycles/kernel/svm/svm_noise.h +++ b/intern/cycles/kernel/svm/svm_noise.h @@ -84,9 +84,9 @@ __device uint phash(int kx, int ky, int kz, int3 p) __device float floorfrac(float x, int* i) { - float f = floorf(x); - *i = (int)f; - return x - f; + float f = floorf(x); + *i = (int)f; + return x - f; } __device float fade(float t) @@ -96,7 +96,7 @@ __device float fade(float t) __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) diff --git a/intern/cycles/kernel/svm/svm_texture.h b/intern/cycles/kernel/svm/svm_texture.h index d12a85a5402..6c22d98e0df 100644 --- a/intern/cycles/kernel/svm/svm_texture.h +++ b/intern/cycles/kernel/svm/svm_texture.h @@ -221,7 +221,7 @@ __device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float o int i, n; octaves = clamp(octaves, 0.0f, 16.0f); - n= (int)octaves; + n = (int)octaves; for(i = 0; i <= n; i++) { float t = noise_basis(fscale*p, basis); diff --git a/intern/cycles/kernel/svm/svm_voronoi.h b/intern/cycles/kernel/svm/svm_voronoi.h index f5ee7851a51..7e7bd970320 100644 --- a/intern/cycles/kernel/svm/svm_voronoi.h +++ b/intern/cycles/kernel/svm/svm_voronoi.h @@ -38,7 +38,7 @@ __device_noinline float4 svm_voronoi(NodeVoronoiColoring coloring, float scale, } else { color = cellnoise_color(pa[0]); - fac= average(color); + fac = average(color); } return make_float4(color.x, color.y, color.z, fac); diff --git a/intern/cycles/kernel/svm/svm_wave.h b/intern/cycles/kernel/svm/svm_wave.h index 7050bbe7f00..d2d808e4063 100644 --- a/intern/cycles/kernel/svm/svm_wave.h +++ b/intern/cycles/kernel/svm/svm_wave.h @@ -27,9 +27,9 @@ __device_noinline float svm_wave(NodeWaveType type, float3 p, float scale, float p *= scale; 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) */ - n= len(p)*20.0f; + n = len(p) * 20.0f; if(distortion != 0.0f) n += distortion * noise_turbulence(p*dscale, NODE_NOISE_PERLIN, detail, 0); diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp index c1a089cc872..5c7966d6d96 100644 --- a/intern/cycles/render/attribute.cpp +++ b/intern/cycles/render/attribute.cpp @@ -74,10 +74,13 @@ bool Attribute::same_storage(TypeDesc a, TypeDesc b) if(a == TypeDesc::TypeColor || a == TypeDesc::TypePoint || a == TypeDesc::TypeVector || a == TypeDesc::TypeNormal) + { if(b == TypeDesc::TypeColor || b == TypeDesc::TypePoint || b == TypeDesc::TypeVector || b == TypeDesc::TypeNormal) + { return true; - + } + } return false; } @@ -286,10 +289,13 @@ bool AttributeRequestSet::modified(const AttributeRequestSet& other) for(size_t j = 0; j < requests.size() && !found; j++) if(requests[i].name == other.requests[j].name && requests[i].std == other.requests[j].std) + { found = true; + } - if(!found) + if(!found) { return true; + } } return false; diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index a7fd47c94cf..a79a3591e0f 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -117,8 +117,8 @@ void RenderBuffers::reset(Device *device, BufferParams& params_) uint *init_state = rng_state.resize(params.width, params.height); int x, y, width = params.width, height = params.height; - for(x=0; xmem_alloc(rng_state, MEM_READ_WRITE); diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index ed239074cd4..55a0f23f8d0 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -199,7 +199,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene) kcam->bladesrotation = bladesrotation; /* motion blur */ - kcam->shuttertime= (need_motion == Scene::MOTION_BLUR)? shuttertime: 0.0f; + kcam->shuttertime = (need_motion == Scene::MOTION_BLUR) ? shuttertime: 0.0f; /* type */ kcam->type = type; diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h index 647423d88ba..d2a3cce1817 100644 --- a/intern/cycles/render/camera.h +++ b/intern/cycles/render/camera.h @@ -78,7 +78,7 @@ public: bool use_motion; /* computed camera parameters */ - Transform screentoworld; + Transform screentoworld; Transform rastertoworld; Transform ndctoworld; Transform rastertocamera; diff --git a/intern/cycles/render/filter.cpp b/intern/cycles/render/filter.cpp index 9bcf57b5a27..0bd4fb4d579 100644 --- a/intern/cycles/render/filter.cpp +++ b/intern/cycles/render/filter.cpp @@ -73,17 +73,17 @@ static vector filter_table(FilterType type, float width) /* compute cumulative distribution function */ filter_table_cdf[0] = 0.0f; - for(i=0; i +# define WIN32_LEAN_AND_MEAN +# define VC_EXTRALEAN +# include - typedef HMODULE CLCC_DYNLIB_HANDLE; + typedef HMODULE CLCC_DYNLIB_HANDLE; - #define CLCC_DYNLIB_OPEN LoadLibrary - #define CLCC_DYNLIB_CLOSE FreeLibrary - #define CLCC_DYNLIB_IMPORT GetProcAddress +# define CLCC_DYNLIB_OPEN LoadLibrary +# define CLCC_DYNLIB_CLOSE FreeLibrary +# define CLCC_DYNLIB_IMPORT GetProcAddress #else - #include - - typedef void* CLCC_DYNLIB_HANDLE; +# include - #define CLCC_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL) - #define CLCC_DYNLIB_CLOSE dlclose - #define CLCC_DYNLIB_IMPORT dlsym + typedef void* CLCC_DYNLIB_HANDLE; + +# define CLCC_DYNLIB_OPEN(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL) +# define CLCC_DYNLIB_CLOSE dlclose +# define CLCC_DYNLIB_IMPORT dlsym #endif #else - //typedef implementation_defined CLCC_DYNLIB_HANDLE; - //#define CLCC_DYNLIB_OPEN(path) implementation_defined - //#define CLCC_DYNLIB_CLOSE implementation_defined - //#define CLCC_DYNLIB_IMPORT implementation_defined +// typedef implementation_defined CLCC_DYNLIB_HANDLE; +//# define CLCC_DYNLIB_OPEN(path) implementation_defined +//# define CLCC_DYNLIB_CLOSE implementation_defined +//# define CLCC_DYNLIB_IMPORT implementation_defined #endif CCL_NAMESPACE_BEGIN @@ -117,12 +117,12 @@ PFNCLGETEXTENSIONFUNCTIONADDRESS __clewGetExtensionFunctionAddress = NULL; //! \brief Unloads OpenCL dynamic library, should not be called directly static void clewExit(void) { - if (module != NULL) - { - // Ignore errors - CLCC_DYNLIB_CLOSE(module); - module = NULL; - } + if (module != NULL) + { + // Ignore errors + CLCC_DYNLIB_CLOSE(module); + module = NULL; + } } //! \param path path to dynamic library to load @@ -138,186 +138,186 @@ int clLibraryInit() #else const char *path = "libOpenCL.so"; #endif - int error = 0; + int error = 0; - // Check if already initialized - if (module != NULL) - { - return 1; - } + // Check if already initialized + if (module != NULL) + { + return 1; + } - // Load library - module = CLCC_DYNLIB_OPEN(path); + // Load library + module = CLCC_DYNLIB_OPEN(path); - // Check for errors - if (module == NULL) - { - return 0; - } + // Check for errors + if (module == NULL) + { + return 0; + } - // Set unloading - error = atexit(clewExit); + // Set unloading + error = atexit(clewExit); - if (error) - { - // Failure queing atexit, shutdown with error - CLCC_DYNLIB_CLOSE(module); - module = NULL; + if (error) + { + // Failure queing atexit, shutdown with error + CLCC_DYNLIB_CLOSE(module); + module = NULL; - return 0; - } + return 0; + } - // Determine function entry-points - __clewGetPlatformIDs = (PFNCLGETPLATFORMIDS )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs"); - __clewGetPlatformInfo = (PFNCLGETPLATFORMINFO )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo"); - __clewGetDeviceIDs = (PFNCLGETDEVICEIDS )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs"); - __clewGetDeviceInfo = (PFNCLGETDEVICEINFO )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo"); - __clewCreateContext = (PFNCLCREATECONTEXT )CLCC_DYNLIB_IMPORT(module, "clCreateContext"); - __clewCreateContextFromType = (PFNCLCREATECONTEXTFROMTYPE )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType"); - __clewRetainContext = (PFNCLRETAINCONTEXT )CLCC_DYNLIB_IMPORT(module, "clRetainContext"); - __clewReleaseContext = (PFNCLRELEASECONTEXT )CLCC_DYNLIB_IMPORT(module, "clReleaseContext"); - __clewGetContextInfo = (PFNCLGETCONTEXTINFO )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo"); - __clewCreateCommandQueue = (PFNCLCREATECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue"); - __clewRetainCommandQueue = (PFNCLRETAINCOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue"); - __clewReleaseCommandQueue = (PFNCLRELEASECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue"); - __clewGetCommandQueueInfo = (PFNCLGETCOMMANDQUEUEINFO )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo"); - __clewSetCommandQueueProperty = (PFNCLSETCOMMANDQUEUEPROPERTY )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty"); - __clewCreateBuffer = (PFNCLCREATEBUFFER )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer"); - __clewCreateImage2D = (PFNCLCREATEIMAGE2D )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D"); - __clewCreateImage3D = (PFNCLCREATEIMAGE3D )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D"); - __clewRetainMemObject = (PFNCLRETAINMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject"); - __clewReleaseMemObject = (PFNCLRELEASEMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject"); - __clewGetSupportedImageFormats = (PFNCLGETSUPPORTEDIMAGEFORMATS )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats"); - __clewGetMemObjectInfo = (PFNCLGETMEMOBJECTINFO )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo"); - __clewGetImageInfo = (PFNCLGETIMAGEINFO )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo"); - __clewCreateSampler = (PFNCLCREATESAMPLER )CLCC_DYNLIB_IMPORT(module, "clCreateSampler"); - __clewRetainSampler = (PFNCLRETAINSAMPLER )CLCC_DYNLIB_IMPORT(module, "clRetainSampler"); - __clewReleaseSampler = (PFNCLRELEASESAMPLER )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler"); - __clewGetSamplerInfo = (PFNCLGETSAMPLERINFO )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo"); - __clewCreateProgramWithSource = (PFNCLCREATEPROGRAMWITHSOURCE )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource"); - __clewCreateProgramWithBinary = (PFNCLCREATEPROGRAMWITHBINARY )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary"); - __clewRetainProgram = (PFNCLRETAINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clRetainProgram"); - __clewReleaseProgram = (PFNCLRELEASEPROGRAM )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram"); - __clewBuildProgram = (PFNCLBUILDPROGRAM )CLCC_DYNLIB_IMPORT(module, "clBuildProgram"); - __clewUnloadCompiler = (PFNCLUNLOADCOMPILER )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler"); - __clewGetProgramInfo = (PFNCLGETPROGRAMINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo"); - __clewGetProgramBuildInfo = (PFNCLGETPROGRAMBUILDINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo"); - __clewCreateKernel = (PFNCLCREATEKERNEL )CLCC_DYNLIB_IMPORT(module, "clCreateKernel"); - __clewCreateKernelsInProgram = (PFNCLCREATEKERNELSINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram"); - __clewRetainKernel = (PFNCLRETAINKERNEL )CLCC_DYNLIB_IMPORT(module, "clRetainKernel"); - __clewReleaseKernel = (PFNCLRELEASEKERNEL )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel"); - __clewSetKernelArg = (PFNCLSETKERNELARG )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg"); - __clewGetKernelInfo = (PFNCLGETKERNELINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo"); - __clewGetKernelWorkGroupInfo = (PFNCLGETKERNELWORKGROUPINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo"); - __clewWaitForEvents = (PFNCLWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents"); - __clewGetEventInfo = (PFNCLGETEVENTINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo"); - __clewRetainEvent = (PFNCLRETAINEVENT )CLCC_DYNLIB_IMPORT(module, "clRetainEvent"); - __clewReleaseEvent = (PFNCLRELEASEEVENT )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent"); - __clewGetEventProfilingInfo = (PFNCLGETEVENTPROFILINGINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo"); - __clewFlush = (PFNCLFLUSH )CLCC_DYNLIB_IMPORT(module, "clFlush"); - __clewFinish = (PFNCLFINISH )CLCC_DYNLIB_IMPORT(module, "clFinish"); - __clewEnqueueReadBuffer = (PFNCLENQUEUEREADBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer"); - __clewEnqueueWriteBuffer = (PFNCLENQUEUEWRITEBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer"); - __clewEnqueueCopyBuffer = (PFNCLENQUEUECOPYBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer"); - __clewEnqueueReadImage = (PFNCLENQUEUEREADIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage"); - __clewEnqueueWriteImage = (PFNCLENQUEUEWRITEIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage"); - __clewEnqueueCopyImage = (PFNCLENQUEUECOPYIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage"); - __clewEnqueueCopyImageToBuffer = (PFNCLENQUEUECOPYIMAGETOBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer"); - __clewEnqueueCopyBufferToImage = (PFNCLENQUEUECOPYBUFFERTOIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage"); - __clewEnqueueMapBuffer = (PFNCLENQUEUEMAPBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer"); - __clewEnqueueMapImage = (PFNCLENQUEUEMAPIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage"); - __clewEnqueueUnmapMemObject = (PFNCLENQUEUEUNMAPMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject"); - __clewEnqueueNDRangeKernel = (PFNCLENQUEUENDRANGEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel"); - __clewEnqueueTask = (PFNCLENQUEUETASK )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask"); - __clewEnqueueNativeKernel = (PFNCLENQUEUENATIVEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel"); - __clewEnqueueMarker = (PFNCLENQUEUEMARKER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker"); - __clewEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents"); - __clewEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier"); - __clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress"); + // Determine function entry-points + __clewGetPlatformIDs = (PFNCLGETPLATFORMIDS )CLCC_DYNLIB_IMPORT(module, "clGetPlatformIDs"); + __clewGetPlatformInfo = (PFNCLGETPLATFORMINFO )CLCC_DYNLIB_IMPORT(module, "clGetPlatformInfo"); + __clewGetDeviceIDs = (PFNCLGETDEVICEIDS )CLCC_DYNLIB_IMPORT(module, "clGetDeviceIDs"); + __clewGetDeviceInfo = (PFNCLGETDEVICEINFO )CLCC_DYNLIB_IMPORT(module, "clGetDeviceInfo"); + __clewCreateContext = (PFNCLCREATECONTEXT )CLCC_DYNLIB_IMPORT(module, "clCreateContext"); + __clewCreateContextFromType = (PFNCLCREATECONTEXTFROMTYPE )CLCC_DYNLIB_IMPORT(module, "clCreateContextFromType"); + __clewRetainContext = (PFNCLRETAINCONTEXT )CLCC_DYNLIB_IMPORT(module, "clRetainContext"); + __clewReleaseContext = (PFNCLRELEASECONTEXT )CLCC_DYNLIB_IMPORT(module, "clReleaseContext"); + __clewGetContextInfo = (PFNCLGETCONTEXTINFO )CLCC_DYNLIB_IMPORT(module, "clGetContextInfo"); + __clewCreateCommandQueue = (PFNCLCREATECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clCreateCommandQueue"); + __clewRetainCommandQueue = (PFNCLRETAINCOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clRetainCommandQueue"); + __clewReleaseCommandQueue = (PFNCLRELEASECOMMANDQUEUE )CLCC_DYNLIB_IMPORT(module, "clReleaseCommandQueue"); + __clewGetCommandQueueInfo = (PFNCLGETCOMMANDQUEUEINFO )CLCC_DYNLIB_IMPORT(module, "clGetCommandQueueInfo"); + __clewSetCommandQueueProperty = (PFNCLSETCOMMANDQUEUEPROPERTY )CLCC_DYNLIB_IMPORT(module, "clSetCommandQueueProperty"); + __clewCreateBuffer = (PFNCLCREATEBUFFER )CLCC_DYNLIB_IMPORT(module, "clCreateBuffer"); + __clewCreateImage2D = (PFNCLCREATEIMAGE2D )CLCC_DYNLIB_IMPORT(module, "clCreateImage2D"); + __clewCreateImage3D = (PFNCLCREATEIMAGE3D )CLCC_DYNLIB_IMPORT(module, "clCreateImage3D"); + __clewRetainMemObject = (PFNCLRETAINMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clRetainMemObject"); + __clewReleaseMemObject = (PFNCLRELEASEMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clReleaseMemObject"); + __clewGetSupportedImageFormats = (PFNCLGETSUPPORTEDIMAGEFORMATS )CLCC_DYNLIB_IMPORT(module, "clGetSupportedImageFormats"); + __clewGetMemObjectInfo = (PFNCLGETMEMOBJECTINFO )CLCC_DYNLIB_IMPORT(module, "clGetMemObjectInfo"); + __clewGetImageInfo = (PFNCLGETIMAGEINFO )CLCC_DYNLIB_IMPORT(module, "clGetImageInfo"); + __clewCreateSampler = (PFNCLCREATESAMPLER )CLCC_DYNLIB_IMPORT(module, "clCreateSampler"); + __clewRetainSampler = (PFNCLRETAINSAMPLER )CLCC_DYNLIB_IMPORT(module, "clRetainSampler"); + __clewReleaseSampler = (PFNCLRELEASESAMPLER )CLCC_DYNLIB_IMPORT(module, "clReleaseSampler"); + __clewGetSamplerInfo = (PFNCLGETSAMPLERINFO )CLCC_DYNLIB_IMPORT(module, "clGetSamplerInfo"); + __clewCreateProgramWithSource = (PFNCLCREATEPROGRAMWITHSOURCE )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithSource"); + __clewCreateProgramWithBinary = (PFNCLCREATEPROGRAMWITHBINARY )CLCC_DYNLIB_IMPORT(module, "clCreateProgramWithBinary"); + __clewRetainProgram = (PFNCLRETAINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clRetainProgram"); + __clewReleaseProgram = (PFNCLRELEASEPROGRAM )CLCC_DYNLIB_IMPORT(module, "clReleaseProgram"); + __clewBuildProgram = (PFNCLBUILDPROGRAM )CLCC_DYNLIB_IMPORT(module, "clBuildProgram"); + __clewUnloadCompiler = (PFNCLUNLOADCOMPILER )CLCC_DYNLIB_IMPORT(module, "clUnloadCompiler"); + __clewGetProgramInfo = (PFNCLGETPROGRAMINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramInfo"); + __clewGetProgramBuildInfo = (PFNCLGETPROGRAMBUILDINFO )CLCC_DYNLIB_IMPORT(module, "clGetProgramBuildInfo"); + __clewCreateKernel = (PFNCLCREATEKERNEL )CLCC_DYNLIB_IMPORT(module, "clCreateKernel"); + __clewCreateKernelsInProgram = (PFNCLCREATEKERNELSINPROGRAM )CLCC_DYNLIB_IMPORT(module, "clCreateKernelsInProgram"); + __clewRetainKernel = (PFNCLRETAINKERNEL )CLCC_DYNLIB_IMPORT(module, "clRetainKernel"); + __clewReleaseKernel = (PFNCLRELEASEKERNEL )CLCC_DYNLIB_IMPORT(module, "clReleaseKernel"); + __clewSetKernelArg = (PFNCLSETKERNELARG )CLCC_DYNLIB_IMPORT(module, "clSetKernelArg"); + __clewGetKernelInfo = (PFNCLGETKERNELINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelInfo"); + __clewGetKernelWorkGroupInfo = (PFNCLGETKERNELWORKGROUPINFO )CLCC_DYNLIB_IMPORT(module, "clGetKernelWorkGroupInfo"); + __clewWaitForEvents = (PFNCLWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clWaitForEvents"); + __clewGetEventInfo = (PFNCLGETEVENTINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventInfo"); + __clewRetainEvent = (PFNCLRETAINEVENT )CLCC_DYNLIB_IMPORT(module, "clRetainEvent"); + __clewReleaseEvent = (PFNCLRELEASEEVENT )CLCC_DYNLIB_IMPORT(module, "clReleaseEvent"); + __clewGetEventProfilingInfo = (PFNCLGETEVENTPROFILINGINFO )CLCC_DYNLIB_IMPORT(module, "clGetEventProfilingInfo"); + __clewFlush = (PFNCLFLUSH )CLCC_DYNLIB_IMPORT(module, "clFlush"); + __clewFinish = (PFNCLFINISH )CLCC_DYNLIB_IMPORT(module, "clFinish"); + __clewEnqueueReadBuffer = (PFNCLENQUEUEREADBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadBuffer"); + __clewEnqueueWriteBuffer = (PFNCLENQUEUEWRITEBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteBuffer"); + __clewEnqueueCopyBuffer = (PFNCLENQUEUECOPYBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBuffer"); + __clewEnqueueReadImage = (PFNCLENQUEUEREADIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueReadImage"); + __clewEnqueueWriteImage = (PFNCLENQUEUEWRITEIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueWriteImage"); + __clewEnqueueCopyImage = (PFNCLENQUEUECOPYIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImage"); + __clewEnqueueCopyImageToBuffer = (PFNCLENQUEUECOPYIMAGETOBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyImageToBuffer"); + __clewEnqueueCopyBufferToImage = (PFNCLENQUEUECOPYBUFFERTOIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueCopyBufferToImage"); + __clewEnqueueMapBuffer = (PFNCLENQUEUEMAPBUFFER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapBuffer"); + __clewEnqueueMapImage = (PFNCLENQUEUEMAPIMAGE )CLCC_DYNLIB_IMPORT(module, "clEnqueueMapImage"); + __clewEnqueueUnmapMemObject = (PFNCLENQUEUEUNMAPMEMOBJECT )CLCC_DYNLIB_IMPORT(module, "clEnqueueUnmapMemObject"); + __clewEnqueueNDRangeKernel = (PFNCLENQUEUENDRANGEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNDRangeKernel"); + __clewEnqueueTask = (PFNCLENQUEUETASK )CLCC_DYNLIB_IMPORT(module, "clEnqueueTask"); + __clewEnqueueNativeKernel = (PFNCLENQUEUENATIVEKERNEL )CLCC_DYNLIB_IMPORT(module, "clEnqueueNativeKernel"); + __clewEnqueueMarker = (PFNCLENQUEUEMARKER )CLCC_DYNLIB_IMPORT(module, "clEnqueueMarker"); + __clewEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents"); + __clewEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier"); + __clewGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress"); if(__clewGetPlatformIDs == NULL) return 0; - return 1; + return 1; } //! \param error CL error code //! \return a string representation of the error code const char *clErrorString(cl_int error) { - static const char* strings[] = - { - // Error Codes - "CL_SUCCESS" // 0 - , "CL_DEVICE_NOT_FOUND" // -1 - , "CL_DEVICE_NOT_AVAILABLE" // -2 - , "CL_COMPILER_NOT_AVAILABLE" // -3 - , "CL_MEM_OBJECT_ALLOCATION_FAILURE" // -4 - , "CL_OUT_OF_RESOURCES" // -5 - , "CL_OUT_OF_HOST_MEMORY" // -6 - , "CL_PROFILING_INFO_NOT_AVAILABLE" // -7 - , "CL_MEM_COPY_OVERLAP" // -8 - , "CL_IMAGE_FORMAT_MISMATCH" // -9 - , "CL_IMAGE_FORMAT_NOT_SUPPORTED" // -10 - , "CL_BUILD_PROGRAM_FAILURE" // -11 - , "CL_MAP_FAILURE" // -12 + static const char* strings[] = + { + // Error Codes + "CL_SUCCESS" // 0 + , "CL_DEVICE_NOT_FOUND" // -1 + , "CL_DEVICE_NOT_AVAILABLE" // -2 + , "CL_COMPILER_NOT_AVAILABLE" // -3 + , "CL_MEM_OBJECT_ALLOCATION_FAILURE" // -4 + , "CL_OUT_OF_RESOURCES" // -5 + , "CL_OUT_OF_HOST_MEMORY" // -6 + , "CL_PROFILING_INFO_NOT_AVAILABLE" // -7 + , "CL_MEM_COPY_OVERLAP" // -8 + , "CL_IMAGE_FORMAT_MISMATCH" // -9 + , "CL_IMAGE_FORMAT_NOT_SUPPORTED" // -10 + , "CL_BUILD_PROGRAM_FAILURE" // -11 + , "CL_MAP_FAILURE" // -12 - , "" // -13 - , "" // -14 - , "" // -15 - , "" // -16 - , "" // -17 - , "" // -18 - , "" // -19 + , "" // -13 + , "" // -14 + , "" // -15 + , "" // -16 + , "" // -17 + , "" // -18 + , "" // -19 - , "" // -20 - , "" // -21 - , "" // -22 - , "" // -23 - , "" // -24 - , "" // -25 - , "" // -26 - , "" // -27 - , "" // -28 - , "" // -29 + , "" // -20 + , "" // -21 + , "" // -22 + , "" // -23 + , "" // -24 + , "" // -25 + , "" // -26 + , "" // -27 + , "" // -28 + , "" // -29 - , "CL_INVALID_VALUE" // -30 - , "CL_INVALID_DEVICE_TYPE" // -31 - , "CL_INVALID_PLATFORM" // -32 - , "CL_INVALID_DEVICE" // -33 - , "CL_INVALID_CONTEXT" // -34 - , "CL_INVALID_QUEUE_PROPERTIES" // -35 - , "CL_INVALID_COMMAND_QUEUE" // -36 - , "CL_INVALID_HOST_PTR" // -37 - , "CL_INVALID_MEM_OBJECT" // -38 - , "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR" // -39 - , "CL_INVALID_IMAGE_SIZE" // -40 - , "CL_INVALID_SAMPLER" // -41 - , "CL_INVALID_BINARY" // -42 - , "CL_INVALID_BUILD_OPTIONS" // -43 - , "CL_INVALID_PROGRAM" // -44 - , "CL_INVALID_PROGRAM_EXECUTABLE" // -45 - , "CL_INVALID_KERNEL_NAME" // -46 - , "CL_INVALID_KERNEL_DEFINITION" // -47 - , "CL_INVALID_KERNEL" // -48 - , "CL_INVALID_ARG_INDEX" // -49 - , "CL_INVALID_ARG_VALUE" // -50 - , "CL_INVALID_ARG_SIZE" // -51 - , "CL_INVALID_KERNEL_ARGS" // -52 - , "CL_INVALID_WORK_DIMENSION" // -53 - , "CL_INVALID_WORK_GROUP_SIZE" // -54 - , "CL_INVALID_WORK_ITEM_SIZE" // -55 - , "CL_INVALID_GLOBAL_OFFSET" // -56 - , "CL_INVALID_EVENT_WAIT_LIST" // -57 - , "CL_INVALID_EVENT" // -58 - , "CL_INVALID_OPERATION" // -59 - , "CL_INVALID_GL_OBJECT" // -60 - , "CL_INVALID_BUFFER_SIZE" // -61 - , "CL_INVALID_MIP_LEVEL" // -62 - , "CL_INVALID_GLOBAL_WORK_SIZE" // -63 - }; + , "CL_INVALID_VALUE" // -30 + , "CL_INVALID_DEVICE_TYPE" // -31 + , "CL_INVALID_PLATFORM" // -32 + , "CL_INVALID_DEVICE" // -33 + , "CL_INVALID_CONTEXT" // -34 + , "CL_INVALID_QUEUE_PROPERTIES" // -35 + , "CL_INVALID_COMMAND_QUEUE" // -36 + , "CL_INVALID_HOST_PTR" // -37 + , "CL_INVALID_MEM_OBJECT" // -38 + , "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR" // -39 + , "CL_INVALID_IMAGE_SIZE" // -40 + , "CL_INVALID_SAMPLER" // -41 + , "CL_INVALID_BINARY" // -42 + , "CL_INVALID_BUILD_OPTIONS" // -43 + , "CL_INVALID_PROGRAM" // -44 + , "CL_INVALID_PROGRAM_EXECUTABLE" // -45 + , "CL_INVALID_KERNEL_NAME" // -46 + , "CL_INVALID_KERNEL_DEFINITION" // -47 + , "CL_INVALID_KERNEL" // -48 + , "CL_INVALID_ARG_INDEX" // -49 + , "CL_INVALID_ARG_VALUE" // -50 + , "CL_INVALID_ARG_SIZE" // -51 + , "CL_INVALID_KERNEL_ARGS" // -52 + , "CL_INVALID_WORK_DIMENSION" // -53 + , "CL_INVALID_WORK_GROUP_SIZE" // -54 + , "CL_INVALID_WORK_ITEM_SIZE" // -55 + , "CL_INVALID_GLOBAL_OFFSET" // -56 + , "CL_INVALID_EVENT_WAIT_LIST" // -57 + , "CL_INVALID_EVENT" // -58 + , "CL_INVALID_OPERATION" // -59 + , "CL_INVALID_GL_OBJECT" // -60 + , "CL_INVALID_BUFFER_SIZE" // -61 + , "CL_INVALID_MIP_LEVEL" // -62 + , "CL_INVALID_GLOBAL_WORK_SIZE" // -63 + }; - return strings[-error]; + return strings[-error]; } CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_opencl.h b/intern/cycles/util/util_opencl.h index 907d372d3ce..5f3f1667bcc 100644 --- a/intern/cycles/util/util_opencl.h +++ b/intern/cycles/util/util_opencl.h @@ -339,8 +339,8 @@ typedef cl_uint cl_command_type; typedef cl_uint cl_profiling_info; typedef struct _cl_image_format { - cl_channel_order image_channel_order; - cl_channel_type image_channel_data_type; + cl_channel_order image_channel_order; + cl_channel_type image_channel_data_type; } cl_image_format; diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp index 0b311b0331a..328c0c97391 100644 --- a/intern/cycles/util/util_view.cpp +++ b/intern/cycles/util/util_view.cpp @@ -55,7 +55,7 @@ static void view_display_text(int x, int y, const char *text) glRasterPos3f(x, y, 0); - for(c=text; *c != '\0'; c++) + for(c = text; *c != '\0'; c++) glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, *c); }