summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2012-03-26 15:55:08 -0400
committerTom Stellard <thomas.stellard@amd.com>2012-03-26 15:55:08 -0400
commitd425853dd9111b68def72fc25c949aa9f12146a2 (patch)
treecb9eb893b44b395b7a8499154876e4584988f90c
parentdf4efa63e13eeae05694986c9ad27e9abc2a68d8 (diff)
Add clSimpleEnqueueReadBuffer()
Also a better error mesage for clCreateBuffer()
-rw-r--r--cl_simple.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/cl_simple.c b/cl_simple.c
index eddfe21..169807a 100644
--- a/cl_simple.c
+++ b/cl_simple.c
@@ -75,7 +75,29 @@ unsigned clSimpleCreateBuffer(cl_mem * buffer, cl_context context,
&error); /* error code */
if (error != CL_SUCCESS) {
- fprintf(stderr, "clCreateBuffer() failed: %s\n", clUtilErrorString(error));
+ fprintf(stderr, "clCreateBuffer(%p, %p, %u, %u) failed: %s\n",
+ buffer, context, flags, size,
+ clUtilErrorString(error));
+ return 0;
+ }
+
+ return 1;
+}
+
+unsigned clSimpleEnqueueWriteBuffer(cl_command_queue command_queue,
+ cl_mem buffer, size_t buffer_size, void * ptr)
+{
+
+ cl_int error = clEnqueueWriteBuffer(command_queue,
+ buffer,
+ CL_TRUE, /* Blocking write */
+ 0, /* Offset into buffer */
+ buffer_size,
+ ptr,
+ 0, /* Events in waiting list */
+ NULL, /* Wait list */
+ NULL); /* Event */
+ if (error != CL_SUCCESS) {
return 0;
}