diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-10 13:44:26 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-10 13:44:26 +0400 |
commit | f06f1878c218653cd326fc2df6ac54bad404d94d (patch) | |
tree | aa86205dd2f7f73389a588871316513c54756538 | |
parent | 7bb79e777dd44d3d919a15b37d1bf4863c8d2856 (diff) | |
parent | 6e9e758d605741a2ecb8b0fbf24881a17dbe7453 (diff) |
Merging r47624 through r47661 from trunk into soc-2011-tomato
162 files changed, 1741 insertions, 1710 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/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp index cfa4095104b..1190ee185fd 100644 --- a/intern/cycles/app/cycles_xml.cpp +++ b/intern/cycles/app/cycles_xml.cpp @@ -392,9 +392,9 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug snode = dist; } else if(string_iequals(node.name(), "wave_texture")) { - WaveTextureNode *wood = new WaveTextureNode(); - xml_read_enum(&wood->type, WaveTextureNode::type_enum, node, "type"); - snode = wood; + WaveTextureNode *wave = new WaveTextureNode(); + xml_read_enum(&wave->type, WaveTextureNode::type_enum, node, "type"); + snode = wave; } else if(string_iequals(node.name(), "normal")) { snode = new NormalNode(); diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index 9bc82344fcc..122d0bd7c17 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -141,7 +141,7 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::Object b_ob) bcam->lens = b_camera.lens(); /* allow f/stop number to change aperture_size but still - give manual control over aperture radius */ + * give manual control over aperture radius */ int aperture_type = RNA_enum_get(&ccamera, "aperture_type"); if(aperture_type == 1) { @@ -179,8 +179,8 @@ static Transform blender_camera_matrix(const Transform& tfm, CameraType type) if(type == CAMERA_PANORAMA) { /* make it so environment camera needs to be pointed in the direction - of the positive x-axis to match an environment texture, this way - it is looking at the center of the texture */ + * of the positive x-axis to match an environment texture, this way + * it is looking at the center of the texture */ result = tfm * make_transform( 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, @@ -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 */ @@ -297,7 +297,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int cam->fisheye_lens = bcam->fisheye_lens; /* perspective */ - cam->fov = 2.0f*atan((0.5f*sensor_size)/bcam->lens/aspectratio); + cam->fov = 2.0f * atanf((0.5f * sensor_size) / bcam->lens / aspectratio); cam->focaldistance = bcam->focaldistance; cam->aperturesize = bcam->aperturesize; cam->blades = bcam->apertureblades; @@ -405,7 +405,7 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL: } else if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_ORTHO) { /* orthographic view */ - bcam->farclip *= 0.5; + bcam->farclip *= 0.5f; bcam->nearclip = -bcam->farclip; bcam->type = CAMERA_ORTHOGRAPHIC; diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index ad91022de07..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; @@ -68,8 +68,8 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< } /* create generated coordinates. todo: we should actually get the orco - coordinates from modifiers, for now we use texspace loc/size which - is available in the api. */ + * coordinates from modifiers, for now we use texspace loc/size which + * is available in the api. */ if(mesh->need_attribute(scene, ATTR_STD_GENERATED)) { Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED); float3 loc = get_float3(b_mesh.texspace_location()); @@ -82,7 +82,6 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< loc = loc*size - make_float3(0.5f, 0.5f, 0.5f); float3 *fdata = attr->data_float3(); - BL::Mesh::vertices_iterator v; size_t i = 0; for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v) @@ -176,13 +175,15 @@ 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) sdmesh.add_face(vi[0], vi[1], vi[2], vi[3]); - /*else - sdmesh.add_face(vi[0], vi[1], vi[2]);*/ +#if 0 + else + sdmesh.add_face(vi[0], vi[1], vi[2]); +#endif } /* finalize subd mesh */ @@ -210,8 +211,6 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated) BL::Object::material_slots_iterator slot; for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) { - BL::Material material_override = render_layer.material_override; - if(material_override) find_shader(material_override, used_shaders, scene->default_surface); else @@ -232,7 +231,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated) /* if transform was applied to mesh, need full update */ if(object_updated && mesh->transform_applied); /* test if shaders changed, these can be object level so mesh - does not get tagged for recalc */ + * does not get tagged for recalc */ else if(mesh->used_shaders != used_shaders); else { /* even if not tagged for recalc, we may need to sync anyway @@ -319,7 +318,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion) AttributeStandard std = (motion == -1)? ATTR_STD_MOTION_PRE: ATTR_STD_MOTION_POST; Attribute *attr_M = mesh->attributes.add(std); float3 *M = attr_M->data_float3(); - size_t i = 0, size = mesh->verts.size(); + size_t i = 0; for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end() && i < size; ++v, M++, i++) *M = get_float3(v->co()); diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index b70491a7b82..c4b58d6fa76 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -264,7 +264,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, } /* camera flag is not actually used, instead is tested - against render layer flags */ + * against render layer flags */ if(object->visibility & PATH_RAY_CAMERA) { object->visibility |= layer_flag << PATH_RAY_LAYER_SHIFT; object->visibility &= ~PATH_RAY_CAMERA; 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 9726f7b94cf..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(); @@ -304,7 +305,7 @@ void BlenderSession::synchronize() session->set_pause(BlenderSync::get_session_pause(b_scene, background)); /* copy recalc flags, outside of mutex so we can decide to do the real - synchronization at a later time to not block on running updates */ + * synchronization at a later time to not block on running updates */ sync->sync_recalc(); /* try to acquire mutex. if we don't want to or can't, come back later */ @@ -334,7 +335,7 @@ void BlenderSession::synchronize() bool BlenderSession::draw(int w, int h) { /* before drawing, we verify camera and viewport size changes, because - we do not get update callbacks for those, we must detect them here */ + * we do not get update callbacks for those, we must detect them here */ if(session->ready_to_reset()) { bool reset = false; @@ -429,11 +430,11 @@ void BlenderSession::tag_redraw() { if(background) { /* update stats and progress, only for background here because - in 3d view we do it in draw for thread safety reasons */ + * in 3d view we do it in draw for thread safety reasons */ update_status_progress(); /* offline render, redraw if timeout passed */ - if(time_dt() - last_redraw_time > 1.0f) { + if(time_dt() - last_redraw_time > 1.0) { write_render_result(); engine_tag_redraw((RenderEngine*)b_engine.ptr.data); last_redraw_time = time_dt(); diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index a7be0a8fb54..35fe4c67673 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -641,7 +641,7 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap to_pair = sockets_map[b_to_sock.ptr.data]; /* either node may be NULL when the node was not exported, typically - because the node type is not supported */ + * because the node type is not supported */ if(from_pair.first && to_pair.first) { ShaderOutput *output = from_pair.first->output(from_pair.second.c_str()); ShaderInput *input = to_pair.first->input(to_pair.second.c_str()); @@ -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 488fea8d12b..13040e551bd 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -63,7 +63,7 @@ BlenderSync::~BlenderSync() bool BlenderSync::sync_recalc() { /* sync recalc flags from blender to cycles. actual update is done separate, - so we can do it later on if doing it immediate is not suitable */ + * so we can do it later on if doing it immediate is not suitable */ BL::BlendData::materials_iterator b_mat; @@ -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/blender/blender_util.h b/intern/cycles/blender/blender_util.h index b9c60738b36..b5a76836bed 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -27,7 +27,7 @@ #include "util_vector.h" /* Hacks to hook into Blender API - todo: clean this up ... */ + * todo: clean this up ... */ extern "C" { @@ -53,7 +53,8 @@ int rna_Object_is_deform_modified(void *ob, void *scene, int settings); void BLI_timestr(double _time, char *str); void rna_ColorRamp_eval(void *coba, float position, float color[4]); void rna_Scene_frame_set(void *scene, int frame, float subframe); -void BKE_image_user_file_path(void *iuser, void *ima, int cfra, char *path); +void BKE_image_user_frame_calc(void *iuser, int cfra, int fieldnr); +void BKE_image_user_file_path(void *iuser, void *ima, char *path); } @@ -105,7 +106,8 @@ static inline bool BKE_object_is_deform_modified(BL::Object self, BL::Scene scen static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, int cfra) { char filepath[1024]; - BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, cfra, filepath); + BKE_image_user_frame_calc(iuser.ptr.data, cfra, 0); + BKE_image_user_file_path(iuser.ptr.data, ima.ptr.data, filepath); return string(filepath); } @@ -121,7 +123,7 @@ static inline Transform get_transform(BL::Array<float, 16> array) Transform tfm; /* we assume both types to be just 16 floats, and transpose because blender - use column major matrix order while we use row major */ + * use column major matrix order while we use row major */ memcpy(&tfm, &array, sizeof(float)*16); tfm = transform_transpose(tfm); @@ -164,12 +166,14 @@ static inline uint get_layer(BL::Array<int, 20> array) return layer; } -/*static inline float3 get_float3(PointerRNA& ptr, const char *name) +#if 0 +static inline float3 get_float3(PointerRNA& ptr, const char *name) { float3 f; RNA_float_get_array(&ptr, name, &f.x); return f; -}*/ +} +#endif static inline bool get_boolean(PointerRNA& ptr, const char *name) { diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp index 15695dddf45..a383ad317ab 100644 --- a/intern/cycles/bvh/bvh.cpp +++ b/intern/cycles/bvh/bvh.cpp @@ -292,13 +292,13 @@ void BVH::pack_triangles() void BVH::pack_instances(size_t nodes_size) { /* The BVH's for instances are built separately, but for traversal all - BVH's are stored in global arrays. This function merges them into the - top level BVH, adjusting indexes and offsets where appropriate. */ + * BVH's are stored in global arrays. This function merges them into the + * top level BVH, adjusting indexes and offsets where appropriate. */ bool use_qbvh = params.use_qbvh; size_t nsize = (use_qbvh)? BVH_QNODE_SIZE: BVH_NODE_SIZE; /* adjust primitive index to point to the triangle in the global array, for - meshes with transform applied and already in the top level BVH */ + * meshes with transform applied and already in the top level BVH */ for(size_t i = 0; i < pack.prim_index.size(); i++) if(pack.prim_index[i] != -1) pack.prim_index[i] += objects[pack.prim_object[i]]->mesh->tri_offset; @@ -356,14 +356,14 @@ void BVH::pack_instances(size_t nodes_size) Mesh *mesh = ob->mesh; /* if mesh transform is applied, that means it's already in the top - level BVH, and we don't need to merge it in */ + * level BVH, and we don't need to merge it in */ if(mesh->transform_applied) { pack.object_node[object_offset++] = 0; continue; } /* if mesh already added once, don't add it again, but used set - node offset for this object */ + * node offset for this object */ map<Mesh*, int>::iterator it = mesh_map.find(mesh); if(mesh_map.find(mesh) != mesh_map.end()) { diff --git a/intern/cycles/bvh/bvh.h b/intern/cycles/bvh/bvh.h index 30ae7dac106..549f1e3ac1d 100644 --- a/intern/cycles/bvh/bvh.h +++ b/intern/cycles/bvh/bvh.h @@ -46,7 +46,7 @@ class Progress; struct PackedBVH { /* BVH nodes storage, one node is 4x int4, and contains two bounding boxes, - and child, triangle or object indexes dependening on the node type */ + * and child, triangle or object indexes dependening on the node type */ array<int4> nodes; /* object index to BVH node index mapping for instances */ array<int> object_node; @@ -55,12 +55,12 @@ struct PackedBVH { /* visibility visibilitys for primitives */ array<uint> prim_visibility; /* mapping from BVH primitive index to true primitive index, as primitives - may be duplicated due to spatial splits. -1 for instances. */ + * may be duplicated due to spatial splits. -1 for instances. */ array<int> prim_index; /* mapping from BVH primitive index, to the object id of that primitive. */ array<int> prim_object; /* quick array to lookup if a node is a leaf, not used for traversal, only - for instance BVH merging */ + * for instance BVH merging */ array<int> is_leaf; /* index of the root node. */ diff --git a/intern/cycles/bvh/bvh_binning.cpp b/intern/cycles/bvh/bvh_binning.cpp index e4b88584a33..05a674a47a7 100644 --- a/intern/cycles/bvh/bvh_binning.cpp +++ b/intern/cycles/bvh/bvh_binning.cpp @@ -200,7 +200,7 @@ void BVHObjectBinning::split(BVHReference* prims, BVHObjectBinning& left_o, BVHO } /* object medium split if we did not make progress, can happen when all - primitives have same centroid */ + * primitives have same centroid */ lgeom_bounds = BoundBox::empty; rgeom_bounds = BoundBox::empty; lcent_bounds = BoundBox::empty; diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index 28237aea611..705b805a3a9 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -196,14 +196,14 @@ BVHNode* BVHBuild::run() void BVHBuild::progress_update() { - if(time_dt() - progress_start_time < 0.25f) + if(time_dt() - progress_start_time < 0.25) return; double progress_start = (double)progress_count/(double)progress_total; double duplicates = (double)(progress_total - progress_original_total)/(double)progress_total; string msg = string_printf("Building BVH %.0f%%, duplicates %.0f%%", - progress_start*100.0f, duplicates*100.0f); + progress_start * 100.0, duplicates * 100.0); progress.set_substatus(msg); progress_start_time = time_dt(); 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;i<num_children();i++) + for(int i = 0; i < num_children(); i++) cnt += get_child(i)->getSubtreeSize(stat); return cnt; @@ -60,7 +60,7 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const void BVHNode::deleteSubtree() { - for(int i=0;i<num_children();i++) + for(int i = 0; i < num_children(); i++) if(get_child(i)) 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()); - for(int i=0;i<num_children();i++) { + for(int i = 0; i < num_children(); i++) { BVHNode *child = get_child(i); SAH += child->computeSubtreeSAHCost(p, probability * child->m_bounds.safe_area()/m_bounds.safe_area()); } diff --git a/intern/cycles/bvh/bvh_params.h b/intern/cycles/bvh/bvh_params.h index 0cf5e905fea..a78496d841d 100644 --- a/intern/cycles/bvh/bvh_params.h +++ b/intern/cycles/bvh/bvh_params.h @@ -98,11 +98,11 @@ class BVHReference public: __forceinline BVHReference() {} - __forceinline BVHReference(const BoundBox& bounds_, int prim_index, int prim_object) + __forceinline BVHReference(const BoundBox& bounds_, int prim_index_, int prim_object_) : rbounds(bounds_) { - rbounds.min.w = __int_as_float(prim_index); - rbounds.max.w = __int_as_float(prim_object); + rbounds.min.w = __int_as_float(prim_index_); + rbounds.max.w = __int_as_float(prim_object_); } __forceinline const BoundBox& bounds() const { return rbounds; } diff --git a/intern/cycles/bvh/bvh_sort.h b/intern/cycles/bvh/bvh_sort.h index ba35ba3fae7..18aafb5f1ff 100644 --- a/intern/cycles/bvh/bvh_sort.h +++ b/intern/cycles/bvh/bvh_sort.h @@ -1,4 +1,4 @@ - /* +/* * Adapted from code copyright 2009-2010 NVIDIA Corporation * Modifications Copyright 2011, Blender Foundation. * diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index 42dda1180c7..33040f287d1 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -124,7 +124,7 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int w uint8_t *pixels = (uint8_t*)rgba.data_pointer; /* for multi devices, this assumes the ineffecient method that we allocate - all pixels on the device even though we only render to a subset */ + * all pixels on the device even though we only render to a subset */ pixels += 4*y*w; glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels); diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index 5f422332cd2..070b20aec49 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -226,7 +226,7 @@ public: void task_add(DeviceTask& task) { /* split task into smaller ones, more than number of threads for uneven - workloads where some parts of the image render slower than others */ + * workloads where some parts of the image render slower than others */ list<DeviceTask> tasks; task.split(tasks, TaskScheduler::num_threads()*10); diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 491a63a7cf2..357f99145b2 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -771,7 +771,7 @@ public: cuda_push_context(); /* for multi devices, this assumes the ineffecient method that we allocate - all pixels on the device even though we only render to a subset */ + * all pixels on the device even though we only render to a subset */ size_t offset = sizeof(uint8_t)*4*y*w; glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pmem.cuPBO); diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h index 591216a77b9..e3afe46d2b0 100644 --- a/intern/cycles/device/device_network.h +++ b/intern/cycles/device/device_network.h @@ -126,8 +126,10 @@ typedef struct RPCReceive { if(len == data_size) { archive_str = (data.size())? string(&data[0], data.size()): string(""); - /*istringstream archive_stream(archive_str); - boost::archive::text_iarchive archive(archive_stream);*/ +#if 0 + istringstream archive_stream(archive_str); + boost::archive::text_iarchive archive(archive_stream); +#endif archive_stream = new istringstream(archive_str); archive = new boost::archive::text_iarchive(*archive_stream); diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index bb2b852d4e1..13ebeff70d2 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -239,7 +239,7 @@ public: } /* we don't check CL_DEVICE_VERSION since for e.g. nvidia sm 1.3 cards this is - 1.0 even if the language features are there, just limited shared memory */ + * 1.0 even if the language features are there, just limited shared memory */ return true; } @@ -344,8 +344,8 @@ public: bool compile_kernel(const string& kernel_path, const string& kernel_md5) { /* we compile kernels consisting of many files. unfortunately opencl - kernel caches do not seem to recognize changes in included files. - so we force recompile on changes by adding the md5 hash of all files */ + * kernel caches do not seem to recognize changes in included files. + * so we force recompile on changes by adding the md5 hash of all files */ string source = "#include \"kernel.cl\" // " + kernel_md5 + "\n"; source = path_source_replace_includes(source, kernel_path); @@ -680,8 +680,6 @@ public: else tasks.push_back(maintask); - DeviceTask task; - foreach(DeviceTask& task, tasks) { if(task.type == DeviceTask::TONEMAP) tonemap(task); diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h index 6c3ade1c531..d99beb8905a 100644 --- a/intern/cycles/kernel/kernel_accumulate.h +++ b/intern/cycles/kernel/kernel_accumulate.h @@ -271,8 +271,8 @@ __device_inline float3 path_radiance_sum(KernelGlobals *kg, PathRadiance *L) #ifdef __PASSES__ if(L->use_light_pass) { /* this division is a bit ugly, but means we only have to keep track of - only a single throughput further along the path, here we recover just - the indirect parth that is not influenced by any particular BSDF type */ + * only a single throughput further along the path, here we recover just + * the indirect parth that is not influenced by any particular BSDF type */ L->direct_emission = safe_divide_color(L->direct_emission, L->direct_throughput); L->direct_diffuse += L->indirect_diffuse*L->direct_emission; L->direct_glossy += L->indirect_glossy*L->direct_emission; diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h index 522f9861c35..34a44af8b8d 100644 --- a/intern/cycles/kernel/kernel_bvh.h +++ b/intern/cycles/kernel/kernel_bvh.h @@ -34,8 +34,8 @@ CCL_NAMESPACE_BEGIN #define TRI_NODE_SIZE 3 /* silly workaround for float extended precision that happens when compiling - without sse support on x86, it results in different results for float ops - that you would otherwise expect to compare correctly */ + * without sse support on x86, it results in different results for float ops + * that you would otherwise expect to compare correctly */ #if !defined(__i386__) || defined(__SSE__) #define NO_EXTENDED_PRECISION #else @@ -160,7 +160,7 @@ __device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *ise if(v >= 0.0f && u + v <= 1.0f) { #ifdef __VISIBILITY_FLAG__ /* visibility flag test. we do it here under the assumption - that most triangles are culled by node flags */ + * that most triangles are culled by node flags */ if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility) #endif { diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index 2bd0b61b4fa..cc8f1f3323b 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -28,13 +28,13 @@ CCL_NAMESPACE_BEGIN /* Assertions inside the kernel only work for the CPU device, so we wrap it in - a macro which is empty for other devices */ + * a macro which is empty for other devices */ #define kernel_assert(cond) assert(cond) /* Texture types to be compatible with CUDA textures. These are really just - simple arrays and after inlining fetch hopefully revert to being a simple - pointer lookup. */ + * simple arrays and after inlining fetch hopefully revert to being a simple + * pointer lookup. */ template<typename T> struct texture { T fetch(int index) @@ -43,7 +43,8 @@ template<typename T> struct texture { return data[index]; } - /*__m128 fetch_m128(int index) +#if 0 + __m128 fetch_m128(int index) { kernel_assert(index >= 0 && index < width); return ((__m128*)data)[index]; @@ -53,7 +54,8 @@ template<typename T> struct texture { { kernel_assert(index >= 0 && index < width); return ((__m128i*)data)[index]; - }*/ + } +#endif float interp(float x, int size) { 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_emission.h b/intern/cycles/kernel/kernel_emission.h index 881d25ad7ba..f582ace69f0 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -44,7 +44,7 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando, ls->Ng = sd.Ng; /* no path flag, we're evaluating this for all closures. that's weak but - we'd have to do multiple evaluations otherwise */ + * we'd have to do multiple evaluations otherwise */ shader_eval_surface(kg, &sd, rando, 0); /* evaluate emissive closure */ @@ -145,7 +145,7 @@ __device float3 indirect_emission(KernelGlobals *kg, ShaderData *sd, float t, in if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_SAMPLE_AS_LIGHT)) { /* multiple importance sampling, get triangle light pdf, - and compute weight with respect to BSDF pdf */ + * and compute weight with respect to BSDF pdf */ float pdf = triangle_light_pdf(kg, sd->Ng, sd->I, t); float mis_weight = power_heuristic(bsdf_pdf, pdf); @@ -172,7 +172,7 @@ __device float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, if(!(path_flag & PATH_RAY_MIS_SKIP) && res) { /* multiple importance sampling, get background light pdf for ray - direction, and compute weight with respect to BSDF pdf */ + * direction, and compute weight with respect to BSDF pdf */ float pdf = background_light_pdf(kg, ray->D); float mis_weight = power_heuristic(bsdf_pdf, pdf); diff --git a/intern/cycles/kernel/kernel_globals.h b/intern/cycles/kernel/kernel_globals.h index 1f2fc97e685..a99fffbc519 100644 --- a/intern/cycles/kernel/kernel_globals.h +++ b/intern/cycles/kernel/kernel_globals.h @@ -29,9 +29,9 @@ CCL_NAMESPACE_BEGIN /* On the CPU, we pass along the struct KernelGlobals to nearly everywhere in - the kernel, to access constant data. These are all stored as "textures", but - these are really just standard arrays. We can't use actually globals because - multiple renders may be running inside the same process. */ + * the kernel, to access constant data. These are all stored as "textures", but + * these are really just standard arrays. We can't use actually globals because + * multiple renders may be running inside the same process. */ #ifdef __KERNEL_CPU__ @@ -45,7 +45,7 @@ typedef struct KernelGlobals { #ifdef __OSL__ /* On the CPU, we also have the OSL globals here. Most data structures are shared - with SVM, the difference is in the shaders and object/mesh attributes. */ + * with SVM, the difference is in the shaders and object/mesh attributes. */ OSLGlobals osl; #endif @@ -54,9 +54,9 @@ typedef struct KernelGlobals { #endif /* For CUDA, constant memory textures must be globals, so we can't put them - into a struct. As a result we don't actually use this struct and use actual - globals and simply pass along a NULL pointer everywhere, which we hope gets - optimized out. */ + * into a struct. As a result we don't actually use this struct and use actual + * globals and simply pass along a NULL pointer everywhere, which we hope gets + * optimized out. */ #ifdef __KERNEL_CUDA__ diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index 2bc5a882ce5..edc302cd6e3 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -64,8 +64,8 @@ __device float3 area_light_sample(float3 axisu, float3 axisv, float randu, float __device float3 background_light_sample(KernelGlobals *kg, float randu, float randv, float *pdf) { /* for the following, the CDF values are actually a pair of floats, with the - function value as X and the actual CDF as Y. The last entry's function - value is the CDF total. */ + * function value as X and the actual CDF as Y. The last entry's function + * value is the CDF total. */ int res = kernel_data.integrator.pdf_background_res; int cdf_count = res + 1; @@ -326,9 +326,9 @@ __device float triangle_light_pdf(KernelGlobals *kg, __device int light_distribution_sample(KernelGlobals *kg, float randt) { /* this is basically std::upper_bound as used by pbrt, to find a point light or - triangle to emit from, proportional to area. a good improvement would be to - also sample proportional to power, though it's not so well defined with - OSL shaders. */ + * triangle to emit from, proportional to area. a good improvement would be to + * also sample proportional to power, though it's not so well defined with + * OSL shaders. */ int first = 0; int len = kernel_data.integrator.num_distribution + 1; diff --git a/intern/cycles/kernel/kernel_montecarlo.h b/intern/cycles/kernel/kernel_montecarlo.h index bdd147f83d3..939f3915b6c 100644 --- a/intern/cycles/kernel/kernel_montecarlo.h +++ b/intern/cycles/kernel/kernel_montecarlo.h @@ -28,7 +28,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + */ #ifndef __KERNEL_MONTECARLO_CL__ #define __KERNEL_MONTECARLO_CL__ diff --git a/intern/cycles/kernel/kernel_optimized.cpp b/intern/cycles/kernel/kernel_optimized.cpp index 393686bb203..0b662095133 100644 --- a/intern/cycles/kernel/kernel_optimized.cpp +++ b/intern/cycles/kernel/kernel_optimized.cpp @@ -17,8 +17,8 @@ */ /* Optimized CPU kernel entry points. This file is compiled with SSE3 - optimization flags and nearly all functions inlined, while kernel.cpp - is compiled without for other CPU's. */ + * optimization flags and nearly all functions inlined, while kernel.cpp + * is compiled without for other CPU's. */ #ifdef WITH_OPTIMIZED_KERNEL diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index e41a5a62c14..8dbf66c108c 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -59,7 +59,7 @@ __device_inline void path_state_init(PathState *state) __device_inline void path_state_next(KernelGlobals *kg, PathState *state, int label) { /* ray through transparent keeps same flags from previous ray and is - not counted as a regular bounce, transparent has separate max */ + * not counted as a regular bounce, transparent has separate max */ if(label & LABEL_TRANSPARENT) { state->flag |= PATH_RAY_TRANSPARENT; state->transparent_bounce++; @@ -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 */ @@ -159,13 +162,13 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra #ifdef __TRANSPARENT_SHADOWS__ if(result && kernel_data.integrator.transparent_shadows) { /* transparent shadows work in such a way to try to minimize overhead - in cases where we don't need them. after a regular shadow ray is - cast we check if the hit primitive was potentially transparent, and - only in that case start marching. this gives on extra ray cast for - the cases were we do want transparency. - - also note that for this to work correct, multi close sampling must - be used, since we don't pass a random number to shader_eval_surface */ + * in cases where we don't need them. after a regular shadow ray is + * cast we check if the hit primitive was potentially transparent, and + * only in that case start marching. this gives on extra ray cast for + * the cases were we do want transparency. + * + * also note that for this to work correct, multi close sampling must + * be used, since we don't pass a random number to shader_eval_surface */ if(shader_transparent_shadow(kg, &isect)) { float3 throughput = make_float3(1.0f, 1.0f, 1.0f); float3 Pend = ray->P + ray->D*ray->t; @@ -266,7 +269,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R kernel_write_data_passes(kg, buffer, &L, &sd, sample, state.flag, throughput); /* blurring of bsdf after bounces, for rays that have a small likelihood - of following this particular path (diffuse, rough glossy) */ + * of following this particular path (diffuse, rough glossy) */ if(kernel_data.integrator.filter_glossy != FLT_MAX) { float blur_pdf = kernel_data.integrator.filter_glossy*min_ray_pdf; @@ -305,8 +308,8 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R #endif /* path termination. this is a strange place to put the termination, it's - mainly due to the mixed in MIS that we use. gives too many unneeded - shader evaluations, only need emission if we are going to terminate */ + * mainly due to the mixed in MIS that we use. gives too many unneeded + * shader evaluations, only need emission if we are going to terminate */ float probability = path_state_terminate_probability(kg, &state, throughput); float terminate = path_rng(kg, rng, sample, rng_offset + PRNG_TERMINATE); diff --git a/intern/cycles/kernel/kernel_projection.h b/intern/cycles/kernel/kernel_projection.h index 72d36811626..64747bcb42e 100644 --- a/intern/cycles/kernel/kernel_projection.h +++ b/intern/cycles/kernel/kernel_projection.h @@ -28,7 +28,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + */ #ifndef __KERNEL_PROJECTION_CL__ #define __KERNEL_PROJECTION_CL__ diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h index 6d15100f8a3..9083b7cbfd7 100644 --- a/intern/cycles/kernel/kernel_random.h +++ b/intern/cycles/kernel/kernel_random.h @@ -23,8 +23,8 @@ typedef uint RNG; #ifdef __SOBOL__ /* skip initial numbers that are not as well distributed, especially the - first sequence is just 0 everywhere, which can be problematic for e.g. - path termination */ + * first sequence is just 0 everywhere, which can be problematic for e.g. + * path termination */ #define SOBOL_SKIP 64 /* High Dimensional Sobol */ @@ -66,7 +66,7 @@ __device uint sobol_inverse(uint i) } /* multidimensional sobol with generator matrices - dimension 0 and 1 are equal to van_der_corput() and sobol() respectively */ + * dimension 0 and 1 are equal to van_der_corput() and sobol() respectively */ __device uint sobol_dimension(KernelGlobals *kg, int index, int dimension) { uint result = 0; @@ -119,7 +119,7 @@ __device_inline float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dime else shift = (*rng & 0xFFFF)/((float)0xFFFF); - return r + shift - floor(r + shift); + return r + shift - floorf(r + shift); #endif } diff --git a/intern/cycles/kernel/kernel_triangle.h b/intern/cycles/kernel/kernel_triangle.h index 674c3b52539..384c3a8a506 100644 --- a/intern/cycles/kernel/kernel_triangle.h +++ b/intern/cycles/kernel/kernel_triangle.h @@ -208,7 +208,7 @@ __device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd) motion_post = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_VERTEX, offset_post, NULL, NULL); /* object motion. note that depending on the mesh having motion vectors, this - transformation was set match the world/object space of motion_pre/post */ + * transformation was set match the world/object space of motion_pre/post */ Transform tfm; tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM_MOTION_PRE); @@ -220,7 +220,7 @@ __device float4 triangle_motion_vector(KernelGlobals *kg, ShaderData *sd) float3 P; /* camera motion, for perspective/orthographic motion.pre/post will be a - world-to-raster matrix, for panorama it's world-to-camera */ + * world-to-raster matrix, for panorama it's world-to-camera */ if (kernel_data.cam.type != CAMERA_PANORAMA) { tfm = kernel_data.cam.worldtoraster; P = transform_perspective(&tfm, sd->P); diff --git a/intern/cycles/kernel/osl/nodes/node_fresnel.h b/intern/cycles/kernel/osl/nodes/node_fresnel.h index de5d29a3c18..dfd0a23fe1e 100644 --- a/intern/cycles/kernel/osl/nodes/node_fresnel.h +++ b/intern/cycles/kernel/osl/nodes/node_fresnel.h @@ -17,7 +17,7 @@ float fresnel_dielectric(vector Incoming, normal Normal, float eta) { /* compute fresnel reflectance without explicitly computing - the refracted direction */ + * the refracted direction */ float c = fabs(dot(Incoming, Normal)); float g = eta * eta - 1 + c * c; float result; diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 12f3a377ef4..a1574d6e0db 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -65,7 +65,7 @@ void OSLRenderServices::thread_init(KernelGlobals *kernel_globals_) bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) { /* this is only used for shader and object space, we don't really have - a concept of shader space, so we just use object space for both. */ + * a concept of shader space, so we just use object space for both. */ if (xform) { KernelGlobals *kg = kernel_globals; const ShaderData *sd = (const ShaderData *)xform; @@ -86,7 +86,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) { /* this is only used for shader and object space, we don't really have - a concept of shader space, so we just use object space for both. */ + * a concept of shader space, so we just use object space for both. */ if (xform) { KernelGlobals *kg = kernel_globals; const ShaderData *sd = (const ShaderData *)xform; @@ -305,11 +305,11 @@ void *OSLRenderServices::get_pointcloud_attr_query(ustring *attr_names, AttrQuery &query = m_attr_queries.back(); /* make space for what we need. the only reason to use - std::vector is to skip the delete */ + * std::vector is to skip the delete */ query.attr_names.resize(nattrs); query.attr_partio_types.resize(nattrs); /* capacity will keep the length of the smallest array passed - to the query. Just to prevent buffer overruns */ + * to the query. Just to prevent buffer overruns */ query.capacity = -1; for (int i = 0; i < nattrs; ++i) { @@ -323,7 +323,7 @@ void *OSLRenderServices::get_pointcloud_attr_query(ustring *attr_names, query.capacity = min(query.capacity, (int)attr_types[i].numelements()); /* convert the OSL (OIIO) type to the equivalent Partio type so - we can do a fast check at query time. */ + * we can do a fast check at query time. */ if (element_type == TypeDesc::TypeFloat) { query.attr_partio_types[i] = Partio::FLOAT; } @@ -359,7 +359,7 @@ int OSLRenderServices::pointcloud(ustring filename, const OSL::Vec3 ¢er, flo int max_points, void *_attr_query, void **attr_outdata) { /* todo: this code has never been tested, and most likely does not - work. it's based on the example code in OSL */ + * work. it's based on the example code in OSL */ #ifdef WITH_PARTIO /* query Partio for this pointcloud lookup using cached attr_query */ @@ -374,7 +374,7 @@ int OSLRenderServices::pointcloud(ustring filename, const OSL::Vec3 ¢er, flo Partio::ParticlesData *cloud = get_pointcloud(filename); /* now we have to look up all the attributes in the file. we can't do this - before hand cause we never know what we are going to load. */ + * before hand cause we never know what we are going to load. */ int nattrs = attr_query->attr_names.size(); Partio::ParticleAttribute *attr = (Partio::ParticleAttribute *)alloca(sizeof(Partio::ParticleAttribute) * nattrs); @@ -414,8 +414,8 @@ int OSLRenderServices::pointcloud(ustring filename, const OSL::Vec3 ¢er, flo } else { /* note we make a single call per attribute, we don't loop over the - points. Partio does it, so it is there that we have to care about - performance */ + * points. Partio does it, so it is there that we have to care about + * performance */ cloud->data(attr[j], count, &indices[0], true, attr_outdata[j]); } } diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index 88735c073c2..e637b53ab78 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -76,14 +76,14 @@ private: #ifdef WITH_PARTIO /* OSL gets pointers to this but its definition is private. - right now it only caches the types already converted to - Partio constants. this is what get_pointcloud_attr_query - returns */ + * right now it only caches the types already converted to + * Partio constants. this is what get_pointcloud_attr_query + * returns */ struct AttrQuery { /* names of the attributes to query */ std::vector<ustring> attr_names; /* types as (enum Partio::ParticleAttributeType) of the - attributes in the query */ + * attributes in the query */ std::vector<int> attr_partio_types; /* for sanity checks, capacity of the output arrays */ int capacity; diff --git a/intern/cycles/kernel/svm/bsdf.h b/intern/cycles/kernel/svm/bsdf.h index 18c1da73fbd..1a90eab0cd1 100644 --- a/intern/cycles/kernel/svm/bsdf.h +++ b/intern/cycles/kernel/svm/bsdf.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __OSL_BSDF_H__ #define __OSL_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/bsdf_ashikhmin_velvet.h b/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h index 2e9343647b8..40249dbe9c6 100644 --- a/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h +++ b/intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h @@ -28,7 +28,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + */ #ifndef __BSDF_ASHIKHMIN_VELVET_H__ #define __BSDF_ASHIKHMIN_VELVET_H__ diff --git a/intern/cycles/kernel/svm/bsdf_diffuse.h b/intern/cycles/kernel/svm/bsdf_diffuse.h index e8a002cb84c..45e82a566c0 100644 --- a/intern/cycles/kernel/svm/bsdf_diffuse.h +++ b/intern/cycles/kernel/svm/bsdf_diffuse.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __BSDF_DIFFUSE_H__ #define __BSDF_DIFFUSE_H__ diff --git a/intern/cycles/kernel/svm/bsdf_microfacet.h b/intern/cycles/kernel/svm/bsdf_microfacet.h index 8771578a2fd..01e3acb76e8 100644 --- a/intern/cycles/kernel/svm/bsdf_microfacet.h +++ b/intern/cycles/kernel/svm/bsdf_microfacet.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __BSDF_MICROFACET_H__ #define __BSDF_MICROFACET_H__ diff --git a/intern/cycles/kernel/svm/bsdf_reflection.h b/intern/cycles/kernel/svm/bsdf_reflection.h index f00b72c4869..09b4e0e48f0 100644 --- a/intern/cycles/kernel/svm/bsdf_reflection.h +++ b/intern/cycles/kernel/svm/bsdf_reflection.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __BSDF_REFLECTION_H__ #define __BSDF_REFLECTION_H__ diff --git a/intern/cycles/kernel/svm/bsdf_refraction.h b/intern/cycles/kernel/svm/bsdf_refraction.h index 07ef8633e0d..c9c268999c0 100644 --- a/intern/cycles/kernel/svm/bsdf_refraction.h +++ b/intern/cycles/kernel/svm/bsdf_refraction.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __BSDF_REFRACTION_H__ #define __BSDF_REFRACTION_H__ diff --git a/intern/cycles/kernel/svm/bsdf_transparent.h b/intern/cycles/kernel/svm/bsdf_transparent.h index 4425c4bf104..511836cdfa2 100644 --- a/intern/cycles/kernel/svm/bsdf_transparent.h +++ b/intern/cycles/kernel/svm/bsdf_transparent.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __BSDF_TRANSPARENT_H__ #define __BSDF_TRANSPARENT_H__ diff --git a/intern/cycles/kernel/svm/bsdf_ward.h b/intern/cycles/kernel/svm/bsdf_ward.h index d46baf099a6..86bca69425d 100644 --- a/intern/cycles/kernel/svm/bsdf_ward.h +++ b/intern/cycles/kernel/svm/bsdf_ward.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __BSDF_WARD_H__ #define __BSDF_WARD_H__ diff --git a/intern/cycles/kernel/svm/bsdf_westin.h b/intern/cycles/kernel/svm/bsdf_westin.h index 21e5018c489..6193d81c244 100644 --- a/intern/cycles/kernel/svm/bsdf_westin.h +++ b/intern/cycles/kernel/svm/bsdf_westin.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef __BSDF_WESTIN_H__ #define __BSDF_WESTIN_H__ diff --git a/intern/cycles/kernel/svm/emissive.h b/intern/cycles/kernel/svm/emissive.h index 0b0218674b8..9a906f82963 100644 --- a/intern/cycles/kernel/svm/emissive.h +++ b/intern/cycles/kernel/svm/emissive.h @@ -1,34 +1,34 @@ -/* - * Adapted from Open Shading Language with this license: - * - * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. - * All Rights Reserved. - * - * Modifications Copyright 2011, Blender Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Sony Pictures Imageworks nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ +/* + * Adapted from Open Shading Language with this license: + * + * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al. + * All Rights Reserved. + * + * Modifications Copyright 2011, Blender Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sony Pictures Imageworks nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ CCL_NAMESPACE_BEGIN diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index 8409e83d94e..935504026ef 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -374,7 +374,7 @@ __device void svm_node_mix_closure(ShaderData *sd, float *stack, { #ifdef __MULTI_CLOSURE__ /* fetch weight from blend input, previous mix closures, - and write to stack to be used by closure nodes later */ + * and write to stack to be used by closure nodes later */ uint weight_offset, in_weight_offset, weight1_offset, weight2_offset; decode_node_uchar4(node.y, &weight_offset, &in_weight_offset, &weight1_offset, &weight2_offset); @@ -387,8 +387,8 @@ __device void svm_node_mix_closure(ShaderData *sd, float *stack, stack_store_float(stack, weight2_offset, in_weight*weight); #else /* pick a closure and make the random number uniform over 0..1 again. - closure 1 starts on the next node, for closure 2 the start is at an - offset from the current node, so we jump */ + * closure 1 starts on the next node, for closure 2 the start is at an + * offset from the current node, so we jump */ uint weight_offset = node.y; uint node_jump = node.z; float weight = stack_load_float(stack, weight_offset); @@ -410,8 +410,8 @@ __device void svm_node_add_closure(ShaderData *sd, float *stack, uint unused, /* nothing to do, handled in compiler */ #else /* pick one of the two closures with probability 0.5. sampling quality - is not going to be great, for that we'd need to evaluate the weights - of the two closures being added */ + * is not going to be great, for that we'd need to evaluate the weights + * of the two closures being added */ float weight = 0.5f; if(*randb < weight) { diff --git a/intern/cycles/kernel/svm/svm_gradient.h b/intern/cycles/kernel/svm/svm_gradient.h index c7013800d6b..7fad1175c49 100644 --- a/intern/cycles/kernel/svm/svm_gradient.h +++ b/intern/cycles/kernel/svm/svm_gradient.h @@ -20,13 +20,13 @@ CCL_NAMESPACE_BEGIN /* Gradient */ -__device float svm_gradient(float3 p, NodeBlendType type) +__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; @@ -45,7 +45,7 @@ __device float svm_gradient(float3 p, NodeBlendType type) return (x + y)/2.0f; } else if(type == NODE_BLEND_RADIAL) { - return atan2(y, x)/(2.0f*M_PI_F) + 0.5f; + return atan2f(y, x) / (2.0f * M_PI_F) + 0.5f; } else { float r = fmaxf(1.0f - sqrtf(x*x + y*y + z*z), 0.0f); @@ -67,7 +67,7 @@ __device void svm_node_tex_gradient(ShaderData *sd, float *stack, uint4 node) float3 co = stack_load_float3(stack, co_offset); - float f = svm_gradient(co, (NodeBlendType)type); + float f = svm_gradient(co, (NodeGradientType)type); f = clamp(f, 0.0f, 1.0f); if(stack_valid(fac_offset)) diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index 388f006c40f..3b2b9204d86 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -92,13 +92,13 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y) float4 r; /* not particularly proud of this massive switch, what are the - alternatives? - - use a single big 1D texture, and do our own lookup/filtering - - group by size and use a 3d texture, performance impact - - group into larger texture with some padding for correct lerp - - also note that cuda has 128 textures limit, we use 100 now, since - we still need some for other storage */ + * alternatives? + * - use a single big 1D texture, and do our own lookup/filtering + * - group by size and use a 3d texture, performance impact + * - group into larger texture with some padding for correct lerp + * + * also note that cuda has 128 textures limit, we use 100 now, since + * we still need some for other storage */ switch(id) { case 0: r = kernel_tex_image_interp(__tex_image_000, x, y); break; 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_musgrave.h b/intern/cycles/kernel/svm/svm_musgrave.h index 9444dc20e6e..425909e59f1 100644 --- a/intern/cycles/kernel/svm/svm_musgrave.h +++ b/intern/cycles/kernel/svm/svm_musgrave.h @@ -41,7 +41,7 @@ __device_noinline float noise_musgrave_fBm(float3 p, NodeNoiseBasis basis, float p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) value += rmd * snoise(p) * pwr; @@ -69,7 +69,7 @@ __device_noinline float noise_musgrave_multi_fractal(float3 p, NodeNoiseBasis ba p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) value *= (rmd * pwr * snoise(p) + 1.0f); /* correct? */ @@ -102,7 +102,7 @@ __device_noinline float noise_musgrave_hetero_terrain(float3 p, NodeNoiseBasis b p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) { increment = (snoise(p) + offset) * pwr * value; value += rmd * increment; @@ -141,7 +141,7 @@ __device_noinline float noise_musgrave_hybrid_multi_fractal(float3 p, NodeNoiseB p *= lacunarity; } - rmd = octaves - floor(octaves); + rmd = octaves - floorf(octaves); if(rmd != 0.0f) result += rmd * ((snoise(p) + offset) * pwr); diff --git a/intern/cycles/kernel/svm/svm_noise.h b/intern/cycles/kernel/svm/svm_noise.h index 1d3ace061ab..dfaf43acbd4 100644 --- a/intern/cycles/kernel/svm/svm_noise.h +++ b/intern/cycles/kernel/svm/svm_noise.h @@ -28,7 +28,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ + */ CCL_NAMESPACE_BEGIN @@ -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 448132bff46..6c22d98e0df 100644 --- a/intern/cycles/kernel/svm/svm_texture.h +++ b/intern/cycles/kernel/svm/svm_texture.h @@ -152,7 +152,7 @@ __device float voronoi_CrS(float3 p) { return 2.0f*voronoi_Cr(p) - 1.0f; } __device float noise_basis(float3 p, NodeNoiseBasis basis) { /* Only Perlin enabled for now, others break CUDA compile by making kernel - too big, with compile using > 4GB, due to everything being inlined. */ + * too big, with compile using > 4GB, due to everything being inlined. */ #if 0 if(basis == NODE_NOISE_PERLIN) @@ -188,10 +188,10 @@ __device float noise_basis_hard(float3 p, NodeNoiseBasis basis, int hard) /* Waves */ -__device float noise_wave(NodeWaveType wave, float a) +__device float noise_wave(NodeWaveBasis wave, float a) { if(wave == NODE_WAVE_SINE) { - return 0.5f + 0.5f*sin(a); + return 0.5f + 0.5f * sinf(a); } else if(wave == NODE_WAVE_SAW) { float b = 2.0f*M_PI_F; @@ -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); @@ -234,7 +234,7 @@ __device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float o fscale *= 2.0f; } - float rmd = octaves - floor(octaves); + float rmd = octaves - floorf(octaves); if(rmd != 0.0f) { float t = noise_basis(fscale*p, basis); diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index 2d756d57f41..c1eeeb55268 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -30,71 +30,66 @@ CCL_NAMESPACE_BEGIN /* Nodes */ -/* note that we do not simply use 0, 1, 2, .. as values for these. this works - * around an obscure CUDA bug that happens when compiling for fermi. why it - * happens i have no idea, but consecutive values are problematic, maybe it - * generates an incorrect jump table. */ - typedef enum NodeType { NODE_END = 0, - NODE_CLOSURE_BSDF = 100, - NODE_CLOSURE_EMISSION = 200, - NODE_CLOSURE_BACKGROUND = 300, - NODE_CLOSURE_SET_WEIGHT = 400, - NODE_CLOSURE_WEIGHT = 500, - NODE_MIX_CLOSURE = 600, - NODE_JUMP = 700, - NODE_TEX_IMAGE = 1000, - NODE_TEX_SKY = 1100, - NODE_GEOMETRY = 1200, - NODE_LIGHT_PATH = 1300, - NODE_VALUE_F = 1400, - NODE_VALUE_V = 1500, - NODE_MIX = 1600, - NODE_ATTR = 1700, - NODE_CONVERT = 1900, - NODE_FRESNEL = 2000, - NODE_EMISSION_WEIGHT = 2100, - NODE_TEX_GRADIENT = 2200, - NODE_TEX_VORONOI = 2300, - NODE_TEX_MUSGRAVE = 2400, - NODE_TEX_WAVE = 2500, - NODE_TEX_MAGIC = 2600, - NODE_TEX_NOISE = 3000, - NODE_SHADER_JUMP = 3100, - NODE_SET_DISPLACEMENT = 3200, - NODE_GEOMETRY_BUMP_DX = 3300, - NODE_GEOMETRY_BUMP_DY = 3400, - NODE_SET_BUMP = 3500, - NODE_MATH = 3600, - NODE_VECTOR_MATH = 3700, - NODE_MAPPING = 3800, - NODE_TEX_COORD = 3900, - NODE_TEX_COORD_BUMP_DX = 4000, - NODE_TEX_COORD_BUMP_DY = 4100, - NODE_ADD_CLOSURE = 4200, - NODE_EMISSION_SET_WEIGHT_TOTAL = 4300, - NODE_ATTR_BUMP_DX = 4400, - NODE_ATTR_BUMP_DY = 4500, - NODE_TEX_ENVIRONMENT = 4600, - NODE_CLOSURE_HOLDOUT = 4700, - NODE_LAYER_WEIGHT = 4800, - NODE_CLOSURE_VOLUME = 4900, - NODE_SEPARATE_RGB = 5000, - NODE_COMBINE_RGB = 5100, - NODE_HSV = 5200, - NODE_CAMERA = 5300, - NODE_INVERT = 5400, - NODE_NORMAL = 5500, - NODE_GAMMA = 5600, - NODE_TEX_CHECKER = 5700, - NODE_BRIGHTCONTRAST = 5800, - NODE_RGB_RAMP = 5900, - NODE_RGB_CURVES = 6000, - NODE_MIN_MAX = 6100, - NODE_LIGHT_FALLOFF = 6200, - NODE_OBJECT_INFO = 6300, - NODE_PARTICLE_INFO = 6400 + NODE_CLOSURE_BSDF, + NODE_CLOSURE_EMISSION, + NODE_CLOSURE_BACKGROUND, + NODE_CLOSURE_SET_WEIGHT, + NODE_CLOSURE_WEIGHT, + NODE_MIX_CLOSURE, + NODE_JUMP, + NODE_TEX_IMAGE, + NODE_TEX_SKY, + NODE_GEOMETRY, + NODE_LIGHT_PATH, + NODE_VALUE_F, + NODE_VALUE_V, + NODE_MIX, + NODE_ATTR, + NODE_CONVERT, + NODE_FRESNEL, + NODE_EMISSION_WEIGHT, + NODE_TEX_GRADIENT, + NODE_TEX_VORONOI, + NODE_TEX_MUSGRAVE, + NODE_TEX_WAVE, + NODE_TEX_MAGIC, + NODE_TEX_NOISE, + NODE_SHADER_JUMP, + NODE_SET_DISPLACEMENT, + NODE_GEOMETRY_BUMP_DX, + NODE_GEOMETRY_BUMP_DY, + NODE_SET_BUMP, + NODE_MATH, + NODE_VECTOR_MATH, + NODE_MAPPING, + NODE_TEX_COORD, + NODE_TEX_COORD_BUMP_DX, + NODE_TEX_COORD_BUMP_DY, + NODE_ADD_CLOSURE, + NODE_EMISSION_SET_WEIGHT_TOTAL, + NODE_ATTR_BUMP_DX, + NODE_ATTR_BUMP_DY, + NODE_TEX_ENVIRONMENT, + NODE_CLOSURE_HOLDOUT, + NODE_LAYER_WEIGHT, + NODE_CLOSURE_VOLUME, + NODE_SEPARATE_RGB, + NODE_COMBINE_RGB, + NODE_HSV, + NODE_CAMERA, + NODE_INVERT, + NODE_NORMAL, + NODE_GAMMA, + NODE_TEX_CHECKER, + NODE_BRIGHTCONTRAST, + NODE_RGB_RAMP, + NODE_RGB_CURVES, + NODE_MIN_MAX, + NODE_LIGHT_FALLOFF, + NODE_OBJECT_INFO, + NODE_PARTICLE_INFO } NodeType; typedef enum NodeAttributeType { @@ -226,11 +221,11 @@ typedef enum NodeNoiseBasis { NODE_NOISE_CELL_NOISE } NodeNoiseBasis; -typedef enum NodeWaveType { +typedef enum NodeWaveBasis { NODE_WAVE_SINE, NODE_WAVE_SAW, NODE_WAVE_TRI -} NodeWaveType; +} NodeWaveBasis; typedef enum NodeMusgraveType { NODE_MUSGRAVE_MULTIFRACTAL, @@ -240,12 +235,12 @@ typedef enum NodeMusgraveType { NODE_MUSGRAVE_HETERO_TERRAIN } NodeMusgraveType; -typedef enum NodeWoodType { +typedef enum NodeWaveType { NODE_WAVE_BANDS, NODE_WAVE_RINGS -} NodeWoodType; +} NodeWaveType; -typedef enum NodeBlendType { +typedef enum NodeGradientType { NODE_BLEND_LINEAR, NODE_BLEND_QUADRATIC, NODE_BLEND_EASING, @@ -253,24 +248,7 @@ typedef enum NodeBlendType { NODE_BLEND_RADIAL, NODE_BLEND_QUADRATIC_SPHERE, NODE_BLEND_SPHERICAL -} NodeBlendType; - -typedef enum NodeBlendAxis { - NODE_BLEND_HORIZONTAL, - NODE_BLEND_VERTICAL -} NodeBlendAxis; - -typedef enum NodeMarbleType { - NODE_MARBLE_SOFT, - NODE_MARBLE_SHARP, - NODE_MARBLE_SHARPER -} NodeMarbleType; - -typedef enum NodeStucciType { - NODE_STUCCI_PLASTIC, - NODE_STUCCI_WALL_IN, - NODE_STUCCI_WALL_OUT -} NodeStucciType; +} NodeGradientType; typedef enum NodeVoronoiColoring { NODE_VORONOI_INTENSITY, 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 39edd7d9fff..d2d808e4063 100644 --- a/intern/cycles/kernel/svm/svm_wave.h +++ b/intern/cycles/kernel/svm/svm_wave.h @@ -18,18 +18,18 @@ CCL_NAMESPACE_BEGIN -/* Marble */ +/* Wave */ -__device_noinline float svm_wave(NodeWoodType type, float3 p, float scale, float detail, float distortion, float dscale) +__device_noinline float svm_wave(NodeWaveType type, float3 p, float scale, float detail, float distortion, float dscale) { float w, n; 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); @@ -55,7 +55,7 @@ __device void svm_node_tex_wave(KernelGlobals *kg, ShaderData *sd, float *stack, float distortion = stack_load_float_default(stack, distortion_offset, node2.z); float dscale = stack_load_float_default(stack, dscale_offset, node2.w); - float f = svm_wave((NodeWoodType)type, co, scale, detail, distortion, dscale); + float f = svm_wave((NodeWaveType)type, co, scale, detail, distortion, dscale); if(stack_valid(fac_offset)) stack_store_float(stack, fac_offset, f); if(stack_valid(color_offset)) stack_store_float3(stack, color_offset, make_float3(f, f, f)); diff --git a/intern/cycles/kernel/svm/volume.h b/intern/cycles/kernel/svm/volume.h index 86cb2dcc24e..10e9c5de352 100644 --- a/intern/cycles/kernel/svm/volume.h +++ b/intern/cycles/kernel/svm/volume.h @@ -19,7 +19,7 @@ CCL_NAMESPACE_BEGIN /* note: the interfaces here are just as an example, need to figure - out the right functions and parameters to use */ + * out the right functions and parameters to use */ /* ISOTROPIC VOLUME CLOSURE */ 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; x<width; x++) - for(y=0; y<height; y++) + for(x = 0; x < width; x++) + for(y = 0; y < height; 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); diff --git a/intern/cycles/render/buffers.h b/intern/cycles/render/buffers.h index 77ad4a5a4b0..78712ed89ef 100644 --- a/intern/cycles/render/buffers.h +++ b/intern/cycles/render/buffers.h @@ -35,7 +35,7 @@ class Device; struct float4; /* Buffer Parameters - Size of render buffer and how it fits in the full image (border render). */ + * Size of render buffer and how it fits in the full image (border render). */ class BufferParams { public: @@ -98,8 +98,8 @@ public: /* buffer parameters */ BufferParams params; /* dimensions for how much of the buffer is actually ready for display. - with progressive render we can be using only a subset of the buffer. - if these are zero, it means nothing can be drawn yet */ + * with progressive render we can be using only a subset of the buffer. + * if these are zero, it means nothing can be drawn yet */ int draw_width, draw_height; /* draw alpha channel? */ bool transparent; 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/film.cpp b/intern/cycles/render/film.cpp index 878aa87510e..035821fadde 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -142,7 +142,7 @@ void Pass::add(PassType type, vector<Pass>& passes) passes.push_back(pass); /* order from by components, to ensure alignment so passes with size 4 - come first and then passes with size 1 */ + * come first and then passes with size 1 */ sort(passes.begin(), passes.end(), compare_pass_order); if(pass.divide_type != PASS_NONE) 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<float> filter_table(FilterType type, float width) /* compute cumulative distribution function */ 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 y = filter_func(x, width); 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]; /* create importance sampling table */ - for(i=0; i<=half_size; i++) { + for(i = 0; i <= half_size; i++) { float x = i/(float)half_size; int index = upper_bound(filter_table_cdf.begin(), filter_table_cdf.end(), x) - filter_table_cdf.begin(); float t; diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index a0e7af66100..34c8879aa1f 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -375,8 +375,8 @@ void ShaderGraph::break_cycles(ShaderNode *node, vector<bool>& visited, vector<b void ShaderGraph::clean() { /* we do two things here: find cycles and break them, and remove unused - nodes that don't feed into the output. how cycles are broken is - undefined, they are invalid input, the important thing is to not crash */ + * nodes that don't feed into the output. how cycles are broken is + * undefined, they are invalid input, the important thing is to not crash */ vector<bool> removed(nodes.size(), false); vector<bool> visited(nodes.size(), false); @@ -495,7 +495,7 @@ void ShaderGraph::bump_from_displacement() copy_nodes(nodes_displace, nodes_dy); /* mark nodes to indicate they are use for bump computation, so - that any texture coordinates are shifted by dx/dy when sampling */ + * that any texture coordinates are shifted by dx/dy when sampling */ foreach(NodePair& pair, nodes_center) pair.second->bump = SHADER_BUMP_CENTER; foreach(NodePair& pair, nodes_dx) @@ -516,15 +516,15 @@ void ShaderGraph::bump_from_displacement() connect(out_dy, bump->input("SampleY")); /* connect bump output to normal input nodes that aren't set yet. actually - this will only set the normal input to the geometry node that we created - and connected to all other normal inputs already. */ + * this will only set the normal input to the geometry node that we created + * and connected to all other normal inputs already. */ foreach(ShaderNode *node, nodes) foreach(ShaderInput *input, node->inputs) if(!input->link && input->default_value == ShaderInput::NORMAL) connect(bump->output("Normal"), input); /* finally, add the copied nodes to the graph. we can't do this earlier - because we would create dependency cycles in the above loop */ + * because we would create dependency cycles in the above loop */ foreach(NodePair& pair, nodes_center) add(pair.second); foreach(NodePair& pair, nodes_dx) diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 6417d0e2103..dc20dbdbea2 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -66,7 +66,7 @@ static bool is_float_image(const string& filename) if(in->open(filename, spec)) { /* check the main format, and channel formats; - if any take up more than one byte, we'll need a float texture slot */ + * if any take up more than one byte, we'll need a float texture slot */ if(spec.format.basesize() > 1) is_float = true; @@ -171,8 +171,8 @@ void ImageManager::remove_image(const string& filename) assert(images[slot]->users >= 0); /* don't remove immediately, rather do it all together later on. one of - the reasons for this is that on shader changes we add and remove nodes - that use them, but we do not want to reload the image all the time. */ + * the reasons for this is that on shader changes we add and remove nodes + * that use them, but we do not want to reload the image all the time. */ if(images[slot]->users == 0) need_update = true; @@ -189,8 +189,8 @@ void ImageManager::remove_image(const string& filename) assert(float_images[slot]->users >= 0); /* don't remove immediately, rather do it all together later on. one of - the reasons for this is that on shader changes we add and remove nodes - that use them, but we do not want to reload the image all the time. */ + * the reasons for this is that on shader changes we add and remove nodes + * that use them, but we do not want to reload the image all the time. */ if(float_images[slot]->users == 0) need_update = true; @@ -483,7 +483,7 @@ void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress& void ImageManager::device_pack_images(Device *device, DeviceScene *dscene, Progress& progess) { /* for OpenCL, we pack all image textures inside a single big texture, and - will do our own interpolation in the kernel */ + * will do our own interpolation in the kernel */ size_t size = 0; for(size_t slot = 0; slot < images.size(); slot++) { diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 1bf1cde4a1c..e918de990c2 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -362,7 +362,7 @@ void LightManager::device_update_background(Device *device, DeviceScene *dscene, float cdf_total = cond_cdf[i * cdf_count + res - 1].y + cond_cdf[i * cdf_count + res - 1].x / res; /* stuff the total into the brightness value for the last entry, because - we are going to normalize the CDFs to 0.0 to 1.0 afterwards */ + * we are going to normalize the CDFs to 0.0 to 1.0 afterwards */ cond_cdf[i * cdf_count + res].x = cdf_total; if(cdf_total > 0.0f) diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index cabbd5760c2..8f5f2647ebf 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -474,7 +474,7 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene, AttributeRequestSet& attributes = mesh_attributes[i]; /* todo: we now store std and name attributes from requests even if - they actually refer to the same mesh attributes, optimize */ + * they actually refer to the same mesh attributes, optimize */ foreach(AttributeRequest& req, attributes.requests) { Attribute *mattr = mesh->attributes.find(req); @@ -493,7 +493,7 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene, } /* we abuse AttributeRequest to pass on info like element and - offset, it doesn't really make sense but is convenient */ + * offset, it doesn't really make sense but is convenient */ /* store element and type */ if(mattr->element == Attribute::VERTEX) @@ -528,7 +528,7 @@ void MeshManager::device_update_attributes(Device *device, DeviceScene *dscene, } /* mesh vertex/triangle index is global, not per object, so we sneak - a correction for that in here */ + * a correction for that in here */ if(req.element == ATTR_ELEMENT_VERTEX) req.offset -= mesh->vert_offset; else if(mattr->element == Attribute::FACE) diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 1c9eeacddbe..0f64d858de0 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -332,7 +332,7 @@ static void sky_texture_precompute(KernelSunSky *ksunsky, float3 dir, float turb float T2 = T * T; float chi = (4.0f / 9.0f - T / 120.0f) * (M_PI_F - 2.0f * theta); - ksunsky->zenith_Y = (4.0453f * T - 4.9710f) * tan(chi) - 0.2155f * T + 2.4192f; + ksunsky->zenith_Y = (4.0453f * T - 4.9710f) * tanf(chi) - 0.2155f * T + 2.4192f; ksunsky->zenith_Y *= 0.06f; ksunsky->zenith_x = @@ -695,7 +695,7 @@ static ShaderEnum wave_type_init() ShaderEnum WaveTextureNode::type_enum = wave_type_init(); WaveTextureNode::WaveTextureNode() -: TextureNode("marble_texture") +: TextureNode("wave_texture") { type = ustring("Bands"); diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index 650758a6113..efd814e4ae6 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -44,7 +44,7 @@ public: float3 min, max; 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; enum Projection { FLAT, CUBE, TUBE, SPHERE }; @@ -55,7 +55,7 @@ public: class TextureNode : public ShaderNode { public: - TextureNode(const char *name) : ShaderNode(name) {} + TextureNode(const char *name_) : ShaderNode(name_) {} TextureMapping tex_mapping; }; diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index 259a0d25bcc..376a7911fc9 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -89,7 +89,7 @@ void Object::apply_transform() Transform ntfm = transform_transpose(transform_inverse(tfm)); /* we keep normals pointing in same direction on negative scale, notify - mesh about this in it (re)calculates normals */ + * mesh about this in it (re)calculates normals */ if(transform_negative_scale(tfm)) mesh->transform_negative_scaled = true; @@ -161,7 +161,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene Transform itfm = transform_inverse(tfm); /* compute surface area. for uniform scale we can do avoid the many - transform calls and share computation for instances */ + * transform calls and share computation for instances */ /* todo: correct for displacement, and move to a better place */ float uniform_scale; float surface_area = 0.0f; @@ -206,8 +206,8 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene if(need_motion == Scene::MOTION_PASS) { /* motion transformations, is world/object space depending if mesh - comes with deformed position in object space, or if we transform - the shading point in world space */ + * comes with deformed position in object space, or if we transform + * the shading point in world space */ Transform mtfm_pre = ob->motion.pre; Transform mtfm_post = ob->motion.post; diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index b0173334c76..04af9b48280 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -167,7 +167,7 @@ string OSLCompiler::compatible_name(const char *name) bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input) { /* exception for output node, only one input is actually used - depending on the current shader type */ + * depending on the current shader type */ if(node->name == ustring("output")) { if(strcmp(input->name, "Surface") == 0 && current_type != SHADER_TYPE_SURFACE) diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 173d73ea2c7..a9f7e5beb56 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -116,8 +116,8 @@ bool Session::ready_to_reset() void Session::reset_gpu(BufferParams& buffer_params, int samples) { /* block for buffer acces and reset immediately. we can't do this - in the thread, because we need to allocate an OpenGL buffer, and - that only works in the main thread */ + * in the thread, because we need to allocate an OpenGL buffer, and + * that only works in the main thread */ thread_scoped_lock display_lock(display->mutex); thread_scoped_lock buffers_lock(buffers->mutex); @@ -140,10 +140,10 @@ bool Session::draw_gpu(BufferParams& buffer_params) /* first check we already rendered something */ if(gpu_draw_ready) { /* then verify the buffers have the expected size, so we don't - draw previous results in a resized window */ + * draw previous results in a resized window */ if(!buffer_params.modified(display->params)) { /* for CUDA we need to do tonemapping still, since we can - only access GL buffers from the main thread */ + * only access GL buffers from the main thread */ if(gpu_need_tonemap) { thread_scoped_lock buffers_lock(buffers->mutex); tonemap(); @@ -185,7 +185,7 @@ void Session::run_gpu() } else { /* if in interactive mode, and we are either paused or done for now, - wait for pause condition notify to wake up again */ + * wait for pause condition notify to wake up again */ thread_scoped_lock pause_lock(pause_mutex); if(pause || no_tiles) { @@ -224,8 +224,8 @@ void Session::run_gpu() if(!no_tiles) { /* buffers mutex is locked entirely while rendering each - sample, and released/reacquired on each iteration to allow - reset and draw in between */ + * sample, and released/reacquired on each iteration to allow + * reset and draw in between */ thread_scoped_lock buffers_lock(buffers->mutex); /* update status and timing */ @@ -294,7 +294,7 @@ bool Session::draw_cpu(BufferParams& buffer_params) /* first check we already rendered something */ if(display->draw_ready()) { /* then verify the buffers have the expected size, so we don't - draw previous results in a resized window */ + * draw previous results in a resized window */ if(!buffer_params.modified(display->params)) { display->draw(device); @@ -334,7 +334,7 @@ void Session::run_cpu() } else { /* if in interactive mode, and we are either paused or done for now, - wait for pause condition notify to wake up again */ + * wait for pause condition notify to wake up again */ thread_scoped_lock pause_lock(pause_mutex); if(pause || no_tiles) { @@ -362,8 +362,8 @@ void Session::run_cpu() if(!no_tiles) { /* buffers mutex is locked entirely while rendering each - sample, and released/reacquired on each iteration to allow - reset and draw in between */ + * sample, and released/reacquired on each iteration to allow + * reset and draw in between */ thread_scoped_lock buffers_lock(buffers->mutex); /* update scene */ @@ -406,7 +406,7 @@ void Session::run_cpu() } else if(need_tonemap) { /* tonemap only if we do not reset, we don't we don't - want to show the result of an incomplete sample*/ + * wan't to show the result of an incomplete sample*/ tonemap(); } @@ -535,8 +535,8 @@ void Session::update_scene() progress.set_status("Updating Scene"); /* update camera if dimensions changed for progressive render. the camera - knows nothing about progressive or cropped rendering, it just gets the - image dimensions passed in */ + * knows nothing about progressive or cropped rendering, it just gets the + * image dimensions passed in */ Camera *cam = scene->camera; int width = tile_manager.state.buffer.full_width; int height = tile_manager.state.buffer.full_height; diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index f50709146ef..fae1d6bd81c 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -81,9 +81,9 @@ void Shader::tag_update(Scene *scene) scene->light_manager->need_update = true; /* get requested attributes. this could be optimized by pruning unused - nodes here already, but that's the job of the shader manager currently, - and may not be so great for interactive rendering where you temporarily - disconnect a node */ + * nodes here already, but that's the job of the shader manager currently, + * and may not be so great for interactive rendering where you temporarily + * disconnect a node */ AttributeRequestSet prev_attributes = attributes; attributes.clear(); @@ -91,7 +91,7 @@ void Shader::tag_update(Scene *scene) node->attributes(&attributes); /* compare if the attributes changed, mesh manager will check - need_update_attributes, update the relevant meshes and clear it. */ + * need_update_attributes, update the relevant meshes and clear it. */ if(attributes.modified(prev_attributes)) { need_update_attributes = true; scene->mesh_manager->need_update = true; diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h index 48d517ce21a..02788008060 100644 --- a/intern/cycles/render/shader.h +++ b/intern/cycles/render/shader.h @@ -53,8 +53,8 @@ public: ShaderGraph *graph; /* shader graph with auto bump mapping included, we compile two shaders, - with and without bump, because the displacement method is a mesh - level setting, so we need to handle both */ + * with and without bump, because the displacement method is a mesh + * level setting, so we need to handle both */ ShaderGraph *graph_bump; /* sampling */ @@ -109,7 +109,7 @@ public: int get_shader_id(uint shader, Mesh *mesh = NULL, bool smooth = false); /* add default shaders to scene, to use as default for things that don't - have any shader assigned explicitly */ + * have any shader assigned explicitly */ static void add_default(Scene *scene); protected: diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index 1ff3ac20d50..844ce01569f 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -251,11 +251,11 @@ void SVMCompiler::stack_link(ShaderInput *input, ShaderOutput *output) void SVMCompiler::stack_clear_users(ShaderNode *node, set<ShaderNode*>& done) { /* optimization we should add: - find and lower user counts for outputs for which all inputs are done. - this is done before the node is compiled, under the assumption that the - node will first load all inputs from the stack and then writes its - outputs. this used to work, but was disabled because it gave trouble - with inputs getting stack positions assigned */ + * find and lower user counts for outputs for which all inputs are done. + * this is done before the node is compiled, under the assumption that the + * node will first load all inputs from the stack and then writes its + * outputs. this used to work, but was disabled because it gave trouble + * with inputs getting stack positions assigned */ foreach(ShaderInput *input, node->inputs) { ShaderOutput *output = input->link; @@ -418,8 +418,8 @@ void SVMCompiler::generate_closure(ShaderNode *node, set<ShaderNode*>& done) add_node(NODE_ADD_CLOSURE, 0, 0, 0); /* generate code for closure 1 - note we backup all compiler state and restore it afterwards, so one - closure choice doesn't influence the other*/ + * note we backup all compiler state and restore it afterwards, so one + * closure choice doesn't influence the other*/ if(cl1in->link) { StackBackup backup; stack_backup(backup, done); @@ -448,7 +448,7 @@ void SVMCompiler::generate_closure(ShaderNode *node, set<ShaderNode*>& done) add_node(NODE_END, 0, 0, 0); /* set jump for mix node, -1 because offset is already - incremented when this jump is added to it */ + * incremented when this jump is added to it */ svm_nodes[mix_offset].z = cl2_offset - mix_offset - 1; done.insert(node); @@ -482,9 +482,9 @@ void SVMCompiler::generate_closure(ShaderNode *node, set<ShaderNode*>& done) void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& done, uint in_offset) { /* todo: the weaks point here is that unlike the single closure sampling - we will evaluate all nodes even if they are used as input for closures - that are unused. it's not clear what would be the best way to skip such - nodes at runtime, especially if they are tangled up */ + * we will evaluate all nodes even if they are used as input for closures + * that are unused. it's not clear what would be the best way to skip such + * nodes at runtime, especially if they are tangled up */ if(node->name == ustring("mix_closure") || node->name == ustring("add_closure")) { ShaderInput *fin = node->input("Fac"); @@ -597,10 +597,10 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty memset(&active_stack, 0, sizeof(active_stack)); svm_nodes.clear(); - foreach(ShaderNode *node, graph->nodes) { - foreach(ShaderInput *input, node->inputs) + foreach(ShaderNode *node_iter, graph->nodes) { + foreach(ShaderInput *input, node_iter->inputs) input->stack_offset = SVM_STACK_INVALID; - foreach(ShaderOutput *output, node->outputs) + foreach(ShaderOutput *output, node_iter->outputs) output->stack_offset = SVM_STACK_INVALID; } diff --git a/intern/cycles/subd/subd_build.cpp b/intern/cycles/subd/subd_build.cpp index 640c30eba9d..c8181838ec3 100644 --- a/intern/cycles/subd/subd_build.cpp +++ b/intern/cycles/subd/subd_build.cpp @@ -82,7 +82,7 @@ static float pseudoValence(SubdVert *vert) if(vert->is_boundary()) { /* we treat boundary verts as being half a closed mesh. corners are - special case. n = 4 for corners and n = 2*(n-1) for boundaries. */ + * special case. n = 4 for corners and n = 2*(n-1) for boundaries. */ if(valence == 2) return 4; return (valence - 1)*2; } @@ -314,7 +314,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s stencil->get(eid1) = stencil->get(cid); stencil->get(eid2) = stencil->get(cid); - int j = 0; + j = 0; for(SubdVert::EdgeIterator eit(vert->edges()); !eit.isDone(); eit.advance(), j++) { SubdEdge *edge = eit.current(); assert(vert->co == edge->from()->co); @@ -402,8 +402,8 @@ void SubdAccBuilder::computeInteriorStencil(SubdFaceRing *ring, GregoryAccStenci int idx2 = interior2Indices[primitiveOffset+v]; int i = 0; - for(SubdFace::EdgeIterator it(face->edges(edge)); !it.isDone(); it.advance(), i++) { - SubdVert *vert = it.current()->from(); + for(SubdFace::EdgeIterator it_sub(face->edges(edge)); !it_sub.isDone(); it_sub.advance(), i++) { + SubdVert *vert = it_sub.current()->from(); stencil->get(idx1, vert) += weights1[i]; stencil->get(idx2, vert) += weights2[i]; } @@ -481,10 +481,11 @@ void SubdAccBuilder::computeInteriorStencil(SubdFaceRing *ring, GregoryAccStenci } /* this change makes the triangle boundaries smoother, but distorts the quads next to them */ - /*if(ring->is_triangle() || SubdFaceRing::is_triangle(edge->pair->face)) - { +#if 0 + if(ring->is_triangle() || SubdFaceRing::is_triangle(edge->pair->face)) { y *= 4.0f / 3.0f; - }*/ + } +#endif stencil->get(interior1Indices[primitiveOffset+v]) = stencil->get(edge1Indices[primitiveOffset+v]); stencil->get(interior1Indices[primitiveOffset+v]) += x; @@ -539,8 +540,10 @@ void SubdAccBuilder::computeInteriorStencil(SubdFaceRing *ring, GregoryAccStenci } /* this change makes the triangle boundaries smoother, but distorts the quads next to them. */ - /*if(ring->is_triangle() || SubdFaceRing::is_triangle(edge->pair->face)) - y *= 4.0f / 3.0f;*/ +#if 0 + if(ring->is_triangle() || SubdFaceRing::is_triangle(edge->pair->face)) + y *= 4.0f / 3.0f; +#endif stencil->get(interior2Indices[primitiveOffset+v]) = stencil->get(edge2Indices[primitiveOffset+v]); stencil->get(interior2Indices[primitiveOffset+v]) += x; diff --git a/intern/cycles/subd/subd_dice.cpp b/intern/cycles/subd/subd_dice.cpp index 6e24bb410b5..6920df9954c 100644 --- a/intern/cycles/subd/subd_dice.cpp +++ b/intern/cycles/subd/subd_dice.cpp @@ -81,9 +81,9 @@ void EdgeDice::stitch_triangles(vector<int>& outer, vector<int>& inner) return; // XXX avoid crashes for Mu or Mv == 1, missing polygons /* stitch together two arrays of verts with triangles. at each step, - we compare using the next verts on both sides, to find the split - direction with the smallest diagonal, and use that in order to keep - the triangle shape reasonable. */ + * we compare using the next verts on both sides, to find the split + * direction with the smallest diagonal, and use that in order to keep + * the triangle shape reasonable. */ for(size_t i = 0, j = 0; i+1 < inner.size() || j+1 < outer.size();) { int v0, v1, v2; @@ -354,8 +354,8 @@ void TriangleDice::add_grid(SubPatch& sub, EdgeFactors& ef, int M) // XXX normals are flipped, why? /* grid is constructed starting from the outside edges, and adding - progressively smaller inner triangles that connected to the outer - one, until M = 1 or 2, the we fill up the last part. */ + * progressively smaller inner triangles that connected to the outer + * one, until M = 1 or 2, the we fill up the last part. */ vector<int> outer_u, outer_v, outer_w; int m; @@ -388,13 +388,13 @@ void TriangleDice::add_grid(SubPatch& sub, EdgeFactors& ef, int M) for(m = M-2; m > 0; m -= 2) { vector<int> inner_u, inner_v, inner_w; - float t = m/(float)M; + const float t0 = m / (float)M; float2 center = make_float2(1.0f/3.0f, 1.0f/3.0f); /* 3 corner vertices */ - float2 p_u = interp(center, make_float2(1.0f, 0.0f), t); - float2 p_v = interp(center, make_float2(0.0f, 1.0f), t); - float2 p_w = interp(center, make_float2(0.0f, 0.0f), t); + float2 p_u = interp(center, make_float2(1.0f, 0.0f), t0); + float2 p_v = interp(center, make_float2(0.0f, 1.0f), t0); + float2 p_w = interp(center, make_float2(0.0f, 0.0f), t0); int corner_u = add_vert(sub, p_u); int corner_v = add_vert(sub, p_v); @@ -407,11 +407,11 @@ void TriangleDice::add_grid(SubPatch& sub, EdgeFactors& ef, int M) for(int i = 1; i < m; i++) { /* add vertices between corners */ - float t = i/(float)m; + const float t1 = i / (float)m; - inner_u.push_back(add_vert(sub, interp(p_v, p_w, t))); - inner_v.push_back(add_vert(sub, interp(p_w, p_u, t))); - inner_w.push_back(add_vert(sub, interp(p_u, p_v, t))); + inner_u.push_back(add_vert(sub, interp(p_v, p_w, t1))); + inner_v.push_back(add_vert(sub, interp(p_w, p_u, t1))); + inner_w.push_back(add_vert(sub, interp(p_u, p_v, t1))); } inner_u.push_back(corner_w); diff --git a/intern/cycles/subd/subd_ring.cpp b/intern/cycles/subd/subd_ring.cpp index cbd12e60da0..66eab02231c 100644 --- a/intern/cycles/subd/subd_ring.cpp +++ b/intern/cycles/subd/subd_ring.cpp @@ -82,8 +82,8 @@ int SubdFaceRing::vert_index(SubdVert *vertex) void SubdFaceRing::evaluate_stencils(float3 *P, StencilMask *mask, int num) { /* first we sort verts by id. this way verts will always be added - in the same order to ensure the exact same float ops happen for control - points of other patches, so we get water-tight patches */ + * in the same order to ensure the exact same float ops happen for control + * points of other patches, so we get water-tight patches */ int num_verts = m_verts.size(); vector<int> vmap(num_verts); @@ -161,8 +161,8 @@ bool SubdFaceRing::is_quad(SubdFace *face) bool SubdFaceRing::is_boundary(SubdFace *face) { /* note that face->is_boundary() returns a different result. That function - returns true when any of the *edges* are on the boundary. however, this - function returns true if any of the face *verts* are on the boundary. */ + * returns true when any of the *edges* are on the boundary. however, this + * function returns true if any of the face *verts* are on the boundary. */ for(SubdFace::EdgeIterator it(face->edges()); !it.isDone(); it.advance()) { SubdEdge *edge = it.current(); diff --git a/intern/cycles/subd/subd_split.cpp b/intern/cycles/subd/subd_split.cpp index f0b87200f08..074c82a2348 100644 --- a/intern/cycles/subd/subd_split.cpp +++ b/intern/cycles/subd/subd_split.cpp @@ -248,19 +248,19 @@ void DiagSplit::split(QuadDice::SubPatch& sub, QuadDice::EdgeFactors& ef, int de void DiagSplit::split_triangle(Mesh *mesh, Patch *patch, int shader, bool smooth) { - TriangleDice::SubPatch sub; - TriangleDice::EdgeFactors ef; + TriangleDice::SubPatch sub_split; + TriangleDice::EdgeFactors ef_split; - sub.patch = patch; - sub.Pu = make_float2(1.0f, 0.0f); - sub.Pv = make_float2(0.0f, 1.0f); - sub.Pw = make_float2(0.0f, 0.0f); + sub_split.patch = patch; + sub_split.Pu = make_float2(1.0f, 0.0f); + sub_split.Pv = make_float2(0.0f, 1.0f); + sub_split.Pw = make_float2(0.0f, 0.0f); - ef.tu = T(patch, sub.Pv, sub.Pw); - ef.tv = T(patch, sub.Pw, sub.Pu); - ef.tw = T(patch, sub.Pu, sub.Pv); + ef_split.tu = T(patch, sub_split.Pv, sub_split.Pw); + ef_split.tv = T(patch, sub_split.Pw, sub_split.Pu); + ef_split.tw = T(patch, sub_split.Pu, sub_split.Pv); - split(sub, ef); + split(sub_split, ef_split); TriangleDice dice(mesh, shader, smooth, dicing_rate); dice.camera = camera; @@ -286,21 +286,21 @@ void DiagSplit::split_triangle(Mesh *mesh, Patch *patch, int shader, bool smooth void DiagSplit::split_quad(Mesh *mesh, Patch *patch, int shader, bool smooth) { - QuadDice::SubPatch sub; - QuadDice::EdgeFactors ef; + QuadDice::SubPatch sub_split; + QuadDice::EdgeFactors ef_split; - sub.patch = patch; - sub.P00 = make_float2(0.0f, 0.0f); - sub.P10 = make_float2(1.0f, 0.0f); - sub.P01 = make_float2(0.0f, 1.0f); - sub.P11 = make_float2(1.0f, 1.0f); + sub_split.patch = patch; + sub_split.P00 = make_float2(0.0f, 0.0f); + sub_split.P10 = make_float2(1.0f, 0.0f); + sub_split.P01 = make_float2(0.0f, 1.0f); + sub_split.P11 = make_float2(1.0f, 1.0f); - ef.tu0 = T(patch, sub.P00, sub.P10); - ef.tu1 = T(patch, sub.P01, sub.P11); - ef.tv0 = T(patch, sub.P00, sub.P01); - ef.tv1 = T(patch, sub.P10, sub.P11); + ef_split.tu0 = T(patch, sub_split.P00, sub_split.P10); + ef_split.tu1 = T(patch, sub_split.P01, sub_split.P11); + ef_split.tv0 = T(patch, sub_split.P00, sub_split.P01); + ef_split.tv1 = T(patch, sub_split.P10, sub_split.P11); - split(sub, ef); + split(sub_split, ef_split); QuadDice dice(mesh, shader, smooth, dicing_rate); dice.camera = camera; diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h index 8b4a175f498..5136ea5c5db 100644 --- a/intern/cycles/util/util_color.h +++ b/intern/cycles/util/util_color.h @@ -29,15 +29,15 @@ __device float color_srgb_to_scene_linear(float c) if(c < 0.04045f) return (c < 0.0f)? 0.0f: c * (1.0f/12.92f); else - return pow((c + 0.055f)*(1.0f/1.055f), 2.4f); + return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f); } __device float color_scene_linear_to_srgb(float c) { if(c < 0.0031308f) return (c < 0.0f)? 0.0f: c * 12.92f; - else - return 1.055f * pow(c, 1.0f/2.4f) - 0.055f; + else + return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f; } #ifndef __KERNEL_OPENCL__ diff --git a/intern/cycles/util/util_cuda.cpp b/intern/cycles/util/util_cuda.cpp index f81a11ba9da..2960022fd8d 100644 --- a/intern/cycles/util/util_cuda.cpp +++ b/intern/cycles/util/util_cuda.cpp @@ -326,8 +326,8 @@ bool cuLibraryInit() CUDA_LIBRARY_FIND(cuCtxGetLimit); /* functions which changed 3.1 -> 3.2 for 64 bit stuff, the cuda library - has both the old ones for compatibility and new ones with _v2 postfix, - we load the _v2 ones here. */ + * has both the old ones for compatibility and new ones with _v2 postfix, + * we load the _v2 ones here. */ CUDA_LIBRARY_FIND_V2(cuDeviceTotalMem); CUDA_LIBRARY_FIND_V2(cuCtxCreate); CUDA_LIBRARY_FIND_V2(cuModuleGetGlobal); diff --git a/intern/cycles/util/util_cuda.h b/intern/cycles/util/util_cuda.h index ffc71b8864e..d9d956b7bd9 100644 --- a/intern/cycles/util/util_cuda.h +++ b/intern/cycles/util/util_cuda.h @@ -56,225 +56,225 @@ typedef struct CUstream_st *CUstream; typedef struct CUgraphicsResource_st *CUgraphicsResource; typedef struct CUuuid_st { - char bytes[16]; + char bytes[16]; } CUuuid; typedef enum CUctx_flags_enum { - CU_CTX_SCHED_AUTO = 0, - CU_CTX_SCHED_SPIN = 1, - CU_CTX_SCHED_YIELD = 2, - CU_CTX_SCHED_MASK = 0x3, - CU_CTX_BLOCKING_SYNC = 4, - CU_CTX_MAP_HOST = 8, - CU_CTX_LMEM_RESIZE_TO_MAX = 16, - CU_CTX_FLAGS_MASK = 0x1f + CU_CTX_SCHED_AUTO = 0, + CU_CTX_SCHED_SPIN = 1, + CU_CTX_SCHED_YIELD = 2, + CU_CTX_SCHED_MASK = 0x3, + CU_CTX_BLOCKING_SYNC = 4, + CU_CTX_MAP_HOST = 8, + CU_CTX_LMEM_RESIZE_TO_MAX = 16, + CU_CTX_FLAGS_MASK = 0x1f } CUctx_flags; typedef enum CUevent_flags_enum { - CU_EVENT_DEFAULT = 0, - CU_EVENT_BLOCKING_SYNC = 1, - CU_EVENT_DISABLE_TIMING = 2 + CU_EVENT_DEFAULT = 0, + CU_EVENT_BLOCKING_SYNC = 1, + CU_EVENT_DISABLE_TIMING = 2 } CUevent_flags; typedef enum CUarray_format_enum { - CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, - CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, - CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, - CU_AD_FORMAT_SIGNED_INT8 = 0x08, - CU_AD_FORMAT_SIGNED_INT16 = 0x09, - CU_AD_FORMAT_SIGNED_INT32 = 0x0a, - CU_AD_FORMAT_HALF = 0x10, - CU_AD_FORMAT_FLOAT = 0x20 + CU_AD_FORMAT_UNSIGNED_INT8 = 0x01, + CU_AD_FORMAT_UNSIGNED_INT16 = 0x02, + CU_AD_FORMAT_UNSIGNED_INT32 = 0x03, + CU_AD_FORMAT_SIGNED_INT8 = 0x08, + CU_AD_FORMAT_SIGNED_INT16 = 0x09, + CU_AD_FORMAT_SIGNED_INT32 = 0x0a, + CU_AD_FORMAT_HALF = 0x10, + CU_AD_FORMAT_FLOAT = 0x20 } CUarray_format; typedef enum CUaddress_mode_enum { - CU_TR_ADDRESS_MODE_WRAP = 0, - CU_TR_ADDRESS_MODE_CLAMP = 1, - CU_TR_ADDRESS_MODE_MIRROR = 2, - CU_TR_ADDRESS_MODE_BORDER = 3 + CU_TR_ADDRESS_MODE_WRAP = 0, + CU_TR_ADDRESS_MODE_CLAMP = 1, + CU_TR_ADDRESS_MODE_MIRROR = 2, + CU_TR_ADDRESS_MODE_BORDER = 3 } CUaddress_mode; typedef enum CUfilter_mode_enum { - CU_TR_FILTER_MODE_POINT = 0, - CU_TR_FILTER_MODE_LINEAR = 1 + CU_TR_FILTER_MODE_POINT = 0, + CU_TR_FILTER_MODE_LINEAR = 1 } CUfilter_mode; typedef enum CUdevice_attribute_enum { - CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2, - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3, - CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4, - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5, - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6, - CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7, - CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8, - CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, - CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9, - CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, - CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11, - CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, - CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, - CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, - CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, - CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15, - CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, - CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17, - CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, - CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, - CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28, - CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, - CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30, - CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31, - CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32, - CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33, - CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34, - CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35 + CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 1, + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_X = 2, + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Y = 3, + CU_DEVICE_ATTRIBUTE_MAX_BLOCK_DIM_Z = 4, + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_X = 5, + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Y = 6, + CU_DEVICE_ATTRIBUTE_MAX_GRID_DIM_Z = 7, + CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK = 8, + CU_DEVICE_ATTRIBUTE_SHARED_MEMORY_PER_BLOCK = 8, + CU_DEVICE_ATTRIBUTE_TOTAL_CONSTANT_MEMORY = 9, + CU_DEVICE_ATTRIBUTE_WARP_SIZE = 10, + CU_DEVICE_ATTRIBUTE_MAX_PITCH = 11, + CU_DEVICE_ATTRIBUTE_MAX_REGISTERS_PER_BLOCK = 12, + CU_DEVICE_ATTRIBUTE_REGISTERS_PER_BLOCK = 12, + CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13, + CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14, + CU_DEVICE_ATTRIBUTE_GPU_OVERLAP = 15, + CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16, + CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT = 17, + CU_DEVICE_ATTRIBUTE_INTEGRATED = 18, + CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19, + CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH = 21, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH = 22, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT = 23, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH = 24, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT = 25, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH = 26, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_WIDTH = 27, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_HEIGHT = 28, + CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_ARRAY_NUMSLICES = 29, + CU_DEVICE_ATTRIBUTE_SURFACE_ALIGNMENT = 30, + CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31, + CU_DEVICE_ATTRIBUTE_ECC_ENABLED = 32, + CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33, + CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34, + CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35 } CUdevice_attribute; typedef struct CUdevprop_st { - int maxThreadsPerBlock; - int maxThreadsDim[3]; - int maxGridSize[3]; - int sharedMemPerBlock; - int totalConstantMemory; - int SIMDWidth; - int memPitch; - int regsPerBlock; - int clockRate; - int textureAlign; + int maxThreadsPerBlock; + int maxThreadsDim[3]; + int maxGridSize[3]; + int sharedMemPerBlock; + int totalConstantMemory; + int SIMDWidth; + int memPitch; + int regsPerBlock; + int clockRate; + int textureAlign; } CUdevprop; typedef enum CUfunction_attribute_enum { - CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, - CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, - CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, - CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, - CU_FUNC_ATTRIBUTE_NUM_REGS = 4, - CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, - CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, - CU_FUNC_ATTRIBUTE_MAX + CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK = 0, + CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES = 1, + CU_FUNC_ATTRIBUTE_CONST_SIZE_BYTES = 2, + CU_FUNC_ATTRIBUTE_LOCAL_SIZE_BYTES = 3, + CU_FUNC_ATTRIBUTE_NUM_REGS = 4, + CU_FUNC_ATTRIBUTE_PTX_VERSION = 5, + CU_FUNC_ATTRIBUTE_BINARY_VERSION = 6, + CU_FUNC_ATTRIBUTE_MAX } CUfunction_attribute; typedef enum CUfunc_cache_enum { - CU_FUNC_CACHE_PREFER_NONE = 0x00, - CU_FUNC_CACHE_PREFER_SHARED = 0x01, - CU_FUNC_CACHE_PREFER_L1 = 0x02 + CU_FUNC_CACHE_PREFER_NONE = 0x00, + CU_FUNC_CACHE_PREFER_SHARED = 0x01, + CU_FUNC_CACHE_PREFER_L1 = 0x02 } CUfunc_cache; typedef enum CUmemorytype_enum { - CU_MEMORYTYPE_HOST = 0x01, - CU_MEMORYTYPE_DEVICE = 0x02, - CU_MEMORYTYPE_ARRAY = 0x03 + CU_MEMORYTYPE_HOST = 0x01, + CU_MEMORYTYPE_DEVICE = 0x02, + CU_MEMORYTYPE_ARRAY = 0x03 } CUmemorytype; typedef enum CUcomputemode_enum { - CU_COMPUTEMODE_DEFAULT = 0, - CU_COMPUTEMODE_EXCLUSIVE = 1, - CU_COMPUTEMODE_PROHIBITED = 2 + CU_COMPUTEMODE_DEFAULT = 0, + CU_COMPUTEMODE_EXCLUSIVE = 1, + CU_COMPUTEMODE_PROHIBITED = 2 } CUcomputemode; typedef enum CUjit_option_enum { - CU_JIT_MAX_REGISTERS = 0, - CU_JIT_THREADS_PER_BLOCK, - CU_JIT_WALL_TIME, - CU_JIT_INFO_LOG_BUFFER, - CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, - CU_JIT_ERROR_LOG_BUFFER, - CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, - CU_JIT_OPTIMIZATION_LEVEL, - CU_JIT_TARGET_FROM_CUCONTEXT, - CU_JIT_TARGET, - CU_JIT_FALLBACK_STRATEGY + CU_JIT_MAX_REGISTERS = 0, + CU_JIT_THREADS_PER_BLOCK, + CU_JIT_WALL_TIME, + CU_JIT_INFO_LOG_BUFFER, + CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES, + CU_JIT_ERROR_LOG_BUFFER, + CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES, + CU_JIT_OPTIMIZATION_LEVEL, + CU_JIT_TARGET_FROM_CUCONTEXT, + CU_JIT_TARGET, + CU_JIT_FALLBACK_STRATEGY } CUjit_option; typedef enum CUjit_target_enum { - CU_TARGET_COMPUTE_10 = 0, - CU_TARGET_COMPUTE_11, - CU_TARGET_COMPUTE_12, - CU_TARGET_COMPUTE_13, - CU_TARGET_COMPUTE_20, - CU_TARGET_COMPUTE_21, - CU_TARGET_COMPUTE_30 + CU_TARGET_COMPUTE_10 = 0, + CU_TARGET_COMPUTE_11, + CU_TARGET_COMPUTE_12, + CU_TARGET_COMPUTE_13, + CU_TARGET_COMPUTE_20, + CU_TARGET_COMPUTE_21, + CU_TARGET_COMPUTE_30 } CUjit_target; typedef enum CUjit_fallback_enum { - CU_PREFER_PTX = 0, - CU_PREFER_BINARY + CU_PREFER_PTX = 0, + CU_PREFER_BINARY } CUjit_fallback; typedef enum CUgraphicsRegisterFlags_enum { - CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00 + CU_GRAPHICS_REGISTER_FLAGS_NONE = 0x00 } CUgraphicsRegisterFlags; typedef enum CUgraphicsMapResourceFlags_enum { - CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00, - CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, - CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02 + CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE = 0x00, + CU_GRAPHICS_MAP_RESOURCE_FLAGS_READ_ONLY = 0x01, + CU_GRAPHICS_MAP_RESOURCE_FLAGS_WRITE_DISCARD = 0x02 } CUgraphicsMapResourceFlags; typedef enum CUarray_cubemap_face_enum { - CU_CUBEMAP_FACE_POSITIVE_X = 0x00, - CU_CUBEMAP_FACE_NEGATIVE_X = 0x01, - CU_CUBEMAP_FACE_POSITIVE_Y = 0x02, - CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03, - CU_CUBEMAP_FACE_POSITIVE_Z = 0x04, - CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05 + CU_CUBEMAP_FACE_POSITIVE_X = 0x00, + CU_CUBEMAP_FACE_NEGATIVE_X = 0x01, + CU_CUBEMAP_FACE_POSITIVE_Y = 0x02, + CU_CUBEMAP_FACE_NEGATIVE_Y = 0x03, + CU_CUBEMAP_FACE_POSITIVE_Z = 0x04, + CU_CUBEMAP_FACE_NEGATIVE_Z = 0x05 } CUarray_cubemap_face; typedef enum CUlimit_enum { - CU_LIMIT_STACK_SIZE = 0x00, - CU_LIMIT_PRINTF_FIFO_SIZE = 0x01, - CU_LIMIT_MALLOC_HEAP_SIZE = 0x02 + CU_LIMIT_STACK_SIZE = 0x00, + CU_LIMIT_PRINTF_FIFO_SIZE = 0x01, + CU_LIMIT_MALLOC_HEAP_SIZE = 0x02 } CUlimit; typedef enum cudaError_enum { - CUDA_SUCCESS = 0, - CUDA_ERROR_INVALID_VALUE = 1, - CUDA_ERROR_OUT_OF_MEMORY = 2, - CUDA_ERROR_NOT_INITIALIZED = 3, - CUDA_ERROR_DEINITIALIZED = 4, - CUDA_ERROR_NO_DEVICE = 100, - CUDA_ERROR_INVALID_DEVICE = 101, - CUDA_ERROR_INVALID_IMAGE = 200, - CUDA_ERROR_INVALID_CONTEXT = 201, - CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202, - CUDA_ERROR_MAP_FAILED = 205, - CUDA_ERROR_UNMAP_FAILED = 206, - CUDA_ERROR_ARRAY_IS_MAPPED = 207, - CUDA_ERROR_ALREADY_MAPPED = 208, - CUDA_ERROR_NO_BINARY_FOR_GPU = 209, - CUDA_ERROR_ALREADY_ACQUIRED = 210, - CUDA_ERROR_NOT_MAPPED = 211, - CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212, - CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213, - CUDA_ERROR_ECC_UNCORRECTABLE = 214, - CUDA_ERROR_UNSUPPORTED_LIMIT = 215, - CUDA_ERROR_INVALID_SOURCE = 300, - CUDA_ERROR_FILE_NOT_FOUND = 301, - CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, - CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303, - CUDA_ERROR_OPERATING_SYSTEM = 304, - CUDA_ERROR_INVALID_HANDLE = 400, - CUDA_ERROR_NOT_FOUND = 500, - CUDA_ERROR_NOT_READY = 600, - CUDA_ERROR_LAUNCH_FAILED = 700, - CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701, - CUDA_ERROR_LAUNCH_TIMEOUT = 702, - CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703, - CUDA_ERROR_UNKNOWN = 999 + CUDA_SUCCESS = 0, + CUDA_ERROR_INVALID_VALUE = 1, + CUDA_ERROR_OUT_OF_MEMORY = 2, + CUDA_ERROR_NOT_INITIALIZED = 3, + CUDA_ERROR_DEINITIALIZED = 4, + CUDA_ERROR_NO_DEVICE = 100, + CUDA_ERROR_INVALID_DEVICE = 101, + CUDA_ERROR_INVALID_IMAGE = 200, + CUDA_ERROR_INVALID_CONTEXT = 201, + CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202, + CUDA_ERROR_MAP_FAILED = 205, + CUDA_ERROR_UNMAP_FAILED = 206, + CUDA_ERROR_ARRAY_IS_MAPPED = 207, + CUDA_ERROR_ALREADY_MAPPED = 208, + CUDA_ERROR_NO_BINARY_FOR_GPU = 209, + CUDA_ERROR_ALREADY_ACQUIRED = 210, + CUDA_ERROR_NOT_MAPPED = 211, + CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212, + CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213, + CUDA_ERROR_ECC_UNCORRECTABLE = 214, + CUDA_ERROR_UNSUPPORTED_LIMIT = 215, + CUDA_ERROR_INVALID_SOURCE = 300, + CUDA_ERROR_FILE_NOT_FOUND = 301, + CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302, + CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303, + CUDA_ERROR_OPERATING_SYSTEM = 304, + CUDA_ERROR_INVALID_HANDLE = 400, + CUDA_ERROR_NOT_FOUND = 500, + CUDA_ERROR_NOT_READY = 600, + CUDA_ERROR_LAUNCH_FAILED = 700, + CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701, + CUDA_ERROR_LAUNCH_TIMEOUT = 702, + CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703, + CUDA_ERROR_UNKNOWN = 999 } CUresult; #define CU_MEMHOSTALLOC_PORTABLE 0x01 @@ -282,76 +282,76 @@ typedef enum cudaError_enum { #define CU_MEMHOSTALLOC_WRITECOMBINED 0x04 typedef struct CUDA_MEMCPY2D_st { - size_t srcXInBytes; - size_t srcY; - - CUmemorytype srcMemoryType; - const void *srcHost; - CUdeviceptr srcDevice; - CUarray srcArray; - size_t srcPitch; - - size_t dstXInBytes; - size_t dstY; - - CUmemorytype dstMemoryType; - void *dstHost; - CUdeviceptr dstDevice; - CUarray dstArray; - size_t dstPitch; - - size_t WidthInBytes; - size_t Height; + size_t srcXInBytes; + size_t srcY; + + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + size_t srcPitch; + + size_t dstXInBytes; + size_t dstY; + + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + size_t dstPitch; + + size_t WidthInBytes; + size_t Height; } CUDA_MEMCPY2D; typedef struct CUDA_MEMCPY3D_st { - size_t srcXInBytes; - size_t srcY; - size_t srcZ; - size_t srcLOD; - CUmemorytype srcMemoryType; - const void *srcHost; - CUdeviceptr srcDevice; - CUarray srcArray; - void *reserved0; - size_t srcPitch; - size_t srcHeight; - - size_t dstXInBytes; - size_t dstY; - size_t dstZ; - size_t dstLOD; - CUmemorytype dstMemoryType; - void *dstHost; - CUdeviceptr dstDevice; - CUarray dstArray; - void *reserved1; - size_t dstPitch; - size_t dstHeight; - - size_t WidthInBytes; - size_t Height; - size_t Depth; + size_t srcXInBytes; + size_t srcY; + size_t srcZ; + size_t srcLOD; + CUmemorytype srcMemoryType; + const void *srcHost; + CUdeviceptr srcDevice; + CUarray srcArray; + void *reserved0; + size_t srcPitch; + size_t srcHeight; + + size_t dstXInBytes; + size_t dstY; + size_t dstZ; + size_t dstLOD; + CUmemorytype dstMemoryType; + void *dstHost; + CUdeviceptr dstDevice; + CUarray dstArray; + void *reserved1; + size_t dstPitch; + size_t dstHeight; + + size_t WidthInBytes; + size_t Height; + size_t Depth; } CUDA_MEMCPY3D; typedef struct CUDA_ARRAY_DESCRIPTOR_st { - size_t Width; - size_t Height; + size_t Width; + size_t Height; - CUarray_format Format; - unsigned int NumChannels; + CUarray_format Format; + unsigned int NumChannels; } CUDA_ARRAY_DESCRIPTOR; typedef struct CUDA_ARRAY3D_DESCRIPTOR_st { - size_t Width; - size_t Height; - size_t Depth; + size_t Width; + size_t Height; + size_t Depth; - CUarray_format Format; - unsigned int NumChannels; - unsigned int Flags; + CUarray_format Format; + unsigned int NumChannels; + unsigned int Flags; } CUDA_ARRAY3D_DESCRIPTOR; #define CUDA_ARRAY3D_2DARRAY 0x01 diff --git a/intern/cycles/util/util_hash.h b/intern/cycles/util/util_hash.h index c31b46e1580..5b3ff76af7f 100644 --- a/intern/cycles/util/util_hash.h +++ b/intern/cycles/util/util_hash.h @@ -34,14 +34,14 @@ static inline uint hash_int_2d(uint kx, uint ky) b += ky; c ^= b; c -= rot(b,14); - a ^= c; a -= rot(c,11); - b ^= a; b -= rot(a,25); - c ^= b; c -= rot(b,16); - a ^= c; a -= rot(c,4); - b ^= a; b -= rot(a,14); - c ^= b; c -= rot(b,24); - - return c; + a ^= c; a -= rot(c,11); + b ^= a; b -= rot(a,25); + c ^= b; c -= rot(b,16); + a ^= c; a -= rot(c,4); + b ^= a; b -= rot(a,14); + c ^= b; c -= rot(b,24); + + return c; #undef rot } diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index cd44b7e8cda..a6bc478ee64 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -334,7 +334,7 @@ __device_inline float2 as_float2(const float4 a) __device_inline void print_float2(const char *label, const float2& a) { - printf("%s: %.8f %.8f\n", label, a.x, a.y); + printf("%s: %.8f %.8f\n", label, (double)a.x, (double)a.y); } #endif @@ -532,7 +532,7 @@ __device_inline float4 float3_to_float4(const float3 a) __device_inline void print_float3(const char *label, const float3& a) { - printf("%s: %.8f %.8f %.8f\n", label, a.x, a.y, a.z); + printf("%s: %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z); } __device_inline float3 rcp(const float3& a) @@ -844,7 +844,7 @@ __device_inline float4 reduce_add(const float4& a) __device_inline void print_float4(const char *label, const float4& a) { - printf("%s: %.8f %.8f %.8f %.8f\n", label, a.x, a.y, a.z, a.w); + printf("%s: %.8f %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z, (double)a.w); } #endif diff --git a/intern/cycles/util/util_md5.cpp b/intern/cycles/util/util_md5.cpp index 25a77f18d02..9dcd69cec99 100644 --- a/intern/cycles/util/util_md5.cpp +++ b/intern/cycles/util/util_md5.cpp @@ -148,7 +148,7 @@ void MD5Hash::process(const uint8_t *data /*[64]*/) /* Round 1. */ /* Let [abcd k s i] denote the operation - a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ + * a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ #define F(x, y, z) (((x) & (y)) | (~(x) & (z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + F(b,c,d) + X[k] + Ti;\ @@ -172,9 +172,9 @@ void MD5Hash::process(const uint8_t *data /*[64]*/) SET(b, c, d, a, 15, 22, T16); #undef SET - /* Round 2. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ + /* Round 2. */ + /* Let [abcd k s i] denote the operation + * a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ #define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + G(b,c,d) + X[k] + Ti;\ @@ -198,9 +198,9 @@ void MD5Hash::process(const uint8_t *data /*[64]*/) SET(b, c, d, a, 12, 20, T32); #undef SET - /* Round 3. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ + /* Round 3. */ + /* Let [abcd k s t] denote the operation + * a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ #define H(x, y, z) ((x) ^ (y) ^ (z)) #define SET(a, b, c, d, k, s, Ti)\ t = a + H(b,c,d) + X[k] + Ti;\ @@ -224,9 +224,9 @@ void MD5Hash::process(const uint8_t *data /*[64]*/) SET(b, c, d, a, 2, 23, T48); #undef SET - /* Round 4. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ + /* Round 4. */ + /* Let [abcd k s t] denote the operation + * a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ #define I(x, y, z) ((y) ^ ((x) | ~(z))) #define SET(a, b, c, d, k, s, Ti)\ t = a + I(b,c,d) + X[k] + Ti;\ @@ -250,9 +250,9 @@ void MD5Hash::process(const uint8_t *data /*[64]*/) SET(b, c, d, a, 9, 21, T64); #undef SET - /* Then perform the following additions. (That is increment each - of the four registers by the value it had before this block - was started.) */ + /* Then perform the following additions. (That is increment each + * of the four registers by the value it had before this block + * was started.) */ abcd[0] += a; abcd[1] += b; abcd[2] += c; @@ -365,7 +365,7 @@ string MD5Hash::get_hex() finish(digest); - for(int i=0; i<16; i++) + for(int i = 0; i < 16; i++) sprintf(buf + i*2, "%02X", digest[i]); buf[sizeof(buf)-1] = '\0'; diff --git a/intern/cycles/util/util_md5.h b/intern/cycles/util/util_md5.h index 5e7e604c4cf..43e08e64f39 100644 --- a/intern/cycles/util/util_md5.h +++ b/intern/cycles/util/util_md5.h @@ -44,13 +44,13 @@ public: bool append_file(const string& filepath); string get_hex(); -protected: + protected: void process(const uint8_t *data); void finish(uint8_t digest[16]); - uint32_t count[2]; /* message length in bits, lsw first */ - uint32_t abcd[4]; /* digest buffer */ - uint8_t buf[64]; /* accumulate block */ + uint32_t count[2]; /* message length in bits, lsw first */ + uint32_t abcd[4]; /* digest buffer */ + uint8_t buf[64]; /* accumulate block */ }; CCL_NAMESPACE_END diff --git a/intern/cycles/util/util_opencl.cpp b/intern/cycles/util/util_opencl.cpp index 4087c2c3823..c9df9c2ff5c 100644 --- a/intern/cycles/util/util_opencl.cpp +++ b/intern/cycles/util/util_opencl.cpp @@ -13,29 +13,29 @@ #ifndef CLCC_GENERATE_DOCUMENTATION #ifdef _WIN32 - #define WIN32_LEAN_AND_MEAN - #define VC_EXTRALEAN - #include <windows.h> +# define WIN32_LEAN_AND_MEAN +# define VC_EXTRALEAN +# include <windows.h> - 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 <dlfcn.h> - - typedef void* CLCC_DYNLIB_HANDLE; +# include <dlfcn.h> - #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 2e97097ef36..5f3f1667bcc 100644 --- a/intern/cycles/util/util_opencl.h +++ b/intern/cycles/util/util_opencl.h @@ -36,27 +36,27 @@ CCL_NAMESPACE_BEGIN #endif // CLCC_GENERATE_DOCUMENTATION /******************************************************************************* -* Copyright (c) 2008-2009 The Khronos Group Inc. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and/or associated documentation files (the -* "Materials"), to deal in the Materials without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Materials, and to -* permit persons to whom the Materials are furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Materials. -* -* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -******************************************************************************/ + * Copyright (c) 2008-2009 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and/or associated documentation files (the + * "Materials"), to deal in the Materials without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Materials, and to + * permit persons to whom the Materials are furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + ******************************************************************************/ #ifndef CLCC_GENERATE_DOCUMENTATION @@ -88,20 +88,20 @@ typedef double cl_double; /* -* Vector types -* -* Note: OpenCL requires that all types be naturally aligned. -* This means that vector types must be naturally aligned. -* For example, a vector of four floats must be aligned to -* a 16 byte boundary (calculated as 4 * the natural 4-byte -* alignment of the float). The alignment qualifiers here -* will only function properly if your compiler supports them -* and if you don't actively work to defeat them. For example, -* in order for a cl_float4 to be 16 byte aligned in a struct, -* the start of the struct must itself be 16-byte aligned. -* -* Maintaining proper alignment is the user's responsibility. -*/ + * Vector types + * + * Note: OpenCL requires that all types be naturally aligned. + * This means that vector types must be naturally aligned. + * For example, a vector of four floats must be aligned to + * a 16 byte boundary (calculated as 4 * the natural 4-byte + * alignment of the float). The alignment qualifiers here + * will only function properly if your compiler supports them + * and if you don't actively work to defeat them. For example, + * in order for a cl_float4 to be 16 byte aligned in a struct, + * the start of the struct must itself be 16-byte aligned. + * + * Maintaining proper alignment is the user's responsibility. + */ typedef signed __int8 cl_char2[2]; typedef signed __int8 cl_char4[4]; typedef signed __int8 cl_char8[8]; @@ -168,20 +168,20 @@ typedef float cl_float __attribute__((aligned(4))); typedef double cl_double __attribute__((aligned(8))); /* -* Vector types -* -* Note: OpenCL requires that all types be naturally aligned. -* This means that vector types must be naturally aligned. -* For example, a vector of four floats must be aligned to -* a 16 byte boundary (calculated as 4 * the natural 4-byte -* alignment of the float). The alignment qualifiers here -* will only function properly if your compiler supports them -* and if you don't actively work to defeat them. For example, -* in order for a cl_float4 to be 16 byte aligned in a struct, -* the start of the struct must itself be 16-byte aligned. -* -* Maintaining proper alignment is the user's responsibility. -*/ + * Vector types + * + * Note: OpenCL requires that all types be naturally aligned. + * This means that vector types must be naturally aligned. + * For example, a vector of four floats must be aligned to + * a 16 byte boundary (calculated as 4 * the natural 4-byte + * alignment of the float). The alignment qualifiers here + * will only function properly if your compiler supports them + * and if you don't actively work to defeat them. For example, + * in order for a cl_float4 to be 16 byte aligned in a struct, + * the start of the struct must itself be 16-byte aligned. + * + * Maintaining proper alignment is the user's responsibility. + */ typedef int8_t cl_char2[2] __attribute__((aligned(2))); typedef int8_t cl_char4[4] __attribute__((aligned(4))); typedef int8_t cl_char8[8] __attribute__((aligned(8))); @@ -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_path.cpp b/intern/cycles/util/util_path.cpp index 69069a3bbce..717aa34c426 100644 --- a/intern/cycles/util/util_path.cpp +++ b/intern/cycles/util/util_path.cpp @@ -179,8 +179,8 @@ static bool path_read_text(const string& path, string& text) string path_source_replace_includes(const string& source_, const string& path) { /* our own little c preprocessor that replaces #includes with the file - contents, to work around issue of opencl drivers not supporting - include paths with spaces in them */ + * contents, to work around issue of opencl drivers not supporting + * include paths with spaces in them */ string source = source_; const string include = "#include \""; size_t n, pos = 0; diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index ad7f3347cee..2d9f0fffae6 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -149,8 +149,10 @@ bool system_cpu_support_optimized() __cpuid(result, 0); num = result[0]; - /*__cpuid(result, 0x80000000); - num_ex = result[0];*/ +#if 0 + __cpuid(result, 0x80000000); + num_ex = result[0]; +#endif if(num >= 1) { __cpuid(result, 0x00000001); @@ -167,13 +169,15 @@ bool system_cpu_support_optimized() caps.fma3 = (result[2] & ((int)1 << 12)) != 0; } - /*if(num_ex >= 0x80000001) { +#if 0 + if(num_ex >= 0x80000001) { __cpuid(result, 0x80000001); caps.x64 = (result[3] & ((int)1 << 29)) != 0; caps.sse4a = (result[2] & ((int)1 << 6)) != 0; caps.fma4 = (result[2] & ((int)1 << 16)) != 0; caps.xop = (result[2] & ((int)1 << 11)) != 0; - }*/ + } +#endif caps_init = true; } diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp index 023630e8fae..ea0abd6f54f 100644 --- a/intern/cycles/util/util_task.cpp +++ b/intern/cycles/util/util_task.cpp @@ -164,7 +164,7 @@ void TaskScheduler::init(int num_threads) thread_scoped_lock lock(mutex); /* multiple cycles instances can use this task scheduler, sharing the same - threads, so we keep track of the number of users. */ + * threads, so we keep track of the number of users. */ if(users == 0) { do_exit = false; diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h index 008f68e69e8..9bea4e7808a 100644 --- a/intern/cycles/util/util_thread.h +++ b/intern/cycles/util/util_thread.h @@ -34,7 +34,7 @@ typedef boost::mutex::scoped_lock thread_scoped_lock; typedef boost::condition_variable thread_condition_variable; /* own pthread based implementation, to avoid boost version conflicts with - dynamically loaded blender plugins */ + * dynamically loaded blender plugins */ class thread { public: diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp index 1780994da27..b3c6506dfa0 100644 --- a/intern/cycles/util/util_transform.cpp +++ b/intern/cycles/util/util_transform.cpp @@ -139,7 +139,7 @@ Transform transform_inverse(const Transform& tfm) if(!transform_matrix4_gj_inverse(R, M)) { /* matrix is degenerate (e.g. 0 scale on some axis), ideally we should - never be in this situation, but try to invert it anyway with tweak */ + * never be in this situation, but try to invert it anyway with tweak */ M[0][0] += 1e-8f; M[1][1] += 1e-8f; M[2][2] += 1e-8f; @@ -160,15 +160,15 @@ static float4 transform_to_quat(const Transform& tfm) double trace = tfm[0][0] + tfm[1][1] + tfm[2][2]; float4 qt; - if(trace > 0.0f) { + if(trace > 0.0) { double s = sqrt(trace + 1.0); qt.w = (float)(s/2.0); s = 0.5/s; - qt.x = (float)((tfm[2][1] - tfm[1][2]) * s); - qt.y = (float)((tfm[0][2] - tfm[2][0]) * s); - qt.z = (float)((tfm[1][0] - tfm[0][1]) * s); + qt.x = (float)((double)(tfm[2][1] - tfm[1][2]) * s); + qt.y = (float)((double)(tfm[0][2] - tfm[2][0]) * s); + qt.z = (float)((double)(tfm[1][0] - tfm[0][1]) * s); } else { int i = 0; @@ -181,16 +181,16 @@ static float4 transform_to_quat(const Transform& tfm) int j = (i + 1)%3; int k = (j + 1)%3; - double s = sqrt((tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0); + double s = sqrt((double)(tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0); double q[3]; q[i] = s * 0.5; if(s != 0.0) s = 0.5/s; - double w = (tfm[k][j] - tfm[j][k]) * s; - q[j] = (tfm[j][i] + tfm[i][j]) * s; - q[k] = (tfm[k][i] + tfm[i][k]) * s; + double w = (double)(tfm[k][j] - tfm[j][k]) * s; + q[j] = (double)(tfm[j][i] + tfm[i][j]) * s; + q[k] = (double)(tfm[k][i] + tfm[i][k]) * s; qt.x = (float)q[0]; qt.y = (float)q[1]; diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index b460c4c87a2..d93bbff5415 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -255,7 +255,7 @@ Transform transform_inverse(const Transform& a); __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale) { /* the epsilon here is quite arbitrary, but this function is only used for - surface area and bump, where we except it to not be so sensitive */ + * surface area and bump, where we except it to not be so sensitive */ Transform ttfm = transform_transpose(tfm); float eps = 1e-6f; 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); } diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 2e6d1bf8fbc..4e8179775d5 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -345,8 +345,7 @@ def preset_paths(subdir): dirs.append(directory) # Find addons preset paths - import addon_utils - for path in addon_utils.paths(): + for path in _addon_utils.paths(): directory = _os.path.join(path, "presets", subdir) if _os.path.isdir(directory): dirs.append(directory) diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 134ec1acd8e..f3223fb4af1 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -57,6 +57,7 @@ struct bGPdata *gpencil_data_duplicate(struct bGPdata *gpd); void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf); +struct bGPDframe *BKE_gpencil_layer_find_frame(struct bGPDlayer *gpl, int cframe); struct bGPDframe *gpencil_layer_getframe(struct bGPDlayer *gpl, int cframe, short addnew); void gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf); struct bGPDlayer *gpencil_layer_getactive(struct bGPdata *gpd); diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 279ec272fe8..baa530c0599 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -157,7 +157,7 @@ void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf); void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr); -void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, int cfra, char *path); +void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path); /* sets index offset for multilayer files */ struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index afd50de8159..0150646a96c 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1460,7 +1460,7 @@ static bConstraintTypeInfo CTI_ROTLIMIT = { rotlimit_evaluate /* evaluate */ }; -/* --------- Limit Scaling --------- */ +/* --------- Limit Scale --------- */ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) @@ -1507,7 +1507,7 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U static bConstraintTypeInfo CTI_SIZELIMIT = { CONSTRAINT_TYPE_SIZELIMIT, /* type */ sizeof(bSizeLimitConstraint), /* size */ - "Limit Scaling", /* name */ + "Limit Scale", /* name */ "bSizeLimitConstraint", /* struct name */ NULL, /* free data */ NULL, /* id looper */ @@ -1721,7 +1721,7 @@ static bConstraintTypeInfo CTI_ROTLIKE = { rotlike_evaluate /* evaluate */ }; -/* ---------- Copy Scaling ---------- */ +/* ---------- Copy Scale ---------- */ static void sizelike_new_data(void *cdata) { @@ -3352,7 +3352,7 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t static bConstraintTypeInfo CTI_TRANSFORM = { CONSTRAINT_TYPE_TRANSFORM, /* type */ sizeof(bTransformConstraint), /* size */ - "Transform", /* name */ + "Transformation", /* name */ "bTransformConstraint", /* struct name */ NULL, /* free data */ transform_id_looper, /* id looper */ @@ -4213,10 +4213,10 @@ static void constraints_init_typeinfo(void) constraintsTypeInfo[4] = &CTI_FOLLOWPATH; /* Follow-Path Constraint */ constraintsTypeInfo[5] = &CTI_ROTLIMIT; /* Limit Rotation Constraint */ constraintsTypeInfo[6] = &CTI_LOCLIMIT; /* Limit Location Constraint */ - constraintsTypeInfo[7] = &CTI_SIZELIMIT; /* Limit Scaling Constraint */ + constraintsTypeInfo[7] = &CTI_SIZELIMIT; /* Limit Scale Constraint */ constraintsTypeInfo[8] = &CTI_ROTLIKE; /* Copy Rotation Constraint */ constraintsTypeInfo[9] = &CTI_LOCLIKE; /* Copy Location Constraint */ - constraintsTypeInfo[10] = &CTI_SIZELIKE; /* Copy Scaling Constraint */ + constraintsTypeInfo[10] = &CTI_SIZELIKE; /* Copy Scale Constraint */ constraintsTypeInfo[11] = &CTI_PYTHON; /* Python/Script Constraint */ constraintsTypeInfo[12] = &CTI_ACTION; /* Action Constraint */ constraintsTypeInfo[13] = &CTI_LOCKTRACK; /* Locked-Track Constraint */ diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 6ec19018ab5..c317dc63ef7 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -321,6 +321,19 @@ void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf) /* -------- GP-Layer API ---------- */ +bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe) +{ + bGPDframe *gpf; + + for (gpf = gpl->frames.last; gpf; gpf = gpf->prev) { + if (gpf->framenum == cframe) { + return gpf; + } + } + + return NULL; +} + /* get the appropriate gp-frame from a given layer * - this sets the layer's actframe var (if allowed to) * - extension beyond range (if first gp-frame is after all frame in interest and cannot add) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d733092e792..157c8782523 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -2092,7 +2092,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame) ima->tpageflag |= IMA_TPAGE_REFRESH; ima->lastframe = frame; - BKE_image_user_file_path(iuser, ima, frame, name); + BKE_image_user_file_path(iuser, ima, name); flag = IB_rect | IB_multilayer; if (ima->flag & IMA_DO_PREMUL) @@ -2204,7 +2204,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame) if (ima->anim == NULL) { char str[FILE_MAX]; - BKE_image_user_file_path(iuser, ima, frame, str); + BKE_image_user_file_path(iuser, ima, str); /* FIXME: make several stream accessible in image editor, too*/ ima->anim = openanim(str, IB_rect, 0); @@ -2267,7 +2267,8 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) flag |= IB_premul; /* get the right string */ - BKE_image_user_file_path(iuser, ima, cfra, str); + BKE_image_user_frame_calc(iuser, cfra, 0); + BKE_image_user_file_path(iuser, ima, str); /* read ibuf */ ibuf = IMB_loadiffname(str, flag); @@ -2741,21 +2742,14 @@ void BKE_image_user_check_frame_calc(ImageUser *iuser, int cfra, int fieldnr) } } -void BKE_image_user_file_path(ImageUser *iuser, Image *ima, int cfra, char *filepath) +void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath) { BLI_strncpy(filepath, ima->name, FILE_MAX); if (ima->source == IMA_SRC_SEQUENCE) { char head[FILE_MAX], tail[FILE_MAX]; unsigned short numlen; - int frame; - - if(iuser) { - BKE_image_user_frame_calc(iuser, cfra, 0); - frame = iuser->framenr; - } - else { - } + int frame = iuser->framenr; BLI_stringdec(filepath, head, tail, &numlen); BLI_stringenc(filepath, head, tail, numlen, frame); diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h index 11c91aac6ac..3c38c0380e0 100644 --- a/source/blender/blenlib/BLI_string_cursor_utf8.h +++ b/source/blender/blenlib/BLI_string_cursor_utf8.h @@ -26,7 +26,7 @@ #ifndef __BLI_STRING_CURSOR_UTF8_H__ #define __BLI_STRING_CURSOR_UTF8_H__ -/** \file BLI_string_utf8.h +/** \file BLI_string_cursor_utf8.h * \ingroup bli */ diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c index 4578270d571..c550a17e696 100644 --- a/source/blender/bmesh/operators/bmo_mesh_conv.c +++ b/source/blender/bmesh/operators/bmo_mesh_conv.c @@ -20,7 +20,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/bmesh/operators/bmesh_mesh_conv.c +/** \file blender/bmesh/operators/bmo_mesh_conv.c * \ingroup bmesh * * This file contains functions diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index e53144bd597..0903620f9a0 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -20,7 +20,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/bmesh/operators/bmo_subdivide.c +/** \file blender/bmesh/operators/bmo_triangulate.c * \ingroup bmesh */ diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 4377eb3e883..3ebc7b04aa4 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -20,7 +20,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/bmesh/operators/bmo_subdivide.c +/** \file blender/bmesh/operators/bmo_utils.c * \ingroup bmesh * * utility bmesh operators, e.g. transform, diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 6fc938c192c..b9e5c7d385c 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -26,24 +26,24 @@ set(INC . + intern + nodes + operations ../blenkernel ../blenlib + ../blenlib + ../blenloader + ../imbuf ../makesdna - ../render/extern/include - ../render/intern/include ../makesrna - ../blenloader - ../blenlib + ../opencl ../windowmanager - ../imbuf - ../../../intern/guardedalloc - nodes - ../nodes/ + ../nodes ../nodes/composite ../nodes/intern - intern - operations - ../opencl + ../render/extern/include + ../render/intern/include + ../../../intern/guardedalloc ) set(SRC @@ -100,7 +100,7 @@ set(SRC operations/COM_QualityStepHelper.h operations/COM_QualityStepHelper.cpp -# Internal nodes + # Internal nodes nodes/COM_MuteNode.cpp nodes/COM_MuteNode.h nodes/COM_GroupNode.cpp @@ -108,7 +108,7 @@ set(SRC nodes/COM_SocketProxyNode.cpp nodes/COM_SocketProxyNode.h -# input nodes + # input nodes nodes/COM_RenderLayersNode.cpp nodes/COM_RenderLayersNode.h nodes/COM_ImageNode.cpp @@ -132,7 +132,7 @@ set(SRC nodes/COM_MaskNode.cpp nodes/COM_MaskNode.h -# output nodes + # output nodes nodes/COM_CompositorNode.cpp nodes/COM_CompositorNode.h nodes/COM_ViewerNode.cpp @@ -146,7 +146,7 @@ set(SRC operations/COM_CalculateMeanOperation.cpp operations/COM_CalculateMeanOperation.h -# distort nodes + # distort nodes nodes/COM_TranslateNode.cpp nodes/COM_TranslateNode.h nodes/COM_ScaleNode.cpp @@ -193,27 +193,27 @@ set(SRC nodes/COM_DefocusNode.cpp nodes/COM_DefocusNode.h -# color nodes - nodes/COM_VectorCurveNode.cpp - nodes/COM_VectorCurveNode.h - nodes/COM_ColorCurveNode.cpp - nodes/COM_ColorCurveNode.h - nodes/COM_ColorToBWNode.cpp - nodes/COM_ColorToBWNode.h - nodes/COM_ColorRampNode.cpp - nodes/COM_ColorRampNode.h - nodes/COM_MixNode.cpp - nodes/COM_MixNode.h - nodes/COM_AlphaOverNode.cpp - nodes/COM_AlphaOverNode.h - nodes/COM_ZCombineNode.cpp - nodes/COM_ZCombineNode.h - nodes/COM_BrightnessNode.cpp - nodes/COM_BrightnessNode.h - nodes/COM_ColorBalanceNode.cpp - nodes/COM_ColorBalanceNode.h - nodes/COM_InvertNode.cpp - nodes/COM_InvertNode.h + # color nodes + nodes/COM_VectorCurveNode.cpp + nodes/COM_VectorCurveNode.h + nodes/COM_ColorCurveNode.cpp + nodes/COM_ColorCurveNode.h + nodes/COM_ColorToBWNode.cpp + nodes/COM_ColorToBWNode.h + nodes/COM_ColorRampNode.cpp + nodes/COM_ColorRampNode.h + nodes/COM_MixNode.cpp + nodes/COM_MixNode.h + nodes/COM_AlphaOverNode.cpp + nodes/COM_AlphaOverNode.h + nodes/COM_ZCombineNode.cpp + nodes/COM_ZCombineNode.h + nodes/COM_BrightnessNode.cpp + nodes/COM_BrightnessNode.h + nodes/COM_ColorBalanceNode.cpp + nodes/COM_ColorBalanceNode.h + nodes/COM_InvertNode.cpp + nodes/COM_InvertNode.h nodes/COM_GammaNode.cpp nodes/COM_GammaNode.h nodes/COM_SetAlphaNode.cpp @@ -233,25 +233,25 @@ set(SRC operations/COM_TonemapOperation.cpp operations/COM_TonemapOperation.h -# converter nodes - nodes/COM_IDMaskNode.cpp - nodes/COM_IDMaskNode.h - nodes/COM_SeparateRGBANode.cpp - nodes/COM_SeparateRGBANode.h - nodes/COM_CombineRGBANode.cpp - nodes/COM_CombineRGBANode.h - nodes/COM_SeparateHSVANode.cpp - nodes/COM_SeparateHSVANode.h - nodes/COM_CombineHSVANode.cpp - nodes/COM_CombineHSVANode.h - nodes/COM_SeparateYUVANode.cpp - nodes/COM_SeparateYUVANode.h - nodes/COM_CombineYUVANode.cpp - nodes/COM_CombineYUVANode.h - nodes/COM_SeparateYCCANode.cpp - nodes/COM_SeparateYCCANode.h - nodes/COM_CombineYCCANode.cpp - nodes/COM_CombineYCCANode.h + # converter nodes + nodes/COM_IDMaskNode.cpp + nodes/COM_IDMaskNode.h + nodes/COM_SeparateRGBANode.cpp + nodes/COM_SeparateRGBANode.h + nodes/COM_CombineRGBANode.cpp + nodes/COM_CombineRGBANode.h + nodes/COM_SeparateHSVANode.cpp + nodes/COM_SeparateHSVANode.h + nodes/COM_CombineHSVANode.cpp + nodes/COM_CombineHSVANode.h + nodes/COM_SeparateYUVANode.cpp + nodes/COM_SeparateYUVANode.h + nodes/COM_CombineYUVANode.cpp + nodes/COM_CombineYUVANode.h + nodes/COM_SeparateYCCANode.cpp + nodes/COM_SeparateYCCANode.h + nodes/COM_CombineYCCANode.cpp + nodes/COM_CombineYCCANode.h nodes/COM_NormalNode.cpp nodes/COM_NormalNode.h @@ -265,7 +265,7 @@ set(SRC operations/COM_NormalizeOperation.cpp operations/COM_NormalizeOperation.h -# Filter nodes + # Filter nodes nodes/COM_BilateralBlurNode.cpp nodes/COM_BilateralBlurNode.h operations/COM_BilateralBlurOperation.cpp @@ -275,12 +275,10 @@ set(SRC operations/COM_VectorBlurOperation.cpp operations/COM_VectorBlurOperation.h - - - nodes/COM_FilterNode.cpp - nodes/COM_FilterNode.h - nodes/COM_DilateErodeNode.cpp - nodes/COM_DilateErodeNode.h + nodes/COM_FilterNode.cpp + nodes/COM_FilterNode.h + nodes/COM_DilateErodeNode.cpp + nodes/COM_DilateErodeNode.h nodes/COM_BlurNode.cpp nodes/COM_BlurNode.h nodes/COM_BokehBlurNode.cpp @@ -310,7 +308,7 @@ set(SRC operations/COM_GammaCorrectOperation.h operations/COM_GammaCorrectOperation.cpp -# Matte nodes + # Matte nodes nodes/COM_BoxMaskNode.cpp nodes/COM_BoxMaskNode.h nodes/COM_EllipseMaskNode.cpp @@ -323,6 +321,7 @@ set(SRC operations/COM_DoubleEdgeMaskOperation.cpp operations/COM_DoubleEdgeMaskOperation.h + nodes/COM_KeyingNode.cpp nodes/COM_KeyingNode.h nodes/COM_KeyingScreenNode.cpp @@ -336,50 +335,50 @@ set(SRC operations/COM_KeyingClipOperation.cpp operations/COM_KeyingClipOperation.h -operations/COM_ColorSpillOperation.cpp -operations/COM_ColorSpillOperation.h - operations/COM_RenderLayersBaseProg.cpp - operations/COM_RenderLayersBaseProg.h - operations/COM_RenderLayersImageProg.cpp - operations/COM_RenderLayersImageProg.h - operations/COM_RenderLayersAlphaProg.cpp - operations/COM_RenderLayersAlphaProg.h - operations/COM_RenderLayersDepthProg.cpp - operations/COM_RenderLayersDepthProg.h - operations/COM_RenderLayersNormalOperation.cpp - operations/COM_RenderLayersNormalOperation.h - operations/COM_RenderLayersSpeedOperation.cpp - operations/COM_RenderLayersSpeedOperation.h - operations/COM_RenderLayersColorOperation.cpp - operations/COM_RenderLayersColorOperation.h - operations/COM_RenderLayersUVOperation.cpp - operations/COM_RenderLayersUVOperation.h - operations/COM_RenderLayersMistOperation.cpp - operations/COM_RenderLayersMistOperation.h - operations/COM_RenderLayersObjectIndexOperation.cpp - operations/COM_RenderLayersObjectIndexOperation.h - operations/COM_RenderLayersMaterialIndexOperation.cpp - operations/COM_RenderLayersMaterialIndexOperation.h - operations/COM_RenderLayersDiffuseOperation.cpp - operations/COM_RenderLayersDiffuseOperation.h - operations/COM_RenderLayersSpecularOperation.cpp - operations/COM_RenderLayersSpecularOperation.h - operations/COM_RenderLayersShadowOperation.cpp - operations/COM_RenderLayersShadowOperation.h - operations/COM_RenderLayersAOOperation.cpp - operations/COM_RenderLayersAOOperation.h - operations/COM_RenderLayersEmitOperation.cpp - operations/COM_RenderLayersEmitOperation.h - operations/COM_RenderLayersReflectionOperation.cpp - operations/COM_RenderLayersReflectionOperation.h - operations/COM_RenderLayersRefractionOperation.cpp - operations/COM_RenderLayersRefractionOperation.h - operations/COM_RenderLayersEnvironmentOperation.cpp - operations/COM_RenderLayersEnvironmentOperation.h - operations/COM_RenderLayersIndirectOperation.cpp - operations/COM_RenderLayersIndirectOperation.h - operations/COM_RenderLayersCyclesOperation.cpp - operations/COM_RenderLayersCyclesOperation.h + operations/COM_ColorSpillOperation.cpp + operations/COM_ColorSpillOperation.h + operations/COM_RenderLayersBaseProg.cpp + operations/COM_RenderLayersBaseProg.h + operations/COM_RenderLayersImageProg.cpp + operations/COM_RenderLayersImageProg.h + operations/COM_RenderLayersAlphaProg.cpp + operations/COM_RenderLayersAlphaProg.h + operations/COM_RenderLayersDepthProg.cpp + operations/COM_RenderLayersDepthProg.h + operations/COM_RenderLayersNormalOperation.cpp + operations/COM_RenderLayersNormalOperation.h + operations/COM_RenderLayersSpeedOperation.cpp + operations/COM_RenderLayersSpeedOperation.h + operations/COM_RenderLayersColorOperation.cpp + operations/COM_RenderLayersColorOperation.h + operations/COM_RenderLayersUVOperation.cpp + operations/COM_RenderLayersUVOperation.h + operations/COM_RenderLayersMistOperation.cpp + operations/COM_RenderLayersMistOperation.h + operations/COM_RenderLayersObjectIndexOperation.cpp + operations/COM_RenderLayersObjectIndexOperation.h + operations/COM_RenderLayersMaterialIndexOperation.cpp + operations/COM_RenderLayersMaterialIndexOperation.h + operations/COM_RenderLayersDiffuseOperation.cpp + operations/COM_RenderLayersDiffuseOperation.h + operations/COM_RenderLayersSpecularOperation.cpp + operations/COM_RenderLayersSpecularOperation.h + operations/COM_RenderLayersShadowOperation.cpp + operations/COM_RenderLayersShadowOperation.h + operations/COM_RenderLayersAOOperation.cpp + operations/COM_RenderLayersAOOperation.h + operations/COM_RenderLayersEmitOperation.cpp + operations/COM_RenderLayersEmitOperation.h + operations/COM_RenderLayersReflectionOperation.cpp + operations/COM_RenderLayersReflectionOperation.h + operations/COM_RenderLayersRefractionOperation.cpp + operations/COM_RenderLayersRefractionOperation.h + operations/COM_RenderLayersEnvironmentOperation.cpp + operations/COM_RenderLayersEnvironmentOperation.h + operations/COM_RenderLayersIndirectOperation.cpp + operations/COM_RenderLayersIndirectOperation.h + operations/COM_RenderLayersCyclesOperation.cpp + operations/COM_RenderLayersCyclesOperation.h operations/COM_ImageOperation.cpp operations/COM_ImageOperation.h @@ -391,39 +390,39 @@ operations/COM_ColorSpillOperation.h operations/COM_BokehImageOperation.h - operations/COM_SocketProxyOperation.h - operations/COM_SocketProxyOperation.cpp + operations/COM_SocketProxyOperation.h + operations/COM_SocketProxyOperation.cpp - operations/COM_CompositorOperation.h - operations/COM_CompositorOperation.cpp + operations/COM_CompositorOperation.h + operations/COM_CompositorOperation.cpp operations/COM_OutputFileOperation.h operations/COM_OutputFileOperation.cpp - operations/COM_ViewerBaseOperation.h - operations/COM_ViewerBaseOperation.cpp - operations/COM_ViewerOperation.h - operations/COM_ViewerOperation.cpp - operations/COM_PreviewOperation.h - operations/COM_PreviewOperation.cpp - operations/COM_SplitViewerOperation.h - operations/COM_SplitViewerOperation.cpp - operations/COM_ConvertValueToColourProg.h - operations/COM_ConvertValueToColourProg.cpp - operations/COM_ConvertColourToValueProg.h - operations/COM_ConvertColourToValueProg.cpp - operations/COM_ConvertColorToBWOperation.h - operations/COM_ConvertColorToBWOperation.cpp - operations/COM_ConvertColorToVectorOperation.h - operations/COM_ConvertColorToVectorOperation.cpp - operations/COM_ConvertValueToVectorOperation.h - operations/COM_ConvertValueToVectorOperation.cpp - operations/COM_ConvertVectorToColorOperation.h - operations/COM_ConvertVectorToColorOperation.cpp - operations/COM_ConvertVectorToValueOperation.h - operations/COM_ConvertVectorToValueOperation.cpp -operations/COM_ConvertDepthToRadiusOperation.h -operations/COM_ConvertDepthToRadiusOperation.cpp - operations/COM_ZCombineOperation.cpp - operations/COM_ZCombineOperation.h + operations/COM_ViewerBaseOperation.h + operations/COM_ViewerBaseOperation.cpp + operations/COM_ViewerOperation.h + operations/COM_ViewerOperation.cpp + operations/COM_PreviewOperation.h + operations/COM_PreviewOperation.cpp + operations/COM_SplitViewerOperation.h + operations/COM_SplitViewerOperation.cpp + operations/COM_ConvertValueToColourProg.h + operations/COM_ConvertValueToColourProg.cpp + operations/COM_ConvertColourToValueProg.h + operations/COM_ConvertColourToValueProg.cpp + operations/COM_ConvertColorToBWOperation.h + operations/COM_ConvertColorToBWOperation.cpp + operations/COM_ConvertColorToVectorOperation.h + operations/COM_ConvertColorToVectorOperation.cpp + operations/COM_ConvertValueToVectorOperation.h + operations/COM_ConvertValueToVectorOperation.cpp + operations/COM_ConvertVectorToColorOperation.h + operations/COM_ConvertVectorToColorOperation.cpp + operations/COM_ConvertVectorToValueOperation.h + operations/COM_ConvertVectorToValueOperation.cpp + operations/COM_ConvertDepthToRadiusOperation.h + operations/COM_ConvertDepthToRadiusOperation.cpp + operations/COM_ZCombineOperation.cpp + operations/COM_ZCombineOperation.h operations/COM_ConvertRGBToYCCOperation.h operations/COM_ConvertRGBToYCCOperation.cpp @@ -484,86 +483,86 @@ operations/COM_ConvertDepthToRadiusOperation.cpp operations/COM_GammaOperation.h operations/COM_ColorCorrectionOperation.cpp operations/COM_ColorCorrectionOperation.h - operations/COM_SetValueOperation.h - operations/COM_SetValueOperation.cpp - operations/COM_SetColorOperation.h - operations/COM_SetColorOperation.cpp - operations/COM_SetVectorOperation.h - operations/COM_SetVectorOperation.cpp - - operations/COM_MixBurnOperation.h - operations/COM_MixBurnOperation.cpp - operations/COM_MixColorOperation.h - operations/COM_MixColorOperation.cpp - operations/COM_MixDarkenOperation.h - operations/COM_MixDarkenOperation.cpp - operations/COM_MixDodgeOperation.h - operations/COM_MixDodgeOperation.cpp - operations/COM_MixDifferenceOperation.h - operations/COM_MixDifferenceOperation.cpp - operations/COM_MixDivideOperation.h - operations/COM_MixDivideOperation.cpp - operations/COM_MixHueOperation.h - operations/COM_MixHueOperation.cpp - operations/COM_MixLightenOperation.h - operations/COM_MixLightenOperation.cpp - operations/COM_MixLinearLightOperation.h - operations/COM_MixLinearLightOperation.cpp - operations/COM_MixOverlayOperation.h - operations/COM_MixOverlayOperation.cpp - operations/COM_MixSaturationOperation.h - operations/COM_MixSaturationOperation.cpp - operations/COM_MixScreenOperation.h - operations/COM_MixScreenOperation.cpp - operations/COM_MixSoftLightOperation.h - operations/COM_MixSoftLightOperation.cpp - operations/COM_MixValueOperation.h - operations/COM_MixValueOperation.cpp - operations/COM_MixSubtractOperation.h - operations/COM_MixSubtractOperation.cpp + operations/COM_SetValueOperation.h + operations/COM_SetValueOperation.cpp + operations/COM_SetColorOperation.h + operations/COM_SetColorOperation.cpp + operations/COM_SetVectorOperation.h + operations/COM_SetVectorOperation.cpp + + operations/COM_MixBurnOperation.h + operations/COM_MixBurnOperation.cpp + operations/COM_MixColorOperation.h + operations/COM_MixColorOperation.cpp + operations/COM_MixDarkenOperation.h + operations/COM_MixDarkenOperation.cpp + operations/COM_MixDodgeOperation.h + operations/COM_MixDodgeOperation.cpp + operations/COM_MixDifferenceOperation.h + operations/COM_MixDifferenceOperation.cpp + operations/COM_MixDivideOperation.h + operations/COM_MixDivideOperation.cpp + operations/COM_MixHueOperation.h + operations/COM_MixHueOperation.cpp + operations/COM_MixLightenOperation.h + operations/COM_MixLightenOperation.cpp + operations/COM_MixLinearLightOperation.h + operations/COM_MixLinearLightOperation.cpp + operations/COM_MixOverlayOperation.h + operations/COM_MixOverlayOperation.cpp + operations/COM_MixSaturationOperation.h + operations/COM_MixSaturationOperation.cpp + operations/COM_MixScreenOperation.h + operations/COM_MixScreenOperation.cpp + operations/COM_MixSoftLightOperation.h + operations/COM_MixSoftLightOperation.cpp + operations/COM_MixValueOperation.h + operations/COM_MixValueOperation.cpp + operations/COM_MixSubtractOperation.h + operations/COM_MixSubtractOperation.cpp operations/COM_MathBaseOperation.h operations/COM_MathBaseOperation.cpp - operations/COM_AlphaOverMixedOperation.h - operations/COM_AlphaOverMixedOperation.cpp - operations/COM_AlphaOverPremultiplyOperation.h - operations/COM_AlphaOverPremultiplyOperation.cpp - operations/COM_AlphaOverKeyOperation.h - operations/COM_AlphaOverKeyOperation.cpp - - operations/COM_ColorBalanceLGGOperation.h - operations/COM_ColorBalanceLGGOperation.cpp - operations/COM_ColorBalanceASCCDLOperation.h - operations/COM_ColorBalanceASCCDLOperation.cpp - operations/COM_InvertOperation.cpp - operations/COM_InvertOperation.h + operations/COM_AlphaOverMixedOperation.h + operations/COM_AlphaOverMixedOperation.cpp + operations/COM_AlphaOverPremultiplyOperation.h + operations/COM_AlphaOverPremultiplyOperation.cpp + operations/COM_AlphaOverKeyOperation.h + operations/COM_AlphaOverKeyOperation.cpp + + operations/COM_ColorBalanceLGGOperation.h + operations/COM_ColorBalanceLGGOperation.cpp + operations/COM_ColorBalanceASCCDLOperation.h + operations/COM_ColorBalanceASCCDLOperation.cpp + operations/COM_InvertOperation.cpp + operations/COM_InvertOperation.h operations/COM_SetAlphaOperation.cpp operations/COM_SetAlphaOperation.h operations/COM_MapValueOperation.cpp operations/COM_MapValueOperation.h -# Distort operation - operations/COM_TranslateOperation.h - operations/COM_TranslateOperation.cpp - operations/COM_RotateOperation.h - operations/COM_RotateOperation.cpp - operations/COM_ScaleOperation.h - operations/COM_ScaleOperation.cpp - operations/COM_MapUVOperation.h - operations/COM_MapUVOperation.cpp - operations/COM_DisplaceOperation.h - operations/COM_DisplaceOperation.cpp - operations/COM_DisplaceSimpleOperation.h - operations/COM_DisplaceSimpleOperation.cpp - operations/COM_FlipOperation.h - operations/COM_FlipOperation.cpp - operations/COM_ProjectorLensDistortionOperation.cpp - operations/COM_ProjectorLensDistortionOperation.h - operations/COM_ScreenLensDistortionOperation.cpp - operations/COM_ScreenLensDistortionOperation.h - -#Filter operations + # Distort operation + operations/COM_TranslateOperation.h + operations/COM_TranslateOperation.cpp + operations/COM_RotateOperation.h + operations/COM_RotateOperation.cpp + operations/COM_ScaleOperation.h + operations/COM_ScaleOperation.cpp + operations/COM_MapUVOperation.h + operations/COM_MapUVOperation.cpp + operations/COM_DisplaceOperation.h + operations/COM_DisplaceOperation.cpp + operations/COM_DisplaceSimpleOperation.h + operations/COM_DisplaceSimpleOperation.cpp + operations/COM_FlipOperation.h + operations/COM_FlipOperation.cpp + operations/COM_ProjectorLensDistortionOperation.cpp + operations/COM_ProjectorLensDistortionOperation.h + operations/COM_ScreenLensDistortionOperation.cpp + operations/COM_ScreenLensDistortionOperation.h + + #Filter operations operations/COM_ConvolutionFilterOperation.h operations/COM_ConvolutionFilterOperation.cpp operations/COM_ConvolutionEdgeFilterOperation.h @@ -586,7 +585,7 @@ operations/COM_ConvertDepthToRadiusOperation.cpp operations/COM_SetSamplerOperation.h -#Convert operations + #Convert operations operations/COM_IDMaskOperation.cpp operations/COM_IDMaskOperation.h @@ -597,7 +596,8 @@ operations/COM_ConvertDepthToRadiusOperation.cpp operations/COM_DotproductOperation.cpp operations/COM_DotproductOperation.h -# Matte operation + + # Matte operation operations/COM_BoxMaskOperation.h operations/COM_BoxMaskOperation.cpp operations/COM_EllipseMaskOperation.h diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp index 94110f0bcfe..0ab08ec5810 100644 --- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp +++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp @@ -35,6 +35,6 @@ double ChunkOrderHotspot::determineDistance(int x, int y) int dx = x-this->x; int dy = y-this->y; double result = sqrt((double)(dx*dx+dy*dy)); - result += this->addition; + result += (double)this->addition; return result; } diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index 37d79607d12..3ebf8398c02 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -150,8 +150,8 @@ void MemoryBuffer::readCubic(float result[4], float x, float y) float valuex = x - x1; float valuey = y - y1; - float mvaluex = 1.0 - valuex; - float mvaluey = 1.0 - valuey; + float mvaluex = 1.0f - valuex; + float mvaluey = 1.0f - valuey; float color1[4]; float color2[4]; diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index c48f3b0a291..71a87dce2a7 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -121,9 +121,9 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer * bufferindex +=offsetadd; } } - color[0] = tempColor[0]*(1.0/overallmultiplyerr); - color[1] = tempColor[1]*(1.0/overallmultiplyerg); - color[2] = tempColor[2]*(1.0/overallmultiplyerb); + color[0] = tempColor[0] * (1.0f / overallmultiplyerr); + color[1] = tempColor[1] * (1.0f / overallmultiplyerg); + color[2] = tempColor[2] * (1.0f / overallmultiplyerb); color[3] = 1.0f; } else { diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp index 0279b9a5bdf..a0297b12961 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp @@ -34,25 +34,25 @@ void BokehImageOperation::initExecution() this->centerY = getHeight() / 2; this->center[0] = this->centerX; this->center[1] = this->centerY; - this->inverseRounding = 1.0-this->data->rounding; + this->inverseRounding = 1.0f - this->data->rounding; this->circularDistance = getWidth()/2; - this->flapRad = (M_PI*2)/this->data->flaps; - this->flapRadAdd = (this->data->angle/360.0)*M_PI*2; - while (this->flapRadAdd<0.0f) { - this->flapRadAdd+=M_PI*2; + this->flapRad = (float)(M_PI * 2) / this->data->flaps; + this->flapRadAdd = (this->data->angle / 360.0f) * (float)(M_PI * 2.0); + while (this->flapRadAdd < 0.0f) { + this->flapRadAdd += (float)(M_PI * 2.0); } - while (this->flapRadAdd>M_PI) { - this->flapRadAdd-=M_PI*2; + while (this->flapRadAdd > (float)M_PI) { + this->flapRadAdd -= (float)(M_PI * 2.0); } } void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance) { - r[0] = sin(flapRad*flapNumber + flapRadAdd)*distance+centerX; - r[1] = cos(flapRad*flapNumber + flapRadAdd)*distance+centerY; + r[0] = sinf(flapRad * flapNumber + flapRadAdd) * distance + centerX; + r[1] = cosf(flapRad * flapNumber + flapRadAdd) * distance + centerY; } float BokehImageOperation::isInsideBokeh(float distance, float x, float y) { - float insideBokeh = 0.0; + float insideBokeh = 0.0f; const float deltaX = x - centerX; const float deltaY = y - centerY; float closestPoint[2]; @@ -63,7 +63,7 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) point[1] = y; const float distanceToCenter = len_v2v2(point, center); - const float bearing = (atan2f(deltaX, deltaY) + (M_PI*2)); + const float bearing = (atan2f(deltaX, deltaY) + (float)(M_PI * 2.0)); int flapNumber = (int)((bearing-flapRadAdd)/flapRad); detemineStartPointOfFlap(lineP1, flapNumber, distance); @@ -73,16 +73,16 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) const float distanceLineToCenter = len_v2v2(center, closestPoint); const float distanceRoundingToCenter = inverseRounding*distanceLineToCenter+this->data->rounding*distance; - const float catadioptricDistanceToCenter = distanceRoundingToCenter*this->data->catadioptric; - if (distanceRoundingToCenter>=distanceToCenter && catadioptricDistanceToCenter<=distanceToCenter) { - if (distanceRoundingToCenter-distanceToCenter<1.0) { + const float catadioptricDistanceToCenter = distanceRoundingToCenter * this->data->catadioptric; + if (distanceRoundingToCenter>=distanceToCenter && catadioptricDistanceToCenter <= distanceToCenter) { + if (distanceRoundingToCenter - distanceToCenter < 1.0f) { insideBokeh = (distanceRoundingToCenter-distanceToCenter); } - else if (this->data->catadioptric != 0.0 && distanceToCenter-catadioptricDistanceToCenter<1.0) { - insideBokeh = (distanceToCenter-catadioptricDistanceToCenter); + else if (this->data->catadioptric != 0.0f && distanceToCenter - catadioptricDistanceToCenter < 1.0f) { + insideBokeh = (distanceToCenter - catadioptricDistanceToCenter); } else { - insideBokeh = 1.0; + insideBokeh = 1.0f; } } return insideBokeh; @@ -90,11 +90,11 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) void BokehImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { float shift = this->data->lensshift; - float shift2 = shift/2.0f; + float shift2 = shift / 2.0f; float distance = this->circularDistance; float insideBokehMax = isInsideBokeh(distance, x, y); - float insideBokehMed = isInsideBokeh(distance-fabs(shift2*distance), x, y); - float insideBokehMin = isInsideBokeh(distance-fabs(shift*distance), x, y); + float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y); + float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y); if (shift<0) { color[0] = insideBokehMax; color[1] = insideBokehMed; diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index 0244be4cad3..ae83115ff69 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -38,7 +38,7 @@ void BoxMaskOperation::initExecution() { this->inputMask = this->getInputSocketReader(0); this->inputValue = this->getInputSocketReader(1); - const double rad = DEG2RAD(this->data->rotation); + const double rad = DEG2RAD((double)this->data->rotation); this->cosine = cos(rad); this->sine = sin(rad); this->aspectRatio = ((float)this->getWidth())/this->getHeight(); @@ -60,12 +60,12 @@ void BoxMaskOperation::executePixel(float *color, float x, float y, PixelSampler this->inputMask->read(inputMask, x, y, sampler, inputBuffers); this->inputValue->read(inputValue, x, y, sampler, inputBuffers); - float halfHeight = (this->data->height)/2.0f; - float halfWidth = this->data->width/2.0f; - bool inside = rx > this->data->x-halfWidth - && rx < this->data->x+halfWidth - && ry > this->data->y-halfHeight - && ry < this->data->y+halfHeight; + float halfHeight = this->data->height / 2.0f; + float halfWidth = this->data->width / 2.0f; + bool inside = (rx > this->data->x - halfWidth && + rx < this->data->x + halfWidth && + ry > this->data->y - halfHeight && + ry < this->data->y + halfHeight); switch (this->maskType) { case CMP_NODE_MASKTYPE_ADD: diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index 9b7f87e38bc..f949b0a55fa 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -46,7 +46,8 @@ void ChangeHSVOperation::executePixel(float *outputValue, float x, float y, Pixe inputOperation->read(inputColor1, x, y, sampler, inputBuffers); outputValue[0] = inputColor1[0] + (this->hue - 0.5f); - if (outputValue[0]>1.0f) outputValue[0]-=1.0; else if (outputValue[0]<0.0) outputValue[0]+= 1.0; + if (outputValue[0] > 1.0f) outputValue[0] -= 1.0f; + else if (outputValue[0] < 0.0f) outputValue[0] += 1.0f; outputValue[1] = inputColor1[1] * this->saturation; outputValue[2] = inputColor1[2] * this->value; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp index cc535cd95df..6fe6bde7c09 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp @@ -28,7 +28,7 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope) float x = in * slope + offset; /* prevent NaN */ - CLAMP(x, 0.0, 1.0); + CLAMP(x, 0.0f, 1.0f); return powf(x, power); } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index af28b776892..82a71f6a7a8 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -62,21 +62,21 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix float levelShadows = 0.0; float levelMidtones = 0.0; float levelHighlights = 0.0; -#define MARGIN 0.10 -#define MARGIN_DIV (0.5/MARGIN) - if (level < this->data->startmidtones-MARGIN) { +#define MARGIN 0.10f +#define MARGIN_DIV (0.5f / MARGIN) + if (level < this->data->startmidtones - MARGIN) { levelShadows = 1.0f; } - else if (level < this->data->startmidtones+MARGIN) { - levelMidtones = ((level-this->data->startmidtones)*MARGIN_DIV)+0.5; - levelShadows = 1.0 - levelMidtones; + else if (level < this->data->startmidtones + MARGIN) { + levelMidtones = ((level - this->data->startmidtones) * MARGIN_DIV) + 0.5f; + levelShadows = 1.0f - levelMidtones; } - else if (level < this->data->endmidtones-MARGIN) { + else if (level < this->data->endmidtones - MARGIN) { levelMidtones = 1.0f; } - else if (level < this->data->endmidtones+MARGIN) { - levelHighlights = ((level-this->data->endmidtones)*MARGIN_DIV)+0.5; - levelMidtones = 1.0 - levelHighlights; + else if (level < this->data->endmidtones + MARGIN) { + levelHighlights = ((level - this->data->endmidtones) * MARGIN_DIV) + 0.5f; + levelMidtones = 1.0f - levelHighlights; } else { levelHighlights = 1.0f; @@ -93,15 +93,15 @@ void ColorCorrectionOperation::executePixel(float *output, float x, float y, Pix g = inputImageColor[1]; b = inputImageColor[2]; - float invgamma = 1.0f/gamma; - float luma = 0.2126 * r + 0.7152 * g + 0.0722 * b; + float invgamma = 1.0f / gamma; + float luma = 0.2126f * r + 0.7152f * g + 0.0722f * b; r = (luma + saturation * (r - luma)); g = (luma + saturation * (g - luma)); b = (luma + saturation * (b - luma)); - r = 0.5+((r-0.5)*contrast); - g = 0.5+((g-0.5)*contrast); - b = 0.5+((b-0.5)*contrast); + r = 0.5f + ((r - 0.5f) * contrast); + g = 0.5f + ((g - 0.5f) * contrast); + b = 0.5f + ((b - 0.5f) * contrast); r = powf(r*gain+lift, invgamma); g = powf(g*gain+lift, invgamma); diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index 069bbde5e73..a38012271f1 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -76,19 +76,19 @@ void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSamp this->inputFacProgram->read(fac, x, y, sampler, inputBuffers); this->inputImageProgram->read(image, x, y, sampler, inputBuffers); - if (fac[0] >= 1.0) + if (*fac >= 1.0f) curvemapping_evaluate_premulRGBF(workingCopy, color, image); - else if (*fac<=0.0) { + else if (*fac <= 0.0f) { color[0] = image[0]; color[1] = image[1]; color[2] = image[2]; } else { - float col[4], mfac = 1.0f-*fac; + float col[4], mfac = 1.0f - *fac; curvemapping_evaluate_premulRGBF(workingCopy, col, image); - color[0] = mfac*image[0] + *fac*col[0]; - color[1] = mfac*image[1] + *fac*col[1]; - color[2] = mfac*image[2] + *fac*col[2]; + color[0] = mfac * image[0] + *fac * col[0]; + color[1] = mfac * image[1] + *fac * col[1]; + color[2] = mfac * image[2] + *fac * col[2]; } color[3] = image[3]; MEM_freeN(workingCopy); @@ -137,19 +137,19 @@ void ConstantLevelColorCurveOperation::executePixel(float *color, float x, float this->inputFacProgram->read(fac, x, y, sampler, inputBuffers); this->inputImageProgram->read(image, x, y, sampler, inputBuffers); - if (fac[0] >= 1.0) + if (*fac >= 1.0f) curvemapping_evaluate_premulRGBF(this->curveMapping, color, image); - else if (*fac<=0.0) { + else if (*fac <= 0.0f) { color[0] = image[0]; color[1] = image[1]; color[2] = image[2]; } else { - float col[4], mfac = 1.0f-*fac; + float col[4], mfac = 1.0f - *fac; curvemapping_evaluate_premulRGBF(this->curveMapping, col, image); - color[0] = mfac*image[0] + *fac*col[0]; - color[1] = mfac*image[1] + *fac*col[1]; - color[2] = mfac*image[2] + *fac*col[2]; + color[0] = mfac * image[0] + *fac * col[0]; + color[1] = mfac * image[1] + *fac * col[1]; + color[2] = mfac * image[2] + *fac * col[2]; } color[3] = image[3]; } diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index 628daa7c775..0b1ac1b2127 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -57,16 +57,16 @@ void DifferenceMatteOperation::executePixel(float *outputValue, float x, float y this->inputImage1Program->read(inColor1, x, y, sampler, inputBuffers); this->inputImage2Program->read(inColor2, x, y, sampler, inputBuffers); - difference = (fabs(inColor2[0] - inColor1[0]) + - fabs(inColor2[1] - inColor1[1]) + - fabs(inColor2[2] - inColor1[2])); + difference = (fabsf(inColor2[0] - inColor1[0]) + + fabsf(inColor2[1] - inColor1[1]) + + fabsf(inColor2[2] - inColor1[2])); - /*average together the distances*/ - difference=difference/3.0; + /* average together the distances */ + difference = difference / 3.0f; /*make 100% transparent*/ if (difference < tolerence) { - outputValue[0]=0.0; + outputValue[0] = 0.0f; } /*in the falloff region, make partially transparent */ else if (difference < falloff+tolerence) { diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 30a09a45ade..43cba09d16f 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -51,17 +51,17 @@ void DirectionalBlurOperation::initExecution() const float height = getHeight(); const float a = angle; - const float itsc = 1.f / pow(2.f, (float)iterations); + const float itsc = 1.0f / powf(2.0f, (float)iterations); float D; D = distance * sqrtf(width*width + height*height); center_x_pix = center_x * width; center_y_pix = center_y * height; - tx= itsc * D * cos(a); - ty= -itsc * D * sin(a); - sc= itsc * zoom; - rot = itsc * spin; + tx = itsc * D * cosf(a); + ty = -itsc * D * sinf(a); + sc = itsc * zoom; + rot = itsc * spin; } diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 85a629f7365..650c57dd8dc 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -38,7 +38,7 @@ void EllipseMaskOperation::initExecution() { this->inputMask = this->getInputSocketReader(0); this->inputValue = this->getInputSocketReader(1); - const double rad = DEG2RAD(this->data->rotation); + const double rad = DEG2RAD((double)this->data->rotation); this->cosine = cos(rad); this->sine = sin(rad); this->aspectRatio = ((float)this->getWidth())/this->getHeight(); diff --git a/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp b/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp index 600bfde64d9..05a758aca7f 100644 --- a/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp +++ b/source/blender/compositor/operations/COM_FogGlowImageOperation.cpp @@ -37,7 +37,7 @@ void FogGlowImageOperation::executePixel(float *color, float x, float y, PixelSa u = 2.f*(x / (float)512) - 1.f; r = (u*u + v*v)*256; d = -sqrtf(sqrtf(sqrtf(r))); - w = (0.5f + 0.5f*cos((double)u*M_PI))*(0.5f + 0.5f*cos((double)v*M_PI)); + w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI)); color[0] = expf(d*cs_r) * w; color[1] = expf(d*cs_g) * w; color[2] = expf(d*cs_b) * w; diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp index f0887d4adee..989ffd5dfba 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaOperation.cpp @@ -46,9 +46,9 @@ void GammaOperation::executePixel(float *color, float x, float y, PixelSampler s this->inputGammaProgram->read(inputGamma, x, y, sampler, inputBuffers); const float gamma = inputGamma[0]; /* check for negative to avoid nan's */ - color[0] = inputValue[0]>0.0f?pow(inputValue[0], gamma):inputValue[0]; - color[1] = inputValue[1]>0.0f?pow(inputValue[1], gamma):inputValue[1]; - color[2] = inputValue[2]>0.0f?pow(inputValue[2], gamma):inputValue[2]; + color[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0]; + color[1] = inputValue[1] > 0.0f ? powf(inputValue[1], gamma) : inputValue[1]; + color[2] = inputValue[2] > 0.0f ? powf(inputValue[2], gamma) : inputValue[2]; color[3] = inputValue[3]; } diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index 642a28627bd..e522d334d8b 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -147,11 +147,11 @@ void GaussianBokehBlurOperation::executePixel(float *color, int x, int y, Memory bufferindex +=offsetadd; } } - float divider = 1.0/overallmultiplyer; - color[0] = tempColor[0]*divider; - color[1] = tempColor[1]*divider; - color[2] = tempColor[2]*divider; - color[3] = tempColor[3]*divider; + float divider = 1.0f / overallmultiplyer; + color[0] = tempColor[0] * divider; + color[1] = tempColor[1] * divider; + color[2] = tempColor[2] * divider; + color[3] = tempColor[3] * divider; } void GaussianBokehBlurOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index 852754416f4..2eb51b4577f 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -77,7 +77,7 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuff tempColor[1] = 0; tempColor[2] = 0; tempColor[3] = 0; - float overallmultiplyer = 0; + float overallmultiplyer = 0.0f; MemoryBuffer *inputBuffer = (MemoryBuffer*)data; float *buffer = inputBuffer->getBuffer(); int bufferwidth = inputBuffer->getWidth(); @@ -106,11 +106,11 @@ void GaussianXBlurOperation::executePixel(float *color, int x, int y, MemoryBuff overallmultiplyer += multiplyer; bufferindex +=offsetadd; } - float divider = 1.0/overallmultiplyer; - color[0] = tempColor[0]*divider; - color[1] = tempColor[1]*divider; - color[2] = tempColor[2]*divider; - color[3] = tempColor[3]*divider; + float divider = 1.0f / overallmultiplyer; + color[0] = tempColor[0] * divider; + color[1] = tempColor[1] * divider; + color[2] = tempColor[2] * divider; + color[3] = tempColor[3] * divider; } void GaussianXBlurOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index cab3e3d6094..28e8e548530 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -101,11 +101,11 @@ void GaussianYBlurOperation::executePixel(float *color, int x, int y, MemoryBuff tempColor[3] += multiplyer * buffer[bufferindex+3]; overallmultiplyer += multiplyer; } - float divider = 1.0/overallmultiplyer; - color[0] = tempColor[0]*divider; - color[1] = tempColor[1]*divider; - color[2] = tempColor[2]*divider; - color[3] = tempColor[3]*divider; + float divider = 1.0f / overallmultiplyer; + color[0] = tempColor[0] * divider; + color[1] = tempColor[1] * divider; + color[2] = tempColor[2] * divider; + color[3] = tempColor[3] * divider; } void GaussianYBlurOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp index 2970c396493..2afcc2e5cc7 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp @@ -63,8 +63,8 @@ void HueSaturationValueCorrectOperation::executePixel(float *output, float x, fl f = curvemapping_evaluateF(this->curveMapping, 2, hsv[0]); hsv[2] *= (f * 2.f); - hsv[0] = hsv[0] - floor(hsv[0]); /* mod 1.0 */ - CLAMP(hsv[1], 0.f, 1.f); + hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ + CLAMP(hsv[1], 0.0f, 1.0f); output[0] = hsv[0]; output[1] = hsv[1]; diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index 7b393cc04a8..035f5584065 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -61,16 +61,16 @@ void MapUVOperation::executePixel(float *color, float x, float y, PixelSampler s /* adaptive sampling, red (U) channel */ this->inputUVProgram->read(uv_a, x-1, y, COM_PS_NEAREST, inputBuffers); this->inputUVProgram->read(uv_b, x+1, y, COM_PS_NEAREST, inputBuffers); - uv_l = uv_a[2]!=0.f? fabs(inputUV[0] - uv_a[0]) : 0.f; - uv_r = uv_b[2]!=0.f? fabs(inputUV[0] - uv_b[0]) : 0.f; + uv_l = uv_a[2]!=0.f? fabsf(inputUV[0] - uv_a[0]) : 0.f; + uv_r = uv_b[2]!=0.f? fabsf(inputUV[0] - uv_b[0]) : 0.f; dx = 0.5f * (uv_l + uv_r); /* adaptive sampling, green (V) channel */ this->inputUVProgram->read(uv_a, x, y-1, COM_PS_NEAREST, inputBuffers); this->inputUVProgram->read(uv_b, x, y+1, COM_PS_NEAREST, inputBuffers); - uv_u = uv_a[2]!=0.f? fabs(inputUV[1] - uv_a[1]) : 0.f; - uv_d = uv_b[2]!=0.f? fabs(inputUV[1] - uv_b[1]) : 0.f; + uv_u = uv_a[2]!=0.f? fabsf(inputUV[1] - uv_a[1]) : 0.f; + uv_d = uv_b[2]!=0.f? fabsf(inputUV[1] - uv_b[1]) : 0.f; dy = 0.5f * (uv_u + uv_d); diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index 2ea5f85253b..b943ec88fde 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -196,8 +196,8 @@ void MathPowerOperation::executePixel(float *outputValue, float x, float y, Pixe else { float y_mod_1 = fmod(inputValue2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ - if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { - outputValue[0] = pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5)); + if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) { + outputValue[0] = pow(inputValue1[0], floorf(inputValue2[0] + 0.5f)); } else { outputValue[0] = 0.0; diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index 313e49d8609..af2633f0e53 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -43,7 +43,7 @@ void RotateOperation::initExecution() this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL); double rad; if (this->doDegree2RadConversion) { - rad = DEG2RAD(degree[0]); + rad = DEG2RAD((double)degree[0]); } else { rad = degree[0]; diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp index 56830f4970d..d8089bdf3ea 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cpp +++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp @@ -53,14 +53,14 @@ void TonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *in float dr = output[0] + this->data->offset; float dg = output[1] + this->data->offset; float db = output[2] + this->data->offset; - output[0] /= ((dr == 0.f) ? 1.f : dr); - output[1] /= ((dg == 0.f) ? 1.f : dg); - output[2] /= ((db == 0.f) ? 1.f : db); + output[0] /= ((dr == 0.f) ? 1.0f : dr); + output[1] /= ((dg == 0.f) ? 1.0f : dg); + output[2] /= ((db == 0.f) ? 1.0f : db); const float igm = avg->igm; - if (igm != 0.f) { - output[0] = pow((double)MAX2(output[0], 0.), (double)igm); - output[1] = pow((double)MAX2(output[1], 0.), (double)igm); - output[2] = pow((double)MAX2(output[2], 0.), (double)igm); + if (igm != 0.0f) { + output[0] = powf(MAX2(output[0], 0.0f), igm); + output[1] = powf(MAX2(output[1], 0.0f), igm); + output[2] = powf(MAX2(output[2], 0.0f), igm); } color[0] = output[0]; @@ -68,31 +68,31 @@ void TonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *in color[2] = output[2]; color[3] = output[3]; } -void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void * data) +void PhotoreceptorTonemapOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { - AvgLogLum * avg = (AvgLogLum*)data; + AvgLogLum *avg = (AvgLogLum *)data; NodeTonemap *ntm = this->data; - const float f = exp((double)-this->data->f); - const float m = (ntm->m > 0.f) ? ntm->m : (0.3f + 0.7f*pow((double)avg->auto_key, 1.4)); - const float ic = 1.f - ntm->c, ia = 1.f - ntm->a; + const float f = expf(-this->data->f); + const float m = (ntm->m > 0.0f) ? ntm->m : (0.3f + 0.7f * powf(avg->auto_key, 1.4f)); + const float ic = 1.0f - ntm->c, ia = 1.0f - ntm->a; float output[4]; this->imageReader->read(output, x, y, inputBuffers, NULL); - const float L = 0.212671f*output[0] + 0.71516f*output[1] + 0.072169f*output[2]; - float I_l = output[0] + ic*(L - output[0]); - float I_g = avg->cav[0] + ic*(avg->lav - avg->cav[0]); - float I_a = I_l + ia*(I_g - I_l); - output[0] /= (output[0] + pow((double)f*I_a, (double)m)); - I_l = output[1] + ic*(L - output[1]); - I_g = avg->cav[1] + ic*(avg->lav - avg->cav[1]); - I_a = I_l + ia*(I_g - I_l); - output[1] /= (output[1] + pow((double)f*I_a,(double)m)); - I_l = output[2] + ic*(L - output[2]); - I_g = avg->cav[2] + ic*(avg->lav - avg->cav[2]); - I_a = I_l + ia*(I_g - I_l); - output[2] /= (output[2] + pow((double)f*I_a, (double)m)); + const float L = 0.212671f * output[0] + 0.71516f * output[1] + 0.072169f * output[2]; + float I_l = output[0] + ic * (L - output[0]); + float I_g = avg->cav[0] + ic * (avg->lav - avg->cav[0]); + float I_a = I_l + ia * (I_g - I_l); + output[0] /= (output[0] + powf(f * I_a, m)); + I_l = output[1] + ic * (L - output[1]); + I_g = avg->cav[1] + ic * (avg->lav - avg->cav[1]); + I_a = I_l + ia * (I_g - I_l); + output[1] /= (output[1] + powf(f * I_a, m)); + I_l = output[2] + ic * (L - output[2]); + I_g = avg->cav[2] + ic * (avg->lav - avg->cav[2]); + I_a = I_l + ia * (I_g - I_l); + output[2] /= (output[2] + powf(f * I_a, m)); color[0] = output[0]; color[1] = output[1]; @@ -133,20 +133,20 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff float * buffer = tile->getBuffer(); - float lsum = 0; + float lsum = 0.0f; int p = tile->getWidth() * tile->getHeight(); float *bc = buffer; float avl, maxl = -1e10f, minl = 1e10f; - const float sc = 1.f/(p); + const float sc = 1.0f / p; float Lav = 0.f; float cav[4] = {0.0f,0.0f,0.0f,0.0f}; while (p--) { - float L = 0.212671f*bc[0] + 0.71516f*bc[1] + 0.072169f*bc[2]; + float L = 0.212671f * bc[0] + 0.71516f * bc[1] + 0.072169f * bc[2]; Lav += L; cav[0] += bc[0]; cav[1] += bc[1]; cav[2] += bc[2]; - lsum += (float)log((double)MAX2(L, 0.0) + 1e-5); + lsum += logf(MAX2(L, 0.0f) + 1e-5f); maxl = (L > maxl) ? L : maxl; minl = (L < minl) ? L : minl; bc+=4; @@ -155,7 +155,7 @@ void *TonemapOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuff data->cav[0] = cav[0]*sc; data->cav[1] = cav[1]*sc; data->cav[2] = cav[2]*sc; - maxl = log((double)maxl + 1e-5); minl = log((double)minl + 1e-5f); avl = lsum*sc; + maxl = log((double)maxl + 1e-5); minl = log((double)minl + 1e-5); avl = lsum * sc; data->auto_key = (maxl > minl) ? ((maxl - avl) / (maxl - minl)) : 1.f; float al = exp((double)avl); data->al = (al == 0.f) ? 0.f : (this->data->key / al); diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index f14de097dfd..270fedc174b 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -89,7 +89,7 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me if (nx == x && ny == y) { /* pass */ } - else if (size>= fabs(dx) && size >= fabs(dy)) { + else if (size >= fabsf(dx) && size >= fabsf(dy)) { float u = 256 + dx*256/size; float v = 256 + dy*256/size; inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers); @@ -104,9 +104,9 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me } } } - color[0] = tempColor[0]*(1.0/overallmultiplyerr); - color[1] = tempColor[1]*(1.0/overallmultiplyerg); - color[2] = tempColor[2]*(1.0/overallmultiplyerb); + color[0] = tempColor[0] * (1.0f / overallmultiplyerr); + color[1] = tempColor[1] * (1.0f / overallmultiplyerg); + color[2] = tempColor[2] * (1.0f / overallmultiplyerb); color[3] = 1.0f; } diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 9cc738b016e..a7beaa74eb7 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -62,7 +62,7 @@ /* Generics - Loopers */ /* Loops over the gp-frames for a gp-layer, and applies the given callback */ -short gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *)) +short ED_gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *)) { bGPDframe *gpf; @@ -85,7 +85,7 @@ short gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDfr /* Data Conversion Tools */ /* make a listing all the gp-frames in a layer as cfraelems */ -void gplayer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, short onlysel) +void ED_gplayer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, short onlysel) { bGPDframe *gpf; CfraElem *ce; @@ -111,7 +111,7 @@ void gplayer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, short onlysel) /* Selection Tools */ /* check if one of the frames in this layer is selected */ -short is_gplayer_frame_selected(bGPDlayer *gpl) +short ED_gplayer_frame_select_check(bGPDlayer *gpl) { bGPDframe *gpf; @@ -149,7 +149,7 @@ static void gpframe_select(bGPDframe *gpf, short select_mode) } /* set all/none/invert select (like above, but with SELECT_* modes) */ -void select_gpencil_frames(bGPDlayer *gpl, short select_mode) +void ED_gpencil_select_frames(bGPDlayer *gpl, short select_mode) { bGPDframe *gpf; @@ -164,36 +164,33 @@ void select_gpencil_frames(bGPDlayer *gpl, short select_mode) } /* set all/none/invert select */ -void set_gplayer_frame_selection(bGPDlayer *gpl, short mode) +void ED_gplayer_frame_select_set(bGPDlayer *gpl, short mode) { /* error checking */ if (gpl == NULL) return; /* now call the standard function */ - select_gpencil_frames(gpl, mode); + ED_gpencil_select_frames(gpl, mode); } /* select the frame in this layer that occurs on this frame (there should only be one at most) */ -void select_gpencil_frame(bGPDlayer *gpl, int selx, short select_mode) +void ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode) { bGPDframe *gpf; if (gpl == NULL) return; - - /* search through frames for a match */ - for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { - /* there should only be one frame with this frame-number */ - if (gpf->framenum == selx) { - gpframe_select(gpf, select_mode); - break; - } + + gpf = BKE_gpencil_layer_find_frame(gpl, selx); + + if (gpf) { + gpframe_select(gpf, select_mode); } } /* select the frames in this layer that occur within the bounds specified */ -void borderselect_gplayer_frames(bGPDlayer *gpl, float min, float max, short select_mode) +void ED_gplayer_frames_select_border(bGPDlayer *gpl, float min, float max, short select_mode) { bGPDframe *gpf; @@ -211,7 +208,7 @@ void borderselect_gplayer_frames(bGPDlayer *gpl, float min, float max, short sel /* Frame Editing Tools */ /* Delete selected frames */ -void delete_gplayer_frames(bGPDlayer *gpl) +void ED_gplayer_frames_delete(bGPDlayer *gpl) { bGPDframe *gpf, *gpfn; @@ -229,7 +226,7 @@ void delete_gplayer_frames(bGPDlayer *gpl) } /* Duplicate selected frames from given gp-layer */ -void duplicate_gplayer_frames(bGPDlayer *gpl) +void ED_gplayer_frames_duplicate(bGPDlayer *gpl) { bGPDframe *gpf, *gpfn; @@ -502,19 +499,19 @@ void snap_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode) { switch (mode) { case 1: /* snap to nearest frame */ - gplayer_frames_looper(gpl, scene, snap_gpf_nearest); + ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearest); break; case 2: /* snap to current frame */ - gplayer_frames_looper(gpl, scene, snap_gpf_cframe); + ED_gplayer_frames_looper(gpl, scene, snap_gpf_cframe); break; case 3: /* snap to nearest marker */ - gplayer_frames_looper(gpl, scene, snap_gpf_nearmarker); + ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearmarker); break; case 4: /* snap to nearest second */ - gplayer_frames_looper(gpl, scene, snap_gpf_nearestsec); + ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearestsec); break; default: /* just in case */ - gplayer_frames_looper(gpl, scene, snap_gpf_nearest); + ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearest); break; } } @@ -604,21 +601,21 @@ void mirror_gplayer_frames(bGPDlayer *gpl, Scene *scene, short mode) { switch (mode) { case 1: /* mirror over current frame */ - gplayer_frames_looper(gpl, scene, mirror_gpf_cframe); + ED_gplayer_frames_looper(gpl, scene, mirror_gpf_cframe); break; case 2: /* mirror over frame 0 */ - gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); + ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); break; case 3: /* mirror over value 0 */ - gplayer_frames_looper(gpl, scene, mirror_gpf_xaxis); + ED_gplayer_frames_looper(gpl, scene, mirror_gpf_xaxis); break; case 4: /* mirror over marker */ mirror_gpf_marker(NULL, NULL); - gplayer_frames_looper(gpl, scene, mirror_gpf_marker); + ED_gplayer_frames_looper(gpl, scene, mirror_gpf_marker); mirror_gpf_marker(NULL, NULL); break; default: /* just in case */ - gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); + ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); break; } } diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 80f7fb9d1ed..32eb63a26d5 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -83,25 +83,27 @@ void draw_gpencil_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion void gpencil_panel_standard(const struct bContext *C, struct Panel *pa); /* ----------- Grease-Pencil AnimEdit API ------------------ */ -short gplayer_frames_looper(struct bGPDlayer *gpl, struct Scene *scene, - short (*gpf_cb)(struct bGPDframe *, struct Scene *)); -void gplayer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, short onlysel); +short ED_gplayer_frames_looper(struct bGPDlayer *gpl, struct Scene *scene, + short (*gpf_cb)(struct bGPDframe *, struct Scene *)); +void ED_gplayer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, short onlysel); -short is_gplayer_frame_selected(struct bGPDlayer *gpl); -void set_gplayer_frame_selection(struct bGPDlayer *gpl, short mode); -void select_gpencil_frames(struct bGPDlayer *gpl, short select_mode); -void select_gpencil_frame(struct bGPDlayer *gpl, int selx, short select_mode); -void borderselect_gplayer_frames(struct bGPDlayer *gpl, float min, float max, short select_mode); +short ED_gplayer_frame_select_check(struct bGPDlayer *gpl); +void ED_gplayer_frame_select_set(struct bGPDlayer *gpl, short mode); +void ED_gplayer_frames_select_border(struct bGPDlayer *gpl, float min, float max, short select_mode); +void ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode); +void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode); -void delete_gplayer_frames(struct bGPDlayer *gpl); -void duplicate_gplayer_frames(struct bGPDlayer *gpl); +void ED_gplayer_frames_delete(struct bGPDlayer *gpl); +void ED_gplayer_frames_duplicate(struct bGPDlayer *gpl); +#if 0 void free_gpcopybuf(void); void copy_gpdata(void); void paste_gpdata(void); void snap_gplayer_frames(struct bGPDlayer *gpl, short mode); void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode); +#endif /* ------------ Grease-Pencil Undo System ------------------ */ int ED_gpencil_session_active(void); diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index bbfc47c582a..773da04bc7b 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -49,24 +49,26 @@ int ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame); int ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame); /* ----------- Mask AnimEdit API ------------------ */ -short masklayer_frames_looper(struct MaskLayer *masklay, struct Scene *scene, - short (*masklay_shape_cb)(struct MaskLayerShape *, struct Scene *)); -void masklayer_make_cfra_list(struct MaskLayer *masklay, ListBase *elems, short onlysel); +short ED_masklayer_frames_looper(struct MaskLayer *masklay, struct Scene *scene, + short (*masklay_shape_cb)(struct MaskLayerShape *, struct Scene *)); +void ED_masklayer_make_cfra_list(struct MaskLayer *masklay, ListBase *elems, short onlysel); -short is_masklayer_frame_selected(struct MaskLayer *masklay); -void set_masklayer_frame_selection(struct MaskLayer *masklay, short mode); -void select_mask_frames(struct MaskLayer *masklay, short select_mode); -void select_mask_frame(struct MaskLayer *masklay, int selx, short select_mode); -void borderselect_masklayer_frames(struct MaskLayer *masklay, float min, float max, short select_mode); +short ED_masklayer_frame_select_check(struct MaskLayer *masklay); +void ED_masklayer_frame_select_set(struct MaskLayer *masklay, short mode); +void ED_masklayer_frames_select_border(struct MaskLayer *masklay, float min, float max, short select_mode); +void ED_mask_select_frames(struct MaskLayer *masklay, short select_mode); +void ED_mask_select_frame(struct MaskLayer *masklay, int selx, short select_mode); -void delete_masklayer_frames(struct MaskLayer *masklay); -void duplicate_masklayer_frames(struct MaskLayer *masklay); +void ED_masklayer_frames_delete(struct MaskLayer *masklay); +void ED_masklayer_frames_duplicate(struct MaskLayer *masklay); -//void free_gpcopybuf(void); -//void copy_gpdata(void); -//void paste_gpdata(void); +#if 0 +void free_gpcopybuf(void); +void copy_gpdata(void); +void paste_gpdata(void); -void snap_masklayer_frames(struct MaskLayer *masklay, short mode); -void mirror_masklayer_frames(struct MaskLayer *masklay, short mode); + void snap_masklayer_frames(struct MaskLayer *masklay, short mode); + void mirror_masklayer_frames(struct MaskLayer *masklay, short mode); +#endif #endif /* __ED_MASK_H__ */ diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 42036d1ea17..608df8dd9b3 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -103,7 +103,7 @@ enum { * returns 1 if successful, 0 otherwise (usually means there's no selection) * (if 0 is returns, *vec is unmodified) * */ -int calculateTransformCenter(struct bContext *C, int centerMode, float *cent3d, int *cent2d); +int calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], int cent2d[2]); struct TransInfo; struct ScrArea; diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index 6a59279934e..24f55f66bb8 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/editors/mask/mask_ops.c +/** \file blender/editors/mask/mask_edit.c * \ingroup edmask */ diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index c773e13e2eb..3836b393bf8 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -59,7 +59,7 @@ /* Generics - Loopers */ /* Loops over the gp-frames for a gp-layer, and applies the given callback */ -short masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*masklay_shape_cb)(MaskLayerShape *, Scene *)) +short ED_masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*masklay_shape_cb)(MaskLayerShape *, Scene *)) { MaskLayerShape *masklay_shape; @@ -82,7 +82,7 @@ short masklayer_frames_looper(MaskLayer *masklay, Scene *scene, short (*masklay_ /* Data Conversion Tools */ /* make a listing all the gp-frames in a layer as cfraelems */ -void masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short onlysel) +void ED_masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short onlysel) { MaskLayerShape *masklay_shape; CfraElem *ce; @@ -108,7 +108,7 @@ void masklayer_make_cfra_list(MaskLayer *masklay, ListBase *elems, short onlysel /* Selection Tools */ /* check if one of the frames in this layer is selected */ -short is_masklayer_frame_selected(MaskLayer *masklay) +short ED_masklayer_frame_select_check(MaskLayer *masklay) { MaskLayerShape *masklay_shape; @@ -146,7 +146,7 @@ static void masklayshape_select(MaskLayerShape *masklay_shape, short select_mode } /* set all/none/invert select (like above, but with SELECT_* modes) */ -void select_mask_frames(MaskLayer *masklay, short select_mode) +void ED_mask_select_frames(MaskLayer *masklay, short select_mode) { MaskLayerShape *masklay_shape; @@ -161,36 +161,33 @@ void select_mask_frames(MaskLayer *masklay, short select_mode) } /* set all/none/invert select */ -void set_masklayer_frame_selection(MaskLayer *masklay, short mode) +void ED_masklayer_frame_select_set(MaskLayer *masklay, short mode) { /* error checking */ if (masklay == NULL) return; /* now call the standard function */ - select_mask_frames(masklay, mode); + ED_mask_select_frames(masklay, mode); } /* select the frame in this layer that occurs on this frame (there should only be one at most) */ -void select_mask_frame(MaskLayer *masklay, int selx, short select_mode) +void ED_mask_select_frame(MaskLayer *masklay, int selx, short select_mode) { MaskLayerShape *masklay_shape; if (masklay == NULL) return; - /* search through frames for a match */ - for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) { - /* there should only be one frame with this frame-number */ - if (masklay_shape->frame == selx) { - masklayshape_select(masklay_shape, select_mode); - break; - } + masklay_shape = BKE_mask_layer_shape_find_frame(masklay, selx); + + if (masklay_shape) { + masklayshape_select(masklay_shape, select_mode); } } /* select the frames in this layer that occur within the bounds specified */ -void borderselect_masklayer_frames(MaskLayer *masklay, float min, float max, short select_mode) +void ED_masklayer_frames_select_border(MaskLayer *masklay, float min, float max, short select_mode) { MaskLayerShape *masklay_shape; @@ -208,7 +205,7 @@ void borderselect_masklayer_frames(MaskLayer *masklay, float min, float max, sho /* Frame Editing Tools */ /* Delete selected frames */ -void delete_masklayer_frames(MaskLayer *masklay) +void ED_masklayer_frames_delete(MaskLayer *masklay) { MaskLayerShape *masklay_shape, *masklay_shape_next; @@ -226,7 +223,7 @@ void delete_masklayer_frames(MaskLayer *masklay) } /* Duplicate selected frames from given gp-layer */ -void duplicate_masklayer_frames(MaskLayer *masklay) +void ED_masklayer_frames_duplicate(MaskLayer *masklay) { MaskLayerShape *masklay_shape, *gpfn; diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index 7c0a598ba9f..77fe2a71225 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/editors/mask/mask_relationshops.c +/** \file blender/editors/mask/mask_relationships.c * \ingroup edmask */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 93ed7d37235..b6d89a62d05 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4498,13 +4498,18 @@ static int edbm_bevel_invoke(bContext *C, wmOperator *op, wmEvent *event) BevelData *opdata; float mlen[2]; - if (!edbm_bevel_init(C, op, TRUE)) + if (!edbm_bevel_init(C, op, TRUE)) { return OPERATOR_CANCELLED; + } - /* initialize mouse values */ opdata = op->customdata; - calculateTransformCenter(C, V3D_CENTROID, NULL, opdata->mcenter); + /* initialize mouse values */ + if (!calculateTransformCenter(C, V3D_CENTROID, NULL, opdata->mcenter)) { + /* in this case the tool will likely do nothing, + * ideally this will never happen and should be checked for above */ + opdata->mcenter[0] = opdata->mcenter[1] = 0; + } mlen[0] = opdata->mcenter[0] - event->mval[0]; mlen[1] = opdata->mcenter[1] - event->mval[1]; opdata->initial_length = len_v2(mlen); @@ -4795,8 +4800,12 @@ static int edbm_inset_invoke(bContext *C, wmOperator *op, wmEvent *event) opdata = op->customdata; - calculateTransformCenter(C, V3D_CENTROID, NULL, opdata->mcenter); /* initialize mouse values */ + if (!calculateTransformCenter(C, V3D_CENTROID, NULL, opdata->mcenter)) { + /* in this case the tool will likely do nothing, + * ideally this will never happen and should be checked for above */ + opdata->mcenter[0] = opdata->mcenter[1] = 0; + } mlen[0] = opdata->mcenter[0] - event->mval[0]; mlen[1] = opdata->mcenter[1] - event->mval[1]; opdata->initial_length = len_v2(mlen); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 85b9d78c657..fc0aa39e733 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1929,6 +1929,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, ma); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 8b26461cc4f..b5cd49cc15c 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -702,9 +702,9 @@ static void duplicate_action_keys(bAnimContext *ac) if (ale->type == ANIMTYPE_FCURVE) duplicate_fcurve_keys((FCurve *)ale->key_data); else if (ale->type == ANIMTYPE_GPLAYER) - duplicate_gplayer_frames((bGPDlayer *)ale->data); + ED_gplayer_frames_duplicate((bGPDlayer *)ale->data); else if (ale->type == ANIMTYPE_MASKLAYER) - duplicate_masklayer_frames((MaskLayer *)ale->data); + ED_masklayer_frames_duplicate((MaskLayer *)ale->data); else BLI_assert(0); } @@ -777,10 +777,10 @@ static void delete_action_keys(bAnimContext *ac) /* loop through filtered data and delete selected keys */ for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - delete_gplayer_frames((bGPDlayer *)ale->data); + ED_gplayer_frames_delete((bGPDlayer *)ale->data); } else if (ale->type == ANIMTYPE_MASKLAYER) { - delete_masklayer_frames((MaskLayer *)ale->data); + ED_masklayer_frames_delete((MaskLayer *)ale->data); } else { FCurve *fcu = (FCurve *)ale->key_data; diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index bd73e35815b..539a32161e5 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -109,13 +109,13 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel) if (test) { for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - if (is_gplayer_frame_selected(ale->data)) { + if (ED_gplayer_frame_select_check(ale->data)) { sel = SELECT_SUBTRACT; break; } } else if (ale->type == ANIMTYPE_MASKLAYER) { - if (is_masklayer_frame_selected(ale->data)) { + if (ED_masklayer_frame_select_check(ale->data)) { sel = SELECT_SUBTRACT; break; } @@ -135,9 +135,9 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel) /* Now set the flags */ for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) - set_gplayer_frame_selection(ale->data, sel); + ED_gplayer_frame_select_set(ale->data, sel); else if (ale->type == ANIMTYPE_MASKLAYER) - set_masklayer_frame_selection(ale->data, sel); + ED_masklayer_frame_select_set(ale->data, sel); else ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, sel_cb, NULL); } @@ -259,9 +259,9 @@ static void borderselect_action(bAnimContext *ac, rcti rect, short mode, short s { /* loop over data selecting */ if (ale->type == ANIMTYPE_GPLAYER) - borderselect_gplayer_frames(ale->data, rectf.xmin, rectf.xmax, selectmode); + ED_gplayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode); else if (ale->type == ANIMTYPE_MASKLAYER) - borderselect_masklayer_frames(ale->data, rectf.xmin, rectf.xmax, selectmode); + ED_masklayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, selectmode); else ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); } @@ -410,10 +410,10 @@ static void markers_selectkeys_between(bAnimContext *ac) ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else if (ale->type == ANIMTYPE_GPLAYER) { - borderselect_gplayer_frames(ale->data, min, max, SELECT_ADD); + ED_gplayer_frames_select_border(ale->data, min, max, SELECT_ADD); } else if (ale->type == ANIMTYPE_MASKLAYER) { - borderselect_masklayer_frames(ale->data, min, max, SELECT_ADD); + ED_masklayer_frames_select_border(ale->data, min, max, SELECT_ADD); } else { ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); @@ -447,7 +447,7 @@ static void columnselect_action_keys(bAnimContext *ac, short mode) ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale = anim_data.first; ale; ale = ale->next) - gplayer_make_cfra_list(ale->data, &ked.list, 1); + ED_gplayer_make_cfra_list(ale->data, &ked.list, 1); } else { filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY*/); @@ -503,9 +503,9 @@ static void columnselect_action_keys(bAnimContext *ac, short mode) /* select elements with frame number matching cfraelem */ if (ale->type == ANIMTYPE_GPLAYER) - select_gpencil_frame(ale->data, ce->cfra, SELECT_ADD); + ED_gpencil_select_frame(ale->data, ce->cfra, SELECT_ADD); else if (ale->type == ANIMTYPE_MASKLAYER) - select_mask_frame(ale->data, ce->cfra, SELECT_ADD); + ED_mask_select_frame(ale->data, ce->cfra, SELECT_ADD); else ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); } @@ -788,9 +788,9 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else if (ale->type == ANIMTYPE_GPLAYER) - borderselect_gplayer_frames(ale->data, ked.f1, ked.f2, select_mode); + ED_gplayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); else if (ale->type == ANIMTYPE_MASKLAYER) - borderselect_masklayer_frames(ale->data, ked.f1, ked.f2, select_mode); + ED_masklayer_frames_select_border(ale->data, ked.f1, ked.f2, select_mode); else ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); } @@ -927,9 +927,9 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s /* select the nominated keyframe on the given frame */ if (ale->type == ANIMTYPE_GPLAYER) - select_gpencil_frame(ale->data, selx, select_mode); + ED_gpencil_select_frame(ale->data, selx, select_mode); else if (ale->type == ANIMTYPE_MASKLAYER) - select_mask_frame(ale->data, selx, select_mode); + ED_mask_select_frame(ale->data, selx, select_mode); else ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL); } @@ -971,9 +971,9 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se /* select elements with frame number matching cfra */ if (ale->type == ANIMTYPE_GPLAYER) - select_gpencil_frame(ale->key_data, selx, select_mode); + ED_gpencil_select_frame(ale->key_data, selx, select_mode); else if (ale->type == ANIMTYPE_MASKLAYER) - select_mask_frame(ale->key_data, selx, select_mode); + ED_mask_select_frame(ale->key_data, selx, select_mode); else ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL); } diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index e264d7f3885..63148c2b69d 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/editors/space_clip/clip_graph_draw.c +/** \file blender/editors/space_clip/clip_dopesheet_draw.c * \ingroup spclip */ diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c index 499eae75a73..7b0b1eb170f 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_ops.c +++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/editors/space_clip/clip_graph_ops.c +/** \file blender/editors/space_clip/clip_dopesheet_ops.c * \ingroup spclip */ diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 65d2b8f23b3..f6e9622f0a5 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -2325,14 +2325,17 @@ static int set_orientation_poll(bContext *C) if (sc) { Scene *scene = CTX_data_scene(C); MovieClip *clip = ED_space_clip(sc); - MovieTracking *tracking = &clip->tracking; - MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking); - if (tracking_object->flag & TRACKING_OBJECT_CAMERA) { - return TRUE; - } - else { - return OBACT != NULL; + if (clip) { + MovieTracking *tracking = &clip->tracking; + MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking); + + if (tracking_object->flag & TRACKING_OBJECT_CAMERA) { + return TRUE; + } + else { + return OBACT != NULL; + } } } @@ -2935,10 +2938,13 @@ static int set_solution_scale_poll(bContext *C) if (sc) { MovieClip *clip = ED_space_clip(sc); - MovieTracking *tracking = &clip->tracking; - MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking); - return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0; + if (clip) { + MovieTracking *tracking = &clip->tracking; + MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking); + + return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0; + } } return FALSE; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 1a6ec2813fa..aed282e4a4a 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1442,18 +1442,16 @@ static void node_shader_set_butfunc(bNodeType *ntype) static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; - PointerRNA imaptr; - PropertyRNA *prop; + PointerRNA imaptr, iuserptr; uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); if (!node->id) return; - prop = RNA_struct_find_property(ptr, "image"); - if (!prop || RNA_property_type(prop) != PROP_POINTER) return; - imaptr = RNA_property_pointer_get(ptr, prop); + imaptr = RNA_pointer_get(ptr, "image"); + RNA_pointer_create((ID *)ptr->id.data, &RNA_ImageUser, node->storage, &iuserptr); - node_buts_image_user(layout, C, &imaptr, ptr); + node_buts_image_user(layout, C, &imaptr, &iuserptr); } static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index fb28afbbdd9..d41294c7875 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1186,10 +1186,10 @@ int transformEvent(TransInfo *t, wmEvent *event) return OPERATOR_PASS_THROUGH; } -int calculateTransformCenter(bContext *C, int centerMode, float *cent3d, int *cent2d) +int calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], int cent2d[2]) { TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data"); - int success = 1; + int success; t->state = TRANS_RUNNING; @@ -1204,10 +1204,10 @@ int calculateTransformCenter(bContext *C, int centerMode, float *cent3d, int *ce t->around = centerMode; // override userdefined mode if (t->total == 0) { - success = 0; + success = FALSE; } else { - success = 1; + success = TRUE; calculateCenter(t); diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 7a2d2929e47..59d8e81de39 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -380,7 +380,7 @@ typedef struct bRotLimitConstraint { short flag2; } bRotLimitConstraint; -/* Limit Scaling Constraint */ +/* Limit Scale Constraint */ typedef struct bSizeLimitConstraint { float xmin, xmax; float ymin, ymax; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 3741d53c378..9cab08cbc34 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2961,12 +2961,12 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f) fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer"); fprintf(f, "public:\n"); - fprintf(f, "\t%s(const PointerRNA& ptr) :\n\t\t%s(ptr)", srna->identifier, + fprintf(f, "\t%s(const PointerRNA& ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer"); for (dp = ds->cont.properties.first; dp; dp = dp->next) if (!(dp->prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN))) if (dp->prop->type == PROP_COLLECTION) - fprintf(f, ",\n\t\t%s(ptr)", dp->prop->identifier); + fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier); fprintf(f, "\n\t\t{}\n\n"); for (dp = ds->cont.properties.first; dp; dp = dp->next) diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index e1f1ab97726..8e29e5c2e79 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -44,6 +44,7 @@ #include "ED_object.h" #include "WM_types.h" +/* please keep the names in sync with constraint.c */ EnumPropertyItem constraint_type_items[] = { {0, "", 0, N_("Motion Tracking"), ""}, {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""}, diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index e20435a07cd..3a534cd22b4 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -339,7 +339,6 @@ static StripElem *rna_SequenceElements_push(ID *id, Sequence *seq, const char *f static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index) { - int i; Scene *scene = (Scene *)id; StripElem *new_seq, *se; @@ -361,12 +360,12 @@ static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop"); seq->len--; - /* TODO - simply use 2 memcpy calls */ - for (i = 0, se = seq->strip->stripdata; i < seq->len; i++, se++) { - if (i == index) - se++; - BLI_strncpy(new_seq[i].name, se->name, sizeof(se->name)); - } + se = seq->strip->stripdata; + if (index > 0) + memcpy(new_seq, se, sizeof(StripElem) * index); + + if (index < seq->len) + memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index)); MEM_freeN(seq->strip->stripdata); seq->strip->stripdata = new_seq; diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c index 06b6e79444a..6b24bdb5c52 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.c @@ -28,7 +28,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/nodes/intern/CMP_nodes/CMP_blur.c +/** \file blender/nodes/composite/nodes/node_composite_bokehblur.c * \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c index b46e7e646de..24378c4d5b7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c @@ -28,7 +28,7 @@ */ -/** \file blender/nodes/intern/CMP_nodes/CMP_gamma.c +/** \file blender/nodes/composite/nodes/node_composite_bokehimage.c * \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c index 4bd6ab4698b..81c13980f22 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c @@ -27,7 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/nodes/intern/CMP_nodes/CMP_math.c +/** \file blender/nodes/composite/nodes/node_composite_boxmask.c * \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c index 7a1e82ddd9b..18a86680245 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c @@ -27,7 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/nodes/intern/CMP_nodes/CMP_math.c +/** \file blender/nodes/composite/nodes/node_composite_ellipsemask.c * \ingroup cmpnodes */ diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c index 8c2c2746593..258fac18c11 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switch.c +++ b/source/blender/nodes/composite/nodes/node_composite_switch.c @@ -27,7 +27,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/nodes/intern/CMP_nodes/CMP_switch.c +/** \file blender/nodes/composite/nodes/node_composite_switch.c * \ingroup cmpnodes */ diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c index 9fecc0cdeda..374a01c51f8 100644 --- a/source/blender/python/bmesh/bmesh_py_utils.c +++ b/source/blender/python/bmesh/bmesh_py_utils.c @@ -23,7 +23,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/python/bmesh/bmesh_py_api.c +/** \file blender/python/bmesh/bmesh_py_utils.c * \ingroup pybmesh * * This file defines the 'bmesh.utils' module. diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 73188b3f830..ac9ff4c8ef5 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -537,7 +537,12 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve val = 0.0; for (i = 0; i < PyTuple_GET_SIZE(retval); i++) { - val += PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i)); + const double val_item = PyFloat_AsDouble(PyTuple_GET_ITEM(retval, i)); + if (val_item == -1 && PyErr_Occurred()) { + val = -1; + break; + } + val += val_item; } } else { diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 018a8d44cc1..939f0693161 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -175,8 +175,8 @@ void KX_BlenderMaterial::OnConstruction(int layer) spit("unable to initialize image("<<i<<") in "<< mMaterial->matname<< ", image will not be available"); } - - else { + // If we're using glsl materials, the textures are handled by bf_gpu, so don't load them twice! + else if (!mMaterial->glslmat) { if ( mMaterial->img[i] ) { if ( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 )) spit("unable to initialize image("<<i<<") in "<< |