diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-05-04 19:30:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-05-04 19:30:02 +0400 |
commit | e86dbf687769a7f38ab465c89d1111a8be691ca2 (patch) | |
tree | 709daceab4b5cbab4564b481a5579895c286629b | |
parent | 2a3cdeadf11d29a2321d5d19929c82f19d8ec186 (diff) |
Code cleanup: avoid int/uint mixup in cycles
-rw-r--r-- | intern/cycles/kernel/geom/geom_object.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 23 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_geometry.h | 16 | ||||
-rw-r--r-- | intern/cycles/render/object.cpp | 3 |
4 files changed, 24 insertions, 20 deletions
diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h index de800d7cf00..5b0127f8a3b 100644 --- a/intern/cycles/kernel/geom/geom_object.h +++ b/intern/cycles/kernel/geom/geom_object.h @@ -240,7 +240,7 @@ ccl_device_inline float object_random_number(KernelGlobals *kg, int object) /* Particle ID from which this object was generated */ -ccl_device_inline uint object_particle_id(KernelGlobals *kg, int object) +ccl_device_inline int object_particle_id(KernelGlobals *kg, int object) { if(object == OBJECT_NONE) return 0.0f; diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 8f437755bb9..9861e527afd 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -595,44 +595,44 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD /* Particle Attributes */ else if (name == u_particle_index) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float f = particle_index(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } else if (name == u_particle_age) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float f = particle_age(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } else if (name == u_particle_lifetime) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float f= particle_lifetime(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } else if (name == u_particle_location) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float3 f = particle_location(kg, particle_id); return set_attribute_float3(f, type, derivatives, val); } #if 0 /* unsupported */ else if (name == u_particle_rotation) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float4 f = particle_rotation(kg, particle_id); return set_attribute_float4(f, type, derivatives, val); } #endif else if (name == u_particle_size) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float f = particle_size(kg, particle_id); return set_attribute_float(f, type, derivatives, val); } else if (name == u_particle_velocity) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float3 f = particle_velocity(kg, particle_id); return set_attribute_float3(f, type, derivatives, val); } else if (name == u_particle_angular_velocity) { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); float3 f = particle_angular_velocity(kg, particle_id); return set_attribute_float3(f, type, derivatives, val); } @@ -742,7 +742,8 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri ShaderData *sd = (ShaderData *)renderstate; KernelGlobals *kg = sd->osl_globals; bool is_curve; - int object, prim; + int object; + // int prim; /* lookup of attribute on another object */ if (object_name != u_empty) { @@ -752,12 +753,12 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri return false; object = it->second; - prim = PRIM_NONE; + // prim = PRIM_NONE; is_curve = false; } else { object = sd->object; - prim = sd->prim; + // prim = sd->prim; is_curve = (sd->type & PRIMITIVE_ALL_CURVE) != 0; if (object == OBJECT_NONE) diff --git a/intern/cycles/kernel/svm/svm_geometry.h b/intern/cycles/kernel/svm/svm_geometry.h index 1ed6a4b1916..0ec61fdebf0 100644 --- a/intern/cycles/kernel/svm/svm_geometry.h +++ b/intern/cycles/kernel/svm/svm_geometry.h @@ -98,44 +98,44 @@ ccl_device void svm_node_particle_info(KernelGlobals *kg, ShaderData *sd, float { switch(type) { case NODE_INFO_PAR_INDEX: { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); stack_store_float(stack, out_offset, particle_index(kg, particle_id)); break; } case NODE_INFO_PAR_AGE: { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); stack_store_float(stack, out_offset, particle_age(kg, particle_id)); break; } case NODE_INFO_PAR_LIFETIME: { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); stack_store_float(stack, out_offset, particle_lifetime(kg, particle_id)); break; } case NODE_INFO_PAR_LOCATION: { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); stack_store_float3(stack, out_offset, particle_location(kg, particle_id)); break; } #if 0 /* XXX float4 currently not supported in SVM stack */ case NODE_INFO_PAR_ROTATION: { - uint 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)); break; } #endif case NODE_INFO_PAR_SIZE: { - uint 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)); break; } case NODE_INFO_PAR_VELOCITY: { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); stack_store_float3(stack, out_offset, particle_velocity(kg, particle_id)); break; } case NODE_INFO_PAR_ANGULAR_VELOCITY: { - uint particle_id = object_particle_id(kg, sd->object); + int particle_id = object_particle_id(kg, sd->object); stack_store_float3(stack, out_offset, particle_angular_velocity(kg, particle_id)); break; } diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index b58caab5efa..750fae98662 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -288,8 +288,11 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene /* pack in texture */ int offset = i*OBJECT_SIZE; + /* OBJECT_TRANSFORM */ memcpy(&objects[offset], &tfm, sizeof(float4)*3); + /* OBJECT_INVERSE_TRANSFORM */ memcpy(&objects[offset+4], &itfm, sizeof(float4)*3); + /* OBJECT_PROPERTIES */ objects[offset+8] = make_float4(surface_area, pass_id, random_number, __int_as_float(particle_index)); if(need_motion == Scene::MOTION_PASS) { |