+ struct pipe_sampler_view viewTempl, *view;
+ unsigned bind;
+ boolean is_stencil, is_depth;
+
+ /* Give up if textures are not set. */
+ assert(dst && src);
+ if (!dst || !src)
+ return;
+
+ /* Sanity checks. */
+ if (dst == src) {
+ assert(!is_overlap(srcx, srcx + width, srcy, srcy + height,
+ dstx, dstx + width, dsty, dsty + height));
+ } else {
+ assert(dst->format == src->format);
+ }
+ assert(src->target < PIPE_MAX_TEXTURE_TYPES);
+
+ /* Is this a ZS format? */
+ is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
+ is_stencil = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 1) != 0;
+
+ if (is_depth || is_stencil)
+ bind = PIPE_BIND_DEPTH_STENCIL;
+ else
+ bind = PIPE_BIND_RENDER_TARGET;
+
+ /* Check if we can sample from and render to the surfaces. */
+ /* (assuming copying a stencil buffer is not possible) */
+ if ((!ignore_stencil && is_stencil) ||
+ !screen->is_format_supported(screen, dst->format, dst->target,
+ dst->nr_samples, bind, 0) ||
+ !screen->is_format_supported(screen, src->format, src->target,
+ src->nr_samples, PIPE_BIND_SAMPLER_VIEW, 0)) {
+ util_resource_copy_region(pipe, dst, subdst, dstx, dsty, dstz,
+ src, subsrc, srcx, srcy, srcz, width, height);
+ return;
+ }