diff options
author | Benjamin Segovia <segovia.benjamin@gmail.com> | 2012-04-16 01:09:58 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-08-10 16:16:26 -0700 |
commit | 295e6538f97bd05fa918d76fe95602c6aa777c6f (patch) | |
tree | fef15f638968539b5d70f200734b4e9feec4e864 /src/cl_api.c | |
parent | 9f8ea28a1be64e08c7adc7c9c8e69a802c4a7860 (diff) |
Added first support for compilation from source
Diffstat (limited to 'src/cl_api.c')
-rw-r--r-- | src/cl_api.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/cl_api.c b/src/cl_api.c index aa7b6641..b3971b81 100644 --- a/src/cl_api.c +++ b/src/cl_api.c @@ -418,8 +418,19 @@ clCreateProgramWithSource(cl_context context, const size_t * lengths, cl_int * errcode_ret) { - NOT_IMPLEMENTED; - return NULL; + cl_program program = NULL; + cl_int err = CL_SUCCESS; + + CHECK_CONTEXT (context); + program = cl_program_create_from_source(context, + count, + strings, + lengths, + &err); +error: + if (errcode_ret) + *errcode_ret = err; + return program; } cl_program @@ -447,7 +458,6 @@ error: *errcode_ret = err; return program; } - cl_int clRetainProgram(cl_program program) { @@ -476,9 +486,6 @@ clBuildProgram(cl_program program, void (CL_CALLBACK *pfn_notify) (cl_program, void*), void * user_data) { - /* It does nothing today since we only support creation from binary. We just - * try to follow OCL specification - */ cl_int err = CL_SUCCESS; CHECK_PROGRAM(program); INVALID_VALUE_IF (num_devices > 1); @@ -494,14 +501,14 @@ clBuildProgram(cl_program program, } } - /* XXX */ - FATAL_IF (pfn_notify != NULL || user_data != NULL, - "No call back is supported now"); - - /* TODO support create program from source */ - assert(program->from_source == CL_FALSE); + /* TODO support create program from binary */ + assert(program->source_type == FROM_LLVM || + program->source_type == FROM_SOURCE); + cl_program_build(program); program->is_built = CL_TRUE; + if (pfn_notify) pfn_notify(program, user_data); + error: return err; } |