Commit: 7780a108b3d561989b52c7a553969c31509a95ed
Author: Sergey Sharybin
Date:   Mon Mar 20 18:59:46 2017 +0100
Branches: master
https://developer.blender.org/rB7780a108b3d561989b52c7a553969c31509a95ed

Cycles: Simplify some extra OpenCL query code

===================================================================

M       intern/cycles/device/opencl/opencl_base.cpp
M       intern/cycles/device/opencl/opencl_split.cpp

===================================================================

diff --git a/intern/cycles/device/opencl/opencl_base.cpp 
b/intern/cycles/device/opencl/opencl_base.cpp
index 51ff39f0ad..0328dfed68 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 3faae4039e..d50ae58506 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).";

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to