diff options
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 112 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 74 |
2 files changed, 105 insertions, 81 deletions
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 586d69664fe..a21373baa68 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -58,18 +58,19 @@ struct fetch_pipeline_middle_end { * NOTE: if you change this function, also look at the LLVM * function llvm_middle_end_prepare() for similar changes. */ -static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, - unsigned prim, - unsigned opt, - unsigned *max_vertices ) +static void +fetch_pipeline_prepare(struct draw_pt_middle_end *middle, + unsigned prim, + unsigned opt, + unsigned *max_vertices) { - struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; + struct fetch_pipeline_middle_end *fpme = + (struct fetch_pipeline_middle_end *)middle; struct draw_context *draw = fpme->draw; struct draw_vertex_shader *vs = draw->vs.vertex_shader; struct draw_geometry_shader *gs = draw->gs.geometry_shader; unsigned i; unsigned instance_id_index = ~0; - const unsigned gs_out_prim = (gs ? gs->output_primitive : u_assembled_prim(prim)); unsigned nr_vs_outputs = draw_total_vs_outputs(draw); @@ -95,12 +96,11 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, /* Always leave room for the vertex header whether we need it or * not. It's hard to get rid of it in particular because of the - * viewport code in draw_pt_post_vs.c. + * viewport code in draw_pt_post_vs.c. */ fpme->vertex_size = sizeof(struct vertex_header) + nr * 4 * sizeof(float); - - draw_pt_fetch_prepare( fpme->fetch, + draw_pt_fetch_prepare( fpme->fetch, vs->info.num_inputs, fpme->vertex_size, instance_id_index ); @@ -179,9 +179,11 @@ static void pipeline(struct fetch_pipeline_middle_end *fpme, prim_info ); } -static void emit(struct pt_emit *emit, - const struct draw_vertex_info *vert_info, - const struct draw_prim_info *prim_info) + +static void +emit(struct pt_emit *emit, + const struct draw_vertex_info *vert_info, + const struct draw_prim_info *prim_info) { if (prim_info->linear) { draw_pt_emit_linear(emit, vert_info, prim_info); @@ -192,11 +194,12 @@ static void emit(struct pt_emit *emit, } -static void draw_vertex_shader_run(struct draw_vertex_shader *vshader, - const void *constants[PIPE_MAX_CONSTANT_BUFFERS], - unsigned const_size[PIPE_MAX_CONSTANT_BUFFERS], - const struct draw_vertex_info *input_verts, - struct draw_vertex_info *output_verts ) +static void +draw_vertex_shader_run(struct draw_vertex_shader *vshader, + const void *constants[PIPE_MAX_CONSTANT_BUFFERS], + unsigned const_size[PIPE_MAX_CONSTANT_BUFFERS], + const struct draw_vertex_info *input_verts, + struct draw_vertex_info *output_verts) { output_verts->vertex_size = input_verts->vertex_size; output_verts->stride = input_verts->vertex_size; @@ -215,11 +218,14 @@ static void draw_vertex_shader_run(struct draw_vertex_shader *vshader, input_verts->vertex_size); } -static void fetch_pipeline_generic( struct draw_pt_middle_end *middle, - const struct draw_fetch_info *fetch_info, - const struct draw_prim_info *in_prim_info ) + +static void +fetch_pipeline_generic(struct draw_pt_middle_end *middle, + const struct draw_fetch_info *fetch_info, + const struct draw_prim_info *in_prim_info) { - struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; + struct fetch_pipeline_middle_end *fpme = + (struct fetch_pipeline_middle_end *) middle; struct draw_context *draw = fpme->draw; struct draw_vertex_shader *vshader = draw->vs.vertex_shader; struct draw_geometry_shader *gshader = draw->gs.geometry_shader; @@ -302,7 +308,7 @@ static void fetch_pipeline_generic( struct draw_pt_middle_end *middle, } if (prim_info->count == 0) { debug_printf("GS/IA didn't emit any vertices!\n"); - + FREE(vert_info->verts); if (free_prim_info) { FREE(prim_info->primitive_lengths); @@ -346,14 +352,17 @@ static void fetch_pipeline_generic( struct draw_pt_middle_end *middle, } } -static void fetch_pipeline_run( struct draw_pt_middle_end *middle, - const unsigned *fetch_elts, - unsigned fetch_count, - const ushort *draw_elts, - unsigned draw_count, - unsigned prim_flags ) + +static void +fetch_pipeline_run(struct draw_pt_middle_end *middle, + const unsigned *fetch_elts, + unsigned fetch_count, + const ushort *draw_elts, + unsigned draw_count, + unsigned prim_flags) { - struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; + struct fetch_pipeline_middle_end *fpme = + (struct fetch_pipeline_middle_end *) middle; struct draw_fetch_info fetch_info; struct draw_prim_info prim_info; @@ -375,12 +384,14 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle, } -static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle, - unsigned start, - unsigned count, - unsigned prim_flags) +static void +fetch_pipeline_linear_run(struct draw_pt_middle_end *middle, + unsigned start, + unsigned count, + unsigned prim_flags) { - struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; + struct fetch_pipeline_middle_end *fpme = + (struct fetch_pipeline_middle_end *) middle; struct draw_fetch_info fetch_info; struct draw_prim_info prim_info; @@ -403,14 +414,16 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle, -static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle, - unsigned start, - unsigned count, - const ushort *draw_elts, - unsigned draw_count, - unsigned prim_flags ) +static boolean +fetch_pipeline_linear_run_elts(struct draw_pt_middle_end *middle, + unsigned start, + unsigned count, + const ushort *draw_elts, + unsigned draw_count, + unsigned prim_flags ) { - struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; + struct fetch_pipeline_middle_end *fpme = + (struct fetch_pipeline_middle_end *) middle; struct draw_fetch_info fetch_info; struct draw_prim_info prim_info; @@ -434,15 +447,18 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle } - -static void fetch_pipeline_finish( struct draw_pt_middle_end *middle ) +static void +fetch_pipeline_finish( struct draw_pt_middle_end *middle ) { /* nothing to do */ } -static void fetch_pipeline_destroy( struct draw_pt_middle_end *middle ) + +static void +fetch_pipeline_destroy( struct draw_pt_middle_end *middle ) { - struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle; + struct fetch_pipeline_middle_end *fpme = + (struct fetch_pipeline_middle_end *) middle; if (fpme->fetch) draw_pt_fetch_destroy( fpme->fetch ); @@ -460,9 +476,11 @@ static void fetch_pipeline_destroy( struct draw_pt_middle_end *middle ) } -struct draw_pt_middle_end *draw_pt_fetch_pipeline_or_emit( struct draw_context *draw ) +struct draw_pt_middle_end * +draw_pt_fetch_pipeline_or_emit(struct draw_context *draw) { - struct fetch_pipeline_middle_end *fpme = CALLOC_STRUCT( fetch_pipeline_middle_end ); + struct fetch_pipeline_middle_end *fpme = + CALLOC_STRUCT( fetch_pipeline_middle_end ); if (!fpme) goto fail; 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 49c0d4f3bfb..21a8e443505 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 @@ -303,9 +303,10 @@ llvm_middle_end_bind_parameters(struct draw_pt_middle_end *middle) } -static void pipeline(struct llvm_middle_end *llvm, - const struct draw_vertex_info *vert_info, - const struct draw_prim_info *prim_info) +static void +pipeline(struct llvm_middle_end *llvm, + const struct draw_vertex_info *vert_info, + const struct draw_prim_info *prim_info) { if (prim_info->linear) draw_pipeline_run_linear( llvm->draw, @@ -317,9 +318,11 @@ static void pipeline(struct llvm_middle_end *llvm, prim_info ); } -static void emit(struct pt_emit *emit, - const struct draw_vertex_info *vert_info, - const struct draw_prim_info *prim_info) + +static void +emit(struct pt_emit *emit, + const struct draw_vertex_info *vert_info, + const struct draw_prim_info *prim_info) { if (prim_info->linear) { draw_pt_emit_linear(emit, vert_info, prim_info); @@ -329,10 +332,11 @@ static void emit(struct pt_emit *emit, } } + static void -llvm_pipeline_generic( struct draw_pt_middle_end *middle, - const struct draw_fetch_info *fetch_info, - const struct draw_prim_info *in_prim_info ) +llvm_pipeline_generic(struct draw_pt_middle_end *middle, + const struct draw_fetch_info *fetch_info, + const struct draw_prim_info *in_prim_info) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; struct draw_context *draw = fpme->draw; @@ -351,9 +355,9 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle, llvm_vert_info.count = fetch_info->count; llvm_vert_info.vertex_size = fpme->vertex_size; llvm_vert_info.stride = fpme->vertex_size; - llvm_vert_info.verts = - (struct vertex_header *)MALLOC(fpme->vertex_size * - align(fetch_info->count, lp_native_vector_width / 32)); + llvm_vert_info.verts = (struct vertex_header *) + MALLOC(fpme->vertex_size * + align(fetch_info->count, lp_native_vector_width / 32)); if (!llvm_vert_info.verts) { assert(0); return; @@ -393,7 +397,6 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle, fetch_info = NULL; vert_info = &llvm_vert_info; - if ((opt & PT_SHADE) && gshader) { struct draw_vertex_shader *vshader = draw->vs.vertex_shader; draw_geometry_shader_run(gshader, @@ -423,7 +426,7 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle, } if (prim_info->count == 0) { debug_printf("GS/IA didn't emit any vertices!\n"); - + FREE(vert_info->verts); if (free_prim_info) { FREE(prim_info->primitive_lengths); @@ -464,12 +467,13 @@ llvm_pipeline_generic( struct draw_pt_middle_end *middle, } -static void llvm_middle_end_run( struct draw_pt_middle_end *middle, - const unsigned *fetch_elts, - unsigned fetch_count, - const ushort *draw_elts, - unsigned draw_count, - unsigned prim_flags ) +static void +llvm_middle_end_run(struct draw_pt_middle_end *middle, + const unsigned *fetch_elts, + unsigned fetch_count, + const ushort *draw_elts, + unsigned draw_count, + unsigned prim_flags) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -493,10 +497,11 @@ static void llvm_middle_end_run( struct draw_pt_middle_end *middle, } -static void llvm_middle_end_linear_run( struct draw_pt_middle_end *middle, - unsigned start, - unsigned count, - unsigned prim_flags) +static void +llvm_middle_end_linear_run(struct draw_pt_middle_end *middle, + unsigned start, + unsigned count, + unsigned prim_flags) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -520,14 +525,13 @@ static void llvm_middle_end_linear_run( struct draw_pt_middle_end *middle, } - static boolean -llvm_middle_end_linear_run_elts( struct draw_pt_middle_end *middle, - unsigned start, - unsigned count, - const ushort *draw_elts, - unsigned draw_count, - unsigned prim_flags ) +llvm_middle_end_linear_run_elts(struct draw_pt_middle_end *middle, + unsigned start, + unsigned count, + const ushort *draw_elts, + unsigned draw_count, + unsigned prim_flags) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; struct draw_fetch_info fetch_info; @@ -553,13 +557,15 @@ llvm_middle_end_linear_run_elts( struct draw_pt_middle_end *middle, } - -static void llvm_middle_end_finish( struct draw_pt_middle_end *middle ) +static void +llvm_middle_end_finish(struct draw_pt_middle_end *middle) { /* nothing to do */ } -static void llvm_middle_end_destroy( struct draw_pt_middle_end *middle ) + +static void +llvm_middle_end_destroy(struct draw_pt_middle_end *middle) { struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle; |