From 05487ef88ded5fea0b1de7bc08d44846648d1ce2 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 2 Aug 2013 01:39:35 -0400 Subject: draw: stop crashing with extra shader outputs Draw sometimes injects extra shader outputs (aa points, lines or front face), unfortunately most of the pipeline and llvm code didn't handle them at all. It only worked if number of inputs happened to be bigger or equal to the number of shader outputs plus the extra injected outputs. In particular when running the pipeline which depends on the vertex_id in the vertex_header things were completely broken. The patch adjust the code to correctly use the total number of shader outputs (the standard ones plus the injected ones) to make it all stop crashing and work. Signed-off-by: Zack Rusin Reviewed-by: Roland Scheidegger Reviewed-by: Jose Fonseca Reviewed-by: Brian Paul --- src/gallium/auxiliary/draw/draw_llvm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gallium/auxiliary/draw/draw_llvm.c') 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. -- cgit v1.2.3