Cycles:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 24 Aug 2011 10:44:04 +0000 (10:44 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 24 Aug 2011 10:44:04 +0000 (10:44 +0000)
* auto/fixed threads option is used now, patch by Thomas.
* remove unused CUDA_LIBRARIES, library is dynamically loaded
* fix mesh XML export operator for API update

intern/cycles/app/cycles_test.cpp
intern/cycles/blender/addon/ui.py
intern/cycles/blender/addon/xml.py
intern/cycles/blender/blender_sync.cpp
intern/cycles/cmake/external_libs.cmake
intern/cycles/device/device.cpp
intern/cycles/device/device.h
intern/cycles/device/device_cpu.cpp
intern/cycles/device/device_intern.h
intern/cycles/render/session.cpp
intern/cycles/render/session.h

index 698974b6277eb93576637f25301c246af9fd894d..f617e5db44ba4fe7d57d5a4fdd43eac2a57192a9 100644 (file)
@@ -222,6 +222,7 @@ static void options_parse(int argc, const char **argv)
                "--quiet", &options.quiet, "In background mode, don't print progress messages",
                "--passes %d", &options.session_params.passes, "Number of passes to render",
                "--output %s", &options.session_params.output_path, "File path to write output image",
+               "--threads %d", &options.session_params.threads, "CPU Rendering Threads",
                "--help", &help, "Print help message",
                NULL);
        
index b4aeaa8e7ab4e76fe6de0a2784c74b64f6560589..ca83969111159d8266af46c902d4596ca22cc3e6 100644 (file)
@@ -54,7 +54,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, bpy.types.Panel):
                #row = col.row()
                #row.prop(cycles, "blur_caustics")
                #row.active = not cycles.no_caustics
-
+               
 class CyclesRender_PT_film(CyclesButtonsPanel, bpy.types.Panel):
        bl_label = "Film"
 
@@ -69,32 +69,38 @@ class CyclesRender_PT_film(CyclesButtonsPanel, bpy.types.Panel):
                split.prop(cycles, "exposure")
                split.prop(cycles, "response_curve", text="")
 
-class CyclesRender_PT_debug(CyclesButtonsPanel, bpy.types.Panel):
-       bl_label = "Debug"
+class CyclesRender_PT_performance(CyclesButtonsPanel, bpy.types.Panel):
+       bl_label = "Performance"
        bl_options = {'DEFAULT_CLOSED'}
 
        def draw(self, context):
                layout = self.layout
 
                scene = context.scene
+               rd = scene.render
                cycles = scene.cycles
 
                split = layout.split()
 
-               col = split.column()
+               col = split.column(align=True)
 
-               sub = col.column(align=True)
-               sub.prop(cycles, "debug_bvh_type", text="")
-               sub.prop(cycles, "debug_use_spatial_splits")
+               col.label(text="Threads:")
+               col.row().prop(rd, "threads_mode", expand=True)
+               sub = col.column()
+               sub.enabled = rd.threads_mode == 'FIXED'
+               sub.prop(rd, "threads")
 
                sub = col.column(align=True)
+               sub.label(text="Tiles:")
                sub.prop(cycles, "debug_tile_size")
                sub.prop(cycles, "debug_min_size")
 
-               col = split.column(align=True)
-               col.prop(cycles, "debug_cancel_timeout")
-               col.prop(cycles, "debug_reset_timeout")
-               col.prop(cycles, "debug_text_timeout")
+               col = split.column()
+
+               sub = col.column(align=True)
+               sub.label(text="Acceleration structure:")
+               sub.prop(cycles, "debug_bvh_type", text="")
+               sub.prop(cycles, "debug_use_spatial_splits")
 
 class Cycles_PT_post_processing(CyclesButtonsPanel, bpy.types.Panel):
        bl_label = "Post Processing"
index 3500d3f0aa50fc7ed10d698b99889ba25a25915e..f489f099e8b52ec590ee4ff661738fb49a02fa1f 100644 (file)
@@ -61,7 +61,7 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
                if not object:
                        raise Exception("No active object")
 
-               mesh = object.create_mesh(scene, True, 'PREVIEW')
+               mesh = object.to_mesh(scene, True, 'PREVIEW')
 
                if not mesh:
                        raise Exception("No mesh data in active object")
index c00fd8e7689bbd664658827c8154a5332331849c..a6eeb5ec1ae874b44aa4cbf02dcb214ae7fd9010 100644 (file)
@@ -192,6 +192,7 @@ SessionParams BlenderSync::get_session_params(BL::Scene b_scene, bool background
                        params.device_type = dtype;
 
        /* other parameters */
+       params.threads = b_scene.render().threads();
        params.background = background;
        params.passes = (background)? get_int(cscene, "passes"): INT_MAX;
        params.tile_size = get_int(cscene, "debug_tile_size");
index 01f3cc1af0df39100e07462bc6c8b824132b69f8..b23e3b292c56cb9d39864f10fb40ff71e1f9afc8 100644 (file)
@@ -94,13 +94,11 @@ if(WITH_CYCLES_CUDA)
        set(CYCLES_CUDA_ARCH sm_10 sm_11 sm_12 sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build for")
        set(CYCLES_CUDA_MAXREG 24 CACHE STRING "CUDA maximum number of register to use")
 
-       find_library(CUDA_LIBRARIES NAMES cuda PATHS ${CYCLES_CUDA}/lib ${CYCLES_CUDA}/lib/Win32 NO_DEFAULT_PATH)
        find_path(CUDA_INCLUDES cuda.h ${CYCLES_CUDA}/include NO_DEFAULT_PATH)
        find_program(CUDA_NVCC NAMES nvcc PATHS ${CYCLES_CUDA}/bin NO_DEFAULT_PATH)
 
-       if(CUDA_INCLUDES AND CUDA_LIBRARIES AND CUDA_NVCC)
+       if(CUDA_INCLUDES AND CUDA_NVCC)
                message(STATUS "CUDA includes = ${CUDA_INCLUDES}")
-               message(STATUS "CUDA library = ${CUDA_LIBRARIES}")
                message(STATUS "CUDA nvcc = ${CUDA_NVCC}")
        else()
                message(STATUS "CUDA not found")
index 4fae9310a7f5e0b24a57907a7207b1aa5e4721eb..cd0d64f37ddffed7632e1e61513bf090a966cda5 100644 (file)
@@ -99,13 +99,13 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int width, in
        glPixelZoom(1.0f, 1.0f);
 }
 
-Device *Device::create(DeviceType type, bool background)
+Device *Device::create(DeviceType type, bool background, int threads)
 {
        Device *device;
 
        switch(type) {
                case DEVICE_CPU:
-                       device = device_cpu_create();
+                       device = device_cpu_create(threads);
                        break;
 #ifdef WITH_CUDA
                case DEVICE_CUDA:
index aba077fc2f31cca25aff128be0568309b55bacf5..8006eea1a5f4edf7febc131faecb69d5e22f6113 100644 (file)
@@ -123,7 +123,7 @@ public:
 #endif
 
        /* static */
-       static Device *create(DeviceType type, bool background = true);
+       static Device *create(DeviceType type, bool background = true, int threads = 0);
 
        static DeviceType type_from_string(const char *name);
        static string string_from_type(DeviceType type);
index bb47a127f2008f52e7bab2416981c6d6f6267657..7066efee547363705a6404e7396d9c44368b2067 100644 (file)
@@ -44,10 +44,14 @@ public:
        ThreadQueue<DeviceTask> tasks;
        KernelGlobals *kg;
        
-       CPUDevice()
+       CPUDevice(int threads_num)
        {
                kg = kernel_globals_create();
-               threads.resize(system_cpu_thread_count());
+
+               if(threads_num == 0)
+                       threads_num = system_cpu_thread_count();
+
+               threads.resize(threads_num);
 
                for(size_t i = 0; i < threads.size(); i++)
                        threads[i] = new thread(function_bind(&CPUDevice::thread_run, this, i));
@@ -207,9 +211,9 @@ public:
        }
 };
 
-Device *device_cpu_create()
+Device *device_cpu_create(int threads)
 {
-       return new CPUDevice();
+       return new CPUDevice(threads);
 }
 
 CCL_NAMESPACE_END
index b2875b168b4b74ee9888ba7290fbae45c24562a6..e098ac1f0e30d35c45fd12f075e0344992a4b260 100644 (file)
@@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN
 
 class Device;
 
-Device *device_cpu_create();
+Device *device_cpu_create(int threads);
 Device *device_opencl_create(bool background);
 Device *device_cuda_create(bool background);
 Device *device_network_create(const char *address);
index 9fa0e548cab8458c7e6071ca0a45d4481d5b740b..56fbadcee084d45386ebc1f21329df64e4377067 100644 (file)
@@ -37,7 +37,7 @@ Session::Session(const SessionParams& params_)
 {
        device_use_gl = (params.device_type == DEVICE_CUDA && !params.background);
 
-       device = Device::create(params.device_type, params.background);
+       device = Device::create(params.device_type, params.background, params.threads);
        buffers = new RenderBuffers(device);
        display = new DisplayBuffer(device);
 
index 7b23a89afc2bbfd09f2a3e16863edb743cff38ea..3411dcd23c692efed81eb559ac294ac0bd3d5505 100644 (file)
@@ -46,6 +46,7 @@ public:
        int passes;
        int tile_size;
        int min_size;
+       int threads;
 
        double cancel_timeout;
        double reset_timeout;
@@ -61,6 +62,7 @@ public:
                passes = INT_MAX;
                tile_size = 64;
                min_size = 64;
+               threads = 0;
 
                cancel_timeout = 0.1;
                reset_timeout = 0.1;
@@ -75,6 +77,7 @@ public:
                && progressive == params.progressive
                && tile_size == params.tile_size
                && min_size == params.min_size
+               && threads == params.threads
                && cancel_timeout == params.cancel_timeout
                && reset_timeout == params.reset_timeout
                && text_timeout == params.text_timeout); }