From 90b73bec02cb35f672e991e4ac9a9144e3194634 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Mon, 30 Nov 2015 17:23:42 -0600 Subject: [PATCH] Fix symbol not found for create_image_from_desc on CL 1.1 --- src/c_wrapper/error.h | 7 +++++++ src/c_wrapper/image.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/c_wrapper/error.h b/src/c_wrapper/error.h index 3a7ed85e..5730f361 100644 --- a/src/c_wrapper/error.h +++ b/src/c_wrapper/error.h @@ -21,6 +21,13 @@ #define PYOPENCL_CL_CASTABLE_THIS data() #endif +#define PYOPENCL_UNSUPPORTED(ROUTINE, VERSION) \ + auto err = (error*)malloc(sizeof(error)); \ + err->routine = strdup(#ROUTINE); \ + err->msg = strdup("unsupported in " VERSION); \ + err->code = CL_INVALID_VALUE \ + err->other = 0; \ + return err; class clerror : public std::runtime_error { private: diff --git a/src/c_wrapper/image.cpp b/src/c_wrapper/image.cpp index 427f1e34..12f0f563 100644 --- a/src/c_wrapper/image.cpp +++ b/src/c_wrapper/image.cpp @@ -81,21 +81,23 @@ create_image_3d(clobj_t *img, clobj_t _ctx, cl_mem_flags flags, }); } -#if PYOPENCL_CL_VERSION >= 0x1020 error* create_image_from_desc(clobj_t *img, clobj_t _ctx, cl_mem_flags flags, cl_image_format *fmt, cl_image_desc *desc, void *buf) { +#if PYOPENCL_CL_VERSION >= 0x1020 auto ctx = static_cast<context*>(_ctx); return c_handle_error([&] { auto mem = pyopencl_call_guarded(clCreateImage, ctx, flags, fmt, desc, buf); *img = new_image(mem, fmt); }); +#else + PYOPENCL_UNSUPPORTED(clCreateImage, "CL 1.1 and below") +#endif } -#endif error* image__get_image_info(clobj_t _img, cl_image_info param, generic_info *out) -- GitLab