[Mesa-dev] [PATCH 3/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D_BUFFER'
Edward O'Callaghan
funfunctor at folklore1984.net
Mon Nov 21 23:51:38 UTC 2016
Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net>
---
src/gallium/state_trackers/clover/api/memory.cpp | 9 ++++++++-
src/gallium/state_trackers/clover/core/memory.cpp | 13 +++++++++++++
src/gallium/state_trackers/clover/core/memory.hpp | 10 ++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/gallium/state_trackers/clover/api/memory.cpp b/src/gallium/state_trackers/clover/api/memory.cpp
index 41e344e..7aee417 100644
--- a/src/gallium/state_trackers/clover/api/memory.cpp
+++ b/src/gallium/state_trackers/clover/api/memory.cpp
@@ -174,6 +174,14 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
desc->image_width,
desc->image_row_pitch, host_ptr);
+ case CL_MEM_OBJECT_IMAGE1D_BUFFER:
+ if (!desc->image_width)
+ throw error(CL_INVALID_IMAGE_SIZE);
+
+ return new image1d_buffer(ctx, flags, format,
+ desc->image_width,
+ desc->image_row_pitch, host_ptr);
+
case CL_MEM_OBJECT_IMAGE2D:
if (!desc->image_width || !desc->image_height)
throw error(CL_INVALID_IMAGE_SIZE);
@@ -223,7 +231,6 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
desc->image_slice_pitch, host_ptr);
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
- case CL_MEM_OBJECT_IMAGE1D_BUFFER:
// XXX - Not implemented.
throw error(CL_IMAGE_FORMAT_NOT_SUPPORTED);
diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp
index 246bd2d..94b1273 100644
--- a/src/gallium/state_trackers/clover/core/memory.cpp
+++ b/src/gallium/state_trackers/clover/core/memory.cpp
@@ -198,6 +198,19 @@ image1d::type() const {
return CL_MEM_OBJECT_IMAGE1D;
}
+image1d_buffer::image1d_buffer(clover::context &ctx, cl_mem_flags flags,
+ const cl_image_format *format,
+ size_t width, size_t row_pitch,
+ void *host_ptr) :
+ image(ctx, flags, format, width, 0, 1,
+ row_pitch, 0, row_pitch, host_ptr) {
+}
+
+cl_mem_object_type
+image1d_buffer::type() const {
+ return CL_MEM_OBJECT_IMAGE1D_BUFFER;
+}
+
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 ad9052b..1394fe6 100644
--- a/src/gallium/state_trackers/clover/core/memory.hpp
+++ b/src/gallium/state_trackers/clover/core/memory.hpp
@@ -144,6 +144,16 @@ namespace clover {
virtual cl_mem_object_type type() const;
};
+ class image1d_buffer : public image {
+ public:
+ image1d_buffer(clover::context &ctx, cl_mem_flags flags,
+ const cl_image_format *format,
+ size_t width, size_t row_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