summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2014-10-21 10:33:21 -0400
committerTom Stellard <[email protected]>2014-10-31 15:24:00 -0400
commit64b0fac5e25370224b383c748f1a56b4ef1eb2d6 (patch)
tree350be50cd38e3e7d2a92d6a9938b58d15befb4f5 /src/gallium/state_trackers
parente5468dfa523be2a7a0d04bb9efcf8ae780957563 (diff)
clover: Fix bug when binary programs are passed to clBuildProgram() v2
This was a regression introduced by 611d66fe4513e53bde052dd2bab95d448c909a2a Passing a binary program to clBuildProgram() is legal, but passing one to clCompileProgram() is not. v2: - Code cleanups. Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/clover/api/program.cpp18
-rw-r--r--src/gallium/state_trackers/clover/core/program.hpp2
2 files changed, 14 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
index e32312eec1b..64c4a43f4b3 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -171,12 +171,20 @@ CLOVER_API cl_int
clBuildProgram(cl_program d_prog, cl_uint num_devs,
const cl_device_id *d_devs, const char *p_opts,
void (*pfn_notify)(cl_program, void *),
- void *user_data) {
- cl_int ret = clCompileProgram(d_prog, num_devs, d_devs, p_opts,
- 0, NULL, NULL, pfn_notify, user_data);
+ void *user_data) try {
+ auto &prog = obj(d_prog);
+ auto devs = (d_devs ? objs(d_devs, num_devs) :
+ ref_vector<device>(prog.context().devices()));
+ auto opts = (p_opts ? p_opts : "");
- return (ret == CL_COMPILE_PROGRAM_FAILURE ?
- CL_BUILD_PROGRAM_FAILURE : ret);
+ validate_build_program_common(prog, num_devs, devs, pfn_notify, user_data);
+
+ prog.build(devs, opts);
+ return CL_SUCCESS;
+} catch (error &e) {
+ if (e.get() == CL_COMPILE_PROGRAM_FAILURE)
+ return CL_BUILD_PROGRAM_FAILURE;
+ return e.get();
}
CLOVER_API cl_int
diff --git a/src/gallium/state_trackers/clover/core/program.hpp b/src/gallium/state_trackers/clover/core/program.hpp
index b5aae7e0dff..661fa03102c 100644
--- a/src/gallium/state_trackers/clover/core/program.hpp
+++ b/src/gallium/state_trackers/clover/core/program.hpp
@@ -48,7 +48,7 @@ namespace clover {
operator=(const program &prog) = delete;
void build(const ref_vector<device> &devs, const char *opts,
- const header_map &headers);
+ const header_map &headers = {});
const bool has_source;
const std::string &source() const;