Style cleanup: indentation, braces

This commit is contained in:
Campbell Barton 2014-05-05 02:19:08 +10:00
parent e86dbf6877
commit dc13969e48
45 changed files with 130 additions and 122 deletions

@ -214,7 +214,7 @@ static void motion(int x, int y, int button)
/* Rotate */ /* Rotate */
else if(button == 2) { 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)); 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); float4 r2 = make_float4(y * 0.1f, 1.0f, 0.0f, 0.0f);

@ -14,8 +14,8 @@
* limitations under the License * limitations under the License
*/ */
#ifndef __CYCLES_XML__ #ifndef __CYCLES_XML_H__
#define __CYCLES_XML__ #define __CYCLES_XML_H__
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
@ -29,5 +29,4 @@ void xml_read_file(Scene *scene, const char *filepath);
CCL_NAMESPACE_END CCL_NAMESPACE_END
#endif /* __CYCLES_XML__ */ #endif /* __CYCLES_XML_H__ */

@ -14,8 +14,8 @@
* limitations under the License * limitations under the License
*/ */
#ifndef CCL_API_H #ifndef __CCL_API_H__
#define CCL_API_H #define __CCL_API_H__
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -40,5 +40,4 @@ void *CCL_python_module_init(void);
} }
#endif #endif
#endif /* CCL_API_H */ #endif /* __CCL_API_H__ */

@ -322,7 +322,8 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
/* create triangles */ /* create triangles */
if(n == 4) { if(n == 4) {
if(is_zero(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) || 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[0], vi[1], vi[3], shader, smooth);
mesh->set_triangle(ti++, vi[2], vi[3], vi[1], shader, smooth); mesh->set_triangle(ti++, vi[2], vi[3], vi[1], shader, smooth);
} }

@ -317,7 +317,8 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
} }
else if(param->type.vecsemantics == TypeDesc::POINT || else if(param->type.vecsemantics == TypeDesc::POINT ||
param->type.vecsemantics == TypeDesc::VECTOR || param->type.vecsemantics == TypeDesc::VECTOR ||
param->type.vecsemantics == TypeDesc::NORMAL) { param->type.vecsemantics == TypeDesc::NORMAL)
{
socket_type = "NodeSocketVector"; socket_type = "NodeSocketVector";
data_type = BL::NodeSocket::type_VECTOR; data_type = BL::NodeSocket::type_VECTOR;

@ -508,7 +508,7 @@ public:
if(interpolation == INTERPOLATION_CLOSEST) { if(interpolation == INTERPOLATION_CLOSEST) {
cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_POINT)); 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)); cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_LINEAR));
} }
else {/* CUBIC and SMART are unsupported for CUDA */ else {/* CUBIC and SMART are unsupported for CUDA */

@ -326,7 +326,7 @@ class DeviceServer {
public: public:
thread_mutex rpc_lock; thread_mutex rpc_lock;
void network_error(const string &message){ void network_error(const string &message) {
error_func.network_error(message); error_func.network_error(message);
} }

@ -209,7 +209,7 @@ public:
boost::system::error_code error; boost::system::error_code error;
size_t len = boost::asio::read(socket, boost::asio::buffer(header), 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()); error_func->network_error(error.message());
} }
@ -276,7 +276,7 @@ public:
boost::system::error_code error; boost::system::error_code error;
size_t len = boost::asio::read(socket, boost::asio::buffer(buffer, size), 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()); error_func->network_error(error.message());
} }

@ -461,7 +461,7 @@ public:
vector<cl_platform_id> platforms(num_platforms, NULL); vector<cl_platform_id> platforms(num_platforms, NULL);
ciErr = clGetPlatformIDs(num_platforms, &platforms[0], NULL); ciErr = clGetPlatformIDs(num_platforms, &platforms[0], NULL);
if(opencl_error(ciErr)){ if(opencl_error(ciErr)) {
fprintf(stderr, "clGetPlatformIDs failed \n"); fprintf(stderr, "clGetPlatformIDs failed \n");
return; return;
} }
@ -489,7 +489,7 @@ public:
/* get devices */ /* get devices */
vector<cl_device_id> device_ids(num_devices, NULL); vector<cl_device_id> 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"); fprintf(stderr, "clGetDeviceIDs failed \n");
return; return;
} }
@ -528,7 +528,7 @@ public:
cxContext = clCreateContext(context_props, 1, &cdDevice, cxContext = clCreateContext(context_props, 1, &cdDevice,
context_notify_callback, cdDevice, &ciErr); context_notify_callback, cdDevice, &ciErr);
if(opencl_error(ciErr)){ if(opencl_error(ciErr)) {
opencl_error("OpenCL: clCreateContext failed"); opencl_error("OpenCL: clCreateContext failed");
return; return;
} }

@ -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 theta_i = M_PI_2_F - safe_acosf(omega_in_z);
float cosphi_i = dot(omega_in_y, locy); 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; *pdf = 0.0f;
return make_float3(*pdf, *pdf, *pdf); 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 theta_i = M_PI_2_F - safe_acosf(omega_in_z);
float phi_i = safe_acosf(dot(omega_in_y, locy)); 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; *pdf = 0.0f;
return make_float3(*pdf, *pdf, *pdf); return make_float3(*pdf, *pdf, *pdf);
} }
@ -261,7 +261,7 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc, float3 Ng,
#endif #endif
*pdf = fabsf(phi_pdf * theta_pdf); *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; *pdf = 0.0f;
} }

@ -155,7 +155,7 @@ ccl_device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, fl
float phiM = M_2PI_F * randv; float phiM = M_2PI_F * randv;
float3 m = (cosf(phiM) * sinThetaM) * X + float3 m = (cosf(phiM) * sinThetaM) * X +
(sinf(phiM) * sinThetaM) * Y + (sinf(phiM) * sinThetaM) * Y +
cosThetaM * Z; ( cosThetaM) * Z;
if(!m_refractive) { if(!m_refractive) {
float cosMO = dot(m, I); float cosMO = dot(m, I);
if(cosMO > 0) { if(cosMO > 0) {
@ -384,7 +384,7 @@ ccl_device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 N
float phiM = M_2PI_F * randv; float phiM = M_2PI_F * randv;
float3 m = (cosf(phiM) * sinThetaM) * X + float3 m = (cosf(phiM) * sinThetaM) * X +
(sinf(phiM) * sinThetaM) * Y + (sinf(phiM) * sinThetaM) * Y +
cosThetaM * Z; ( cosThetaM) * Z;
if(!m_refractive) { if(!m_refractive) {
float cosMO = dot(m, I); float cosMO = dot(m, I);

@ -35,7 +35,8 @@
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
ccl_device float fresnel_dielectric(float eta, const float3 N, ccl_device float fresnel_dielectric(
float eta, const float3 N,
const float3 I, float3 *R, float3 *T, const float3 I, float3 *R, float3 *T,
#ifdef __RAY_DIFFERENTIALS__ #ifdef __RAY_DIFFERENTIALS__
const float3 dIdx, const float3 dIdy, const float3 dIdx, const float3 dIdy,

@ -98,8 +98,7 @@ ccl_device int bsdf_westin_backscatter_sample(const ShaderClosure *sc, float3 Ng
*omega_in = (cosf(phi) * sinTheta) * T + *omega_in = (cosf(phi) * sinTheta) * T +
(sinf(phi) * sinTheta) * B + (sinf(phi) * sinTheta) * B +
(cosTheta) * I; (cosTheta) * I;
if(dot(Ng, *omega_in) > 0) if(dot(Ng, *omega_in) > 0) {
{
// common terms for pdf and eval // common terms for pdf and eval
float cosNI = dot(N, *omega_in); float cosNI = dot(N, *omega_in);
// make sure the direction we chose is still in the right hemisphere // make sure the direction we chose is still in the right hemisphere

@ -253,12 +253,13 @@ ccl_device bool BVH_FUNCTION_NAME
int shader = 0; int shader = 0;
#ifdef __HAIR__ #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 #endif
{
float4 Ns = kernel_tex_fetch(__tri_normal, prim); float4 Ns = kernel_tex_fetch(__tri_normal, prim);
shader = __float_as_int(Ns.w); shader = __float_as_int(Ns.w);
#ifdef __HAIR__
} }
#ifdef __HAIR__
else { else {
float4 str = kernel_tex_fetch(__curves, prim); float4 str = kernel_tex_fetch(__curves, prim);
shader = __float_as_int(str.z); shader = __float_as_int(str.z);

@ -77,6 +77,6 @@ CCL_NAMESPACE_END
/* needed for some linkers in combination with scons making empty compilation unit in a library */ /* 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){} void __dummy_function_cycles_avx(void) {}
#endif #endif

@ -119,7 +119,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
/* TODO, disable the closures we won't need */ /* 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); 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); RNG rng = cmj_hash(i, 0);
compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_AO)); compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_AO));
} }

@ -166,10 +166,11 @@ ccl_device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, Shader
float3 L = shader_emissive_eval(kg, sd); float3 L = shader_emissive_eval(kg, sd);
#ifdef __HAIR__ #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 #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 #endif
{
/* multiple importance sampling, get triangle light pdf, /* 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 pdf = triangle_light_pdf(kg, sd->Ng, sd->I, t);

@ -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(!(path_flag & PATH_RAY_SINGLE_PASS_DONE)) {
if(!(sd->flag & SD_TRANSPARENT) || if(!(sd->flag & SD_TRANSPARENT) ||
kernel_data.film.pass_alpha_threshold == 0.0f || 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(sample == 0) {
if(flag & PASS_DEPTH) { if(flag & PASS_DEPTH) {

@ -39,7 +39,7 @@ ccl_device void shader_setup_object_transforms(KernelGlobals *kg, ShaderData *sd
{ {
if(sd->flag & SD_OBJECT_MOTION) { if(sd->flag & SD_OBJECT_MOTION) {
sd->ob_tfm = object_fetch_transform_motion(kg, sd->object, time); 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 { else {
sd->ob_tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM); sd->ob_tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);

@ -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) 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) if(ray->t == 0.0f)
return false; return false;
@ -217,10 +217,11 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *
return true; return true;
#ifdef __HAIR__ #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 #else
if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect)) { if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect))
#endif #endif
{
#ifdef __VOLUME__ #ifdef __VOLUME__
/* attenuation for last line segment towards light */ /* attenuation for last line segment towards light */

@ -75,6 +75,6 @@ CCL_NAMESPACE_END
/* needed for some linkers in combination with scons making empty compilation unit in a library */ /* 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){} void __dummy_function_cycles_sse2(void) {}
#endif #endif

@ -76,6 +76,6 @@ CCL_NAMESPACE_END
/* needed for some linkers in combination with scons making empty compilation unit in a library */ /* 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){} void __dummy_function_cycles_sse3(void) {}
#endif #endif

@ -77,6 +77,6 @@ CCL_NAMESPACE_END
/* needed for some linkers in combination with scons making empty compilation unit in a library */ /* 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){} void __dummy_function_cycles_sse41(void) {}
#endif #endif

@ -524,7 +524,8 @@ static bool get_mesh_element_attribute(KernelGlobals *kg, const ShaderData *sd,
const TypeDesc& type, bool derivatives, void *val) const TypeDesc& type, bool derivatives, void *val)
{ {
if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector || 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]; float3 fval[3];
fval[0] = primitive_attribute_float3(kg, sd, attr.elem, attr.offset, fval[0] = primitive_attribute_float3(kg, sd, attr.elem, attr.offset,
(derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL); (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) { else if (name == u_particle_lifetime) {
int particle_id = object_particle_id(kg, sd->object); 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); return set_attribute_float(f, type, derivatives, val);
} }
else if (name == u_particle_location) { 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) else if ((name == u_geom_trianglevertices || name == u_geom_polyvertices)
#ifdef __HAIR__ #ifdef __HAIR__
&& sd->type & PRIMITIVE_ALL_TRIANGLE) { && sd->type & PRIMITIVE_ALL_TRIANGLE)
#else #else
) { )
#endif #endif
{
float3 P[3]; float3 P[3];
if(sd->type & PRIMITIVE_TRIANGLE) if(sd->type & PRIMITIVE_TRIANGLE)

@ -409,8 +409,9 @@ static void flatten_volume_closure_tree(ShaderData *sd,
sc.data1 = volume->sc.data1; sc.data1 = volume->sc.data1;
/* add */ /* add */
if(sc.sample_weight > CLOSURE_WEIGHT_CUTOFF && if((sc.sample_weight > CLOSURE_WEIGHT_CUTOFF) &&
sd->num_closure < MAX_CLOSURE) { (sd->num_closure < MAX_CLOSURE))
{
sd->closure[sd->num_closure++] = sc; sd->closure[sd->num_closure++] = sc;
sd->flag |= volume->shaderdata_flag(); sd->flag |= volume->shaderdata_flag();
} }

@ -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)); stack_store_float3(stack, out_offset, particle_location(kg, particle_id));
break; 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: { case NODE_INFO_PAR_ROTATION: {
int particle_id = object_particle_id(kg, sd->object); int particle_id = object_particle_id(kg, sd->object);
stack_store_float4(stack, out_offset, particle_rotation(kg, particle_id)); stack_store_float4(stack, out_offset, particle_rotation(kg, particle_id));
break; break;
} }
#endif #endif
case NODE_INFO_PAR_SIZE: { case NODE_INFO_PAR_SIZE: {
int particle_id = object_particle_id(kg, sd->object); int particle_id = object_particle_id(kg, sd->object);
stack_store_float(stack, out_offset, particle_size(kg, particle_id)); stack_store_float(stack, out_offset, particle_size(kg, particle_id));

@ -65,7 +65,7 @@ ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y,
float4 r; float4 r;
int ix, iy, nix, niy; int ix, iy, nix, niy;
if (interpolation == INTERPOLATION_CLOSEST){ if (interpolation == INTERPOLATION_CLOSEST) {
svm_image_texture_frac(x*width, &ix); svm_image_texture_frac(x*width, &ix);
svm_image_texture_frac(y*height, &iy); svm_image_texture_frac(y*height, &iy);

@ -45,10 +45,11 @@ ccl_device void svm_node_wireframe(KernelGlobals *kg, ShaderData *sd, float *sta
/* Calculate wireframe */ /* Calculate wireframe */
#ifdef __HAIR__ #ifdef __HAIR__
if (sd->prim != PRIM_NONE && sd->type & PRIMITIVE_ALL_TRIANGLE) { if (sd->prim != PRIM_NONE && sd->type & PRIMITIVE_ALL_TRIANGLE)
#else #else
if (sd->prim != PRIM_NONE) { if (sd->prim != PRIM_NONE)
#endif #endif
{
float3 Co[3]; float3 Co[3];
float pixelwidth = 1.0f; float pixelwidth = 1.0f;

@ -110,7 +110,7 @@ void CurveSystemManager::device_update(Device *device, DeviceScene *dscene, Scen
progress.set_status("Updating Hair settings", "Copying Hair settings to device"); progress.set_status("Updating Hair settings", "Copying Hair settings to device");
KernelCurves *kcurve= &dscene->data.curve; KernelCurves *kcurve = &dscene->data.curve;
kcurve->curveflags = 0; kcurve->curveflags = 0;

@ -317,7 +317,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
compiler.parameter("is_float", is_float); compiler.parameter("is_float", is_float);
compiler.parameter("use_alpha", !alpha_out->links.empty()); compiler.parameter("use_alpha", !alpha_out->links.empty());
switch (interpolation){ switch (interpolation) {
case INTERPOLATION_CLOSEST: case INTERPOLATION_CLOSEST:
compiler.parameter("interpolation", "closest"); compiler.parameter("interpolation", "closest");
break; break;

@ -226,7 +226,8 @@ void SVMCompiler::stack_assign(ShaderInput *input)
else if(input->type == SHADER_SOCKET_VECTOR || else if(input->type == SHADER_SOCKET_VECTOR ||
input->type == SHADER_SOCKET_NORMAL || input->type == SHADER_SOCKET_NORMAL ||
input->type == SHADER_SOCKET_POINT || 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->stack_offset);
add_node(NODE_VALUE_V, input->value); add_node(NODE_VALUE_V, input->value);

@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN
static inline uint hash_int_2d(uint kx, uint ky) 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; uint a, b, c;
@ -41,7 +41,7 @@ static inline uint hash_int_2d(uint kx, uint ky)
return c; return c;
#undef rot #undef rot
} }
static inline uint hash_int(uint k) static inline uint hash_int(uint k)

@ -304,7 +304,9 @@ typedef struct _cl_kernel * cl_kernel;
typedef struct _cl_event * cl_event; typedef struct _cl_event * cl_event;
typedef struct _cl_sampler * cl_sampler; 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_ulong cl_bitfield;
typedef cl_bitfield cl_device_type; typedef cl_bitfield cl_device_type;
typedef cl_uint cl_platform_info; typedef cl_uint cl_platform_info;

@ -169,14 +169,15 @@ static CPUCapabilities& system_cpu_capabilities()
if( os_uses_xsave_xrestore && cpu_avx_support) { if( os_uses_xsave_xrestore && cpu_avx_support) {
// Check if the OS will save the YMM registers // Check if the OS will save the YMM registers
uint32_t xcr_feature_mask; uint32_t xcr_feature_mask;
#if defined(__GNUC__) #if defined(__GNUC__)
int edx; // not used int edx; /* not used */
__asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (xcr_feature_mask) , "=d" (edx) : "c" (0) ); /* actual opcode for xgetbv */ /* actual opcode for xgetbv */
#elif defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK) __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 */ xcr_feature_mask = (uint32_t)_xgetbv(_XCR_XFEATURE_ENABLED_MASK); /* min VS2010 SP1 compiler is required */
#else #else
xcr_feature_mask = 0; xcr_feature_mask = 0;
#endif #endif
caps.avx = (xcr_feature_mask & 0x6) == 0x6; caps.avx = (xcr_feature_mask & 0x6) == 0x6;
} }
} }

@ -159,8 +159,8 @@ struct int2 {
__forceinline int& operator[](int i) { return *(&x + i); } __forceinline int& operator[](int i) { return *(&x + i); }
}; };
#ifdef __KERNEL_SSE__
struct ccl_try_align(16) int3 { struct ccl_try_align(16) int3 {
#ifdef __KERNEL_SSE__
union { union {
__m128i m128; __m128i m128;
struct { int x, y, z, w; }; 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 const __m128i&(void) const { return m128; }
__forceinline operator __m128i&(void) { return m128; } __forceinline operator __m128i&(void) { return m128; }
#else #else
struct ccl_try_align(16) int3 {
int x, y, z, w; int x, y, z, w;
#endif #endif
@ -179,8 +178,8 @@ struct ccl_try_align(16) int3 {
__forceinline int& operator[](int i) { return *(&x + i); } __forceinline int& operator[](int i) { return *(&x + i); }
}; };
#ifdef __KERNEL_SSE__
struct ccl_try_align(16) int4 { struct ccl_try_align(16) int4 {
#ifdef __KERNEL_SSE__
union { union {
__m128i m128; __m128i m128;
struct { int x, y, z, w; }; 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 const __m128i&(void) const { return m128; }
__forceinline operator __m128i&(void) { return m128; } __forceinline operator __m128i&(void) { return m128; }
#else #else
struct ccl_try_align(16) int4 {
int x, y, z, w; int x, y, z, w;
#endif #endif
@ -227,8 +225,8 @@ struct float2 {
__forceinline float& operator[](int i) { return *(&x + i); } __forceinline float& operator[](int i) { return *(&x + i); }
}; };
#ifdef __KERNEL_SSE__
struct ccl_try_align(16) float3 { struct ccl_try_align(16) float3 {
#ifdef __KERNEL_SSE__
union { union {
__m128 m128; __m128 m128;
struct { float x, y, z, w; }; 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 const __m128&(void) const { return m128; }
__forceinline operator __m128&(void) { return m128; } __forceinline operator __m128&(void) { return m128; }
#else #else
struct ccl_try_align(16) float3 {
float x, y, z, w; float x, y, z, w;
#endif #endif
@ -247,8 +244,8 @@ struct ccl_try_align(16) float3 {
__forceinline float& operator[](int i) { return *(&x + i); } __forceinline float& operator[](int i) { return *(&x + i); }
}; };
#ifdef __KERNEL_SSE__
struct ccl_try_align(16) float4 { struct ccl_try_align(16) float4 {
#ifdef __KERNEL_SSE__
union { union {
__m128 m128; __m128 m128;
struct { float x, y, z, w; }; 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 const __m128&(void) const { return m128; }
__forceinline operator __m128&(void) { return m128; } __forceinline operator __m128&(void) { return m128; }
#else #else
struct ccl_try_align(16) float4 {
float x, y, z, w; float x, y, z, w;
#endif #endif