clover: use fallback path when pipe->clear_texture is not available
authorItalo Nicola <italonicola@collabora.com>
Sun, 9 Jul 2023 22:45:47 +0000 (19:45 -0300)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Jul 2023 15:23:06 +0000 (15:23 +0000)
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23735>

src/gallium/frontends/clover/core/resource.cpp

index 484e579..f3f429f 100644 (file)
@@ -27,6 +27,7 @@
 #include "util/format/u_format.h"
 #include "util/u_inlines.h"
 #include "util/u_resource.h"
+#include "util/u_surface.h"
 
 using namespace clover;
 
@@ -76,7 +77,11 @@ resource::clear(command_queue &q, const vector &origin, const vector &region,
       std::string texture_data;
       texture_data.reserve(util_format_get_blocksize(pipe->format));
       util_format_pack_rgba(pipe->format, &texture_data[0], data.data(), 1);
-      q.pipe->clear_texture(q.pipe, pipe, 0, box(from, region), texture_data.data());
+      if (q.pipe->clear_texture) {
+         q.pipe->clear_texture(q.pipe, pipe, 0, box(from, region), texture_data.data());
+      } else {
+         u_default_clear_texture(q.pipe, pipe, 0, box(from, region), texture_data.data());
+      }
    }
 }