diff options
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.c | 34 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.h | 5 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_gs.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.h | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_vs_variant.c | 2 |
9 files changed, 52 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 4a6ba1ac426..29bbc94d0ab 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -605,6 +605,40 @@ draw_num_shader_outputs(const struct draw_context *draw) /** + * Return total number of the vertex shader outputs. This function + * also counts any extra vertex output attributes that may + * be filled in by some draw stages (such as AA point, AA line, + * front face). + */ +uint +draw_total_vs_outputs(const struct draw_context *draw) +{ + const struct tgsi_shader_info *info = &draw->vs.vertex_shader->info; + + return info->num_outputs + draw->extra_shader_outputs.num;; +} + +/** + * Return total number of the geometry shader outputs. This function + * also counts any extra geometry output attributes that may + * be filled in by some draw stages (such as AA point, AA line, front + * face). + */ +uint +draw_total_gs_outputs(const struct draw_context *draw) +{ + const struct tgsi_shader_info *info; + + if (!draw->gs.geometry_shader) + return 0; + + info = &draw->gs.geometry_shader->info; + + return info->num_outputs + draw->extra_shader_outputs.num; +} + + +/** * Provide TGSI sampler objects for vertex/geometry shaders that use * texture fetches. This state only needs to be set once per context. * This might only be used by software drivers for the time being. diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 4a1b27ee414..c720806feca 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -133,6 +133,11 @@ draw_find_shader_output(const struct draw_context *draw, uint draw_num_shader_outputs(const struct draw_context *draw); +uint +draw_total_vs_outputs(const struct draw_context *draw); + +uint +draw_total_gs_outputs(const struct draw_context *draw); void draw_texture_sampler(struct draw_context *draw, diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index cd63e2bf9e3..13d3d3b7b95 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -534,7 +534,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader, { const float (*input)[4] = (const float (*)[4])input_verts->verts->data; unsigned input_stride = input_verts->vertex_size; - unsigned num_outputs = shader->info.num_outputs; + unsigned num_outputs = draw_total_gs_outputs(shader->draw); unsigned vertex_size = sizeof(struct vertex_header) + num_outputs * 4 * sizeof(float); unsigned num_input_verts = input_prim->linear ? input_verts->count : diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index cf71a5d6bdf..03f863178bc 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1833,6 +1833,7 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store) key->need_edgeflags = (llvm->draw->vs.edgeflag_output ? TRUE : FALSE); key->ucp_enable = llvm->draw->rasterizer->clip_plane_enable; key->has_gs = llvm->draw->gs.geometry_shader != NULL; + key->num_outputs = draw_total_vs_outputs(llvm->draw); key->pad1 = 0; /* All variants of this shader will have the same value for @@ -2270,6 +2271,8 @@ draw_gs_llvm_make_variant_key(struct draw_llvm *llvm, char *store) key = (struct draw_gs_llvm_variant_key *)store; + key->num_outputs = draw_total_gs_outputs(llvm->draw); + /* All variants of this shader will have the same value for * nr_samplers. Not yet trying to compact away holes in the * sampler array. diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index 0675e3bf17b..1d238a2a9c2 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -301,12 +301,13 @@ struct draw_llvm_variant_key unsigned bypass_viewport:1; unsigned need_edgeflags:1; unsigned has_gs:1; + unsigned num_outputs:8; /* * it is important there are no holes in this struct * (and all padding gets zeroed). */ unsigned ucp_enable:PIPE_MAX_CLIP_PLANES; - unsigned pad1:32-PIPE_MAX_CLIP_PLANES; + unsigned pad1:24-PIPE_MAX_CLIP_PLANES; /* Variable number of vertex elements: */ @@ -321,6 +322,7 @@ struct draw_gs_llvm_variant_key { unsigned nr_samplers:8; unsigned nr_sampler_views:8; + unsigned num_outputs:8; struct draw_sampler_static_state samplers[1]; }; diff --git a/src/gallium/auxiliary/draw/draw_pipe.h b/src/gallium/auxiliary/draw/draw_pipe.h index 479250729ff..547e4bf4d05 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.h +++ b/src/gallium/auxiliary/draw/draw_pipe.h @@ -35,6 +35,7 @@ #include "pipe/p_compiler.h" #include "draw_private.h" /* for sizeof(vertex_header) */ +#include "draw_context.h" /** @@ -117,7 +118,7 @@ dup_vert( struct draw_stage *stage, { struct vertex_header *tmp = stage->tmp[idx]; const uint vsize = sizeof(struct vertex_header) - + stage->draw->vs.num_vs_outputs * 4 * sizeof(float); + + draw_num_shader_outputs(stage->draw) * 4 * sizeof(float); memcpy(tmp, vert, vsize); tmp->vertex_id = UNDEFINED_VERTEX_ID; return tmp; 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 84f86ae75ee..8fcc17048d2 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c @@ -72,12 +72,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle, const unsigned gs_out_prim = (gs ? gs->output_primitive : u_assembled_prim(prim)); - - /* Add one to num_outputs because the pipeline occasionally tags on - * an additional texcoord, eg for AA lines. - */ unsigned nr = MAX2( vs->info.num_inputs, - vs->info.num_outputs + 1 ); + draw_total_vs_outputs(draw) ); if (gs) { nr = MAX2(nr, gs->info.num_outputs + 1); 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 17b948a7652..9f172418544 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 @@ -141,12 +141,8 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle, struct draw_geometry_shader *gs = draw->gs.geometry_shader; const unsigned out_prim = gs ? gs->output_primitive : u_assembled_prim(in_prim); - - /* Add one to num_outputs because the pipeline occasionally tags on - * an additional texcoord, eg for AA lines. - */ - const unsigned nr = MAX2( vs->info.num_inputs, - vs->info.num_outputs + 1 ); + const unsigned nr = MAX2(vs->info.num_inputs, + draw_total_vs_outputs(draw)); fpme->input_prim = in_prim; fpme->opt = opt; diff --git a/src/gallium/auxiliary/draw/draw_vs_variant.c b/src/gallium/auxiliary/draw/draw_vs_variant.c index 37500c7db8d..9045b638444 100644 --- a/src/gallium/auxiliary/draw/draw_vs_variant.c +++ b/src/gallium/auxiliary/draw/draw_vs_variant.c @@ -315,7 +315,7 @@ draw_vs_create_variant_generic( struct draw_vertex_shader *vs, vsvg->draw = vs->draw; vsvg->temp_vertex_stride = MAX2(key->nr_inputs, - vsvg->base.vs->info.num_outputs) * 4 * sizeof(float); + draw_total_vs_outputs(vs->draw)) * 4 * sizeof(float); /* Build free-standing fetch and emit functions: */ |