diff options
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/kernel_bvh.h | 47 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_curve.h | 43 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_emission.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_light.h | 26 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_primitive.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_shader.h | 32 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_textures.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 7 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 12 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_shader.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_attribute.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_geometry.h | 2 |
12 files changed, 97 insertions, 90 deletions
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h index d32287f91e8..c811d83ad78 100644 --- a/intern/cycles/kernel/kernel_bvh.h +++ b/intern/cycles/kernel/kernel_bvh.h @@ -207,22 +207,22 @@ __device_inline void bvh_triangle_intersect(KernelGlobals *kg, Intersection *ise #ifdef __HAIR__ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect, - float3 P, float3 idir, uint visibility, int object, int triAddr) + float3 P, float3 idir, uint visibility, int object, int curveAddr, int segment) { /* curve Intersection check */ int flags = kernel_data.curve_kernel_data.curveflags; - int prim = kernel_tex_fetch(__prim_index, triAddr); - float4 v00 = kernel_tex_fetch(__curve_segments, prim); + int prim = kernel_tex_fetch(__prim_index, curveAddr); + float4 v00 = kernel_tex_fetch(__curves, prim); - int v1 = __float_as_int(v00.x); - int v2 = __float_as_int(v00.y); + int k0 = __float_as_int(v00.x) + segment; + int k1 = k0 + 1; - float4 P1 = kernel_tex_fetch(__curve_keys, v1); - float4 P2 = kernel_tex_fetch(__curve_keys, v2); + float4 P1 = kernel_tex_fetch(__curve_keys, k0); + float4 P2 = kernel_tex_fetch(__curve_keys, k1); - float l = v00.w; + float l = len(P2 - P1); // XXX slower float r1 = P1.w; float r2 = P2.w; float mr = max(r1,r2); @@ -329,14 +329,15 @@ __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect, return; }*/ - #ifdef __VISIBILITY_FLAG__ +#ifdef __VISIBILITY_FLAG__ /* visibility flag test. we do it here under the assumption * that most triangles are culled by node flags */ - if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility) - #endif + if(kernel_tex_fetch(__prim_visibility, curveAddr) & visibility) +#endif { /* record intersection */ - isect->prim = triAddr; + isect->prim = curveAddr; + isect->segment = segment; isect->object = object; isect->u = z/l; isect->v = td/(4*a*a); @@ -430,8 +431,9 @@ __device_inline bool bvh_intersect(KernelGlobals *kg, const Ray *ray, const uint while(primAddr < primAddr2) { /* intersect ray against primitive */ #ifdef __HAIR__ - if(kernel_tex_fetch(__prim_type, primAddr)) - bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr); + uint segment = kernel_tex_fetch(__prim_segment, primAddr); + if(segment != ~0) + bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment); else #endif bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr); @@ -555,8 +557,9 @@ __device_inline bool bvh_intersect_motion(KernelGlobals *kg, const Ray *ray, con while(primAddr < primAddr2) { /* intersect ray against primitive */ #ifdef __HAIR__ - if(kernel_tex_fetch(__prim_type, primAddr)) - bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr); + uint segment = kernel_tex_fetch(__prim_segment, primAddr); + if(segment != ~0) + bvh_curve_intersect(kg, isect, P, idir, visibility, object, primAddr, segment); else #endif bvh_triangle_intersect(kg, isect, P, idir, visibility, object, primAddr); @@ -720,14 +723,14 @@ __device_inline float3 bvh_curve_refine(KernelGlobals *kg, ShaderData *sd, const } int prim = kernel_tex_fetch(__prim_index, isect->prim); - float4 v00 = kernel_tex_fetch(__curve_segments, prim); + float4 v00 = kernel_tex_fetch(__curves, prim); - int v1 = __float_as_int(v00.x); - int v2 = __float_as_int(v00.y); + int k0 = __float_as_int(v00.x) + isect->segment; + int k1 = k0 + 1; - float4 P1 = kernel_tex_fetch(__curve_keys, v1); - float4 P2 = kernel_tex_fetch(__curve_keys, v2); - float l = v00.w; + float4 P1 = kernel_tex_fetch(__curve_keys, k0); + float4 P2 = kernel_tex_fetch(__curve_keys, k1); + float l = len(P2 - P1); // XXX slower float r1 = P1.w; float r2 = P2.w; float3 tg = float4_to_float3(P2 - P1) / l; diff --git a/intern/cycles/kernel/kernel_curve.h b/intern/cycles/kernel/kernel_curve.h index fef1a48644d..e065717888c 100644 --- a/intern/cycles/kernel/kernel_curve.h +++ b/intern/cycles/kernel/kernel_curve.h @@ -24,19 +24,21 @@ CCL_NAMESPACE_BEGIN __device float curve_attribute_float(KernelGlobals *kg, const ShaderData *sd, AttributeElement elem, int offset, float *dx, float *dy) { - if(elem == ATTR_ELEMENT_CURVE_SEGMENT) { + if(elem == ATTR_ELEMENT_CURVE) { #ifdef __RAY_DIFFERENTIALS__ if(dx) *dx = 0.0f; if(dy) *dy = 0.0f; #endif - return kernel_tex_fetch(__attributes_float, offset + sd->curve_seg); + return kernel_tex_fetch(__attributes_float, offset + sd->prim); } else if(elem == ATTR_ELEMENT_CURVE_KEY) { - float4 segment = kernel_tex_fetch(__curve_segments, sd->curve_seg); + float4 curvedata = kernel_tex_fetch(__curves, sd->prim); + int k0 = __float_as_int(curvedata.x) + sd->segment; + int k1 = k0 + 1; - float f0 = kernel_tex_fetch(__attributes_float, offset + __float_as_int(segment.x)); - float f1 = kernel_tex_fetch(__attributes_float, offset + __float_as_int(segment.y)); + float f0 = kernel_tex_fetch(__attributes_float, offset + k0); + float f1 = kernel_tex_fetch(__attributes_float, offset + k1); #ifdef __RAY_DIFFERENTIALS__ if(dx) *dx = sd->du.dx*(f1 - f0); @@ -57,7 +59,7 @@ __device float curve_attribute_float(KernelGlobals *kg, const ShaderData *sd, At __device float3 curve_attribute_float3(KernelGlobals *kg, const ShaderData *sd, AttributeElement elem, int offset, float3 *dx, float3 *dy) { - if(elem == ATTR_ELEMENT_CURVE_SEGMENT) { + if(elem == ATTR_ELEMENT_CURVE) { /* idea: we can't derive any useful differentials here, but for tiled * mipmap image caching it would be useful to avoid reading the highest * detail level always. maybe a derivative based on the hair density @@ -67,13 +69,15 @@ __device float3 curve_attribute_float3(KernelGlobals *kg, const ShaderData *sd, if(dy) *dy = make_float3(0.0f, 0.0f, 0.0f); #endif - return float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + sd->curve_seg)); + return float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + sd->prim)); } else if(elem == ATTR_ELEMENT_CURVE_KEY) { - float4 segment = kernel_tex_fetch(__curve_segments, sd->curve_seg); + float4 curvedata = kernel_tex_fetch(__curves, sd->prim); + int k0 = __float_as_int(curvedata.x) + sd->segment; + int k1 = k0 + 1; - float3 f0 = float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + __float_as_int(segment.x))); - float3 f1 = float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + __float_as_int(segment.y))); + float3 f0 = float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + k0)); + float3 f1 = float4_to_float3(kernel_tex_fetch(__attributes_float3, offset + k1)); #ifdef __RAY_DIFFERENTIALS__ if(dx) *dx = sd->du.dx*(f1 - f0); @@ -96,19 +100,16 @@ __device float3 curve_attribute_float3(KernelGlobals *kg, const ShaderData *sd, __device float curve_thickness(KernelGlobals *kg, ShaderData *sd) { - int prim = sd->curve_seg; - float u = sd->u; float r = 0.0f; - if(prim != -1) { - float4 v00 = kernel_tex_fetch(__curve_segments, prim); + if(sd->segment != ~0) { + float4 curvedata = kernel_tex_fetch(__curves, sd->prim); + int k0 = __float_as_int(curvedata.x) + sd->segment; + int k1 = k0 + 1; - int v1 = __float_as_int(v00.x); - int v2 = __float_as_int(v00.y); - - float4 P1 = kernel_tex_fetch(__curve_keys, v1); - float4 P2 = kernel_tex_fetch(__curve_keys, v2); - r = (P2.w - P1.w) * u + P1.w; + float4 P1 = kernel_tex_fetch(__curve_keys, k0); + float4 P2 = kernel_tex_fetch(__curve_keys, k1); + r = (P2.w - P1.w) * sd->u + P1.w; } return r*2.0f; @@ -118,7 +119,7 @@ __device float3 curve_tangent_normal(KernelGlobals *kg, ShaderData *sd) { float3 tgN = make_float3(0.0f,0.0f,0.0f); - if(sd->curve_seg != ~0) { + if(sd->segment != ~0) { float normalmix = kernel_data.curve_kernel_data.normalmix; tgN = -(-sd->I - sd->dPdu * (dot(sd->dPdu,-sd->I) * normalmix / len_squared(sd->dPdu))); diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index adf7e8eca82..d5506ad1dd0 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -157,7 +157,7 @@ __device float3 indirect_emission(KernelGlobals *kg, ShaderData *sd, float t, in float3 L = shader_emissive_eval(kg, sd); #ifdef __HAIR__ - if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_SAMPLE_AS_LIGHT) && (sd->curve_seg == ~0)) { + if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_SAMPLE_AS_LIGHT) && (sd->segment == ~0)) { #else if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_SAMPLE_AS_LIGHT)) { #endif diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index 09ee1f68e12..1561ddc9ddd 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -329,18 +329,20 @@ __device float triangle_light_pdf(KernelGlobals *kg, #ifdef __HAIR__ /* Strand Light */ -__device void curve_seg_light_sample(KernelGlobals *kg, int prim, int object, - float randu, float randv, float time, LightSample *ls) +__device void curve_segment_light_sample(KernelGlobals *kg, int prim, int object, + int segment, float randu, float randv, float time, LightSample *ls) { /* this strand code needs completion */ - float4 v00 = kernel_tex_fetch(__curve_segments, prim); + float4 v00 = kernel_tex_fetch(__curves, prim); + + int k0 = __float_as_int(v00.x) + segment; + int k1 = k0 + 1; - int v1 = __float_as_int(v00.x); - int v2 = __float_as_int(v00.y); - float l = v00.w; + float4 P1 = kernel_tex_fetch(__curve_keys, k0); + float4 P2 = kernel_tex_fetch(__curve_keys, k1); + + float l = len(P2 - P1); // XXX slower - float4 P1 = kernel_tex_fetch(__curve_keys, v1); - float4 P2 = kernel_tex_fetch(__curve_keys, v2); float r1 = P1.w; float r2 = P2.w; float3 tg = float4_to_float3(P2 - P1) / l; @@ -419,15 +421,15 @@ __device void light_sample(KernelGlobals *kg, float randt, float randu, float ra float4 l = kernel_tex_fetch(__light_distribution, index); int prim = __float_as_int(l.y); #ifdef __HAIR__ -/* currently use l.z to indicate is strand sample which isn't ideal */ - bool is_curve = __float_as_int(l.z) == 0.0f; + int segment = __float_as_int(l.z); #endif if(prim >= 0) { int object = __float_as_int(l.w); + #ifdef __HAIR__ - if (is_curve) - curve_seg_light_sample(kg, prim, object, randu, randv, time, ls); + if (segment != ~0) + curve_segment_light_sample(kg, prim, object, segment, randu, randv, time, ls); else #endif triangle_light_sample(kg, prim, object, randu, randv, time, ls); diff --git a/intern/cycles/kernel/kernel_primitive.h b/intern/cycles/kernel/kernel_primitive.h index 2296017c686..7538b7107d0 100644 --- a/intern/cycles/kernel/kernel_primitive.h +++ b/intern/cycles/kernel/kernel_primitive.h @@ -37,7 +37,7 @@ __device_inline int find_attribute(KernelGlobals *kg, ShaderData *sd, uint id, A { /* for SVM, find attribute by unique id */ uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride; - attr_offset = (sd->curve_seg == ~0)? attr_offset: attr_offset + ATTR_PRIM_CURVE; + attr_offset = (sd->segment == ~0)? attr_offset: attr_offset + ATTR_PRIM_CURVE; uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset); while(attr_map.x != id) { @@ -55,7 +55,7 @@ __device_inline int find_attribute(KernelGlobals *kg, ShaderData *sd, uint id, A __device float primitive_attribute_float(KernelGlobals *kg, const ShaderData *sd, AttributeElement elem, int offset, float *dx, float *dy) { #ifdef __HAIR__ - if(sd->curve_seg == ~0) + if(sd->segment == ~0) #endif return triangle_attribute_float(kg, sd, elem, offset, dx, dy); #ifdef __HAIR__ @@ -67,7 +67,7 @@ __device float primitive_attribute_float(KernelGlobals *kg, const ShaderData *sd __device float3 primitive_attribute_float3(KernelGlobals *kg, const ShaderData *sd, AttributeElement elem, int offset, float3 *dx, float3 *dy) { #ifdef __HAIR__ - if(sd->curve_seg == ~0) + if(sd->segment == ~0) #endif return triangle_attribute_float3(kg, sd, elem, offset, dx, dy); #ifdef __HAIR__ @@ -92,7 +92,7 @@ __device float3 primitive_uv(KernelGlobals *kg, ShaderData *sd) __device float3 primitive_tangent(KernelGlobals *kg, ShaderData *sd) { #ifdef __HAIR__ - if(sd->curve_seg != ~0) + if(sd->segment != ~0) return normalize(sd->dPdu); #endif diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 49bbc5a74ab..0a5a2ab54b0 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -69,25 +69,22 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, #endif sd->prim = kernel_tex_fetch(__prim_index, isect->prim); -#ifdef __HAIR__ - sd->curve_seg = ~0; -#endif sd->ray_length = isect->t; #ifdef __HAIR__ - if(kernel_tex_fetch(__prim_type, isect->prim)) { + if(kernel_tex_fetch(__prim_segment, isect->prim) != ~0) { /* Strand Shader setting*/ - float4 CurSeg = kernel_tex_fetch(__curve_segments, sd->prim); - sd->shader = __float_as_int(CurSeg.z); + float4 curvedata = kernel_tex_fetch(__curves, sd->prim); - sd->curve_seg = sd->prim; - sd->prim = isect->prim; + sd->shader = __float_as_int(curvedata.z); + sd->segment = isect->segment; float tcorr = isect->t; if(kernel_data.curve_kernel_data.curveflags & CURVE_KN_POSTINTERSECTCORRECTION) { tcorr = (isect->u < 0)? tcorr + sqrtf(isect->v) : tcorr - sqrtf(isect->v); sd->ray_length = tcorr; } + sd->P = bvh_curve_refine(kg, sd, isect, ray, tcorr); } else { @@ -97,6 +94,10 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, float3 Ng = make_float3(Ns.x, Ns.y, Ns.z); sd->shader = __float_as_int(Ns.w); +#ifdef __HAIR__ + sd->segment = ~0; +#endif + #ifdef __UV__ sd->u = isect->u; sd->v = isect->v; @@ -107,7 +108,6 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, sd->Ng = Ng; sd->N = Ng; - /* smooth normal */ if(sd->shader & SHADER_SMOOTH_NORMAL) sd->N = triangle_smooth_normal(kg, sd->prim, sd->u, sd->v); @@ -162,7 +162,7 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, const float3 P, const float3 Ng, const float3 I, - int shader, int object, int prim, float u, float v, float t, float time, int curve = ~0) + int shader, int object, int prim, float u, float v, float t, float time, int segment = ~0) { /* vectors */ sd->P = P; @@ -171,7 +171,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, sd->I = I; sd->shader = shader; #ifdef __HAIR__ - sd->curve_seg = curve; + sd->segment = segment; #endif /* primitive */ @@ -215,7 +215,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, /* smooth normal */ #ifdef __HAIR__ - if(sd->shader & SHADER_SMOOTH_NORMAL && sd->curve_seg == ~0) { + if(sd->shader & SHADER_SMOOTH_NORMAL && sd->segment == ~0) { sd->N = triangle_smooth_normal(kg, sd->prim, sd->u, sd->v); #else if(sd->shader & SHADER_SMOOTH_NORMAL) { @@ -231,7 +231,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, #ifdef __DPDU__ /* dPdu/dPdv */ #ifdef __HAIR__ - if(sd->prim == ~0 || sd->curve_seg != ~0) { + if(sd->prim == ~0 || sd->segment != ~0) { sd->dPdu = make_float3(0.0f, 0.0f, 0.0f); sd->dPdv = make_float3(0.0f, 0.0f, 0.0f); } @@ -323,7 +323,7 @@ __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData #endif sd->prim = ~0; #ifdef __HAIR__ - sd->curve_seg = ~0; + sd->segment = ~0; #endif #ifdef __UV__ sd->u = 0.0f; @@ -781,14 +781,14 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect) int shader = 0; #ifdef __HAIR__ - if(!kernel_tex_fetch(__prim_type, isect->prim)) { + if(kernel_tex_fetch(__prim_segment, isect->prim) == ~0) { #endif float4 Ns = kernel_tex_fetch(__tri_normal, prim); shader = __float_as_int(Ns.w); #ifdef __HAIR__ } else { - float4 str = kernel_tex_fetch(__curve_segments, prim); + float4 str = kernel_tex_fetch(__curves, prim); shader = __float_as_int(str.z); } #endif diff --git a/intern/cycles/kernel/kernel_textures.h b/intern/cycles/kernel/kernel_textures.h index 072df21a188..e27de95e7ab 100644 --- a/intern/cycles/kernel/kernel_textures.h +++ b/intern/cycles/kernel/kernel_textures.h @@ -27,7 +27,7 @@ /* bvh */ KERNEL_TEX(float4, texture_float4, __bvh_nodes) KERNEL_TEX(float4, texture_float4, __tri_woop) -KERNEL_TEX(uint, texture_uint, __prim_type) +KERNEL_TEX(uint, texture_uint, __prim_segment) KERNEL_TEX(uint, texture_uint, __prim_visibility) KERNEL_TEX(uint, texture_uint, __prim_index) KERNEL_TEX(uint, texture_uint, __prim_object) @@ -44,7 +44,7 @@ KERNEL_TEX(float4, texture_float4, __tri_vindex) KERNEL_TEX(float4, texture_float4, __tri_verts) /* curves */ -KERNEL_TEX(float4, texture_float4, __curve_segments) +KERNEL_TEX(float4, texture_float4, __curves) KERNEL_TEX(float4, texture_float4, __curve_keys) /* attributes */ diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index e80772bd4e2..2bd6b5859f3 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -344,6 +344,7 @@ typedef struct Intersection { float t, u, v; int prim; int object; + int segment; } Intersection; /* Attributes */ @@ -357,7 +358,7 @@ typedef enum AttributeElement { ATTR_ELEMENT_FACE, ATTR_ELEMENT_VERTEX, ATTR_ELEMENT_CORNER, - ATTR_ELEMENT_CURVE_SEGMENT, + ATTR_ELEMENT_CURVE, ATTR_ELEMENT_CURVE_KEY } AttributeElement; @@ -464,8 +465,8 @@ typedef struct ShaderData { int prim; #ifdef __HAIR__ - /* strand id if there is one, -1 otherwise */ - int curve_seg; + /* for curves, segment number in curve, ~0 for triangles */ + int segment; #endif /* parametric coordinates * - barycentric weights for triangles */ diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index afa5211216b..28742d56e3b 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -605,7 +605,7 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD return set_attribute_int(3, type, derivatives, val); } else if ((name == u_geom_trianglevertices || name == u_geom_polyvertices) - && sd->curve_seg == ~0) { + && sd->segment == ~0) { float3 P[3]; triangle_vertices(kg, sd->prim, P); @@ -625,7 +625,7 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD #ifdef __HAIR__ /* Hair Attributes */ else if (name == u_is_curve) { - float f = !(sd->curve_seg == ~0); + float f = (sd->segment != ~0); return set_attribute_float(f, type, derivatives, val); } else if (name == u_curve_thickness) { @@ -659,7 +659,7 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri { KernelGlobals *kg = kernel_globals; ShaderData *sd = (ShaderData *)renderstate; - int object, prim, curve_seg; + int object, prim, segment; /* lookup of attribute on another object */ if (object_name != u_empty || sd == NULL) { @@ -670,19 +670,19 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri object = it->second; prim = ~0; - curve_seg = ~0; + segment = ~0; } else { object = sd->object; prim = sd->prim; - curve_seg = sd->curve_seg; + segment = sd->segment; if (object == ~0) return get_background_attribute(kg, sd, name, type, derivatives, val); } /* find attribute on object */ - object = object*ATTR_PRIM_TYPES + (curve_seg != ~0); + object = object*ATTR_PRIM_TYPES + (segment != ~0); OSLGlobals::AttributeMap& attribute_map = kg->osl->attribute_map[object]; OSLGlobals::AttributeMap::iterator it = attribute_map.find(name); diff --git a/intern/cycles/kernel/osl/osl_shader.cpp b/intern/cycles/kernel/osl/osl_shader.cpp index 18486eba114..59e307bb408 100644 --- a/intern/cycles/kernel/osl/osl_shader.cpp +++ b/intern/cycles/kernel/osl/osl_shader.cpp @@ -457,7 +457,7 @@ float3 OSLShader::volume_eval_phase(const ShaderClosure *sc, const float3 omega_ int OSLShader::find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id, AttributeElement *elem) { /* for OSL, a hash map is used to lookup the attribute by name. */ - int object = sd->object*ATTR_PRIM_TYPES + (sd->curve_seg != ~0); + int object = sd->object*ATTR_PRIM_TYPES + (sd->segment != ~0); OSLGlobals::AttributeMap &attr_map = kg->osl->attribute_map[object]; ustring stdname(std::string("geom:") + std::string(Attribute::standard_name((AttributeStandard)id))); OSLGlobals::AttributeMap::const_iterator it = attr_map.find(stdname); diff --git a/intern/cycles/kernel/svm/svm_attribute.h b/intern/cycles/kernel/svm/svm_attribute.h index f11b69138d1..ea0a31610f1 100644 --- a/intern/cycles/kernel/svm/svm_attribute.h +++ b/intern/cycles/kernel/svm/svm_attribute.h @@ -28,7 +28,7 @@ __device void svm_node_attr_init(KernelGlobals *kg, ShaderData *sd, /* find attribute by unique id */ uint id = node.y; uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride; - attr_offset = (sd->curve_seg == ~0)? attr_offset: attr_offset + ATTR_PRIM_CURVE; + attr_offset = (sd->segment == ~0)? attr_offset: attr_offset + ATTR_PRIM_CURVE; uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset); while(attr_map.x != id) { diff --git a/intern/cycles/kernel/svm/svm_geometry.h b/intern/cycles/kernel/svm/svm_geometry.h index db8bbabe0ec..a04f4ea0fa7 100644 --- a/intern/cycles/kernel/svm/svm_geometry.h +++ b/intern/cycles/kernel/svm/svm_geometry.h @@ -155,7 +155,7 @@ __device void svm_node_hair_info(KernelGlobals *kg, ShaderData *sd, float *stack switch(type) { case NODE_INFO_CURVE_IS_STRAND: { - data = !(sd->curve_seg == ~0); + data = (sd->segment != ~0); stack_store_float(stack, out_offset, data); break; } |