st/mesa: don't draw instead of asserting in transform feedback
authorDave Airlie <airlied@gmail.com>
Thu, 30 Jul 2015 10:44:50 +0000 (20:44 +1000)
committerDave Airlie <airlied@gmail.com>
Thu, 30 Jul 2015 21:27:29 +0000 (07:27 +1000)
if we get a request to take the count from feedback, but there
is no buffer to take it from, just draw as if we got 0 vertices
so nothing.

This fixes this assert killing the ogl conform, and a piglit
test I've sent.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_cb_xformfb.c
src/mesa/state_tracker/st_cb_xformfb.h
src/mesa/state_tracker/st_draw.c

index 07c118e227bbf964b820d563f6094dafebc78f7b..0708e68ec7befdba0f1c6af23591dfe5c5e309a4 100644 (file)
@@ -191,7 +191,6 @@ st_transform_feedback_get_draw_target(struct gl_transform_feedback_object *obj)
       }
    }
 
-   assert(0);
    return NULL;
 }
 
@@ -211,14 +210,17 @@ st_end_transform_feedback(struct gl_context *ctx,
 }
 
 
-void
+bool
 st_transform_feedback_draw_init(struct gl_transform_feedback_object *obj,
                                 struct pipe_draw_info *out)
 {
    struct st_transform_feedback_object *sobj =
          st_transform_feedback_object(obj);
 
+   if (sobj->draw_count == NULL)
+      return false;
    out->count_from_stream_output = sobj->draw_count;
+   return true;
 }
 
 
index 998c418257b9800900295766c87681a8e68855ca..fb50deddfae2b0600b6d93fda1f17731e66a48c5 100644 (file)
@@ -38,7 +38,7 @@ struct pipe_draw_info;
 extern void
 st_init_xformfb_functions(struct dd_function_table *functions);
 
-extern void
+extern bool
 st_transform_feedback_draw_init(struct gl_transform_feedback_object *obj,
                                 struct pipe_draw_info *out);
 
index 66b2f832933c505a0c13feebfb02d1a1a2e0d826..bae8096e080cb7200dd104c92425b3f623bb7d05 100644 (file)
@@ -242,7 +242,8 @@ st_draw_vbo(struct gl_context *ctx,
       /* Transform feedback drawing is always non-indexed. */
       /* Set info.count_from_stream_output. */
       if (tfb_vertcount) {
-         st_transform_feedback_draw_init(tfb_vertcount, &info);
+         if (st_transform_feedback_draw_init(tfb_vertcount, &info) == false)
+            return;
       }
    }