From 0b30a7a243be8fe44d34b1bc2bd58665618074dd Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 8 Nov 2021 12:30:26 -0500 Subject: [PATCH] gallium: add pipe_screen::is_compute_copy_faster hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this can be used to query whether a driver expects a given texture copy to be faster as a compute shader or using cpu/gfx transfers Reviewed-by: Pierre-Eric Pelloux-Prayer Acked-by: Marek Olšák Part-of: --- src/gallium/include/pipe/p_screen.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index bb0b53764ed..904c7ba03a0 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -179,6 +179,19 @@ struct pipe_screen { struct pipe_context * (*context_create)(struct pipe_screen *screen, void *priv, unsigned flags); + /** + * Check if the given image copy will be faster on compute + * \param cpu If true, this is checking against CPU fallback, + * otherwise the copy will be on GFX + */ + bool (*is_compute_copy_faster)( struct pipe_screen *, + enum pipe_format src_format, + enum pipe_format dst_format, + unsigned width, + unsigned height, + unsigned depth, + bool cpu ); + /** * Check if the given pipe_format is supported as a texture or * drawing surface.