[Mesa-dev] [PATCH] st/mesa: fail to draw instead of asserting in transform feedback
Marek Olšák
maraeo at gmail.com
Thu Jul 30 03:51:29 PDT 2015
It's not a failure, so it can't _fail_ to draw. It should be
interpreted such that the drawing succeeds with the vertex count given
by the transform feedback object, which is 0.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Thu, Jul 30, 2015 at 12:46 PM, Dave Airlie <airlied at gmail.com> wrote:
> if we get a request to take the count from feedback, but there
> is no buffer to take it from, just draw nothing instead of asserting.
>
> This fixes this assert killing the ogl conform, and a piglit
> test I've sent.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/mesa/state_tracker/st_cb_xformfb.c | 6 ++++--
> src/mesa/state_tracker/st_cb_xformfb.h | 2 +-
> src/mesa/state_tracker/st_draw.c | 3 ++-
> 3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_xformfb.c b/src/mesa/state_tracker/st_cb_xformfb.c
> index 07c118e..0708e68 100644
> --- a/src/mesa/state_tracker/st_cb_xformfb.c
> +++ b/src/mesa/state_tracker/st_cb_xformfb.c
> @@ -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;
> }
>
>
> diff --git a/src/mesa/state_tracker/st_cb_xformfb.h b/src/mesa/state_tracker/st_cb_xformfb.h
> index 998c418..fb50ded 100644
> --- a/src/mesa/state_tracker/st_cb_xformfb.h
> +++ b/src/mesa/state_tracker/st_cb_xformfb.h
> @@ -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);
>
> diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
> index 66b2f83..bae8096 100644
> --- a/src/mesa/state_tracker/st_draw.c
> +++ b/src/mesa/state_tracker/st_draw.c
> @@ -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;
> }
> }
>
> --
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list