From the OpenCL 1.2 Specification, Section 5.6.2 (about clBuildProgram:

> If program is created with clCreateProgramWithBinary, then the
> program binary must be an executable binary (not a compiled binary or
> library).

Signed-off-by: Pierre Moreau <pierre.mor...@free.fr>
---
 src/gallium/state_trackers/clover/api/program.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/state_trackers/clover/api/program.cpp 
b/src/gallium/state_trackers/clover/api/program.cpp
index 9d59668f8f..6044179587 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -186,6 +186,14 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
    if (prog.has_source) {
       prog.compile(devs, opts);
       prog.link(devs, opts, { prog });
+   } else if (any_of([&](const device &dev){
+         return prog.build(dev).binary_type() != 
CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
+         }, objs<allow_empty_tag>(d_devs, num_devs))) {
+      // OpenCL 1.2 Specification, Section 5.6.2:
+      // > If program is created with clCreateProgramWithBinary, then the
+      // > program binary must be an executable binary (not a compiled binary 
or
+      // > library).
+      throw error(CL_INVALID_BINARY);
    }
 
    return CL_SUCCESS;
-- 
2.16.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to