zink: try copy_region hook for blits where we can't do a regular blit or resolve
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Sun, 14 Jun 2020 04:03:31 +0000 (00:03 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 14 Jul 2020 12:57:22 +0000 (12:57 +0000)
in cases where the formats match, we can likely just pass this through for now

fixes a ton of spec@!opengl 1.1@depthstencil-default_fb-blit piglit tests

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5888>

src/gallium/drivers/zink/zink_blit.c

index 74e1024b616ccd1019a6cd6a3ed08684d8aa3a67..6dd3caaece1bfffaeeef3f9c11b15519fc438764 100644 (file)
@@ -4,6 +4,7 @@
 #include "zink_screen.h"
 
 #include "util/u_blitter.h"
+#include "util/u_surface.h"
 #include "util/format/u_format.h"
 
 static bool
@@ -182,6 +183,12 @@ zink_blit(struct pipe_context *pctx,
          return;
    }
 
+   struct zink_resource *src = zink_resource(info->src.resource);
+   struct zink_resource *dst = zink_resource(info->dst.resource);
+   /* if we're copying between resources with matching aspects then we can probably just copy_region */
+   if (src->aspect == dst->aspect && util_try_blit_via_copy_region(pctx, info))
+      return;
+
    if (!util_blitter_is_blit_supported(ctx->blitter, info)) {
       debug_printf("blit unsupported %s -> %s\n",
               util_format_short_name(info->src.resource->format),