--- src/gallium/state_trackers/clover/api/program.cpp | 33 ++++++++++++++++++++++ src/gallium/state_trackers/clover/core/program.hpp | 4 +-- 2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index 553bc83..4176562 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -238,6 +238,39 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs, return e.get(); } +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) 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); + + if (!pfn_notify && user_data) + throw error(CL_INVALID_VALUE); + + if (any_of([&](const device &dev) { + return !count(dev, ctx.devices()); + }, objs<allow_empty_tag>(d_devs, num_devs))) + throw error(CL_INVALID_DEVICE); + + auto prog = create<program>(ctx); + try { + prog().link(devs, opts, progs); + ret_error(r_errcode, CL_SUCCESS); + } catch (link_error &e) { + ret_error(r_errcode, CL_LINK_PROGRAM_FAILURE); + } + + return ret_object(prog); +} catch (error &e) { + ret_error(r_errcode, e); + return NULL; +} + CLOVER_API cl_int clUnloadCompiler() { return CL_SUCCESS; diff --git a/src/gallium/state_trackers/clover/core/program.hpp b/src/gallium/state_trackers/clover/core/program.hpp index 7d86018..a70ed08 100644 --- a/src/gallium/state_trackers/clover/core/program.hpp +++ b/src/gallium/state_trackers/clover/core/program.hpp @@ -40,8 +40,8 @@ namespace clover { program(clover::context &ctx, const std::string &source); program(clover::context &ctx, - const ref_vector<device> &devs, - const std::vector<module> &binaries); + const ref_vector<device> &devs = {}, + const std::vector<module> &binaries = {}); program(const program &prog) = delete; program & -- 2.5.0.rc2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev