clover: Handle NULL devs argument in clBuildProgram
authorTom Stellard <tstellar@gmail.com>
Thu, 28 Jun 2012 20:05:21 +0000 (20:05 +0000)
committerFrancisco Jerez <currojerez@riseup.net>
Sun, 1 Jul 2012 13:45:24 +0000 (15:45 +0200)
If devs is NULL, then the kernel should be compiled for all devices
associated with the program.

src/gallium/state_trackers/clover/api/program.cpp

index e874c51..b167904 100644 (file)
@@ -142,12 +142,17 @@ clBuildProgram(cl_program prog, cl_uint count, const cl_device_id *devs,
        (!pfn_notify && user_data))
       throw error(CL_INVALID_VALUE);
 
-   if (any_of([&](const cl_device_id dev) {
-            return !prog->ctx.has_device(dev);
-         }, devs, devs + count))
-      throw error(CL_INVALID_DEVICE);
+   if (devs) {
+      if (any_of([&](const cl_device_id dev) {
+               return !prog->ctx.has_device(dev);
+            }, devs, devs + count))
+         throw error(CL_INVALID_DEVICE);
+
+      prog->build({ devs, devs + count });
+   } else {
+      prog->build(prog->ctx.devs);
+   }
 
-   prog->build({ devs, devs + count });
    return CL_SUCCESS;
 
 } catch (error &e) {