Cycles: Make object flag names more obvious that hey are object and not shader
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 23 Dec 2016 09:49:59 +0000 (10:49 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 23 Jan 2017 11:14:17 +0000 (12:14 +0100)
15 files changed:
intern/cycles/kernel/bvh/bvh_subsurface.h
intern/cycles/kernel/bvh/qbvh_subsurface.h
intern/cycles/kernel/geom/geom_motion_triangle_shader.h
intern/cycles/kernel/geom/geom_primitive.h
intern/cycles/kernel/geom/geom_triangle.h
intern/cycles/kernel/kernel_bake.h
intern/cycles/kernel/kernel_light.h
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_path_branched.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/kernel_types.h
intern/cycles/kernel/osl/osl_services.cpp
intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
intern/cycles/kernel/svm/svm_wireframe.h
intern/cycles/render/object.cpp

index d9623c9..889bbca 100644 (file)
@@ -72,7 +72,7 @@ void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
        ss_isect->num_hits = 0;
 
        const int object_flag = kernel_tex_fetch(__object_flag, subsurface_object);
-       if(!(object_flag & SD_TRANSFORM_APPLIED)) {
+       if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
 #if BVH_FEATURE(BVH_MOTION)
                Transform ob_itfm;
                bvh_instance_motion_push(kg,
index ccd36df..84dc400 100644 (file)
@@ -61,7 +61,7 @@ ccl_device void BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
        ss_isect->num_hits = 0;
 
        const int object_flag = kernel_tex_fetch(__object_flag, subsurface_object);
-       if(!(object_flag & SD_TRANSFORM_APPLIED)) {
+       if(!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) {
 #if BVH_FEATURE(BVH_MOTION)
                Transform ob_itfm;
                bvh_instance_motion_push(kg,
index c5dbc6a..5b1e014 100644 (file)
@@ -81,7 +81,7 @@ ccl_device_noinline void motion_triangle_shader_setup(KernelGlobals *kg,
        }
        /* Compute face normal. */
        float3 Ng;
-       if(ccl_fetch(sd, flag) & SD_NEGATIVE_SCALE_APPLIED) {
+       if(ccl_fetch(sd, flag) & SD_OBJECT_NEGATIVE_SCALE_APPLIED) {
                Ng = normalize(cross(verts[2] - verts[0], verts[1] - verts[0]));
        }
        else {
index 4384c20..dba8258 100644 (file)
@@ -157,7 +157,7 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *
        if(is_curve_primitive) {
                center = curve_motion_center_location(kg, sd);
 
-               if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED))
+               if(!(ccl_fetch(sd, flag) & SD_OBJECT_TRANSFORM_APPLIED))
                        object_position_transform(kg, sd, &center);
        }
        else
index 1753887..9ed619f 100644 (file)
@@ -32,7 +32,7 @@ ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd)
        const float3 v2 = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w+2));
 
        /* return normal */
-       if(ccl_fetch(sd, flag) & SD_NEGATIVE_SCALE_APPLIED)
+       if(ccl_fetch(sd, flag) & SD_OBJECT_NEGATIVE_SCALE_APPLIED)
                return normalize(cross(v2 - v0, v1 - v0));
        else
                return normalize(cross(v1 - v0, v2 - v0));
@@ -55,7 +55,7 @@ ccl_device_inline void triangle_point_normal(KernelGlobals *kg, int object, int
        int object_flag = kernel_tex_fetch(__object_flag, object);
 
        /* compute normal */
-       if(object_flag & SD_NEGATIVE_SCALE_APPLIED)
+       if(object_flag & SD_OBJECT_NEGATIVE_SCALE_APPLIED)
                *Ng = normalize(cross(v2 - v0, v1 - v0));
        else
                *Ng = normalize(cross(v1 - v0, v2 - v0));
index c32ac6c..5bcc57c 100644 (file)
@@ -320,7 +320,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
                                 P, Ng, Ng,
                                 shader, object, prim,
                                 u, v, 1.0f, 0.5f,
-                                !(kernel_tex_fetch(__object_flag, object) & SD_TRANSFORM_APPLIED),
+                                !(kernel_tex_fetch(__object_flag, object) & SD_OBJECT_TRANSFORM_APPLIED),
                                 LAMP_NONE);
        sd.I = sd.N;
 
index d4cc36d..a2909ce 100644 (file)
@@ -767,7 +767,7 @@ ccl_device void object_transform_light_sample(KernelGlobals *kg, LightSample *ls
 {
 #ifdef __INSTANCING__
        /* instance transform */
-       if(!(kernel_tex_fetch(__object_flag, object) & SD_TRANSFORM_APPLIED)) {
+       if(!(kernel_tex_fetch(__object_flag, object) & SD_OBJECT_TRANSFORM_APPLIED)) {
 #  ifdef __OBJECT_MOTION__
                Transform itfm;
                Transform tfm = object_fetch_transform_motion_test(kg, object, time, &itfm);
index e25f259..557c308 100644 (file)
@@ -777,11 +777,11 @@ ccl_device_inline float4 kernel_path_integrate(KernelGlobals *kg,
 
                /* holdout */
 #ifdef __HOLDOUT__
-               if((sd.flag & (SD_HOLDOUT|SD_HOLDOUT_MASK)) && (state.flag & PATH_RAY_CAMERA)) {
+               if((sd.flag & (SD_HOLDOUT|SD_OBJECT_HOLDOUT_MASK)) && (state.flag & PATH_RAY_CAMERA)) {
                        if(kernel_data.background.transparent) {
                                float3 holdout_weight;
                                
-                               if(sd.flag & SD_HOLDOUT_MASK)
+                               if(sd.flag & SD_OBJECT_HOLDOUT_MASK)
                                        holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
                                else
                                        holdout_weight = shader_holdout_eval(kg, &sd);
@@ -790,7 +790,7 @@ ccl_device_inline float4 kernel_path_integrate(KernelGlobals *kg,
                                L_transparent += average(holdout_weight*throughput);
                        }
 
-                       if(sd.flag & SD_HOLDOUT_MASK)
+                       if(sd.flag & SD_OBJECT_HOLDOUT_MASK)
                                break;
                }
 #endif  /* __HOLDOUT__ */
index 72a8d98..4ec0ac8 100644 (file)
@@ -473,11 +473,11 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
 
                /* holdout */
 #ifdef __HOLDOUT__
-               if(sd.flag & (SD_HOLDOUT|SD_HOLDOUT_MASK)) {
+               if(sd.flag & (SD_HOLDOUT|SD_OBJECT_HOLDOUT_MASK)) {
                        if(kernel_data.background.transparent) {
                                float3 holdout_weight;
                                
-                               if(sd.flag & SD_HOLDOUT_MASK)
+                               if(sd.flag & SD_OBJECT_HOLDOUT_MASK)
                                        holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
                                else
                                        holdout_weight = shader_holdout_eval(kg, &sd);
@@ -486,7 +486,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
                                L_transparent += average(holdout_weight*throughput);
                        }
 
-                       if(sd.flag & SD_HOLDOUT_MASK)
+                       if(sd.flag & SD_OBJECT_HOLDOUT_MASK)
                                break;
                }
 #endif  /* __HOLDOUT__ */
index c1b3153..d7a9167 100644 (file)
@@ -298,7 +298,7 @@ ccl_device_inline void shader_setup_from_sample(KernelGlobals *kg,
                        ccl_fetch(sd, N) = triangle_smooth_normal(kg, ccl_fetch(sd, prim), ccl_fetch(sd, u), ccl_fetch(sd, v));
 
 #ifdef __INSTANCING__
-                       if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED)) {
+                       if(!(ccl_fetch(sd, flag) & SD_OBJECT_TRANSFORM_APPLIED)) {
                                object_normal_transform_auto(kg, sd, &ccl_fetch(sd, N));
                        }
 #endif
@@ -309,7 +309,7 @@ ccl_device_inline void shader_setup_from_sample(KernelGlobals *kg,
                triangle_dPdudv(kg, ccl_fetch(sd, prim), &ccl_fetch(sd, dPdu), &ccl_fetch(sd, dPdv));
 
 #  ifdef __INSTANCING__
-               if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED)) {
+               if(!(ccl_fetch(sd, flag) & SD_OBJECT_TRANSFORM_APPLIED)) {
                        object_dir_transform_auto(kg, sd, &ccl_fetch(sd, dPdu));
                        object_dir_transform_auto(kg, sd, &ccl_fetch(sd, dPdv));
                }
@@ -364,7 +364,7 @@ ccl_device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
                                 P, Ng, I,
                                 shader, object, prim,
                                 u, v, 0.0f, 0.5f,
-                                !(kernel_tex_fetch(__object_flag, object) & SD_TRANSFORM_APPLIED),
+                                !(kernel_tex_fetch(__object_flag, object) & SD_OBJECT_TRANSFORM_APPLIED),
                                 LAMP_NONE);
 }
 
index 4180465..a826cda 100644 (file)
@@ -732,16 +732,16 @@ enum ShaderDataFlag {
                           SD_VOLUME_CUBIC|SD_HAS_BUMP|SD_HAS_DISPLACEMENT|SD_HAS_CONSTANT_EMISSION),
 
        /* object flags */
-       SD_HOLDOUT_MASK             = (1 << 24),  /* holdout for camera rays */
-       SD_OBJECT_MOTION            = (1 << 25),  /* has object motion blur */
-       SD_TRANSFORM_APPLIED        = (1 << 26),  /* vertices have transform applied */
-       SD_NEGATIVE_SCALE_APPLIED   = (1 << 27),  /* vertices have negative scale applied */
-       SD_OBJECT_HAS_VOLUME        = (1 << 28),  /* object has a volume shader */
-       SD_OBJECT_INTERSECTS_VOLUME = (1 << 29),  /* object intersects AABB of an object with volume shader */
-       SD_OBJECT_HAS_VERTEX_MOTION = (1 << 30),  /* has position for motion vertices */
-
-       SD_OBJECT_FLAGS = (SD_HOLDOUT_MASK|SD_OBJECT_MOTION|SD_TRANSFORM_APPLIED|
-                          SD_NEGATIVE_SCALE_APPLIED|SD_OBJECT_HAS_VOLUME|
+       SD_OBJECT_HOLDOUT_MASK           = (1 << 24),  /* holdout for camera rays */
+       SD_OBJECT_MOTION                 = (1 << 25),  /* has object motion blur */
+       SD_OBJECT_TRANSFORM_APPLIED      = (1 << 26),  /* vertices have transform applied */
+       SD_OBJECT_NEGATIVE_SCALE_APPLIED = (1 << 27),  /* vertices have negative scale applied */
+       SD_OBJECT_HAS_VOLUME             = (1 << 28),  /* object has a volume shader */
+       SD_OBJECT_INTERSECTS_VOLUME      = (1 << 29),  /* object intersects AABB of an object with volume shader */
+       SD_OBJECT_HAS_VERTEX_MOTION      = (1 << 30),  /* has position for motion vertices */
+
+       SD_OBJECT_FLAGS = (SD_OBJECT_HOLDOUT_MASK|SD_OBJECT_MOTION|SD_OBJECT_TRANSFORM_APPLIED|
+                          SD_OBJECT_NEGATIVE_SCALE_APPLIED|SD_OBJECT_HAS_VOLUME|
                           SD_OBJECT_INTERSECTS_VOLUME)
 };
 
index eeccf9a..2c8acb4 100644 (file)
@@ -712,7 +712,7 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD
                else
                        motion_triangle_vertices(kg, sd->object, sd->prim, sd->time, P);
 
-               if(!(sd->flag & SD_TRANSFORM_APPLIED)) {
+               if(!(sd->flag & SD_OBJECT_TRANSFORM_APPLIED)) {
                        object_position_transform(kg, sd, &P[0]);
                        object_position_transform(kg, sd, &P[1]);
                        object_position_transform(kg, sd, &P[2]);
index 435d117..fe5899d 100644 (file)
@@ -137,13 +137,13 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
 
                /* holdout */
 #ifdef __HOLDOUT__
-               if((ccl_fetch(sd, flag) & (SD_HOLDOUT|SD_HOLDOUT_MASK)) &&
+               if((ccl_fetch(sd, flag) & (SD_HOLDOUT|SD_OBJECT_HOLDOUT_MASK)) &&
                   (state->flag & PATH_RAY_CAMERA))
                {
                        if(kernel_data.background.transparent) {
                                float3 holdout_weight;
 
-                               if(ccl_fetch(sd, flag) & SD_HOLDOUT_MASK)
+                               if(ccl_fetch(sd, flag) & SD_OBJECT_HOLDOUT_MASK)
                                        holdout_weight = make_float3(1.0f, 1.0f, 1.0f);
                                else
                                        holdout_weight = shader_holdout_eval(kg, sd);
@@ -152,7 +152,7 @@ ccl_device void kernel_holdout_emission_blurring_pathtermination_ao(
                                L_transparent_coop[ray_index] += average(holdout_weight*throughput);
                        }
 
-                       if(ccl_fetch(sd, flag) & SD_HOLDOUT_MASK) {
+                       if(ccl_fetch(sd, flag) & SD_OBJECT_HOLDOUT_MASK) {
                                ASSIGN_RAY_STATE(ray_state, ray_index, RAY_UPDATE_BUFFER);
                                *enqueue_flag = 1;
                        }
index 6eed9bc..29af11c 100644 (file)
@@ -57,7 +57,7 @@ ccl_device_inline float wireframe(KernelGlobals *kg,
                else
                        motion_triangle_vertices(kg, ccl_fetch(sd, object), ccl_fetch(sd, prim), ccl_fetch(sd, time), Co);
 
-               if(!(ccl_fetch(sd, flag) & SD_TRANSFORM_APPLIED)) {
+               if(!(ccl_fetch(sd, flag) & SD_OBJECT_TRANSFORM_APPLIED)) {
                        object_position_transform(kg, sd, &Co[0]);
                        object_position_transform(kg, sd, &Co[1]);
                        object_position_transform(kg, sd, &Co[2]);
index c592b62..8342f37 100644 (file)
@@ -410,7 +410,7 @@ void ObjectManager::device_update_object_transform(UpdateObejctTransformState *s
 
        /* Object flag. */
        if(ob->use_holdout) {
-               flag |= SD_HOLDOUT_MASK;
+               flag |= SD_OBJECT_HOLDOUT_MASK;
        }
        state->object_flag[object_index] = flag;
 
@@ -716,9 +716,9 @@ void ObjectManager::apply_static_transforms(DeviceScene *dscene, Scene *scene, u
                                        if(progress.get_cancel()) return;
                                }
 
-                               object_flag[i] |= SD_TRANSFORM_APPLIED;
+                               object_flag[i] |= SD_OBJECT_TRANSFORM_APPLIED;
                                if(object->mesh->transform_negative_scaled)
-                                       object_flag[i] |= SD_NEGATIVE_SCALE_APPLIED;
+                                       object_flag[i] |= SD_OBJECT_NEGATIVE_SCALE_APPLIED;
                        }
                        else
                                have_instancing = true;