clover: Add a stub implementation of clCreateImage() v3
authorTom Stellard <thomas.stellard@amd.com>
Wed, 30 Apr 2014 19:57:24 +0000 (12:57 -0700)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 2 May 2014 13:48:17 +0000 (06:48 -0700)
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.

v2:
  - Use c++ features
  - Fix error code handling

v3:
  - Move <iostream> into api/util.hpp
  - Fix indentation

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/state_trackers/clover/api/dispatch.cpp
src/gallium/state_trackers/clover/api/dispatch.hpp
src/gallium/state_trackers/clover/api/memory.cpp
src/gallium/state_trackers/clover/api/util.hpp

index 2ee62086dc8b13f5e54268704ac3bcce277176a5..488e65491bfad7ceb0186a2a34d19e4e59fbd725 100644 (file)
@@ -120,7 +120,7 @@ namespace clover {
       clCreateSubDevices,
       clRetainDevice,
       clReleaseDevice,
-      NULL, // clCreateImage
+      clCreateImage,
       NULL, // clCreateProgramWithBuiltInKernels
       NULL, // clCompileProgram
       NULL, // clLinkProgram
index 833fb0e800831ddf0289a1afcf6e2f97a42b9c8a..ffae1ae6e122c18462ee248579d147c3e830f024 100644 (file)
@@ -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,
index 7ed2191f14e2a4d7d68c920ce312a4560d2f9f13..d26b1c613cb064d0470113c2798c420491bcfa72 100644 (file)
@@ -334,3 +334,15 @@ clSetMemObjectDestructorCallback(cl_mem d_mem,
 } catch (error &e) {
    return e.get();
 }
+
+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) {
+   // This function was added in OpenCL 1.2
+   std::cerr << "CL user error: clCreateImage() not supported by OpenCL 1.1." <<
+                std::endl;
+   ret_error(r_errcode, CL_INVALID_OPERATION);
+   return NULL;
+}
index c2b216ec236a04e7e733a431137fa12aea992bb8..918df6125a4c122aabe8ad1b3300036efd887536 100644 (file)
@@ -24,6 +24,7 @@
 #define CLOVER_API_UTIL_HPP
 
 #include <cassert>
+#include <iostream>
 
 #include "core/error.hpp"
 #include "core/property.hpp"