[Mesa-dev] [PATCH] clover: Handle NULL devs argument in clBuildProgram
Tom Stellard
tstellar at gmail.com
Thu Jun 28 13:05:21 PDT 2012
If devs is NULL, then the kernel should be compiled for all devices
associated with the program's context.
---
src/gallium/state_trackers/clover/api/program.cpp | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
index e874c51..e863e00 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -142,12 +142,16 @@ 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);
-
- prog->build({ devs, devs + count });
+ 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.begin(), prog->ctx.devs.end() });
+ }
return CL_SUCCESS;
} catch (error &e) {
--
1.7.7.6
More information about the mesa-dev
mailing list