[Mesa-dev] [PATCH] clover: Add a stub implementation of clCreateImage()

Tom Stellard thomas.stellard at amd.com
Wed Apr 30 12:59:00 PDT 2014


Now that we are uisng the OpenCL 1.2 headers, applications expect all
the OpenCL 1.2 functions to be implemented.

This fixes linking errors with the piglit CL tests.
---
 src/gallium/state_trackers/clover/api/dispatch.cpp |  2 +-
 src/gallium/state_trackers/clover/api/dispatch.hpp |  8 +++++++-
 src/gallium/state_trackers/clover/api/memory.cpp   | 11 +++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/dispatch.cpp b/src/gallium/state_trackers/clover/api/dispatch.cpp
index 2ee6208..488e654 100644
--- a/src/gallium/state_trackers/clover/api/dispatch.cpp
+++ b/src/gallium/state_trackers/clover/api/dispatch.cpp
@@ -120,7 +120,7 @@ namespace clover {
       clCreateSubDevices,
       clRetainDevice,
       clReleaseDevice,
-      NULL, // clCreateImage
+      clCreateImage,
       NULL, // clCreateProgramWithBuiltInKernels
       NULL, // clCompileProgram
       NULL, // clLinkProgram
diff --git a/src/gallium/state_trackers/clover/api/dispatch.hpp b/src/gallium/state_trackers/clover/api/dispatch.hpp
index 833fb0e..ffae1ae 100644
--- a/src/gallium/state_trackers/clover/api/dispatch.hpp
+++ b/src/gallium/state_trackers/clover/api/dispatch.hpp
@@ -653,7 +653,13 @@ struct _cl_icd_dispatch {
    CL_API_ENTRY cl_int (CL_API_CALL *clReleaseDevice)(
       cl_device_id device);
 
-   void *clCreateImage;
+   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateImage)(
+      cl_context context,
+      cl_mem_flags flags,
+      const cl_image_format *image_format,
+      const cl_image_desc *image_desc,
+      void *host_ptr,
+      cl_int *errcode_ret);
 
    CL_API_ENTRY cl_program (CL_API_CALL *clCreateProgramWithBuiltInKernels)(
       cl_context context,
diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp
index 7ed2191..977e06c 100644
--- a/src/gallium/state_trackers/clover/api/memory.cpp
+++ b/src/gallium/state_trackers/clover/api/memory.cpp
@@ -334,3 +334,14 @@ clSetMemObjectDestructorCallback(cl_mem d_mem,
 } catch (error &e) {
    return e.get();
 }
+
+/* This function was added in OpenCL 1.2 */
+CLOVER_API cl_mem
+clCreateImage(cl_context d_ctx, cl_mem_flags flags,
+              const cl_image_format *format,
+              const cl_image_desc *image_desc,
+              void *host_ptr, cl_int *r_errcode) {
+  fprintf(stderr, "clCreateImage() not implemented\n");
+  *r_errcode = CL_IMAGE_FORMAT_NOT_SUPPORTED;
+  return NULL;
+}
-- 
1.8.1.4



More information about the mesa-dev mailing list