[Mesa-dev] [PATCH] clover: change image class to inherit from buffer
Francisco Jerez
currojerez at riseup.net
Sat Apr 6 19:29:30 PDT 2013
Dmitry Cherkassov <dcherkassov at gmail.com> writes:
> image2d is dynamic_cast-ed down from buffer, but is not it's
> direct subclass. Make it inhernit buffer.
Hm, nope, you're not supposed to be able to dynamic_cast a buffer into
an image2d. If you found this problem in clEnqueueCopyBufferToImage()
try the attached patch.
Thanks.
>
> Signed-off-by: Dmitry Cherkassov <dcherkassov at gmail.com>
> ---
> src/gallium/state_trackers/clover/core/memory.cpp | 4 ++--
> src/gallium/state_trackers/clover/core/memory.hpp | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/core/memory.cpp b/src/gallium/state_trackers/clover/core/memory.cpp
> index 8d8be2e..cb64dc1 100644
> --- a/src/gallium/state_trackers/clover/core/memory.cpp
> +++ b/src/gallium/state_trackers/clover/core/memory.cpp
> @@ -119,7 +119,7 @@ image::image(clover::context &ctx, cl_mem_flags flags,
> size_t width, size_t height, size_t depth,
> size_t row_pitch, size_t slice_pitch, size_t size,
> void *host_ptr) :
> - memory_obj(ctx, flags, size, host_ptr),
> + buffer(ctx, flags, size, host_ptr),
> __format(*format), __width(width), __height(height), __depth(depth),
> __row_pitch(row_pitch), __slice_pitch(slice_pitch) {
> }
> @@ -174,7 +174,7 @@ image2d::image2d(clover::context &ctx, cl_mem_flags flags,
> const cl_image_format *format, size_t width,
> size_t height, size_t row_pitch,
> void *host_ptr) :
> - image(ctx, flags, format, width, height, 0,
> + image(ctx, flags, format, width, height, 1,//
> row_pitch, 0, height * row_pitch, host_ptr) {
> }
>
> diff --git a/src/gallium/state_trackers/clover/core/memory.hpp b/src/gallium/state_trackers/clover/core/memory.hpp
> index 96f70e9..4cb58c4 100644
> --- a/src/gallium/state_trackers/clover/core/memory.hpp
> +++ b/src/gallium/state_trackers/clover/core/memory.hpp
> @@ -104,7 +104,7 @@ namespace clover {
> std::unique_ptr<clover::sub_resource>> resources;
> };
>
> - struct image : public memory_obj {
> + struct image : public buffer {
> protected:
> image(clover::context &ctx, cl_mem_flags flags,
> const cl_image_format *format,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clover_copy_buffer_to_image_cast.patch
Type: text/x-patch
Size: 728 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130407/4e088793/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130407/4e088793/attachment.pgp>
More information about the mesa-dev
mailing list