diff options
author | Serge Martin <[email protected]> | 2016-05-08 21:57:34 -0700 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2016-07-11 20:34:35 -0700 |
commit | f29ed2da2423c8be8a6745f4e98ee16cd699533e (patch) | |
tree | 536d9b4745f4669419833b8641815eab5916af47 /src/gallium/state_trackers/clover | |
parent | c478db6c0a54307b0ec816e63e86deb04a130b9c (diff) |
clover: Add clLinkProgram (CL 1.2).
[ Francisco Jerez: Use validate_build_common for error checking,
simplify control flow slightly and handle additional exception
types. ]
Reviewed-by: Francisco Jerez <[email protected]>
Tested-by: Jan Vesely <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/clover')
-rw-r--r-- | src/gallium/state_trackers/clover/api/program.cpp | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index 18360990cc3..0303c1e9e6e 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -240,10 +240,33 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs, CLOVER_API cl_program clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs, const char *p_opts, cl_uint num_progs, const cl_program *d_progs, - void (*pfn_notify)(cl_program, void *), void *user_data, - cl_int *r_errcode) { - CLOVER_NOT_SUPPORTED_UNTIL("1.2"); - ret_error(r_errcode, CL_LINKER_NOT_AVAILABLE); + void (*pfn_notify) (cl_program, void *), void *user_data, + cl_int *r_errcode) try { + auto &ctx = obj(d_ctx); + auto devs = (d_devs ? objs(d_devs, num_devs) : + ref_vector<device>(ctx.devices())); + auto opts = (p_opts ? p_opts : ""); + auto progs = objs(d_progs, num_progs); + auto prog = create<program>(ctx); + + validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data); + + try { + prog().link(devs, opts, progs); + ret_error(r_errcode, CL_SUCCESS); + + } catch (build_error &e) { + ret_error(r_errcode, CL_LINK_PROGRAM_FAILURE); + } + + return ret_object(prog); + +} catch (invalid_build_options_error &e) { + ret_error(r_errcode, CL_INVALID_LINKER_OPTIONS); + return NULL; + +} catch (error &e) { + ret_error(r_errcode, e); return NULL; } |