[Mesa-dev] [PATCH 2/4] r600g/radeonsi: use the correct types (taken from pipe_draw_info)

Constantine Kharlamov Hi-Angel at yandex.ru
Sun Apr 2 17:33:04 UTC 2017


Note: si_shader.h has also "type" variable that should be changed to
"enum pipe_prim_type", however it triggers a bunch of warnings about
unhandled switches, so due not knowing the correct way to handle them, I
decided to leave it as is.

Signed-off-by: Constantine Kharlamov <Hi-Angel at yandex.ru>
---
 src/gallium/drivers/r600/r600_pipe.h         | 8 ++++----
 src/gallium/drivers/radeonsi/si_pipe.h       | 2 +-
 src/gallium/drivers/radeonsi/si_state_draw.c | 5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index a7b7276732..a05d543f0d 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -29,6 +29,7 @@
 #include "radeon/r600_pipe_common.h"
 #include "radeon/r600_cs.h"
 #include "r600_public.h"
+#include "pipe/p_defines.h"
 
 #include "util/u_suballoc.h"
 #include "util/list.h"
@@ -318,8 +319,7 @@ struct r600_pipe_shader_selector {
 
 	unsigned	num_shaders;
 
-	/* PIPE_SHADER_[VERTEX|FRAGMENT|...] */
-	unsigned	type;
+	enum pipe_shader_type	type;
 
 	/* geometry shader properties */
 	unsigned	gs_output_prim;
@@ -511,8 +511,8 @@ struct r600_context {
 	struct pipe_index_buffer	index_buffer;
 
 	/* Last draw state (-1 = unset). */
-	int				last_primitive_type; /* Last primitive type used in draw_vbo. */
-	int				last_start_instance;
+	enum pipe_prim_type		last_primitive_type; /* Last primitive type used in draw_vbo. */
+	unsigned			last_start_instance;
 
 	void				*sb_context;
 	struct r600_isa		*isa;
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 9225899047..daf29325f7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -348,7 +348,7 @@ struct si_context {
 	int			last_multi_vgt_param;
 	int			last_rast_prim;
 	unsigned		last_sc_line_stipple;
-	int			current_rast_prim; /* primitive type after TES, GS */
+	enum pipe_prim_type	current_rast_prim; /* primitive type after TES, GS */
 	bool			gs_tri_strip_adj_fix;
 
 	/* Scratch buffer */
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 1f219f8ae6..2c4e3715e4 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -468,7 +468,7 @@ static unsigned si_get_ia_multi_vgt_param(struct si_context *sctx,
 static void si_emit_rasterizer_prim_state(struct si_context *sctx)
 {
 	struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
-	unsigned rast_prim = sctx->current_rast_prim;
+	enum pipe_prim_type rast_prim = sctx->current_rast_prim;
 	struct si_state_rasterizer *rs = sctx->emitted.named.rasterizer;
 
 	/* Skip this if not rendering lines. */
@@ -1091,7 +1091,8 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 	struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
 	const struct pipe_index_buffer *ib = &sctx->index_buffer;
 	struct pipe_index_buffer ib_tmp; /* for index buffer uploads only */
-	unsigned mask, dirty_tex_counter, rast_prim;
+	unsigned mask, dirty_tex_counter;
+	enum pipe_prim_type rast_prim;
 
 	if (likely(!info->indirect)) {
 		/* SI-CI treat instance_count==0 as instance_count==1. There is
-- 
2.12.0



More information about the mesa-dev mailing list