From: Dave Airlie Date: Tue, 10 Mar 2020 03:04:01 +0000 (+1000) Subject: llvmpipe: add get_sample_position support (v2) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0a6150251a1ea2545826036aad9c198a61ce815a;p=mesa.git llvmpipe: add get_sample_position support (v2) This just adds the sample values for 4xmsaa, and hooks them up to the get_sample_position API v2: move to vulkan standard sample positions Reviewed-by: Roland Scheidegger Part-of: --- diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 3d335e2ad38..f9b368597d0 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -56,6 +56,10 @@ const struct lp_rast_state *jit_state = NULL; const struct lp_rasterizer_task *jit_task = NULL; #endif +const float lp_sample_pos_4x[4][2] = { { 0.375, 0.125 }, + { 0.875, 0.375 }, + { 0.125, 0.625 }, + { 0.625, 0.875 } }; /** * Begin rasterizing a scene. diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index d9be7f392ef..43a3064be77 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -72,6 +72,7 @@ struct cmd_bin; struct lp_rasterizer_task; +extern const float lp_sample_pos_4x[4][2]; /** * Rasterization state. diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c index 1cdabbb6cc3..70c7911d1aa 100644 --- a/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_surface.c @@ -33,7 +33,7 @@ #include "lp_surface.h" #include "lp_texture.h" #include "lp_query.h" - +#include "lp_rast.h" static void lp_resource_copy(struct pipe_context *pipe, @@ -225,6 +225,21 @@ llvmpipe_clear_depth_stencil(struct pipe_context *pipe, dstx, dsty, width, height); } +static void +llvmpipe_get_sample_position(struct pipe_context *pipe, + unsigned sample_count, + unsigned sample_index, + float *out_value) +{ + switch (sample_count) { + case 4: + out_value[0] = lp_sample_pos_4x[sample_index][0]; + out_value[1] = lp_sample_pos_4x[sample_index][1]; + break; + default: + break; + } +} void llvmpipe_init_surface_functions(struct llvmpipe_context *lp) @@ -238,4 +253,5 @@ llvmpipe_init_surface_functions(struct llvmpipe_context *lp) lp->pipe.resource_copy_region = lp_resource_copy; lp->pipe.blit = lp_blit; lp->pipe.flush_resource = lp_flush_resource; + lp->pipe.get_sample_position = llvmpipe_get_sample_position; }