[Mesa-dev] [PATCH 4/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D_ARRAY'

Edward O'Callaghan funfunctor at folklore1984.net
Mon Nov 21 23:51:39 UTC 2016


Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
---
 src/gallium/state_trackers/clover/api/memory.cpp  | 13 +++++++++----
 src/gallium/state_trackers/clover/core/memory.cpp | 14 ++++++++++++++
 src/gallium/state_trackers/clover/core/memory.hpp | 11 +++++++++++
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp
index 7aee417..9b3b70e 100644
--- a/src/gallium/state_trackers/clover/api/memory.cpp
+++ b/src/gallium/state_trackers/clover/api/memory.cpp
@@ -182,6 +182,15 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
                                 desc->image_width,
                                 desc->image_row_pitch, host_ptr);
 
+   case CL_MEM_OBJECT_IMAGE1D_ARRAY:
+      if (!desc->image_width)
+         throw error(CL_INVALID_IMAGE_SIZE);
+
+      return new image1d_array(ctx, flags, format,
+                               desc->image_width,
+                               desc->image_array_size, desc->image_slice_pitch,
+                               host_ptr);
+
    case CL_MEM_OBJECT_IMAGE2D:
       if (!desc->image_width || !desc->image_height)
          throw error(CL_INVALID_IMAGE_SIZE);
@@ -230,10 +239,6 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
                          desc->image_depth, desc->image_row_pitch,
                          desc->image_slice_pitch, host_ptr);
 
-   case CL_MEM_OBJECT_IMAGE1D_ARRAY:
-      // XXX - Not implemented.
-      throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED);
-
    default:
       throw error(CL_INVALID_IMAGE_DESCRIPTOR);
    }
diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp
index 94b1273..517d53f 100644
--- a/src/gallium/state_trackers/clover/core/memory.cpp
+++ b/src/gallium/state_trackers/clover/core/memory.cpp
@@ -211,6 +211,20 @@ image1d_buffer::type() const {
    return CL_MEM_OBJECT_IMAGE1D_BUFFER;
 }
 
+image1d_array::image1d_array(clover::context &ctx, cl_mem_flags flags,
+                             const cl_image_format *format,
+                             size_t width,
+                             size_t array_size, size_t slice_pitch,
+                             void *host_ptr) :
+   image(ctx, flags, format, width, 0, 1,
+         0, slice_pitch, slice_pitch * array_size, host_ptr) {
+}
+
+cl_mem_object_type
+image1d_array::type() const {
+   return CL_MEM_OBJECT_IMAGE1D_ARRAY;
+}
+
 image2d::image2d(clover::context &ctx, cl_mem_flags flags,
                  const cl_image_format *format, size_t width,
                  size_t height, size_t row_pitch,
diff --git a/src/gallium/state_trackers/clover/core/memory.hpp b/src/gallium/state_trackers/clover/core/memory.hpp
index 1394fe6..a54db83 100644
--- a/src/gallium/state_trackers/clover/core/memory.hpp
+++ b/src/gallium/state_trackers/clover/core/memory.hpp
@@ -154,6 +154,17 @@ namespace clover {
       virtual cl_mem_object_type type() const;
    };
 
+   class image1d_array : public image {
+   public:
+      image1d_array(clover::context &ctx, cl_mem_flags flags,
+                    const cl_image_format *format,
+                    size_t width,
+                    size_t array_size, size_t slice_pitch,
+                    void *host_ptr);
+
+      virtual cl_mem_object_type type() const;
+   };
+
    class image2d : public image {
    public:
       image2d(clover::context &ctx, cl_mem_flags flags,
-- 
2.7.4



More information about the mesa-dev mailing list