From b2d9be86275f52f7a278e1bffa0015964de6d92c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 10 Jun 2022 11:12:16 -0600 Subject: [PATCH] draw: s/unsigned/enum pipe_prim_type/ Signed-off-by: Brian Paul Acked-by: Dave Airlie Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/draw/draw_context.h | 2 +- src/gallium/auxiliary/draw/draw_pipe.c | 4 ++-- src/gallium/auxiliary/draw/draw_pipe_validate.c | 2 +- src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h | 2 +- src/gallium/auxiliary/draw/draw_private.h | 4 ++-- src/gallium/auxiliary/draw/draw_pt.c | 10 +++++----- src/gallium/auxiliary/draw/draw_pt.h | 8 ++++---- src/gallium/auxiliary/draw/draw_pt_emit.c | 2 +- src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c | 2 +- .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 2 +- .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 11 ++++++----- src/gallium/auxiliary/draw/draw_pt_util.c | 3 ++- src/gallium/auxiliary/draw/draw_pt_vsplit.c | 4 ++-- src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h | 4 ++-- src/gallium/auxiliary/draw/draw_so_emit_tmp.h | 2 +- src/gallium/auxiliary/draw/draw_tess.h | 2 +- 16 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index ab10c60e1ef..e1186b89879 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -359,7 +359,7 @@ void draw_collect_primitives_generated(struct draw_context *draw, */ boolean draw_need_pipeline(const struct draw_context *draw, const struct pipe_rasterizer_state *rasterizer, - unsigned prim ); + enum pipe_prim_type prim ); int draw_get_shader_param(enum pipe_shader_type shader, enum pipe_shader_cap param); diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 339bc7f4df4..4339a605a08 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -203,7 +203,7 @@ static void do_triangle( struct draw_context *draw, #define FUNC pipe_run_elts #define FUNC_VARS \ struct draw_context *draw, \ - unsigned prim, \ + enum pipe_prim_type prim, \ unsigned prim_flags, \ struct vertex_header *vertices, \ unsigned stride, \ @@ -302,7 +302,7 @@ void draw_pipeline_run( struct draw_context *draw, #define FUNC pipe_run_linear #define FUNC_VARS \ struct draw_context *draw, \ - unsigned prim, \ + enum pipe_prim_type prim, \ unsigned prim_flags, \ struct vertex_header *vertices, \ unsigned stride, \ diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index 3c5afaf29a8..0dac1b2615c 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -49,7 +49,7 @@ boolean draw_need_pipeline(const struct draw_context *draw, const struct pipe_rasterizer_state *rasterizer, - unsigned int prim ) + enum pipe_prim_type prim ) { unsigned reduced_prim = u_reduced_prim(prim); diff --git a/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h b/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h index bcd0f3f0341..0acbbc777b1 100644 --- a/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h +++ b/src/gallium/auxiliary/draw/draw_prim_assembler_tmp.h @@ -7,7 +7,7 @@ #define FUNC_ENTER \ /* declare more local vars */ \ - const unsigned prim = input_prims->prim; \ + const enum pipe_prim_type prim = input_prims->prim; \ const unsigned prim_flags = input_prims->flags; \ const boolean last_vertex_last = !asmblr->draw->rasterizer->flatshade_first; \ switch (prim) { \ diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index bf3fc0810d1..563b3c2f58a 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -186,7 +186,7 @@ struct draw_context struct { /* Current active frontend */ struct draw_pt_front_end *frontend; - unsigned prim; + enum pipe_prim_type prim; unsigned opt; /**< bitmask of PT_x flags */ unsigned eltSize; /* saved eltSize for flushing */ ubyte vertices_per_patch; @@ -463,7 +463,7 @@ struct draw_prim_info { const ushort *elts; unsigned count; - unsigned prim; + enum pipe_prim_type prim; unsigned flags; unsigned *primitive_lengths; unsigned primitive_count; diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index f1821878ba6..95e3994f12f 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -55,7 +55,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(draw_no_fse, "DRAW_NO_FSE", FALSE) */ static boolean draw_pt_arrays(struct draw_context *draw, - unsigned prim, + enum pipe_prim_type prim, bool index_bias_varies, const struct pipe_draw_start_count_bias *draw_info, unsigned num_draws) @@ -63,8 +63,7 @@ draw_pt_arrays(struct draw_context *draw, struct draw_pt_front_end *frontend = NULL; struct draw_pt_middle_end *middle = NULL; unsigned opt = PT_SHADE; - - unsigned out_prim = prim; + enum pipe_prim_type out_prim = prim; if (draw->gs.geometry_shader) out_prim = draw->gs.geometry_shader->output_primitive; @@ -234,7 +233,8 @@ void draw_pt_destroy( struct draw_context *draw ) * Debug- print the first 'count' vertices. */ static void -draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count, int index_bias) +draw_print_arrays(struct draw_context *draw, enum pipe_prim_type prim, + int start, uint count, int index_bias) { uint i; @@ -404,7 +404,7 @@ draw_pt_arrays_restart(struct draw_context *draw, const struct pipe_draw_start_count_bias *draw_info, unsigned num_draws) { - const unsigned prim = info->mode; + const enum pipe_prim_type prim = info->mode; assert(info->primitive_restart); diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h index 5201676e1f2..aaf33b75541 100644 --- a/src/gallium/auxiliary/draw/draw_pt.h +++ b/src/gallium/auxiliary/draw/draw_pt.h @@ -65,7 +65,7 @@ struct draw_vertex_info; */ struct draw_pt_front_end { void (*prepare)( struct draw_pt_front_end *, - unsigned prim, + enum pipe_prim_type prim, struct draw_pt_middle_end *, unsigned opt ); @@ -89,7 +89,7 @@ struct draw_pt_front_end { */ struct draw_pt_middle_end { void (*prepare)( struct draw_pt_middle_end *, - unsigned prim, + enum pipe_prim_type prim, unsigned opt, unsigned *max_vertices ); @@ -160,7 +160,7 @@ struct draw_pt_middle_end *draw_pt_fetch_pipeline_or_emit_llvm(struct draw_conte struct pt_emit; void draw_pt_emit_prepare( struct pt_emit *emit, - unsigned prim, + enum pipe_prim_type prim, unsigned *max_vertices ); void draw_pt_emit( struct pt_emit *emit, @@ -241,7 +241,7 @@ void draw_pt_post_vs_destroy( struct pt_post_vs *pvs ); /******************************************************************************* * Utils: */ -void draw_pt_split_prim(unsigned prim, unsigned *first, unsigned *incr); +void draw_pt_split_prim(enum pipe_prim_type prim, unsigned *first, unsigned *incr); unsigned draw_pt_trim_count(unsigned count, unsigned first, unsigned incr); diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c index de42241ac30..26d9634db42 100644 --- a/src/gallium/auxiliary/draw/draw_pt_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_emit.c @@ -52,7 +52,7 @@ struct pt_emit { void draw_pt_emit_prepare(struct pt_emit *emit, - unsigned prim, + enum pipe_prim_type prim, unsigned *max_vertices) { struct draw_context *draw = emit->draw; diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index 50f438ce0b1..2a4f61949da 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -67,7 +67,7 @@ struct fetch_shade_emit { static void fse_prepare(struct draw_pt_middle_end *middle, - unsigned prim, + enum pipe_prim_type prim, unsigned opt, unsigned *max_vertices) { diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c index 2b5cb7dc0d8..531536ff225 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -68,7 +68,7 @@ fetch_pipeline_middle_end(struct draw_pt_middle_end *middle) */ static void fetch_pipeline_prepare(struct draw_pt_middle_end *middle, - unsigned prim, + enum pipe_prim_type prim, unsigned opt, unsigned *max_vertices) { diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c index 93010646b03..9e353adce3a 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c @@ -53,7 +53,7 @@ struct llvm_middle_end { unsigned vertex_data_offset; unsigned vertex_size; - unsigned input_prim; + enum pipe_prim_type input_prim; unsigned opt; struct draw_llvm *llvm; @@ -279,7 +279,7 @@ llvm_middle_end_prepare_tes(struct llvm_middle_end *fpme) */ static void llvm_middle_end_prepare( struct draw_pt_middle_end *middle, - unsigned in_prim, + enum pipe_prim_type in_prim, unsigned opt, unsigned *max_vertices ) { @@ -290,7 +290,8 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, struct draw_geometry_shader *gs = draw->gs.geometry_shader; struct draw_tess_ctrl_shader *tcs = draw->tcs.tess_ctrl_shader; struct draw_tess_eval_shader *tes = draw->tes.tess_eval_shader; - const unsigned out_prim = gs ? gs->output_primitive : tes ? get_tes_output_prim(tes) : + const enum pipe_prim_type out_prim = + gs ? gs->output_primitive : tes ? get_tes_output_prim(tes) : u_assembled_prim(in_prim); unsigned point_clip = draw->rasterizer->fill_front == PIPE_POLYGON_MODE_POINT || out_prim == PIPE_PRIM_POINTS; @@ -779,8 +780,8 @@ out: } -static inline unsigned -prim_type(unsigned prim, unsigned flags) +static inline enum pipe_prim_type +prim_type(enum pipe_prim_type prim, unsigned flags) { if (flags & DRAW_LINE_LOOP_AS_STRIP) return PIPE_PRIM_LINE_STRIP; diff --git a/src/gallium/auxiliary/draw/draw_pt_util.c b/src/gallium/auxiliary/draw/draw_pt_util.c index a8faece6437..80e4c5846f1 100644 --- a/src/gallium/auxiliary/draw/draw_pt_util.c +++ b/src/gallium/auxiliary/draw/draw_pt_util.c @@ -35,7 +35,8 @@ #include "draw/draw_pt.h" #include "util/u_debug.h" -void draw_pt_split_prim(unsigned prim, unsigned *first, unsigned *incr) +void +draw_pt_split_prim(enum pipe_prim_type prim, unsigned *first, unsigned *incr) { switch (prim) { case PIPE_PRIM_POINTS: diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit.c b/src/gallium/auxiliary/draw/draw_pt_vsplit.c index 653deab28cd..6983454f931 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit.c +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit.c @@ -40,7 +40,7 @@ struct vsplit_frontend { struct draw_pt_front_end base; struct draw_context *draw; - unsigned prim; + enum pipe_prim_type prim; struct draw_pt_middle_end *middle; @@ -198,7 +198,7 @@ vsplit_add_cache_uint(struct vsplit_frontend *vsplit, const uint *elts, static void vsplit_prepare(struct draw_pt_front_end *frontend, - unsigned in_prim, + enum pipe_prim_type in_prim, struct draw_pt_middle_end *middle, unsigned opt) { diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h index be353c418d8..a1bd0926d76 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h @@ -208,7 +208,7 @@ CONCAT(vsplit_segment_fan_, ELT_TYPE)(struct vsplit_frontend *vsplit, #define LOCAL_VARS \ struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; \ - const unsigned prim = vsplit->prim; \ + const enum pipe_prim_type prim = vsplit->prim; \ const unsigned max_count_simple = vsplit->segment_size; \ const unsigned max_count_loop = vsplit->segment_size - 1; \ const unsigned max_count_fan = vsplit->segment_size; @@ -276,7 +276,7 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags, #define LOCAL_VARS \ struct vsplit_frontend *vsplit = (struct vsplit_frontend *) frontend; \ - const unsigned prim = vsplit->prim; \ + const enum pipe_prim_type prim = vsplit->prim; \ const unsigned max_count_simple = vsplit->max_vertices; \ const unsigned max_count_loop = vsplit->segment_size - 1; \ const unsigned max_count_fan = vsplit->segment_size; diff --git a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h index c3a4695c1f2..d055a6ef962 100644 --- a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h @@ -7,7 +7,7 @@ #define FUNC_ENTER \ /* declare more local vars */ \ - const unsigned prim = input_prims->prim; \ + const enum pipe_prim_type prim = input_prims->prim; \ const unsigned prim_flags = input_prims->flags; \ const boolean quads_flatshade_last = FALSE; \ const boolean last_vertex_last = !so->draw->rasterizer->flatshade_first; \ diff --git a/src/gallium/auxiliary/draw/draw_tess.h b/src/gallium/auxiliary/draw/draw_tess.h index 3cca2aee9ec..9a083f90508 100644 --- a/src/gallium/auxiliary/draw/draw_tess.h +++ b/src/gallium/auxiliary/draw/draw_tess.h @@ -77,7 +77,7 @@ struct draw_tess_eval_shader { struct pipe_shader_state state; struct tgsi_shader_info info; - unsigned prim_mode; + enum pipe_prim_type prim_mode; unsigned spacing; unsigned vertex_order_cw; unsigned point_mode;