diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-03-26 15:55:08 -0400 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-03-26 15:55:08 -0400 |
commit | d425853dd9111b68def72fc25c949aa9f12146a2 (patch) | |
tree | cb9eb893b44b395b7a8499154876e4584988f90c | |
parent | df4efa63e13eeae05694986c9ad27e9abc2a68d8 (diff) |
Add clSimpleEnqueueReadBuffer()
Also a better error mesage for clCreateBuffer()
-rw-r--r-- | cl_simple.c | 24 |
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; } |