From: Dave Airlie Date: Wed, 26 Jun 2019 05:37:11 +0000 (+1000) Subject: util: add util_copy_shader_buffer. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7c3807c1b335ddea58006081bd1363bd6d192ade;p=mesa.git util: add util_copy_shader_buffer. This just adds an inline to copy a pipe_shader_buffer. Reviewed-by: Roland Scheidegger --- diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 21b8c162b30..ffd0ea9c7a2 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -660,6 +660,22 @@ util_copy_constant_buffer(struct pipe_constant_buffer *dst, } } +static inline void +util_copy_shader_buffer(struct pipe_shader_buffer *dst, + const struct pipe_shader_buffer *src) +{ + if (src) { + pipe_resource_reference(&dst->buffer, src->buffer); + dst->buffer_offset = src->buffer_offset; + dst->buffer_size = src->buffer_size; + } + else { + pipe_resource_reference(&dst->buffer, NULL); + dst->buffer_offset = 0; + dst->buffer_size = 0; + } +} + static inline void util_copy_image_view(struct pipe_image_view *dst, const struct pipe_image_view *src)