llvmpipe: add internal multisample texture mapping path.
authorDave Airlie <airlied@redhat.com>
Tue, 10 Mar 2020 03:34:33 +0000 (13:34 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:37 +0000 (06:20 +0000)
For clearing and copying textures llvmpipe needs to internally
access the per-sample data.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_texture.h

index 47491ac46041a1cc6c7cee90ad3b9284ddf3a5d8..fa7a1ff1129c065f7971ed91e3b050e229a25059 100644 (file)
@@ -509,13 +509,14 @@ llvmpipe_resource_get_handle(struct pipe_screen *screen,
 }
 
 
-static void *
-llvmpipe_transfer_map( struct pipe_context *pipe,
-                       struct pipe_resource *resource,
-                       unsigned level,
-                       unsigned usage,
-                       const struct pipe_box *box,
-                       struct pipe_transfer **transfer )
+void *
+llvmpipe_transfer_map_ms( struct pipe_context *pipe,
+                          struct pipe_resource *resource,
+                          unsigned level,
+                          unsigned usage,
+                          unsigned sample,
+                          const struct pipe_box *box,
+                          struct pipe_transfer **transfer )
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
    struct llvmpipe_screen *screen = llvmpipe_screen(pipe->screen);
@@ -620,9 +621,20 @@ llvmpipe_transfer_map( struct pipe_context *pipe,
       box->y / util_format_get_blockheight(format) * pt->stride +
       box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
 
+   map += sample * lpr->sample_stride;
    return map;
 }
 
+static void *
+llvmpipe_transfer_map( struct pipe_context *pipe,
+                       struct pipe_resource *resource,
+                       unsigned level,
+                       unsigned usage,
+                       const struct pipe_box *box,
+                       struct pipe_transfer **transfer )
+{
+   return llvmpipe_transfer_map_ms(pipe, resource, level, usage, 0, box, transfer);
+}
 
 static void
 llvmpipe_transfer_unmap(struct pipe_context *pipe,
index 03cf5a749d5194f2fff36bbc5b7b1b99d97ea49a..f7219da75f213ceb1d33a1d71ae3dc2ecc58493d 100644 (file)
@@ -237,4 +237,12 @@ llvmpipe_is_resource_referenced( struct pipe_context *pipe,
 unsigned
 llvmpipe_get_format_alignment(enum pipe_format format);
 
+void *
+llvmpipe_transfer_map_ms( struct pipe_context *pipe,
+                         struct pipe_resource *resource,
+                         unsigned level,
+                         unsigned usage,
+                         unsigned sample,
+                         const struct pipe_box *box,
+                         struct pipe_transfer **transfer );
 #endif /* LP_TEXTURE_H */