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 <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
This commit is contained in:
Dave Airlie 2020-03-10 13:34:33 +10:00 committed by Marge Bot
parent cab13f9174
commit 178df06821
2 changed files with 27 additions and 7 deletions

View 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,

View 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 */