r300g: don't hang GPU on misbehaving apps
authorMaciej Cencora <m.cencora@gmail.com>
Sun, 25 Oct 2009 12:51:45 +0000 (13:51 +0100)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 7 Nov 2009 19:53:13 +0000 (11:53 -0800)
src/gallium/drivers/r300/r300_render.c

index 86aaf841dd69ee0c5c3181031b7bf896cfdb38e7..cbda30227da0c9870e34ada2d48e9bdd92faf215 100644 (file)
@@ -112,6 +112,9 @@ boolean r300_draw_range_elements(struct pipe_context* pipe,
 {
     struct r300_context* r300 = r300_context(pipe);
 
+    if (!u_trim_pipe_prim(mode, &count))
+        return false;
+
     r300_update_derived_state(r300);
 
     setup_vertex_buffers(r300);
@@ -147,6 +150,9 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
 {
     struct r300_context* r300 = r300_context(pipe);
 
+    if (!u_trim_pipe_prim(mode, &count))
+        return false;
+
     r300_update_derived_state(r300);
 
     setup_vertex_buffers(r300);