[Mesa-dev] [PATCH 4/6] radeonsi: use u_decomposed_prims_for_vertices instead of u_prims_for_vertices

Marek Olšák maraeo at gmail.com
Fri Dec 14 21:23:58 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

It seems to be the same, but this doesn't use integer division with
a variable divisor.
---
 src/gallium/drivers/radeonsi/si_state_draw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index c72c59b29d4..09dd4a7e098 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -308,24 +308,26 @@ static bool si_emit_derived_tess_state(struct si_context *sctx,
 		return true; /* true if the context rolls */
 	}
 	return false;
 }
 
 static unsigned si_num_prims_for_vertices(const struct pipe_draw_info *info)
 {
 	switch (info->mode) {
 	case PIPE_PRIM_PATCHES:
 		return info->count / info->vertices_per_patch;
+	case PIPE_PRIM_POLYGON:
+		return info->count >= 3;
 	case SI_PRIM_RECTANGLE_LIST:
 		return info->count / 3;
 	default:
-		return u_prims_for_vertices(info->mode, info->count);
+		return u_decomposed_prims_for_vertices(info->mode, info->count);
 	}
 }
 
 static unsigned
 si_get_init_multi_vgt_param(struct si_screen *sscreen,
 			    union si_vgt_param_key *key)
 {
 	STATIC_ASSERT(sizeof(union si_vgt_param_key) == 4);
 	unsigned max_primgroup_in_wave = 2;
 
-- 
2.17.1



More information about the mesa-dev mailing list