[Mesa-dev] [PATCH 3/3 v4.1] clover: add clLinkProgramm (CL 1.2)

EdB edb+mesa at sigluy.net
Sat Jul 25 14:58:14 PDT 2015


---
 src/gallium/state_trackers/clover/api/program.cpp | 33 +++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
index 553bc83..086f952 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 = intrusive_ref<program>(*(new 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;
-- 
2.5.0.rc2



More information about the mesa-dev mailing list