Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-01-09 20:58:01 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-01-09 20:58:01 +0400
commitd7932ceea82a3c2277a179c00ca72ecb3cfb97cb (patch)
tree933570102e52c7562b87534e87c0c38bb5eb47ec /source
parent47d9c6689be0448b898d18a1e810d2150867938b (diff)
Cycles: multi GPU rendering support.
The rendering device is now set in User Preferences > System, where you can choose between OpenCL/CUDA and devices. Per scene you can then still choose to use CPU or GPU rendering. Load balancing still needs to be improved, now it just splits the entire render in two, that will be done in a separate commit.
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h7
-rw-r--r--source/blender/makesrna/SConscript5
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt4
-rw-r--r--source/blender/makesrna/intern/SConscript5
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c100
-rw-r--r--source/blender/python/SConscript2
-rw-r--r--source/blender/python/intern/CMakeLists.txt1
-rw-r--r--source/blender/python/intern/bpy_interface.c15
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c3
9 files changed, 127 insertions, 15 deletions
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index b3398460500..fc418069c5c 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -413,6 +413,9 @@ typedef struct UserDef {
short pad3;
char author[80]; /* author name for file formats supporting it */
+
+ int compute_device_type;
+ int compute_device_id;
} UserDef;
extern UserDef U; /* from blenkernel blender.c */
@@ -627,6 +630,10 @@ extern UserDef U; /* from blenkernel blender.c */
#define NDOF_PANY_INVERT_AXIS (1 << 13)
#define NDOF_PANZ_INVERT_AXIS (1 << 14)
+/* compute_device_type */
+#define USER_COMPUTE_DEVICE_NONE 0
+#define USER_COMPUTE_DEVICE_OPENCL 1
+#define USER_COMPUTE_DEVICE_CUDA 2
#ifdef __cplusplus
}
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index 9eea6d83cb9..7eb5d042dd7 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -8,7 +8,7 @@ objs += o
incs = '#/intern/guardedalloc #/intern/memutil #/intern/audaspace/intern ../blenkernel ../blenlib ../makesdna intern .'
incs += ' ../windowmanager ../editors/include ../gpu ../imbuf ../ikplugin ../blenfont ../blenloader'
-incs += ' ../render/extern/include'
+incs += ' ../render/extern/include #/intern/cycles/blender'
incs += ' ../nodes'
incs += ' #/extern/glew/include'
@@ -58,6 +58,9 @@ if env['WITH_BF_COLLADA']:
if env['WITH_BF_OCEANSIM']:
defs.append('WITH_OCEANSIM')
+if env['WITH_BF_CYCLES']:
+ defs.append('WITH_CYCLES')
+
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index fd9cd26cbfa..5bbdac646a7 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -143,6 +143,9 @@ set(INC_SYS
)
+if(WITH_CYCLES)
+ add_definitions(-DWITH_CYCLES)
+endif()
if(WITH_PYTHON)
add_definitions(-DWITH_PYTHON)
@@ -246,6 +249,7 @@ blender_include_dirs(
../../editors/include
../../render/extern/include
../../../../intern/audaspace/intern
+ ../../../../intern/cycles/blender
../../../../intern/guardedalloc
../../../../intern/memutil
)
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index d710dd06a17..1fc6ed0f130 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -33,7 +33,7 @@ incs = '#/intern/guardedalloc ../../blenlib ../../blenkernel ../../blenloader'
incs += ' ../../imbuf ../../makesdna ../../makesrna ../../ikplugin'
incs += ' ../../windowmanager ../../editors/include ../../blenfont'
incs += ' ../../render/extern/include'
-incs += ' #/intern/audaspace/intern '
+incs += ' #/intern/audaspace/intern #/intern/cycles/blender'
incs += ' #/extern/glew/include '
if env['WITH_BF_OPENEXR']:
@@ -91,6 +91,9 @@ if env['WITH_BF_PYTHON']:
if env['WITH_BF_COLLADA']:
defs.append('WITH_COLLADA')
+if env['WITH_BF_CYCLES']:
+ defs.append('WITH_CYCLES')
+
if env['OURPLATFORM'] == 'linux':
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 164f8e4f0d0..4564b9f2946 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -46,6 +46,14 @@
#include "BKE_sound.h"
+#ifdef WITH_CYCLES
+static EnumPropertyItem compute_device_type_items[] = {
+ {USER_COMPUTE_DEVICE_NONE, "NONE", 0, "None", "Don't use compute device"},
+ {USER_COMPUTE_DEVICE_CUDA, "CUDA", 0, "CUDA", "Use CUDA for GPU acceleration"},
+ {USER_COMPUTE_DEVICE_OPENCL, "OPENCL", 0, "OpenCL", "Use OpenCL for GPU acceleration"},
+ { 0, NULL, 0, NULL, NULL}};
+#endif
+
#ifdef RNA_RUNTIME
#include "DNA_object_types.h"
@@ -65,6 +73,8 @@
#include "UI_interface.h"
+#include "CCL_api.h"
+
static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
WM_main_add_notifier(NC_WINDOW, NULL);
@@ -302,6 +312,68 @@ static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
WM_main_add_notifier(NC_WINDOW, NULL);
}
+#ifdef WITH_CYCLES
+static EnumPropertyItem *rna_userdef_compute_device_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+{
+ EnumPropertyItem *item= NULL;
+ int totitem= 0;
+
+ /* add supported device types */
+ RNA_enum_items_add_value(&item, &totitem, compute_device_type_items, USER_COMPUTE_DEVICE_NONE);
+ if(CCL_compute_device_list(0))
+ RNA_enum_items_add_value(&item, &totitem, compute_device_type_items, USER_COMPUTE_DEVICE_CUDA);
+ if(CCL_compute_device_list(1))
+ RNA_enum_items_add_value(&item, &totitem, compute_device_type_items, USER_COMPUTE_DEVICE_OPENCL);
+
+ RNA_enum_item_end(&item, &totitem);
+ *free = 1;
+
+ return item;
+}
+
+static int rna_userdef_compute_device_get(PointerRNA *UNUSED(ptr))
+{
+ if(U.compute_device_type == USER_COMPUTE_DEVICE_NONE)
+ return 0;
+
+ return U.compute_device_id;
+}
+
+static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+{
+ EnumPropertyItem tmp= {0, "", 0, "", ""};
+ EnumPropertyItem *item= NULL;
+ int totitem= 0;
+
+ if(U.compute_device_type == USER_COMPUTE_DEVICE_NONE) {
+ /* only add a single CPU device */
+ tmp.value = 0;
+ tmp.name = "CPU";
+ tmp.identifier = "CPU";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else {
+ /* get device list from cycles. it would be good to make this generic
+ once we have more subsystems using opencl, for now this is easiest */
+ int opencl = (U.compute_device_type == USER_COMPUTE_DEVICE_OPENCL);
+ CCLDeviceInfo *devices = CCL_compute_device_list(opencl);
+ int a;
+
+ for(a = 0; devices[a].name; a++) {
+ tmp.value = devices[a].value;
+ tmp.identifier = devices[a].identifier;
+ tmp.name = devices[a].name;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *free = 1;
+
+ return item;
+}
+#endif
+
#else
static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
@@ -2645,6 +2717,12 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
{ 0, NULL, 0, NULL, NULL}};
+#ifdef WITH_CYCLES
+ static EnumPropertyItem compute_device_items[] = {
+ {0, "CPU", 0, "CPU", ""},
+ { 0, NULL, 0, NULL, NULL}};
+#endif
+
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");
RNA_def_struct_nested(brna, srna, "UserPreferences");
@@ -2853,14 +2931,20 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
RNA_def_property_update(prop, 0, "rna_userdef_text_update");
-#if 0
- prop= RNA_def_property(srna, "verse_master", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "versemaster");
- RNA_def_property_ui_text(prop, "Verse Master", "Verse Master-server IP");
-
- prop= RNA_def_property(srna, "verse_username", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "verseuser");
- RNA_def_property_ui_text(prop, "Verse Username", "Verse user name");
+#ifdef WITH_CYCLES
+ prop= RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
+ RNA_def_property_enum_sdna(prop, NULL, "compute_device_type");
+ RNA_def_property_enum_items(prop, compute_device_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_compute_device_type_itemf");
+ RNA_def_property_ui_text(prop, "Compute Device Type", "Device to use for computation (rendering with Cycles)");
+
+ prop= RNA_def_property(srna, "compute_device", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
+ RNA_def_property_enum_sdna(prop, NULL, "compute_device_id");
+ RNA_def_property_enum_items(prop, compute_device_items);
+ RNA_def_property_enum_funcs(prop, "rna_userdef_compute_device_get", NULL, "rna_userdef_compute_device_itemf");
+ RNA_def_property_ui_text(prop, "Compute Device", "Device to use for computation");
#endif
}
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index cd1666d0eed..2a47c2dcb96 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -6,7 +6,7 @@ Import ('env')
incs = '. ../editors/include ../makesdna ../makesrna ../blenfont ../blenlib ../blenkernel ../nodes'
incs += ' ../imbuf ../blenloader ../gpu ../render/extern/include ../windowmanager'
-incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include'
+incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include #intern/cycles/blender'
incs += ' #intern/audaspace/intern ' + env['BF_PYTHON_INC']
is_debug = (env['OURPLATFORM'] in ('win32-mingw', 'win32-vc','win64-vc') and env['BF_DEBUG'])
diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt
index f110576a297..05583e133dc 100644
--- a/source/blender/python/intern/CMakeLists.txt
+++ b/source/blender/python/intern/CMakeLists.txt
@@ -35,6 +35,7 @@ set(INC
../../windowmanager
../../gpu
../../../../intern/guardedalloc
+ ../../../../intern/cycles/blender
)
set(INC_SYS
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 7d91438e4f7..6c961d8e6a8 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -57,12 +57,13 @@
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
-
#include "BKE_context.h"
#include "BKE_text.h"
#include "BKE_main.h"
#include "BKE_global.h" /* only for script checking */
+#include "CCL_api.h"
+
#include "BPY_extern.h"
#include "../generic/bpy_internal_import.h" // our own imports
@@ -176,8 +177,14 @@ void BPY_context_set(bContext *C)
/* defined in AUD_C-API.cpp */
extern PyObject *AUD_initPython(void);
-/* defined in cycles/blender */
-extern PyObject *CYCLES_initPython(void);
+
+#ifdef WITH_CYCLES
+/* defined in cycles module */
+static PyObject *CCL_initPython(void)
+{
+ return (PyObject*)CCL_python_module_init();
+}
+#endif
static struct _inittab bpy_internal_modules[] = {
{(char *)"mathutils", PyInit_mathutils},
@@ -189,7 +196,7 @@ static struct _inittab bpy_internal_modules[] = {
{(char *)"aud", AUD_initPython},
#endif
#ifdef WITH_CYCLES
- {(char *)"_cycles", CYCLES_initPython},
+ {(char *)"_cycles", CCL_initPython},
#endif
{(char *)"gpu", GPU_initPython},
{NULL, NULL}
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 75d1f182189..9efb8114cbd 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -475,6 +475,9 @@ struct DualConMesh *dualcon(const struct DualConMesh *input_mesh,
float scale,
int depth) {return 0;}
+/* intern/cycles */
+struct CCLDeviceInfo;
+struct CCLDeviceInfo *CCL_compute_device_list(int opencl) { return NULL; }
char blender_path[] = "";