diff --git a/intern/cycles/app/cycles_standalone.cpp b/intern/cycles/app/cycles_standalone.cpp index 9871273381e..7ea1ca2d8fb 100644 --- a/intern/cycles/app/cycles_standalone.cpp +++ b/intern/cycles/app/cycles_standalone.cpp @@ -214,7 +214,7 @@ static void motion(int x, int y, int button) /* Rotate */ else if(button == 2) { - float4 r1= make_float4((float)x * 0.1f, 0.0f, 1.0f, 0.0f); + float4 r1 = make_float4((float)x * 0.1f, 0.0f, 1.0f, 0.0f); matrix = matrix * transform_rotate(DEG2RADF(r1.x), make_float3(r1.y, r1.z, r1.w)); float4 r2 = make_float4(y * 0.1f, 1.0f, 0.0f, 0.0f); diff --git a/intern/cycles/app/cycles_xml.h b/intern/cycles/app/cycles_xml.h index 2d225f3a013..96bc79c35d8 100644 --- a/intern/cycles/app/cycles_xml.h +++ b/intern/cycles/app/cycles_xml.h @@ -14,8 +14,8 @@ * limitations under the License */ -#ifndef __CYCLES_XML__ -#define __CYCLES_XML__ +#ifndef __CYCLES_XML_H__ +#define __CYCLES_XML_H__ CCL_NAMESPACE_BEGIN @@ -29,5 +29,4 @@ void xml_read_file(Scene *scene, const char *filepath); CCL_NAMESPACE_END -#endif /* __CYCLES_XML__ */ - +#endif /* __CYCLES_XML_H__ */ diff --git a/intern/cycles/blender/CCL_api.h b/intern/cycles/blender/CCL_api.h index 6532315cf39..2772b9ac8a7 100644 --- a/intern/cycles/blender/CCL_api.h +++ b/intern/cycles/blender/CCL_api.h @@ -14,8 +14,8 @@ * limitations under the License */ -#ifndef CCL_API_H -#define CCL_API_H +#ifndef __CCL_API_H__ +#define __CCL_API_H__ #ifdef __cplusplus extern "C" { @@ -40,5 +40,4 @@ void *CCL_python_module_init(void); } #endif -#endif /* CCL_API_H */ - +#endif /* __CCL_API_H__ */ diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 29aecee09c2..fb343a74bd5 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -322,7 +322,8 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< /* create triangles */ if(n == 4) { if(is_zero(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) || - is_zero(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]]))) { + is_zero(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]]))) + { mesh->set_triangle(ti++, vi[0], vi[1], vi[3], shader, smooth); mesh->set_triangle(ti++, vi[2], vi[3], vi[1], shader, smooth); } diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 658fccaf12e..872f891cc2a 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -317,7 +317,8 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args) } else if(param->type.vecsemantics == TypeDesc::POINT || param->type.vecsemantics == TypeDesc::VECTOR || - param->type.vecsemantics == TypeDesc::NORMAL) { + param->type.vecsemantics == TypeDesc::NORMAL) + { socket_type = "NodeSocketVector"; data_type = BL::NodeSocket::type_VECTOR; diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 29b348d86ac..c667b8863d6 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -508,7 +508,7 @@ public: if(interpolation == INTERPOLATION_CLOSEST) { cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_POINT)); } - else if (interpolation == INTERPOLATION_LINEAR){ + else if (interpolation == INTERPOLATION_LINEAR) { cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_LINEAR)); } else {/* CUBIC and SMART are unsupported for CUDA */ diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp index 8f00324c3e1..af051076009 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -326,7 +326,7 @@ class DeviceServer { public: thread_mutex rpc_lock; - void network_error(const string &message){ + void network_error(const string &message) { error_func.network_error(message); } @@ -366,7 +366,7 @@ protected: { /* create a new DataVector and insert it into mem_data */ pair data_ins = mem_data.insert( - DataMap::value_type(client_pointer, DataVector())); + DataMap::value_type(client_pointer, DataVector())); /* make sure it was a unique insertion */ assert(data_ins.second); diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h index 8596b61b179..893841d1da7 100644 --- a/intern/cycles/device/device_network.h +++ b/intern/cycles/device/device_network.h @@ -209,7 +209,7 @@ public: boost::system::error_code error; size_t len = boost::asio::read(socket, boost::asio::buffer(header), error); - if(error.value()){ + if(error.value()) { error_func->network_error(error.message()); } @@ -276,7 +276,7 @@ public: boost::system::error_code error; size_t len = boost::asio::read(socket, boost::asio::buffer(buffer, size), error); - if(error.value()){ + if(error.value()) { error_func->network_error(error.message()); } @@ -391,7 +391,7 @@ private: /* add address if it's not already in the list */ bool found = std::find(servers.begin(), servers.end(), - address) != servers.end(); + address) != servers.end(); if(!found) servers.push_back(address); diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 2e759d1a36f..694ec9db036 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -461,7 +461,7 @@ public: vector platforms(num_platforms, NULL); ciErr = clGetPlatformIDs(num_platforms, &platforms[0], NULL); - if(opencl_error(ciErr)){ + if(opencl_error(ciErr)) { fprintf(stderr, "clGetPlatformIDs failed \n"); return; } @@ -489,7 +489,7 @@ public: /* get devices */ vector device_ids(num_devices, NULL); - if(opencl_error(clGetDeviceIDs(cpPlatform, opencl_device_type(), num_devices, &device_ids[0], NULL))){ + if(opencl_error(clGetDeviceIDs(cpPlatform, opencl_device_type(), num_devices, &device_ids[0], NULL))) { fprintf(stderr, "clGetDeviceIDs failed \n"); return; } @@ -528,7 +528,7 @@ public: cxContext = clCreateContext(context_props, 1, &cdDevice, context_notify_callback, cdDevice, &ciErr); - if(opencl_error(ciErr)){ + if(opencl_error(ciErr)) { opencl_error("OpenCL: clCreateContext failed"); return; } diff --git a/intern/cycles/kernel/closure/bsdf_hair.h b/intern/cycles/kernel/closure/bsdf_hair.h index 26e1198ffcf..19cdb773255 100644 --- a/intern/cycles/kernel/closure/bsdf_hair.h +++ b/intern/cycles/kernel/closure/bsdf_hair.h @@ -84,7 +84,7 @@ ccl_device float3 bsdf_hair_reflection_eval_reflect(const ShaderClosure *sc, con float theta_i = M_PI_2_F - safe_acosf(omega_in_z); float cosphi_i = dot(omega_in_y, locy); - if(M_PI_2_F - fabsf(theta_i) < 0.001f || cosphi_i < 0.0f){ + if(M_PI_2_F - fabsf(theta_i) < 0.001f || cosphi_i < 0.0f) { *pdf = 0.0f; return make_float3(*pdf, *pdf, *pdf); } @@ -140,7 +140,7 @@ ccl_device float3 bsdf_hair_transmission_eval_transmit(const ShaderClosure *sc, float theta_i = M_PI_2_F - safe_acosf(omega_in_z); float phi_i = safe_acosf(dot(omega_in_y, locy)); - if(M_PI_2_F - fabsf(theta_i) < 0.001f){ + if(M_PI_2_F - fabsf(theta_i) < 0.001f) { *pdf = 0.0f; return make_float3(*pdf, *pdf, *pdf); } @@ -251,8 +251,8 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc, float3 Ng, float phi_pdf = roughness2 / (c_TT * (p * p + roughness2 * roughness2)); *omega_in =(cosf(phi) * costheta_i) * locy - - (sinf(phi) * costheta_i) * locx + - ( sintheta_i) * Tg; + (sinf(phi) * costheta_i) * locx + + ( sintheta_i) * Tg; //differentials - TODO: find a better approximation for the transmission bounce #ifdef __RAY_DIFFERENTIALS__ @@ -261,7 +261,7 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc, float3 Ng, #endif *pdf = fabsf(phi_pdf * theta_pdf); - if(M_PI_2_F - fabsf(theta_i) < 0.001f){ + if(M_PI_2_F - fabsf(theta_i) < 0.001f) { *pdf = 0.0f; } diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index dfa8886c113..1ec35e444fe 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -154,8 +154,8 @@ ccl_device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, fl float sinThetaM = cosThetaM * safe_sqrtf(tanThetaM2); float phiM = M_2PI_F * randv; float3 m = (cosf(phiM) * sinThetaM) * X + - (sinf(phiM) * sinThetaM) * Y + - cosThetaM * Z; + (sinf(phiM) * sinThetaM) * Y + + ( cosThetaM) * Z; if(!m_refractive) { float cosMO = dot(m, I); if(cosMO > 0) { @@ -383,8 +383,8 @@ ccl_device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 N float sinThetaM = cosThetaM * tanThetaM; float phiM = M_2PI_F * randv; float3 m = (cosf(phiM) * sinThetaM) * X + - (sinf(phiM) * sinThetaM) * Y + - cosThetaM * Z; + (sinf(phiM) * sinThetaM) * Y + + ( cosThetaM) * Z; if(!m_refractive) { float cosMO = dot(m, I); diff --git a/intern/cycles/kernel/closure/bsdf_phong_ramp.h b/intern/cycles/kernel/closure/bsdf_phong_ramp.h index 219c5aea159..2b4e1c68640 100644 --- a/intern/cycles/kernel/closure/bsdf_phong_ramp.h +++ b/intern/cycles/kernel/closure/bsdf_phong_ramp.h @@ -109,8 +109,8 @@ ccl_device int bsdf_phong_ramp_sample(const ShaderClosure *sc, const float3 colo float sinTheta2 = 1 - cosTheta * cosTheta; float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0; *omega_in = (cosf(phi) * sinTheta) * T + - (sinf(phi) * sinTheta) * B + - ( cosTheta) * R; + (sinf(phi) * sinTheta) * B + + ( cosTheta) * R; if (dot(Ng, *omega_in) > 0.0f) { // common terms for pdf and eval diff --git a/intern/cycles/kernel/closure/bsdf_util.h b/intern/cycles/kernel/closure/bsdf_util.h index f6dceb3ca82..b3dcb9dcc38 100644 --- a/intern/cycles/kernel/closure/bsdf_util.h +++ b/intern/cycles/kernel/closure/bsdf_util.h @@ -35,14 +35,15 @@ CCL_NAMESPACE_BEGIN -ccl_device float fresnel_dielectric(float eta, const float3 N, - const float3 I, float3 *R, float3 *T, +ccl_device float fresnel_dielectric( + float eta, const float3 N, + const float3 I, float3 *R, float3 *T, #ifdef __RAY_DIFFERENTIALS__ - const float3 dIdx, const float3 dIdy, - float3 *dRdx, float3 *dRdy, - float3 *dTdx, float3 *dTdy, + const float3 dIdx, const float3 dIdy, + float3 *dRdx, float3 *dRdy, + float3 *dTdx, float3 *dTdy, #endif - bool *is_inside) + bool *is_inside) { float cos = dot(N, I), neta; float3 Nn; diff --git a/intern/cycles/kernel/closure/bsdf_westin.h b/intern/cycles/kernel/closure/bsdf_westin.h index ca4c05e91fe..9dc1c00bb3d 100644 --- a/intern/cycles/kernel/closure/bsdf_westin.h +++ b/intern/cycles/kernel/closure/bsdf_westin.h @@ -96,10 +96,9 @@ ccl_device int bsdf_westin_backscatter_sample(const ShaderClosure *sc, float3 Ng float sinTheta2 = 1 - cosTheta * cosTheta; float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0; *omega_in = (cosf(phi) * sinTheta) * T + - (sinf(phi) * sinTheta) * B + - (cosTheta) * I; - if(dot(Ng, *omega_in) > 0) - { + (sinf(phi) * sinTheta) * B + + (cosTheta) * I; + if(dot(Ng, *omega_in) > 0) { // common terms for pdf and eval float cosNI = dot(N, *omega_in); // make sure the direction we chose is still in the right hemisphere diff --git a/intern/cycles/kernel/geom/geom_bvh_shadow.h b/intern/cycles/kernel/geom/geom_bvh_shadow.h index be9def02080..42ecd4bc54b 100644 --- a/intern/cycles/kernel/geom/geom_bvh_shadow.h +++ b/intern/cycles/kernel/geom/geom_bvh_shadow.h @@ -253,12 +253,13 @@ ccl_device bool BVH_FUNCTION_NAME int shader = 0; #ifdef __HAIR__ - if(kernel_tex_fetch(__prim_type, isect_array->prim) & PRIMITIVE_ALL_TRIANGLE) { + if(kernel_tex_fetch(__prim_type, isect_array->prim) & PRIMITIVE_ALL_TRIANGLE) #endif + { float4 Ns = kernel_tex_fetch(__tri_normal, prim); shader = __float_as_int(Ns.w); -#ifdef __HAIR__ } +#ifdef __HAIR__ else { float4 str = kernel_tex_fetch(__curves, prim); shader = __float_as_int(str.z); diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h index 5b0127f8a3b..91edd5863ac 100644 --- a/intern/cycles/kernel/geom/geom_object.h +++ b/intern/cycles/kernel/geom/geom_object.h @@ -366,8 +366,8 @@ ccl_device_inline float3 bvh_clamp_direction(float3 dir) /* clamp absolute values by exp2f(-80.0f) to avoid division by zero when calculating inverse direction */ float ooeps = 8.271806E-25f; return make_float3((fabsf(dir.x) > ooeps)? dir.x: copysignf(ooeps, dir.x), - (fabsf(dir.y) > ooeps)? dir.y: copysignf(ooeps, dir.y), - (fabsf(dir.z) > ooeps)? dir.z: copysignf(ooeps, dir.z)); + (fabsf(dir.y) > ooeps)? dir.y: copysignf(ooeps, dir.y), + (fabsf(dir.z) > ooeps)? dir.z: copysignf(ooeps, dir.z)); } ccl_device_inline float3 bvh_inverse_direction(float3 dir) diff --git a/intern/cycles/kernel/kernel_avx.cpp b/intern/cycles/kernel/kernel_avx.cpp index d2a7142c551..354214c406e 100644 --- a/intern/cycles/kernel/kernel_avx.cpp +++ b/intern/cycles/kernel/kernel_avx.cpp @@ -77,6 +77,6 @@ CCL_NAMESPACE_END /* needed for some linkers in combination with scons making empty compilation unit in a library */ void __dummy_function_cycles_avx(void); -void __dummy_function_cycles_avx(void){} +void __dummy_function_cycles_avx(void) {} #endif diff --git a/intern/cycles/kernel/kernel_displace.h b/intern/cycles/kernel/kernel_displace.h index a2709e711d2..6e14c8679a8 100644 --- a/intern/cycles/kernel/kernel_displace.h +++ b/intern/cycles/kernel/kernel_displace.h @@ -119,7 +119,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, /* TODO, disable the closures we won't need */ shader_setup_from_sample(kg, &sd, P, Ng, I, shader, object, prim, u, v, t, time, bounce, transparent_bounce); - if(is_light_pass(type)){ + if(is_light_pass(type)) { RNG rng = cmj_hash(i, 0); compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_AO)); } diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index 44899e0bf97..deffa7f2ba2 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -166,10 +166,11 @@ ccl_device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, Shader float3 L = shader_emissive_eval(kg, sd); #ifdef __HAIR__ - if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS) && (sd->type & PRIMITIVE_ALL_TRIANGLE)) { + if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS) && (sd->type & PRIMITIVE_ALL_TRIANGLE)) #else - if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS)) { + if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS)) #endif + { /* multiple importance sampling, get triangle light pdf, * and compute weight with respect to BSDF pdf */ float pdf = triangle_light_pdf(kg, sd->Ng, sd->I, t); diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h index 9cdcb8c5229..b3b6fc02894 100644 --- a/intern/cycles/kernel/kernel_passes.h +++ b/intern/cycles/kernel/kernel_passes.h @@ -51,7 +51,8 @@ ccl_device_inline void kernel_write_data_passes(KernelGlobals *kg, ccl_global fl if(!(path_flag & PATH_RAY_SINGLE_PASS_DONE)) { if(!(sd->flag & SD_TRANSPARENT) || kernel_data.film.pass_alpha_threshold == 0.0f || - average(shader_bsdf_alpha(kg, sd)) >= kernel_data.film.pass_alpha_threshold) { + average(shader_bsdf_alpha(kg, sd)) >= kernel_data.film.pass_alpha_threshold) + { if(sample == 0) { if(flag & PASS_DEPTH) { diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index e71b58aa709..bd7b53e3aec 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -1304,21 +1304,21 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in /* do subsurface scatter step with copy of shader data, this will * replace the BSSRDF with a diffuse BSDF closure */ for(int j = 0; j < num_samples; j++) { - ShaderData bssrdf_sd[BSSRDF_MAX_HITS]; - float bssrdf_u, bssrdf_v; - path_branched_rng_2D(kg, &bssrdf_rng, &state, j, num_samples, PRNG_BSDF_U, &bssrdf_u, &bssrdf_v); - int num_hits = subsurface_scatter_multi_step(kg, &sd, bssrdf_sd, state.flag, sc, &lcg_state, bssrdf_u, bssrdf_v, true); + ShaderData bssrdf_sd[BSSRDF_MAX_HITS]; + float bssrdf_u, bssrdf_v; + path_branched_rng_2D(kg, &bssrdf_rng, &state, j, num_samples, PRNG_BSDF_U, &bssrdf_u, &bssrdf_v); + int num_hits = subsurface_scatter_multi_step(kg, &sd, bssrdf_sd, state.flag, sc, &lcg_state, bssrdf_u, bssrdf_v, true); - /* compute lighting with the BSDF closure */ - for(int hit = 0; hit < num_hits; hit++) { - PathState hit_state = state; + /* compute lighting with the BSDF closure */ + for(int hit = 0; hit < num_hits; hit++) { + PathState hit_state = state; - path_state_branch(&hit_state, j, num_samples); + path_state_branch(&hit_state, j, num_samples); - kernel_branched_path_integrate_lighting(kg, rng, - &bssrdf_sd[hit], throughput, num_samples_inv, - &hit_state, &L, buffer); - } + kernel_branched_path_integrate_lighting(kg, rng, + &bssrdf_sd[hit], throughput, num_samples_inv, + &hit_state, &L, buffer); + } } state.flag &= ~PATH_RAY_BSSRDF_ANCESTOR; diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 1351ab2e482..58cec090410 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -39,7 +39,7 @@ ccl_device void shader_setup_object_transforms(KernelGlobals *kg, ShaderData *sd { if(sd->flag & SD_OBJECT_MOTION) { sd->ob_tfm = object_fetch_transform_motion(kg, sd->object, time); - sd->ob_itfm= transform_quick_inverse(sd->ob_tfm); + sd->ob_itfm = transform_quick_inverse(sd->ob_tfm); } else { sd->ob_tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM); diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index b350e068177..ab7524c411a 100644 --- a/intern/cycles/kernel/kernel_shadow.h +++ b/intern/cycles/kernel/kernel_shadow.h @@ -190,7 +190,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray * ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ray, float3 *shadow) { -*shadow = make_float3(1.0f, 1.0f, 1.0f); + *shadow = make_float3(1.0f, 1.0f, 1.0f); if(ray->t == 0.0f) return false; @@ -217,10 +217,11 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray * return true; #ifdef __HAIR__ - if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect, NULL, 0.0f, 0.0f)) { + if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect, NULL, 0.0f, 0.0f)) #else - if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect)) { + if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect)) #endif + { #ifdef __VOLUME__ /* attenuation for last line segment towards light */ diff --git a/intern/cycles/kernel/kernel_sse2.cpp b/intern/cycles/kernel/kernel_sse2.cpp index 6a2a7804146..2d5f6091908 100644 --- a/intern/cycles/kernel/kernel_sse2.cpp +++ b/intern/cycles/kernel/kernel_sse2.cpp @@ -75,6 +75,6 @@ CCL_NAMESPACE_END /* needed for some linkers in combination with scons making empty compilation unit in a library */ void __dummy_function_cycles_sse2(void); -void __dummy_function_cycles_sse2(void){} +void __dummy_function_cycles_sse2(void) {} #endif diff --git a/intern/cycles/kernel/kernel_sse3.cpp b/intern/cycles/kernel/kernel_sse3.cpp index 9d0abb93cc6..1062fd0c990 100644 --- a/intern/cycles/kernel/kernel_sse3.cpp +++ b/intern/cycles/kernel/kernel_sse3.cpp @@ -76,6 +76,6 @@ CCL_NAMESPACE_END /* needed for some linkers in combination with scons making empty compilation unit in a library */ void __dummy_function_cycles_sse3(void); -void __dummy_function_cycles_sse3(void){} +void __dummy_function_cycles_sse3(void) {} #endif diff --git a/intern/cycles/kernel/kernel_sse41.cpp b/intern/cycles/kernel/kernel_sse41.cpp index bc20de0ec20..ba3b4887650 100644 --- a/intern/cycles/kernel/kernel_sse41.cpp +++ b/intern/cycles/kernel/kernel_sse41.cpp @@ -77,6 +77,6 @@ CCL_NAMESPACE_END /* needed for some linkers in combination with scons making empty compilation unit in a library */ void __dummy_function_cycles_sse41(void); -void __dummy_function_cycles_sse41(void){} +void __dummy_function_cycles_sse41(void) {} #endif diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 9861e527afd..2984cc97437 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -524,7 +524,8 @@ static bool get_mesh_element_attribute(KernelGlobals *kg, const ShaderData *sd, const TypeDesc& type, bool derivatives, void *val) { if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector || - attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor) { + attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor) + { float3 fval[3]; fval[0] = primitive_attribute_float3(kg, sd, attr.elem, attr.offset, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL); @@ -606,7 +607,7 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD } else if (name == u_particle_lifetime) { int particle_id = object_particle_id(kg, sd->object); - float f= particle_lifetime(kg, particle_id); + float f = particle_lifetime(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } else if (name == u_particle_location) { @@ -643,10 +644,11 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD } else if ((name == u_geom_trianglevertices || name == u_geom_polyvertices) #ifdef __HAIR__ - && sd->type & PRIMITIVE_ALL_TRIANGLE) { + && sd->type & PRIMITIVE_ALL_TRIANGLE) #else - ) { + ) #endif + { float3 P[3]; if(sd->type & PRIMITIVE_TRIANGLE) diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index c3ea12253e9..54ddd7a98b4 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -110,9 +110,9 @@ public: ustring dataname, TypeDesc datatype, void *data); static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, - TypeDesc type, bool derivatives, void *val); + TypeDesc type, bool derivatives, void *val); static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name, - TypeDesc type, bool derivatives, void *val); + TypeDesc type, bool derivatives, void *val); static ustring u_distance; static ustring u_index; diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 64c734dec64..843dcdd0985 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -409,8 +409,9 @@ static void flatten_volume_closure_tree(ShaderData *sd, sc.data1 = volume->sc.data1; /* add */ - if(sc.sample_weight > CLOSURE_WEIGHT_CUTOFF && - sd->num_closure < MAX_CLOSURE) { + if((sc.sample_weight > CLOSURE_WEIGHT_CUTOFF) && + (sd->num_closure < MAX_CLOSURE)) + { sd->closure[sd->num_closure++] = sc; sd->flag |= volume->shaderdata_flag(); } diff --git a/intern/cycles/kernel/svm/svm_geometry.h b/intern/cycles/kernel/svm/svm_geometry.h index 0ec61fdebf0..fe681ec92af 100644 --- a/intern/cycles/kernel/svm/svm_geometry.h +++ b/intern/cycles/kernel/svm/svm_geometry.h @@ -117,13 +117,13 @@ ccl_device void svm_node_particle_info(KernelGlobals *kg, ShaderData *sd, float stack_store_float3(stack, out_offset, particle_location(kg, particle_id)); break; } - #if 0 /* XXX float4 currently not supported in SVM stack */ +#if 0 /* XXX float4 currently not supported in SVM stack */ case NODE_INFO_PAR_ROTATION: { int particle_id = object_particle_id(kg, sd->object); stack_store_float4(stack, out_offset, particle_rotation(kg, particle_id)); break; } - #endif +#endif case NODE_INFO_PAR_SIZE: { int particle_id = object_particle_id(kg, sd->object); stack_store_float(stack, out_offset, particle_size(kg, particle_id)); diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index ce2893e1893..6627786725f 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -65,7 +65,7 @@ ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, float4 r; int ix, iy, nix, niy; - if (interpolation == INTERPOLATION_CLOSEST){ + if (interpolation == INTERPOLATION_CLOSEST) { svm_image_texture_frac(x*width, &ix); svm_image_texture_frac(y*height, &iy); diff --git a/intern/cycles/kernel/svm/svm_sepcomb_hsv.h b/intern/cycles/kernel/svm/svm_sepcomb_hsv.h index 0f68ecbea03..111d5d47988 100644 --- a/intern/cycles/kernel/svm/svm_sepcomb_hsv.h +++ b/intern/cycles/kernel/svm/svm_sepcomb_hsv.h @@ -42,12 +42,12 @@ ccl_device void svm_node_separate_hsv(KernelGlobals *kg, ShaderData *sd, float * /* Convert to HSV */ color = rgb_to_hsv(color); - if (stack_valid(hue_out)) - stack_store_float(stack, hue_out, color.x); - if (stack_valid(saturation_out)) - stack_store_float(stack, saturation_out, color.y); - if (stack_valid(value_out)) - stack_store_float(stack, value_out, color.z); + if (stack_valid(hue_out)) + stack_store_float(stack, hue_out, color.x); + if (stack_valid(saturation_out)) + stack_store_float(stack, saturation_out, color.y); + if (stack_valid(value_out)) + stack_store_float(stack, value_out, color.z); } CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/svm/svm_vector_transform.h b/intern/cycles/kernel/svm/svm_vector_transform.h index 890a9ddda69..61d33aeb8cf 100644 --- a/intern/cycles/kernel/svm/svm_vector_transform.h +++ b/intern/cycles/kernel/svm/svm_vector_transform.h @@ -91,9 +91,9 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, flo if(type == NODE_VECTOR_TRANSFORM_TYPE_NORMAL) in = normalize(in); - /* Output */ + /* Output */ if(stack_valid(vector_out)) { - stack_store_float3(stack, vector_out, in); + stack_store_float3(stack, vector_out, in); } } diff --git a/intern/cycles/kernel/svm/svm_wireframe.h b/intern/cycles/kernel/svm/svm_wireframe.h index 7262a7904bb..660e6e2ca47 100644 --- a/intern/cycles/kernel/svm/svm_wireframe.h +++ b/intern/cycles/kernel/svm/svm_wireframe.h @@ -45,10 +45,11 @@ ccl_device void svm_node_wireframe(KernelGlobals *kg, ShaderData *sd, float *sta /* Calculate wireframe */ #ifdef __HAIR__ - if (sd->prim != PRIM_NONE && sd->type & PRIMITIVE_ALL_TRIANGLE) { + if (sd->prim != PRIM_NONE && sd->type & PRIMITIVE_ALL_TRIANGLE) #else - if (sd->prim != PRIM_NONE) { + if (sd->prim != PRIM_NONE) #endif + { float3 Co[3]; float pixelwidth = 1.0f; diff --git a/intern/cycles/render/curves.cpp b/intern/cycles/render/curves.cpp index 6e6b11ca92f..2c96ffa655e 100644 --- a/intern/cycles/render/curves.cpp +++ b/intern/cycles/render/curves.cpp @@ -110,7 +110,7 @@ void CurveSystemManager::device_update(Device *device, DeviceScene *dscene, Scen progress.set_status("Updating Hair settings", "Copying Hair settings to device"); - KernelCurves *kcurve= &dscene->data.curve; + KernelCurves *kcurve = &dscene->data.curve; kcurve->curveflags = 0; diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index ddcc42a9ae9..9607892ceb8 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -554,7 +554,7 @@ bool Mesh::has_motion_blur() const { return (use_motion_blur && (attributes.find(ATTR_STD_MOTION_VERTEX_POSITION) || - curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION))); + curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION))); } /* Mesh Manager */ diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 8748294acb0..28d2a41a113 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -317,7 +317,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler) compiler.parameter("is_float", is_float); compiler.parameter("use_alpha", !alpha_out->links.empty()); - switch (interpolation){ + switch (interpolation) { case INTERPOLATION_CLOSEST: compiler.parameter("interpolation", "closest"); break; diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index db80aad74d4..576c176759c 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -226,7 +226,8 @@ void SVMCompiler::stack_assign(ShaderInput *input) else if(input->type == SHADER_SOCKET_VECTOR || input->type == SHADER_SOCKET_NORMAL || input->type == SHADER_SOCKET_POINT || - input->type == SHADER_SOCKET_COLOR) { + input->type == SHADER_SOCKET_COLOR) + { add_node(NODE_VALUE_V, input->stack_offset); add_node(NODE_VALUE_V, input->value); @@ -506,8 +507,8 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set& don find_dependencies(cl2deps, done, cl2in); set_intersection(cl1deps.begin(), cl1deps.end(), - cl2deps.begin(), cl2deps.end(), - std::inserter(shareddeps, shareddeps.begin())); + cl2deps.begin(), cl2deps.end(), + std::inserter(shareddeps, shareddeps.begin())); if(!shareddeps.empty()) { if(cl1in->link) diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h index 0cfa4049d3e..50d9f59ea27 100644 --- a/intern/cycles/util/util_color.h +++ b/intern/cycles/util/util_color.h @@ -132,8 +132,8 @@ ccl_device float3 xyY_to_xyz(float x, float y, float Y) ccl_device float3 xyz_to_rgb(float x, float y, float z) { return make_float3(3.240479f * x + -1.537150f * y + -0.498535f * z, - -0.969256f * x + 1.875991f * y + 0.041556f * z, - 0.055648f * x + -0.204043f * y + 1.057311f * z); + -0.969256f * x + 1.875991f * y + 0.041556f * z, + 0.055648f * x + -0.204043f * y + 1.057311f * z); } #ifndef __KERNEL_OPENCL__ diff --git a/intern/cycles/util/util_hash.h b/intern/cycles/util/util_hash.h index ded25c92b90..edd2448efa4 100644 --- a/intern/cycles/util/util_hash.h +++ b/intern/cycles/util/util_hash.h @@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN static inline uint hash_int_2d(uint kx, uint ky) { - #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) uint a, b, c; @@ -41,7 +41,7 @@ static inline uint hash_int_2d(uint kx, uint ky) return c; - #undef rot +#undef rot } static inline uint hash_int(uint k) diff --git a/intern/cycles/util/util_opencl.h b/intern/cycles/util/util_opencl.h index 5f3f1667bcc..141c5e38273 100644 --- a/intern/cycles/util/util_opencl.h +++ b/intern/cycles/util/util_opencl.h @@ -304,7 +304,9 @@ typedef struct _cl_kernel * cl_kernel; typedef struct _cl_event * cl_event; typedef struct _cl_sampler * cl_sampler; -typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */ +/* WARNING! Unlike cl_ types in cl_platform.h, + * cl_bool is not guaranteed to be the same size as the bool in kernels. */ +typedef cl_uint cl_bool; typedef cl_ulong cl_bitfield; typedef cl_bitfield cl_device_type; typedef cl_uint cl_platform_info; diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h index 679556ee59b..f0f37fa57aa 100644 --- a/intern/cycles/util/util_simd.h +++ b/intern/cycles/util/util_simd.h @@ -71,7 +71,7 @@ ccl_device_inline const __m128 shuffle_swap(const __m128& a, shuffle_swap_t shuf #ifdef __KERNEL_SSE41__ ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t &shuf_identity, const shuffle_swap_t &shuf_swap, - const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3]) + const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3]) { const __m128 idirsplat_raw[] = { _mm_set_ps1(idir.x), _mm_set_ps1(idir.y), _mm_set_ps1(idir.z) }; idirsplat[0] = _mm_xor_ps(idirsplat_raw[0], pn); @@ -87,7 +87,7 @@ ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t } #else ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t &shuf_identity, const shuffle_swap_t &shuf_swap, - const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3]) + const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3]) { idirsplat[0] = _mm_xor_ps(_mm_set_ps1(idir.x), pn); idirsplat[1] = _mm_xor_ps(_mm_set_ps1(idir.y), pn); diff --git a/intern/cycles/util/util_system.cpp b/intern/cycles/util/util_system.cpp index 9a7f1427cbe..0764f7d9345 100644 --- a/intern/cycles/util/util_system.cpp +++ b/intern/cycles/util/util_system.cpp @@ -169,14 +169,15 @@ static CPUCapabilities& system_cpu_capabilities() if( os_uses_xsave_xrestore && cpu_avx_support) { // Check if the OS will save the YMM registers uint32_t xcr_feature_mask; - #if defined(__GNUC__) - int edx; // not used - __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (xcr_feature_mask) , "=d" (edx) : "c" (0) ); /* actual opcode for xgetbv */ - #elif defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK) - xcr_feature_mask = (uint32_t)_xgetbv(_XCR_XFEATURE_ENABLED_MASK); /* min VS2010 SP1 compiler is required */ - #else - xcr_feature_mask = 0; - #endif +#if defined(__GNUC__) + int edx; /* not used */ + /* actual opcode for xgetbv */ + __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (xcr_feature_mask) , "=d" (edx) : "c" (0) ); +#elif defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK) + xcr_feature_mask = (uint32_t)_xgetbv(_XCR_XFEATURE_ENABLED_MASK); /* min VS2010 SP1 compiler is required */ +#else + xcr_feature_mask = 0; +#endif caps.avx = (xcr_feature_mask & 0x6) == 0x6; } } diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 4c7ce12d1de..5b3dbe42f69 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -108,9 +108,9 @@ ccl_device_inline Transform transform_transpose(const Transform a) } ccl_device_inline Transform make_transform(float a, float b, float c, float d, - float e, float f, float g, float h, - float i, float j, float k, float l, - float m, float n, float o, float p) + float e, float f, float g, float h, + float i, float j, float k, float l, + float m, float n, float o, float p) { Transform t; diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index 5d2037960fc..8ac0b11678e 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -159,8 +159,8 @@ struct int2 { __forceinline int& operator[](int i) { return *(&x + i); } }; -#ifdef __KERNEL_SSE__ struct ccl_try_align(16) int3 { +#ifdef __KERNEL_SSE__ union { __m128i m128; struct { int x, y, z, w; }; @@ -171,7 +171,6 @@ struct ccl_try_align(16) int3 { __forceinline operator const __m128i&(void) const { return m128; } __forceinline operator __m128i&(void) { return m128; } #else -struct ccl_try_align(16) int3 { int x, y, z, w; #endif @@ -179,8 +178,8 @@ struct ccl_try_align(16) int3 { __forceinline int& operator[](int i) { return *(&x + i); } }; -#ifdef __KERNEL_SSE__ struct ccl_try_align(16) int4 { +#ifdef __KERNEL_SSE__ union { __m128i m128; struct { int x, y, z, w; }; @@ -191,7 +190,6 @@ struct ccl_try_align(16) int4 { __forceinline operator const __m128i&(void) const { return m128; } __forceinline operator __m128i&(void) { return m128; } #else -struct ccl_try_align(16) int4 { int x, y, z, w; #endif @@ -227,8 +225,8 @@ struct float2 { __forceinline float& operator[](int i) { return *(&x + i); } }; -#ifdef __KERNEL_SSE__ struct ccl_try_align(16) float3 { +#ifdef __KERNEL_SSE__ union { __m128 m128; struct { float x, y, z, w; }; @@ -239,7 +237,6 @@ struct ccl_try_align(16) float3 { __forceinline operator const __m128&(void) const { return m128; } __forceinline operator __m128&(void) { return m128; } #else -struct ccl_try_align(16) float3 { float x, y, z, w; #endif @@ -247,8 +244,8 @@ struct ccl_try_align(16) float3 { __forceinline float& operator[](int i) { return *(&x + i); } }; -#ifdef __KERNEL_SSE__ struct ccl_try_align(16) float4 { +#ifdef __KERNEL_SSE__ union { __m128 m128; struct { float x, y, z, w; }; @@ -259,7 +256,6 @@ struct ccl_try_align(16) float4 { __forceinline operator const __m128&(void) const { return m128; } __forceinline operator __m128&(void) { return m128; } #else -struct ccl_try_align(16) float4 { float x, y, z, w; #endif