summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_inlines.h
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-04-29 16:06:13 -0500
committerNicolai Hähnle <[email protected]>2016-06-01 22:37:12 +0200
commitfc0352ff9c5b0f6941b37934ee65c6002acd8144 (patch)
treeec1a7e5bcd71416c6096a2c79d66527edb5157a1 /src/gallium/auxiliary/util/u_inlines.h
parent57f576f1fb531bd466878afc503b41854955ede3 (diff)
gallium/u_inlines: allow NULL src in util_copy_image_view
Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_inlines.h')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 90821b29de2..207e2aa838f 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -626,10 +626,17 @@ static inline void
util_copy_image_view(struct pipe_image_view *dst,
const struct pipe_image_view *src)
{
- pipe_resource_reference(&dst->resource, src->resource);
- dst->format = src->format;
- dst->access = src->access;
- dst->u = src->u;
+ if (src) {
+ pipe_resource_reference(&dst->resource, src->resource);
+ dst->format = src->format;
+ dst->access = src->access;
+ dst->u = src->u;
+ } else {
+ pipe_resource_reference(&dst->resource, NULL);
+ dst->format = PIPE_FORMAT_NONE;
+ dst->access = 0;
+ memset(&dst->u, 0, sizeof(dst->u));
+ }
}
static inline unsigned