Cycles: more code refactoring to rename things internally as well. Also change
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 23 Aug 2013 14:34:34 +0000 (14:34 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 23 Aug 2013 14:34:34 +0000 (14:34 +0000)
property name back so we keep compatibility.

17 files changed:
intern/cycles/app/cycles_xml.cpp
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_sync.cpp
intern/cycles/device/device_cuda.cpp
intern/cycles/device/device_task.h
intern/cycles/kernel/kernel.cpp
intern/cycles/kernel/kernel.cu
intern/cycles/kernel/kernel_emission.h
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/kernel_sse2.cpp
intern/cycles/kernel/kernel_sse3.cpp
intern/cycles/kernel/kernel_types.h
intern/cycles/render/integrator.cpp
intern/cycles/render/integrator.h
intern/cycles/render/session.cpp

index 75bff4a41ed21a037ee2260988c6ade616a16592..8c6f501249a78ab7f7512e36d90f7033aaa9206f 100644 (file)
@@ -252,10 +252,14 @@ static void xml_read_film(const XMLReadState& state, pugi::xml_node node)
 static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
 {
        Integrator *integrator = state.scene->integrator;
+       bool branched = false;
        
-       xml_read_bool(&integrator->progressive, node, "progressive");
+       xml_read_bool(&branched, node, "branched");
+
+       if(branched)
+               integrator->method == Integrator::BRANCHED_PATH;
        
-       if(!integrator->progressive) {
+       if(integrator->method == Integrator::BRANCHED_PATH) {
                xml_read_int(&integrator->diffuse_samples, node, "diffuse_samples");
                xml_read_int(&integrator->glossy_samples, node, "glossy_samples");
                xml_read_int(&integrator->transmission_samples, node, "transmission_samples");
index 3b4982eef68d243ab941cb2c8270248da0493b14..367f021ee34c5b55a64bd99675c100ec82455752 100644 (file)
@@ -128,7 +128,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 description="Use Open Shading Language (CPU rendering only)",
                 )
 
-        cls.integrator = EnumProperty(
+        cls.progressive = EnumProperty(
                 name="Integrator",
                 description="Method to sample lights and materials",
                 items=enum_integrator,
index 64633aabbee2c76bd2835eb53abd0158ddcdfc5d..102f551b3d4a23748984346095f98e21f4ce6bb5 100644 (file)
@@ -49,7 +49,7 @@ class CyclesButtonsPanel():
 
 
 def draw_samples_info(layout, cscene):
-    integrator = cscene.integrator
+    integrator = cscene.progressive
 
     # Calculate sample values
     if integrator == 'PATH':
@@ -108,7 +108,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
         row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
 
         row = layout.row()
-        row.prop(cscene, "integrator", text="")
+        row.prop(cscene, "progressive", text="")
         row.prop(cscene, "use_square_samples")
 
         split = layout.split()
@@ -119,7 +119,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
         sub.prop(cscene, "seed")
         sub.prop(cscene, "sample_clamp")
 
-        if cscene.integrator == 'PATH':
+        if cscene.progressive == 'PATH':
             col = split.column()
             sub = col.column(align=True)
             sub.label(text="Samples:")
@@ -715,7 +715,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
                 sub.prop(lamp, "size", text="Size X")
                 sub.prop(lamp, "size_y", text="Size Y")
 
-        if cscene.integrator == 'BRANCHED_PATH':
+        if cscene.progressive == 'BRANCHED_PATH':
             col.prop(clamp, "samples")
 
         col = split.column()
index f6f938b62417aded8d6e38b133f581a1f793aed1..a0c59c4f41d1095ba5808a80bd0cb3e6db1f29f7 100644 (file)
@@ -189,7 +189,7 @@ void BlenderSync::sync_integrator()
        }
 #endif
 
-       integrator->progressive = get_int(cscene, "integrator") == 1;
+       integrator->method = (Integrator::Method)get_int(cscene, "progressive");
 
        int diffuse_samples = get_int(cscene, "diffuse_samples");
        int glossy_samples = get_int(cscene, "glossy_samples");
@@ -420,7 +420,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
                preview_samples = preview_samples * preview_samples;
        }
 
-       if(get_int(cscene, "integrator") == 0) {
+       if(get_int(cscene, "progressive") == 0) {
                if(background) {
                        params.samples = aa_samples;
                }
index 8d44c36a5ec1ef3325affdae62abb9c91b27b289..a60512577cffd3a973499727ae8e783bf86ad824 100644 (file)
@@ -556,7 +556,7 @@ public:
                }
        }
 
-       void path_trace(RenderTile& rtile, int sample, bool progressive)
+       void path_trace(RenderTile& rtile, int sample, bool branched)
        {
                if(have_error())
                        return;
@@ -568,14 +568,14 @@ public:
                CUdeviceptr d_rng_state = cuda_device_ptr(rtile.rng_state);
 
                /* get kernel function */
-               if(progressive)
-                       cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_path_trace_progressive"))
-               else {
-                       cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_path_trace_non_progressive"))
-                       if(have_error())
-                               return;
-               }
-               
+               if(branched)
+                       cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_branched_path_trace"))
+               else
+                       cuda_assert(cuModuleGetFunction(&cuPathTrace, cuModule, "kernel_cuda_path_trace"))
+
+               if(have_error())
+                       return;
+       
                /* pass in parameters */
                int offset = 0;
                
@@ -918,7 +918,7 @@ public:
                if(task->type == DeviceTask::PATH_TRACE) {
                        RenderTile tile;
                        
-                       bool progressive = task->integrator_progressive;
+                       bool branched = task->integrator_branched;
                        
                        /* keep rendering tiles until done */
                        while(task->acquire_tile(this, tile)) {
@@ -931,7 +931,7 @@ public:
                                                        break;
                                        }
 
-                                       path_trace(tile, sample, progressive);
+                                       path_trace(tile, sample, branched);
 
                                        tile.sample = sample + 1;
 
index 56be33f2735f3365cfcd20c184e87cef8ae41528..e232e128827193089937b65a237230813ce56142 100644 (file)
@@ -63,7 +63,7 @@ public:
        boost::function<bool(void)> get_cancel;
 
        bool need_finish_queue;
-       bool integrator_progressive;
+       bool integrator_branched;
 protected:
        double last_update_time;
 };
index 1b887082815a519350707b21a34579b6f1cc6b70..3f357763a8f7aa776ae91c6bcf288ebefc9d654c 100644 (file)
@@ -88,12 +88,12 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t
 
 void kernel_cpu_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
 {
-#ifdef __NON_PROGRESSIVE__
-       if(!kernel_data.integrator.progressive)
-               kernel_path_trace_non_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
+#ifdef __BRANCHED_PATH__
+       if(kernel_data.integrator.branched)
+               kernel_branched_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
        else
 #endif
-               kernel_path_trace_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
+               kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
 }
 
 /* Tonemapping */
index cefc30fc393384247ca6f8c2f26c56f93180275c..c4da1d440b7bdc46538ecbffa68abc7ca3e8f7dc 100644 (file)
 #include "kernel_path.h"
 #include "kernel_displace.h"
 
-extern "C" __global__ void kernel_cuda_path_trace_progressive(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
+extern "C" __global__ void kernel_cuda_path_trace(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
 {
        int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
        int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
 
        if(x < sx + sw && y < sy + sh)
-               kernel_path_trace_progressive(NULL, buffer, rng_state, sample, x, y, offset, stride);
+               kernel_path_trace(NULL, buffer, rng_state, sample, x, y, offset, stride);
 }
 
-#ifdef __NON_PROGRESSIVE__
-extern "C" __global__ void kernel_cuda_path_trace_non_progressive(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
+#ifdef __BRANCHED_PATH__
+extern "C" __global__ void kernel_cuda_branched_path_trace(float *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
 {
        int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
        int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
 
        if(x < sx + sw && y < sy + sh)
-               kernel_path_trace_non_progressive(NULL, buffer, rng_state, sample, x, y, offset, stride);
+               kernel_branched_path_trace(NULL, buffer, rng_state, sample, x, y, offset, stride);
 }
 #endif
 
index be4c1ddc79713205534fbde45eaa443f72dc83a2..0c8d69fb59486657d56e0bb467d662e7347e7f48 100644 (file)
@@ -76,7 +76,7 @@ __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int li
 {
        LightSample ls;
 
-#ifdef __NON_PROGRESSIVE__
+#ifdef __BRANCHED_PATH__
        if(lindex != -1) {
                /* sample position on a specified light */
                light_select(kg, lindex, randu, randv, sd->P, &ls);
index 687e5ee5203d52fa1a8b881e1c3d39f073a4f60f..ffbbbe71cfc348dae1580d9f7edc1ca3f23fcdd4 100644 (file)
@@ -231,7 +231,7 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra
        return result;
 }
 
-__device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
+__device float4 kernel_path_integrator(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
 {
        /* initialize */
        PathRadiance L;
@@ -543,7 +543,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
        return make_float4(L_sum.x, L_sum.y, L_sum.z, 1.0f - L_transparent);
 }
 
-#ifdef __NON_PROGRESSIVE__
+#ifdef __BRANCHED_PATH__
 
 __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer,
        float3 throughput, int num_samples, int num_total_samples,
@@ -778,7 +778,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
        }
 }
 
-__device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, RNG *rng, int sample,
+__device_noinline void kernel_branched_path_integrate_lighting(KernelGlobals *kg, RNG *rng, int sample,
        ShaderData *sd, float3 throughput, float num_samples_adjust,
        float min_ray_pdf, float ray_pdf, PathState state,
        int rng_offset, PathRadiance *L, __global float *buffer)
@@ -971,7 +971,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R
        }
 }
 
-__device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
+__device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, int sample, Ray ray, __global float *buffer)
 {
        /* initialize */
        PathRadiance L;
@@ -1114,7 +1114,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
                                                old_subsurface_scatter_step(kg, &bssrdf_sd, state.flag, sc, &lcg_state, true);
 
                                                /* compute lighting with the BSDF closure */
-                                               kernel_path_non_progressive_lighting(kg, rng, sample*num_samples + j,
+                                               kernel_branched_path_integrate_lighting(kg, rng, sample*num_samples + j,
                                                        &bssrdf_sd, throughput, num_samples_inv,
                                                        ray_pdf, ray_pdf, state, rng_offset, &L, buffer);
                                        }
@@ -1126,7 +1126,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 
                                                /* compute lighting with the BSDF closure */
                                                for(int hit = 0; hit < num_hits; hit++)
-                                                       kernel_path_non_progressive_lighting(kg, rng, sample*num_samples + j,
+                                                       kernel_branched_path_integrate_lighting(kg, rng, sample*num_samples + j,
                                                                &bssrdf_sd[hit], throughput, num_samples_inv,
                                                                ray_pdf, ray_pdf, state, rng_offset, &L, buffer);
                                        }
@@ -1136,7 +1136,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
 #endif
 
                /* lighting */
-               kernel_path_non_progressive_lighting(kg, rng, sample, &sd, throughput,
+               kernel_branched_path_integrate_lighting(kg, rng, sample, &sd, throughput,
                        1.0f, ray_pdf, ray_pdf, state, rng_offset, &L, buffer);
 
                /* continue in case of transparency */
@@ -1192,7 +1192,7 @@ __device_inline void kernel_path_trace_setup(KernelGlobals *kg, __global uint *r
        camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, ray);
 }
 
-__device void kernel_path_trace_progressive(KernelGlobals *kg,
+__device void kernel_path_trace(KernelGlobals *kg,
        __global float *buffer, __global uint *rng_state,
        int sample, int x, int y, int offset, int stride)
 {
@@ -1213,7 +1213,7 @@ __device void kernel_path_trace_progressive(KernelGlobals *kg,
        float4 L;
 
        if (ray.t != 0.0f)
-               L = kernel_path_progressive(kg, &rng, sample, ray, buffer);
+               L = kernel_path_integrator(kg, &rng, sample, ray, buffer);
        else
                L = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
 
@@ -1223,8 +1223,8 @@ __device void kernel_path_trace_progressive(KernelGlobals *kg,
        path_rng_end(kg, rng_state, rng);
 }
 
-#ifdef __NON_PROGRESSIVE__
-__device void kernel_path_trace_non_progressive(KernelGlobals *kg,
+#ifdef __BRANCHED_PATH__
+__device void kernel_branched_path_trace(KernelGlobals *kg,
        __global float *buffer, __global uint *rng_state,
        int sample, int x, int y, int offset, int stride)
 {
@@ -1245,7 +1245,7 @@ __device void kernel_path_trace_non_progressive(KernelGlobals *kg,
        float4 L;
 
        if (ray.t != 0.0f)
-               L = kernel_path_non_progressive(kg, &rng, sample, ray, buffer);
+               L = kernel_branched_path_integrate(kg, &rng, sample, ray, buffer);
        else
                L = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
 
index be47b0674e7d2848d474151e4723561ac4181861..e8e9af64df607b84f8900e96b3e841114467e021 100644 (file)
@@ -959,7 +959,7 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect)
 
 /* Merging */
 
-#ifdef __NON_PROGRESSIVE__
+#ifdef __BRANCHED_PATH__
 __device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd)
 {
        /* merge identical closures, better when we sample a single closure at a time */
index 518a904cc691d387b05ac4f992a65c194c4b448f..e0413ddf44574d6e48c04d701a3f072a193d7bee 100644 (file)
@@ -37,12 +37,12 @@ CCL_NAMESPACE_BEGIN
 
 void kernel_cpu_sse2_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
 {
-#ifdef __NON_PROGRESSIVE__
-       if(!kernel_data.integrator.progressive)
-               kernel_path_trace_non_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
+#ifdef __BRANCHED_PATH__
+       if(kernel_data.integrator.branched)
+               kernel_branched_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
        else
 #endif
-               kernel_path_trace_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
+               kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
 }
 
 /* Tonemapping */
index 6dc0dbfcdf445a1c2cb451e4672acd29a95efe21..86f4705ca1801aaabaf2afb8db083cf0c8514dbf 100644 (file)
@@ -39,12 +39,12 @@ CCL_NAMESPACE_BEGIN
 
 void kernel_cpu_sse3_path_trace(KernelGlobals *kg, float *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
 {
-#ifdef __NON_PROGRESSIVE__
-       if(!kernel_data.integrator.progressive)
-               kernel_path_trace_non_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
+#ifdef __BRANCHED_PATH__
+       if(kernel_data.integrator.branched)
+               kernel_branched_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
        else
 #endif
-               kernel_path_trace_progressive(kg, buffer, rng_state, sample, x, y, offset, stride);
+               kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
 }
 
 /* Tonemapping */
index 78724d71ffacbd809ed21bd1689f59556f4c19f0..caf68e913e8884d5f591d9ec338b4757df4050ad 100644 (file)
@@ -55,7 +55,7 @@ CCL_NAMESPACE_BEGIN
 #ifdef __KERNEL_CPU__
 #define __KERNEL_SHADING__
 #define __KERNEL_ADV_SHADING__
-#define __NON_PROGRESSIVE__
+#define __BRANCHED_PATH__
 #ifdef WITH_OSL
 #define __OSL__
 #endif
@@ -67,7 +67,7 @@ CCL_NAMESPACE_BEGIN
 #define __KERNEL_SHADING__
 #if __CUDA_ARCH__ >= 200
 #define __KERNEL_ADV_SHADING__
-#define __NON_PROGRESSIVE__
+#define __BRANCHED_PATH__
 #endif
 #endif
 
@@ -763,8 +763,8 @@ typedef struct KernelIntegrator {
        /* clamp */
        float sample_clamp;
 
-       /* non-progressive */
-       int progressive;
+       /* branched path */
+       int branched;
        int aa_samples;
        int diffuse_samples;
        int glossy_samples;
index 6acb5474fe44d4cd0c980fddbd2352b715788052..47b1930e27c6650d7f69b67b858833017507dda6 100644 (file)
@@ -54,7 +54,7 @@ Integrator::Integrator()
        ao_samples = 1;
        mesh_light_samples = 1;
        subsurface_samples = 1;
-       progressive = true;
+       method = PATH;
 
        sampling_pattern = SAMPLING_PATTERN_SOBOL;
 
@@ -104,7 +104,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
        
        kintegrator->sample_clamp = (sample_clamp == 0.0f)? FLT_MAX: sample_clamp*3.0f;
 
-       kintegrator->progressive = progressive;
+       kintegrator->branched = (method == BRANCHED_PATH);
        kintegrator->aa_samples = aa_samples;
        kintegrator->diffuse_samples = diffuse_samples;
        kintegrator->glossy_samples = glossy_samples;
@@ -118,7 +118,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
        /* sobol directions table */
        int max_samples = 1;
 
-       if(!progressive) {
+       if(method == BRANCHED_PATH) {
                foreach(Light *light, scene->lights)
                        max_samples = max(max_samples, light->samples);
 
@@ -163,7 +163,7 @@ bool Integrator::modified(const Integrator& integrator)
                layer_flag == integrator.layer_flag &&
                seed == integrator.seed &&
                sample_clamp == integrator.sample_clamp &&
-               progressive == integrator.progressive &&
+               method == integrator.method &&
                aa_samples == integrator.aa_samples &&
                diffuse_samples == integrator.diffuse_samples &&
                glossy_samples == integrator.glossy_samples &&
index 10248fd5ad72aaaa014dfea4ad573e3451b2eb75..a58b4d25cd3866845ec88df25febeb1916f73cb6 100644 (file)
@@ -57,7 +57,12 @@ public:
        int mesh_light_samples;
        int subsurface_samples;
 
-       bool progressive;
+       enum Method {
+               BRANCHED_PATH = 0,
+               PATH = 1
+       };
+       
+       Method method;
 
        SamplingPattern sampling_pattern;
 
index b4dad436edb9d830ddd00d10f1af26a09bb30f2f..01f8a950c8f6f8d9786245f52c25b2a6054a939c 100644 (file)
@@ -830,7 +830,7 @@ void Session::path_trace()
        task.update_tile_sample = function_bind(&Session::update_tile_sample, this, _1);
        task.update_progress_sample = function_bind(&Session::update_progress_sample, this);
        task.need_finish_queue = params.progressive_refine;
-       task.integrator_progressive = scene->integrator->progressive;
+       task.integrator_branched = scene->integrator->method == Integrator::BRANCHED_PATH;
 
        device->task_add(task);
 }