summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2016-06-08 14:36:08 -0600
committerBrian Paul <brianp@vmware.com>2016-06-30 14:32:06 -0600
commit5d31ea4b8faf011e855fa056186e1205bf5abcf1 (patch)
treea82d6a98d249286d6da5891689b39c592f9026f9 /src/gallium/auxiliary/util
parent7988513ac3d86ba367fbe44e73fe483ff96aaa29 (diff)
downloadexternal_mesa3d-5d31ea4b8faf011e855fa056186e1205bf5abcf1.zip
external_mesa3d-5d31ea4b8faf011e855fa056186e1205bf5abcf1.tar.gz
external_mesa3d-5d31ea4b8faf011e855fa056186e1205bf5abcf1.tar.bz2
gallium/util: new util_try_blit_via_copy_region() function
Pulled out of the util_try_blit_via_copy_region() function. Subsequent changes build on this. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_surface.c44
-rw-r--r--src/gallium/auxiliary/util/u_surface.h3
2 files changed, 32 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 8408aa8..8d22bcf 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -686,18 +686,9 @@ get_sample_count(const struct pipe_resource *res)
return res->nr_samples ? res->nr_samples : 1;
}
-/**
- * Try to do a blit using resource_copy_region. The function calls
- * resource_copy_region if the blit description is compatible with it.
- *
- * It returns TRUE if the blit was done using resource_copy_region.
- *
- * It returns FALSE otherwise and the caller must fall back to a more generic
- * codepath for the blit operation. (e.g. by using u_blitter)
- */
+
boolean
-util_try_blit_via_copy_region(struct pipe_context *ctx,
- const struct pipe_blit_info *blit)
+util_can_blit_via_copy_region(const struct pipe_blit_info *blit)
{
unsigned mask = util_format_get_mask(blit->dst.format);
@@ -748,9 +739,32 @@ util_try_blit_via_copy_region(struct pipe_context *ctx,
if (blit->alpha_blend)
return FALSE;
- ctx->resource_copy_region(ctx, blit->dst.resource, blit->dst.level,
- blit->dst.box.x, blit->dst.box.y, blit->dst.box.z,
- blit->src.resource, blit->src.level,
- &blit->src.box);
return TRUE;
}
+
+
+/**
+ * Try to do a blit using resource_copy_region. The function calls
+ * resource_copy_region if the blit description is compatible with it.
+ *
+ * It returns TRUE if the blit was done using resource_copy_region.
+ *
+ * It returns FALSE otherwise and the caller must fall back to a more generic
+ * codepath for the blit operation. (e.g. by using u_blitter)
+ */
+boolean
+util_try_blit_via_copy_region(struct pipe_context *ctx,
+ const struct pipe_blit_info *blit)
+{
+ if (util_can_blit_via_copy_region(blit)) {
+ ctx->resource_copy_region(ctx, blit->dst.resource, blit->dst.level,
+ blit->dst.box.x, blit->dst.box.y,
+ blit->dst.box.z,
+ blit->src.resource, blit->src.level,
+ &blit->src.box);
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h
index bfd8f40..bda2e1e 100644
--- a/src/gallium/auxiliary/util/u_surface.h
+++ b/src/gallium/auxiliary/util/u_surface.h
@@ -98,6 +98,9 @@ util_clear_depth_stencil(struct pipe_context *pipe,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height);
+boolean
+util_can_blit_via_copy_region(const struct pipe_blit_info *blit);
+
extern boolean
util_try_blit_via_copy_region(struct pipe_context *ctx,
const struct pipe_blit_info *blit);