gallium/u_inlines: add helper for simplifying pipe_context::resource_copy_region

this hook has too many params, and I only need like half of them

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8624>
This commit is contained in:
Mike Blumenkrantz 2020-09-09 14:35:23 -04:00 committed by Marge Bot
parent cacb3e1826
commit 53d9beb9b8

View file

@ -427,6 +427,23 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe,
offset, size, data);
}
/**
* Utility for simplifying pipe_context::resource_copy_region calls
*/
static inline void
pipe_buffer_copy(struct pipe_context *pipe,
struct pipe_resource *dst,
struct pipe_resource *src,
unsigned dst_offset,
unsigned src_offset,
unsigned size)
{
struct pipe_box box;
/* only these fields are used */
box.x = (int)src_offset;
box.width = (int)size;
pipe->resource_copy_region(pipe, dst, 0, dst_offset, 0, 0, src, 0, &box);
}
/**
* Create a new resource and immediately put data into it