diff --git a/src/gallium/frontends/clover/api/memory.cpp b/src/gallium/frontends/clover/api/memory.cpp index 668d86bf6a4..014babac6db 100644 --- a/src/gallium/frontends/clover/api/memory.cpp +++ b/src/gallium/frontends/clover/api/memory.cpp @@ -228,6 +228,20 @@ clCreateImageWithProperties(cl_context d_ctx, desc->image_width, row_pitch, host_ptr); + case CL_MEM_OBJECT_IMAGE1D_BUFFER: + if (!desc->image_width) + throw error(CL_INVALID_IMAGE_SIZE); + + if (all_of([=](const device &dev) { + const size_t max = dev.max_image_buffer_size(); + return (desc->image_width > max); + }, ctx.devices())) + throw error(CL_INVALID_IMAGE_SIZE); + + return new image1d_buffer(ctx, properties, flags, format, + desc->image_width, + row_pitch, host_ptr, desc->buffer); + case CL_MEM_OBJECT_IMAGE2D: if (!desc->image_width || !desc->image_height) throw error(CL_INVALID_IMAGE_SIZE); @@ -287,7 +301,6 @@ clCreateImageWithProperties(cl_context d_ctx, } 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/frontends/clover/core/memory.cpp b/src/gallium/frontends/clover/core/memory.cpp index a59972f7953..6180fcf5d41 100644 --- a/src/gallium/frontends/clover/core/memory.cpp +++ b/src/gallium/frontends/clover/core/memory.cpp @@ -270,6 +270,16 @@ image1d::image1d(clover::context &ctx, row_pitch, 0, row_pitch, host_ptr, nullptr) { } +image1d_buffer::image1d_buffer(clover::context &ctx, + std::vector properties, + cl_mem_flags flags, + const cl_image_format *format, + size_t width, size_t row_pitch, + void *host_ptr, cl_mem buffer) : + basic_image(ctx, properties, flags, format, width, 1, 1, 0, + row_pitch, 0, row_pitch, host_ptr, buffer) { +} + image2d::image2d(clover::context &ctx, std::vector properties, cl_mem_flags flags, diff --git a/src/gallium/frontends/clover/core/memory.hpp b/src/gallium/frontends/clover/core/memory.hpp index 72d9d32d969..fa1e53e767f 100644 --- a/src/gallium/frontends/clover/core/memory.hpp +++ b/src/gallium/frontends/clover/core/memory.hpp @@ -195,6 +195,16 @@ namespace clover { void *host_ptr); }; + class image1d_buffer : public basic_image { + public: + image1d_buffer(clover::context &ctx, + std::vector properties, + cl_mem_flags flags, + const cl_image_format *format, + size_t width, size_t row_pitch, + void *host_ptr, cl_mem buffer); + }; + class image2d : public basic_image { public: image2d(clover::context &ctx,