Module: Mesa
Branch: main
Commit: 0b30a7a243be8fe44d34b1bc2bd58665618074dd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b30a7a243be8fe44d34b1bc2bd58665618074dd

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Nov  8 12:30:26 2021 -0500

gallium: add pipe_screen::is_compute_copy_faster hook

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 <[email protected]>
Acked-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11984>

---

 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.

Reply via email to