clover: use fallback path when pipe->clear_texture is not available

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>
This commit is contained in:
Italo Nicola
2023-07-09 19:45:47 -03:00
committed by Marge Bot
parent 6c444ac12f
commit 3d9438ecd6

View 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());
}
}
}