From 178df068210d8c5ff3dd23e925160179c65a5c28 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 10 Mar 2020 13:34:33 +1000 Subject: [PATCH] llvmpipe: add internal multisample texture mapping path. For clearing and copying textures llvmpipe needs to internally access the per-sample data. Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_texture.c | 26 +++++++++++++++++------ src/gallium/drivers/llvmpipe/lp_texture.h | 8 +++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 47491ac4604..fa7a1ff1129 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -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, diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index 03cf5a749d5..f7219da75f2 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -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 */ -- 2.30.2