Mesa (main): clover/api: fix clGetMemObjectInfo for images

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 18 21:29:03 UTC 2021


Module: Mesa
Branch: main
Commit: 753f595e3d075be35547c4a01d9a1fd254c6df62
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=753f595e3d075be35547c4a01d9a1fd254c6df62

Author: Karol Herbst <kherbst at redhat.com>
Date:   Sun Oct 25 02:43:48 2020 +0200

clover/api: fix clGetMemObjectInfo for images

Signed-off-by: Karol Herbst <kherbst at redhat.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13424>

---

 src/gallium/frontends/clover/api/memory.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/clover/api/memory.cpp b/src/gallium/frontends/clover/api/memory.cpp
index f3325950518..bd0c332bf9e 100644
--- a/src/gallium/frontends/clover/api/memory.cpp
+++ b/src/gallium/frontends/clover/api/memory.cpp
@@ -439,7 +439,18 @@ clGetMemObjectInfo(cl_mem d_mem, cl_mem_info param,
 
    case CL_MEM_ASSOCIATED_MEMOBJECT: {
       sub_buffer *sub = dynamic_cast<sub_buffer *>(&mem);
-      buf.as_scalar<cl_mem>() = (sub ? desc(sub->parent()) : NULL);
+      if (sub) {
+         buf.as_scalar<cl_mem>() = desc(sub->parent());
+         break;
+      }
+
+      image *img = dynamic_cast<image *>(&mem);
+      if (img) {
+         buf.as_scalar<cl_mem>() = desc(img->buffer());
+         break;
+      }
+
+      buf.as_scalar<cl_mem>() = NULL;
       break;
    }
    case CL_MEM_OFFSET: {



More information about the mesa-commit mailing list