[Mesa-dev] [PATCH 2/4] clover: Implement 'CL_MEM_OBJECT_IMAGE1D'
Edward O'Callaghan
funfunctor at folklore1984.net
Mon Nov 21 23:51:37 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 58f56d1..41e344e 100644
--- a/src/gallium/state_trackers/clover/api/memory.cpp
+++ b/src/gallium/state_trackers/clover/api/memory.cpp
@@ -166,6 +166,14 @@ clCreateImage(cl_context d_ctx, cl_mem_flags d_flags,
ret_error(r_errcode, CL_SUCCESS);
switch (desc->image_type) {
+ case CL_MEM_OBJECT_IMAGE1D:
+ if (!desc->image_width)
+ throw error(CL_INVALID_IMAGE_SIZE);
+
+ return new image1d(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);
@@ -214,7 +222,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:
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
// XXX - Not implemented.
diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp
index de1862b..246bd2d 100644
--- a/src/gallium/state_trackers/clover/core/memory.cpp
+++ b/src/gallium/state_trackers/clover/core/memory.cpp
@@ -185,6 +185,19 @@ image::slice_pitch() const {
return _slice_pitch;
}
+image1d::image1d(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::type() const {
+ return CL_MEM_OBJECT_IMAGE1D;
+}
+
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 1a3e8c9..ad9052b 100644
--- a/src/gallium/state_trackers/clover/core/memory.hpp
+++ b/src/gallium/state_trackers/clover/core/memory.hpp
@@ -134,6 +134,16 @@ namespace clover {
std::unique_ptr<root_resource>> resources;
};
+ class image1d : public image {
+ public:
+ image1d(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