Cycles: fix broken kernel compile after recent change, some tweaks

to UI to only show options when available, fix linux lib detection.
This commit is contained in:
Brecht Van Lommel 2011-09-01 19:43:57 +00:00
parent 27102bfec4
commit 8ddef5163f
5 changed files with 29 additions and 15 deletions

@ -22,7 +22,7 @@ devices = (
gpu_type = (
("CUDA", "CUDA", "NVidia only"),
("OPENCL", "OpenCL", ""))
("OPENCL", "OpenCL (incomplete)", ""))
shading_systems = (
("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"),

@ -522,10 +522,14 @@ def draw_device(self, context):
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")

@ -199,24 +199,34 @@ bool BlenderSync::get_session_pause(BL::Scene b_scene, bool background)
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;

@ -357,8 +357,8 @@ __device float3 shader_holdout_eval(KernelGlobals *kg, ShaderData *sd)
if(sd->svm_closure == CLOSURE_HOLDOUT_ID)
return make_float3(1.0f, 1.0f, 1.0f);
else
return make_float3(0.0f, 0.0f, 0.0f);
#endif
return make_float3(0.0f, 0.0f, 0.0f);
}
}

@ -134,7 +134,7 @@ int clLibraryInit()
#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;