summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-10-04 08:38:26 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2013-10-04 08:38:26 +0200
commit608db7c81182d1d99ea594ad111feb4d0d9c1c2c (patch)
treeb9786d8281729bbd5ab91b17b7554e299a50a490
parent552df56ad031d50c02087e7bad257f63e98b1613 (diff)
driver: skip draw when # elements and # VS inputs does not match up
This can hang the GPU. This should never happen, but show a BUG and skip draw in case it does.
-rw-r--r--native/driver/etna_pipe.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/native/driver/etna_pipe.c b/native/driver/etna_pipe.c
index 588f24a..91df5f4 100644
--- a/native/driver/etna_pipe.c
+++ b/native/driver/etna_pipe.c
@@ -296,7 +296,6 @@ static void sync_context(struct pipe_context *restrict pipe)
/* re-link vs and fs if needed */
etna_link_shaders(pipe, &e->shader_state, e->vs, e->fs);
}
- assert(!e->vs || e->vertex_elements.num_elements == e->vs->num_inputs);
/* Pre-processing: see what caches we need to flush before making state
* changes.
@@ -800,6 +799,12 @@ static void etna_pipe_draw_vbo(struct pipe_context *pipe,
}
/* First, sync state, then emit DRAW_PRIMITIVES or DRAW_INDEXED_PRIMITIVES */
sync_context(pipe);
+ if(priv->vs && priv->vertex_elements.num_elements != priv->vs->num_inputs)
+ {
+ BUG("Number of elements %i does not match the number of VS inputs %i",
+ priv->vertex_elements.num_elements, priv->vs->num_inputs);
+ return;
+ }
if(info->indexed)
{
etna_draw_indexed_primitives(priv->ctx, translate_draw_mode(info->mode),