diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-20 20:59:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-21 14:01:03 +0300 |
commit | 7780a108b3d561989b52c7a553969c31509a95ed (patch) | |
tree | 4e6db224c2f9df80d2f90af070f1dc56c27150ae /intern/cycles | |
parent | a41240439b002fc26d2fa5dff51134cb960607f8 (diff) |
Cycles: Simplify some extra OpenCL query code
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/device/opencl/opencl_base.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/device/opencl/opencl_split.cpp | 10 |
2 files changed, 4 insertions, 12 deletions
diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp index 51ff39f0ad3..0328dfed689 100644 --- a/intern/cycles/device/opencl/opencl_base.cpp +++ b/intern/cycles/device/opencl/opencl_base.cpp @@ -152,10 +152,8 @@ OpenCLDeviceBase::~OpenCLDeviceBase() void CL_CALLBACK OpenCLDeviceBase::context_notify_callback(const char *err_info, const void * /*private_info*/, size_t /*cb*/, void *user_data) { - char name[256]; - clGetDeviceInfo((cl_device_id)user_data, CL_DEVICE_NAME, sizeof(name), &name, NULL); - - fprintf(stderr, "OpenCL error (%s): %s\n", name, err_info); + string device_name = OpenCLInfo::get_device_name((cl_device_id)user_data); + fprintf(stderr, "OpenCL error (%s): %s\n", device_name.c_str(), err_info); } bool OpenCLDeviceBase::opencl_version_check() diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp index 3faae4039e3..d50ae585062 100644 --- a/intern/cycles/device/opencl/opencl_split.cpp +++ b/intern/cycles/device/opencl/opencl_split.cpp @@ -41,11 +41,7 @@ static string get_build_options(OpenCLDeviceBase *device, const DeviceRequestedF /* Set compute device build option. */ cl_device_type device_type; - device->ciErr = clGetDeviceInfo(device->cdDevice, - CL_DEVICE_TYPE, - sizeof(cl_device_type), - &device_type, - NULL); + OpenCLInfo::get_device_type(device->cdDevice, &device_type, &device->ciErr); assert(device->ciErr == CL_SUCCESS); if(device_type == CL_DEVICE_TYPE_GPU) { build_options += " -D__COMPUTE_DEVICE_GPU__"; @@ -346,9 +342,7 @@ public: virtual int2 split_kernel_global_size(device_memory& kg, device_memory& data, DeviceTask */*task*/) { - cl_device_type type; - clGetDeviceInfo(device->cdDevice, CL_DEVICE_TYPE, sizeof(cl_device_type), &type, NULL); - + cl_device_type type = OpenCLInfo::get_device_type(device->cdDevice); /* Use small global size on CPU devices as it seems to be much faster. */ if(type == CL_DEVICE_TYPE_CPU) { VLOG(1) << "Global size: (64, 64)."; |