[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39850] branches/cycles/intern/cycles: Cycles: fix broken kernel compile after recent change, some tweaks
Brecht Van Lommel
brechtvanlommel at pandora.be
Thu Sep 1 21:43:58 CEST 2011
Revision: 39850
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39850
Author: blendix
Date: 2011-09-01 19:43:57 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
Cycles: fix broken kernel compile after recent change, some tweaks
to UI to only show options when available, fix linux lib detection.
Modified Paths:
--------------
branches/cycles/intern/cycles/blender/addon/enums.py
branches/cycles/intern/cycles/blender/addon/ui.py
branches/cycles/intern/cycles/blender/blender_sync.cpp
branches/cycles/intern/cycles/kernel/kernel_shader.h
branches/cycles/intern/cycles/util/util_opencl.c
Modified: branches/cycles/intern/cycles/blender/addon/enums.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/enums.py 2011-09-01 19:00:23 UTC (rev 39849)
+++ branches/cycles/intern/cycles/blender/addon/enums.py 2011-09-01 19:43:57 UTC (rev 39850)
@@ -22,7 +22,7 @@
gpu_type = (
("CUDA", "CUDA", "NVidia only"),
-("OPENCL", "OpenCL", ""))
+("OPENCL", "OpenCL (incomplete)", ""))
shading_systems = (
("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"),
Modified: branches/cycles/intern/cycles/blender/addon/ui.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/ui.py 2011-09-01 19:00:23 UTC (rev 39849)
+++ branches/cycles/intern/cycles/blender/addon/ui.py 2011-09-01 19:43:57 UTC (rev 39850)
@@ -522,10 +522,14 @@
if scene.render.engine == "CYCLES":
cscene = scene.cycles
- if ('cuda' or 'opencl') in engine.available_devices():
+ available_devices = engine.available_devices()
+ available_cuda = 'cuda' in available_devices
+ available_opencl = 'opencl' in available_devices
+
+ if available_cuda or available_opencl:
layout.prop(cscene, "device")
- if cscene.device == 'GPU':
- layout.prop(cscene, "gpu_type", expand=True)
+ if cscene.device == 'GPU' and available_cuda and available_opencl:
+ layout.prop(cscene, "gpu_type")
if cscene.device == 'CPU' and engine.with_osl():
layout.prop(cscene, "shading_system")
Modified: branches/cycles/intern/cycles/blender/blender_sync.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_sync.cpp 2011-09-01 19:00:23 UTC (rev 39849)
+++ branches/cycles/intern/cycles/blender/blender_sync.cpp 2011-09-01 19:43:57 UTC (rev 39850)
@@ -199,24 +199,34 @@
return (background)? false: get_boolean(cscene, "preview_pause");
}
+static bool device_type_available(vector<DeviceType>& types, DeviceType dtype)
+{
+ foreach(DeviceType dt, types)
+ if(dt == dtype)
+ return true;
+
+ return false;
+}
+
SessionParams BlenderSync::get_session_params(BL::Scene b_scene, bool background)
{
SessionParams params;
- DeviceType dtype;
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
/* device type */
- if ((RNA_enum_get(&cscene, "device")) == 0)
- dtype = DEVICE_CPU;
- else
- dtype = ((RNA_enum_get(&cscene, "gpu_type")) == 0)? DEVICE_CUDA: DEVICE_OPENCL;
-
params.device_type = DEVICE_CPU;
- vector<DeviceType> types = Device::available_types();
- foreach(DeviceType dt, types)
- if(dt == dtype)
+ if(RNA_enum_get(&cscene, "device") != 0) {
+ vector<DeviceType> types = Device::available_types();
+ DeviceType dtype = (RNA_enum_get(&cscene, "gpu_type") == 0)? DEVICE_CUDA: DEVICE_OPENCL;
+
+ if(device_type_available(types, dtype))
params.device_type = dtype;
+ else if(device_type_available(types, DEVICE_OPENCL))
+ params.device_type = DEVICE_OPENCL;
+ else if(device_type_available(types, DEVICE_CUDA))
+ params.device_type = DEVICE_CUDA;
+ }
/* Background */
params.background = background;
Modified: branches/cycles/intern/cycles/kernel/kernel_shader.h
===================================================================
--- branches/cycles/intern/cycles/kernel/kernel_shader.h 2011-09-01 19:00:23 UTC (rev 39849)
+++ branches/cycles/intern/cycles/kernel/kernel_shader.h 2011-09-01 19:43:57 UTC (rev 39850)
@@ -357,8 +357,8 @@
if(sd->svm_closure == CLOSURE_HOLDOUT_ID)
return make_float3(1.0f, 1.0f, 1.0f);
else
+#endif
return make_float3(0.0f, 0.0f, 0.0f);
-#endif
}
}
Modified: branches/cycles/intern/cycles/util/util_opencl.c
===================================================================
--- branches/cycles/intern/cycles/util/util_opencl.c 2011-09-01 19:00:23 UTC (rev 39849)
+++ branches/cycles/intern/cycles/util/util_opencl.c 2011-09-01 19:43:57 UTC (rev 39850)
@@ -134,7 +134,7 @@
#elif defined(__APPLE__)
const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
#else
- const char *path = "libopencl.so";
+ const char *path = "libOpenCL.so";
#endif
int error = 0;
More information about the Bf-blender-cvs
mailing list