[Mesa-dev] [PATCH 2/6] clover: Call clBuildProgram() notification function when build completes v2

Tom Stellard thomas.stellard at amd.com
Mon Mar 30 08:31:38 PDT 2015


v2:
  - Only call notification for build errors
  - Fix clCompileProgram()

Cc: 10.5 10.4 <mesa-stable at lists.freedesktop.org>
---
 src/gallium/state_trackers/clover/api/program.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
index 60184ed..5cd543c 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -180,12 +180,18 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
    validate_build_program_common(prog, num_devs, d_devs, pfn_notify, user_data);
 
    prog.build(devs, opts);
+   if (pfn_notify)
+      pfn_notify(d_prog, user_data);
    return CL_SUCCESS;
+} catch (const build_error &e) {
+   if (pfn_notify)
+      pfn_notify(d_prog, user_data);
+   if (e.get() == CL_COMPILE_PROGRAM_FAILURE)
+      return CL_BUILD_PROGRAM_FAILURE;
+   return e.get();
 } catch (error &e) {
    if (e.get() == CL_INVALID_COMPILER_OPTIONS)
       return CL_INVALID_BUILD_OPTIONS;
-   if (e.get() == CL_COMPILE_PROGRAM_FAILURE)
-      return CL_BUILD_PROGRAM_FAILURE;
    return e.get();
 }
 
@@ -223,8 +229,14 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
       objs<allow_empty_tag>(d_header_progs, num_headers));
 
    prog.build(devs, opts, headers);
+   if (pfn_notify)
+      pfn_notify(d_prog, user_data);
    return CL_SUCCESS;
 
+} catch (const build_error &e) {
+   if (pfn_notify)
+      pfn_notify(d_prog, user_data);
+   return e.get();
 } catch (error &e) {
    return e.get();
 }
-- 
2.0.4



More information about the mesa-dev mailing list