summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_render.c
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-10-28 12:11:52 -0700
committerCorbin Simpson <[email protected]>2009-10-28 12:15:35 -0700
commitf3d8d534e6f1d102d71338d58fbaa98c382f1858 (patch)
tree11981adf767a36581f4e00a9d799a3626b76eac8 /src/gallium/drivers/r300/r300_render.c
parent23d8d15bedb7178bedde9b994be3925a160c193d (diff)
r300g: Use u_trim_pipe_prim to prevent lockups from incorrect vert counts.
Adapted from osiris' version on his tree.
Diffstat (limited to 'src/gallium/drivers/r300/r300_render.c')
-rw-r--r--src/gallium/drivers/r300/r300_render.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 6f392402bd0..c36350d29e2 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -26,6 +26,7 @@
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
+#include "util/u_prim.h"
#include "r300_cs.h"
#include "r300_context.h"
@@ -86,6 +87,10 @@ boolean r300_draw_range_elements(struct pipe_context* pipe,
CS_LOCALS(r300);
+ if (!u_trim_pipe_prim(mode, &count)) {
+ return FALSE;
+ }
+
validate:
for (i = 0; i < aos_count; i++) {
if (!r300->winsys->add_buffer(r300->winsys, aos[i].buffer,
@@ -191,6 +196,10 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
struct r300_context* r300 = r300_context(pipe);
int i;
+ if (!u_trim_pipe_prim(mode, &count)) {
+ return FALSE;
+ }
+
for (i = 0; i < r300->vertex_buffer_count; i++) {
void* buf = pipe_buffer_map(pipe->screen,
r300->vertex_buffers[i].buffer,