clover: Implement CL_MEM_OBJECT_IMAGE1D_BUFFER
v2: Consider surface height as valid when unused by using 1. Fixup width boundary checking. v3 (Karol): Pull in changes from later commits v4:(airlied): use max_buffer_size as the limit (Fixes CTS test) Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13401>
This commit is contained in:
parent
0ec5e50d8a
commit
3200669c2b
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<cl_mem_properties> 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<cl_mem_properties> properties,
|
||||
cl_mem_flags flags,
|
||||
|
|
|
@ -195,6 +195,16 @@ namespace clover {
|
|||
void *host_ptr);
|
||||
};
|
||||
|
||||
class image1d_buffer : public basic_image<CL_MEM_OBJECT_IMAGE1D_BUFFER> {
|
||||
public:
|
||||
image1d_buffer(clover::context &ctx,
|
||||
std::vector<cl_mem_properties> 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<CL_MEM_OBJECT_IMAGE2D> {
|
||||
public:
|
||||
image2d(clover::context &ctx,
|
||||
|
|
Loading…
Reference in New Issue