summaryrefslogtreecommitdiff
path: root/opencl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-02-05 13:16:09 +0200
committerTor Lillqvist <tml@collabora.com>2015-02-05 15:01:16 +0200
commit119d9c33b03790d52d57a27854064ec554a5777c (patch)
tree6b779eb0652d495c21d2858a6095c7a304d4ee3a /opencl
parent32632975a3d88b6a8d6fad31f541b41527abe141 (diff)
The horrible CHECK_OPENCL() fortunately is used only in openclwrapper.cxx
So move it there. While at it, make it use SAL_WARN() instead of printf. Also, add a few more SAL_WARN() and SAL_INFO(). Change-Id: Ib058fb20d07757331ca364a8d7649abc59e9494b
Diffstat (limited to 'opencl')
-rw-r--r--opencl/source/openclwrapper.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 64a84cd78ee5..db53a0436349 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -44,6 +44,13 @@
#define DRIVER_VERSION_LENGTH 1024
#define PLATFORM_VERSION_LENGTH 1024
+#define CHECK_OPENCL(status,name) \
+if( status != CL_SUCCESS ) \
+{ \
+ SAL_WARN( "opencl", "OpenCL error code " << status << " at " SAL_DETAIL_WHERE " from " name ); \
+ return false; \
+}
+
using namespace std;
namespace opencl {
@@ -762,6 +769,8 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
cps[1] = reinterpret_cast<cl_context_properties>(platformId);
cps[2] = 0;
cl_context context = clCreateContext( cps, 1, &pDeviceId, NULL, NULL, &nState );
+ if (nState != CL_SUCCESS)
+ SAL_WARN("opencl", "clCreateContext failed: " << nState);
if(nState != CL_SUCCESS || context == NULL)
{
@@ -771,12 +780,15 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
SAL_WARN("opencl", "failed to set/switch opencl device");
return false;
}
+ SAL_INFO("opencl", "Created context " << context << " for platform " << platformId << ", device " << pDeviceId);
cl_command_queue command_queue[OPENCL_CMDQUEUE_SIZE];
for (int i = 0; i < OPENCL_CMDQUEUE_SIZE; ++i)
{
command_queue[i] = clCreateCommandQueue(
context, pDeviceId, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &nState);
+ if (nState != CL_SUCCESS)
+ SAL_WARN("opencl", "clCreateCommandQueue failed: " << nState);
if (command_queue[i] == NULL || nState != CL_SUCCESS)
{
@@ -794,6 +806,8 @@ bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEv
SAL_WARN("opencl", "failed to set/switch opencl device");
return false;
}
+
+ SAL_INFO("opencl", "Created command queue " << command_queue[i] << " for context " << context);
}
setOpenCLCmdQueuePosition(0); // Call this just to avoid the method being deleted from unused function deleter.