From 26cc01cefda3595acf261fff4a073464fca048f3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 21 Mar 2020 07:29:04 +1000 Subject: [PATCH] llvmpipe: generate multisample triangle rasterizer functions (v2) This uses the templating to generate multisample version of the tri plane raster functions This doesn't generate any optimised version for lower plane numbers, maybe this is worth doing in the future. v2: drop generating 32-bit msaa (Roland) Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_rast.c | 13 +++- src/gallium/drivers/llvmpipe/lp_rast.h | 13 +++- src/gallium/drivers/llvmpipe/lp_rast_priv.h | 52 ++++++++++++++++ src/gallium/drivers/llvmpipe/lp_rast_tri.c | 67 ++++++++++++++++++++- 4 files changed, 142 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 551b517fbb2..777c4450c7f 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -627,7 +627,18 @@ static lp_rast_cmd_func dispatch[LP_RAST_OP_MAX] = lp_rast_triangle_32_8, lp_rast_triangle_32_3_4, lp_rast_triangle_32_3_16, - lp_rast_triangle_32_4_16 + lp_rast_triangle_32_4_16, + lp_rast_triangle_ms_1, + lp_rast_triangle_ms_2, + lp_rast_triangle_ms_3, + lp_rast_triangle_ms_4, + lp_rast_triangle_ms_5, + lp_rast_triangle_ms_6, + lp_rast_triangle_ms_7, + lp_rast_triangle_ms_8, + lp_rast_triangle_ms_3_4, + lp_rast_triangle_ms_3_16, + lp_rast_triangle_ms_4_16, }; diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 43a3064be77..42589370447 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -304,7 +304,18 @@ lp_rast_arg_null( void ) #define LP_RAST_OP_TRIANGLE_32_3_16 0x1b #define LP_RAST_OP_TRIANGLE_32_4_16 0x1c -#define LP_RAST_OP_MAX 0x1d +#define LP_RAST_OP_MS_TRIANGLE_1 0x1d +#define LP_RAST_OP_MS_TRIANGLE_2 0x1e +#define LP_RAST_OP_MS_TRIANGLE_3 0x1f +#define LP_RAST_OP_MS_TRIANGLE_4 0x20 +#define LP_RAST_OP_MS_TRIANGLE_5 0x21 +#define LP_RAST_OP_MS_TRIANGLE_6 0x22 +#define LP_RAST_OP_MS_TRIANGLE_7 0x23 +#define LP_RAST_OP_MS_TRIANGLE_8 0x24 +#define LP_RAST_OP_MS_TRIANGLE_3_4 0x25 +#define LP_RAST_OP_MS_TRIANGLE_3_16 0x26 +#define LP_RAST_OP_MS_TRIANGLE_4_16 0x27 +#define LP_RAST_OP_MAX 0x28 #define LP_RAST_OP_MASK 0xff void diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index de8527ae0c6..aaf52025f1c 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -346,6 +346,58 @@ void lp_rast_triangle_32_3_16( struct lp_rasterizer_task *, void lp_rast_triangle_32_4_16( struct lp_rasterizer_task *, const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_1( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_2( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_3( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_4( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_5( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_6( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_7( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_8( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + +void lp_rast_triangle_ms_3_4(struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + +void lp_rast_triangle_ms_3_16( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + +void lp_rast_triangle_ms_4_16( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + +void lp_rast_triangle_ms_32_1( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_32_2( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_32_3( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_32_4( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_32_5( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_32_6( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_32_7( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); +void lp_rast_triangle_ms_32_8( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + +void lp_rast_triangle_ms_32_3_4(struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + +void lp_rast_triangle_ms_32_3_16( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + +void lp_rast_triangle_ms_32_4_16( struct lp_rasterizer_task *, + const union lp_rast_cmd_arg ); + void lp_rast_set_state(struct lp_rasterizer_task *task, const union lp_rast_cmd_arg arg); diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index c479c91dff6..01fbd2d9d74 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -133,6 +133,33 @@ lp_rast_triangle_4_16(struct lp_rasterizer_task *task, lp_rast_triangle_4(task, arg2); } +void +lp_rast_triangle_ms_3_16(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + union lp_rast_cmd_arg arg2; + arg2.triangle.tri = arg.triangle.tri; + arg2.triangle.plane_mask = (1<<3)-1; + lp_rast_triangle_ms_3(task, arg2); +} + +void +lp_rast_triangle_ms_3_4(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + lp_rast_triangle_ms_3_16(task, arg); +} + +void +lp_rast_triangle_ms_4_16(struct lp_rasterizer_task *task, + const union lp_rast_cmd_arg arg) +{ + union lp_rast_cmd_arg arg2; + arg2.triangle.tri = arg.triangle.tri; + arg2.triangle.plane_mask = (1<<4)-1; + lp_rast_triangle_ms_4(task, arg2); +} + #if defined(PIPE_ARCH_SSE) #include @@ -683,7 +710,6 @@ lp_rast_triangle_32_3_4(struct lp_rasterizer_task *task, #endif - #if defined PIPE_ARCH_SSE #define BUILD_MASKS(c, cdiff, dcdx, dcdy, omask, pmask) build_masks_sse((int)c, (int)cdiff, dcdx, dcdy, omask, pmask) #define BUILD_MASK_LINEAR(c, dcdx, dcdy) build_mask_linear_sse((int)c, dcdx, dcdy) @@ -771,3 +797,42 @@ lp_rast_triangle_32_3_4(struct lp_rasterizer_task *task, #define NR_PLANES 8 #include "lp_rast_tri_tmp.h" +#define MULTISAMPLE 1 +#define RASTER_64 1 + +#define TAG(x) x##_ms_1 +#define NR_PLANES 1 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_ms_2 +#define NR_PLANES 2 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_ms_3 +#define NR_PLANES 3 +/*#define TRI_4 lp_rast_triangle_3_4*/ +/*#define TRI_16 lp_rast_triangle_3_16*/ +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_ms_4 +#define NR_PLANES 4 +/*#define TRI_16 lp_rast_triangle_4_16*/ +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_ms_5 +#define NR_PLANES 5 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_ms_6 +#define NR_PLANES 6 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_ms_7 +#define NR_PLANES 7 +#include "lp_rast_tri_tmp.h" + +#define TAG(x) x##_ms_8 +#define NR_PLANES 8 +#include "lp_rast_tri_tmp.h" + +#undef RASTER_64 -- 2.30.2