summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cl_simple.c14
-rw-r--r--cl_simple.h3
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,