+/**
+ * Do pipe->blit. Return FALSE if the blitting is unsupported
+ * for the given formats.
+ */
+static GLboolean
+st_pipe_blit(struct pipe_context *pipe, struct pipe_blit_info *blit)
+{
+ struct pipe_screen *screen = pipe->screen;
+ unsigned dst_usage;
+
+ if (util_format_is_depth_or_stencil(blit->dst.format)) {
+ dst_usage = PIPE_BIND_DEPTH_STENCIL;
+ }
+ else {
+ dst_usage = PIPE_BIND_RENDER_TARGET;
+ }
+
+ /* try resource_copy_region in case the format is not supported
+ * for rendering */
+ if (util_try_blit_via_copy_region(pipe, blit)) {
+ return GL_TRUE; /* done */
+ }
+
+ /* check the format support */
+ if (!screen->is_format_supported(screen, blit->src.format,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW) ||
+ !screen->is_format_supported(screen, blit->dst.format,
+ PIPE_TEXTURE_2D, 0,
+ dst_usage)) {
+ return GL_FALSE;
+ }
+
+ pipe->blit(pipe, blit);
+ return GL_TRUE;
+}
+