diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-04-27 09:49:45 -0400 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-04-27 09:49:45 -0400 |
commit | b76176dda59d09a2df522ca32231bbd4b05113e0 (patch) | |
tree | eeaba75a564c2bedd31e9c3732271bf136d0ee2f | |
parent | 568f7fcf040bca4b10f61cfb13279780ba5b1051 (diff) |
Add clSimpleCreateKernelString
-rw-r--r-- | cl_simple.c | 14 | ||||
-rw-r--r-- | cl_simple.h | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/cl_simple.c b/cl_simple.c index 169807a..0b37d52 100644 --- a/cl_simple.c +++ b/cl_simple.c @@ -186,9 +186,6 @@ unsigned clSimpleCreateKernel(cl_context context, cl_device_id device_id, */ unsigned filename_len = strlen(kernel_name) + 4; - cl_int error; - cl_program program; - /* Determine file name */ filename = malloc (filename_len + 4); if (!filename) { @@ -221,6 +218,17 @@ unsigned clSimpleCreateKernel(cl_context context, cl_device_id device_id, code_len += bytes_read; } while(bytes_read == CODE_CHUNK); + return clSimpleCreateKernelString(context, device_id, kernel, kernel_name, + code, code_len); +} + +unsigned clSimpleCreateKernelString(cl_context context, cl_device_id device_id, + cl_kernel * kernel, const char * kernel_name, + const char * code, size_t code_len) +{ + cl_int error; + cl_program program; + /* Create program */ program = clCreateProgramWithSource(context, 1, /* Number of strings */ diff --git a/cl_simple.h b/cl_simple.h index 2a324ec..e255086 100644 --- a/cl_simple.h +++ b/cl_simple.h @@ -23,6 +23,9 @@ unsigned clSimpleEnqueueNDRangeKernel(cl_command_queue command_queue, unsigned clSimpleInitGpuDevice(cl_device_id * device_id); unsigned clSimpleCreateKernel(cl_context context, cl_device_id device_id, cl_kernel * kernel, const char * kernel_name); +unsigned clSimpleCreateKernelString(cl_context context, cl_device_id device_id, + cl_kernel * kernel, const char * kernel_name, + const char * code, size_t code_len); unsigned clSimpleSimpleInit(struct cl_simple_context * context, const char * kernel_name); unsigned clSimpleSetOutputBuffer(struct cl_simple_context * context, |