zink: handle blitting of color formats with ignored alpha channels

for e.g., R8G8B8X8 -> R8G8B8A8, we have to force a u_blitter call in order to use
a sampler which ignores alpha, otherwise we end up with broken rendering

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9607>
This commit is contained in:
Mike Blumenkrantz
2020-12-13 10:25:37 -05:00
committed by Marge Bot
parent fc23ddc22a
commit 3bb138ce3e
+16 -7
View File
@@ -182,13 +182,22 @@ zink_blit(struct pipe_context *pctx,
const struct pipe_blit_info *info)
{
struct zink_context *ctx = zink_context(pctx);
if (info->src.resource->nr_samples > 1 &&
info->dst.resource->nr_samples <= 1) {
if (blit_resolve(ctx, info))
return;
} else {
if (blit_native(ctx, info))
return;
const struct util_format_description *src_desc = util_format_description(info->src.format);
const struct util_format_description *dst_desc = util_format_description(info->dst.format);
if (src_desc == dst_desc ||
src_desc->nr_channels != 4 || src_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||
(src_desc->nr_channels == 4 && src_desc->channel[3].type != UTIL_FORMAT_TYPE_VOID)) {
/* we can't blit RGBX -> RGBA formats directly since they're emulated
* so we have to use sampler views
*/
if (info->src.resource->nr_samples > 1 &&
info->dst.resource->nr_samples <= 1) {
if (blit_resolve(ctx, info))
return;
} else {
if (blit_native(ctx, info))
return;
}
}
struct zink_resource *src = zink_resource(info->src.resource);