}
if let Some(cb) = cb_opt {
- unsafe { (cb.func)(program, cb.data) };
+ cb.call(p);
}
//• CL_INVALID_BINARY if program is created with clCreateProgramWithBinary and devices listed in device_list do not have a valid program binary loaded.
}
if let Some(cb) = cb_opt {
- unsafe { (cb.func)(program, cb.data) };
+ cb.call(p);
}
// • CL_INVALID_COMPILER_OPTIONS if the compiler options specified by options are invalid.
CL_LINK_PROGRAM_FAILURE
};
- let res = cl_program::from_arc(res);
-
if let Some(cb) = cb_opt {
- unsafe { (cb.func)(res, cb.data) };
+ cb.call(&res);
}
- Ok((res, code))
+ Ok((cl_program::from_arc(res), code))
//• CL_INVALID_LINKER_OPTIONS if the linker options specified by options are invalid.
//• CL_INVALID_OPERATION if the rules for devices containing compiled binaries or libraries as described in input_programs argument above are not followed.
use crate::core::context::Context;
use crate::core::event::Event;
use crate::core::memory::Mem;
+use crate::core::program::Program;
use crate::core::queue::Queue;
use rusticl_opencl_gen::*;
}
);
+impl ProgramCB {
+ pub fn call(self, program: &Program) {
+ let cl = cl_program::from_ptr(program);
+ // SAFETY: `cl` must have pointed to an OpenCL program, which is where we just got it from.
+ // All other requirements are covered by this callback's type invariants.
+ unsafe { (self.func)(cl, self.data) };
+ }
+}
+
cl_callback!(
SVMFreeCb(FuncSVMFreeCb) {
queue: cl_command_queue,