From: Roland Scheidegger <srol...@vmware.com>

It seems easiest (and best) if we simply skip all the later stages
(after stream output).
(This is different to the llvm case at least for now where we will
simply try to render garbage, though both behaviors should be correct.)
Fixes piglit glsl-1.40-tf-no-position with softpipe.
---
 .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c  |   39 ++++++++++++--------
 1 file changed, 23 insertions(+), 16 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 2fc8220..f0a48df 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -288,23 +288,30 @@ static void fetch_pipeline_generic( struct 
draw_pt_middle_end *middle,
                     vert_info,
                     prim_info );
 
-   if (draw_pt_post_vs_run( fpme->post_vs,
-                            vert_info ))
-   {
-      opt |= PT_PIPELINE;
-   }
-
-   /* Do we need to run the pipeline?
+   /*
+    * if there's no position, need to stop now, or the latter stages
+    * will try to access non-existent position output.
     */
-   if (opt & PT_PIPELINE) {
-      pipeline( fpme,
-                vert_info,
-                prim_info );
-   }
-   else {
-      emit( fpme->emit,
-            vert_info,
-            prim_info );
+   if (draw_current_shader_position_output(draw) != -1) {
+
+      if (draw_pt_post_vs_run( fpme->post_vs,
+                               vert_info ))
+      {
+         opt |= PT_PIPELINE;
+      }
+
+      /* Do we need to run the pipeline?
+       */
+      if (opt & PT_PIPELINE) {
+         pipeline( fpme,
+                   vert_info,
+                   prim_info );
+      }
+      else {
+         emit( fpme->emit,
+               vert_info,
+               prim_info );
+      }
    }
    FREE(vert_info->verts);
 }
-- 
1.7.9.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to