From: Roland Scheidegger <srol...@vmware.com> The clip stage may crash if there's no position output, for this reason code was added to avoid running the pipeline stages in this case (c7c7186045ec617c53f7899280cbe12e59503e4d). However, this failed to actually work when there was a geometry shader, since unlike the vertex shader it did not initialize the position output to -1, hence the code trying to detect this didn't trigger. So simply initialize the position output to -1 just like the vs does. This fixes piglit glsl-1.50-transform-feedback-type-and-size (segfault->pass). clip-distance-out-values.shader_test goes from segfault to assertion failure, suggesting more fixes are needed, no other piglit changes. --- src/gallium/auxiliary/draw/draw_cliptest_tmp.h | 5 ++++- src/gallium/auxiliary/draw/draw_gs.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h index fc54810..779b237 100644 --- a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h +++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h @@ -62,6 +62,7 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs, ucp_enable = (1 << num_written_clipdistance) - 1; } + assert(pos != -1); for (j = 0; j < info->count; j++) { float *position = out->data[pos]; unsigned mask = 0x0; @@ -84,8 +85,10 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs, DO_CLIP_FULL_Z | DO_CLIP_HALF_Z | DO_CLIP_USER)) { float *clipvertex = position; - if ((flags & DO_CLIP_USER) && cv != pos) + if ((flags & DO_CLIP_USER) && cv != pos) { + assert(cv != -1); clipvertex = out->data[cv]; + } for (i = 0; i < 4; i++) { out->clip[i] = clipvertex[i]; diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index fc4f697..f622822 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -791,6 +791,7 @@ draw_create_geometry_shader(struct draw_context *draw, */ gs->primitive_boundary = gs->max_output_vertices + 1; + gs->position_output = -1; for (i = 0; i < gs->info.num_outputs; i++) { if (gs->info.output_semantic_name[i] == TGSI_SEMANTIC_POSITION && gs->info.output_semantic_index[i] == 0) -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev