summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_render.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2009-12-05 20:39:11 +0100
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-12-06 01:13:37 -0800
commit07487643515edb731c6abc3e931c329a89dd9293 (patch)
tree67b95feebac31fc60c4adb90db0a47711e480756 /src/gallium/drivers/r300/r300_render.c
parente1380cae885df37d4a211d0271f59487d9f2db78 (diff)
r300g: don't render if everything is culled by scissoring
Otherwise a CS is refused by kernel 2.6.31 (and maybe all later versions, not sure).
Diffstat (limited to 'src/gallium/drivers/r300/r300_render.c')
-rw-r--r--src/gallium/drivers/r300/r300_render.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 4c5fb405c6..35b335df6a 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -70,6 +70,12 @@ uint32_t r300_translate_primitive(unsigned prim)
}
}
+static boolean r300_nothing_to_draw(struct r300_context *r300)
+{
+ return r300->rs_state->rs.scissor &&
+ r300->scissor_state->scissor.empty_area;
+}
+
static void r300_emit_draw_arrays(struct r300_context *r300,
unsigned mode,
unsigned count)
@@ -173,10 +179,15 @@ boolean r300_draw_range_elements(struct pipe_context* pipe,
return FALSE;
}
+
if (count > 65535) {
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
r300_update_derived_state(r300);
if (!r300_setup_vertex_buffers(r300)) {
@@ -218,6 +229,10 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
r300_update_derived_state(r300);
if (!r300_setup_vertex_buffers(r300)) {
@@ -251,6 +266,10 @@ boolean r300_swtcl_draw_arrays(struct pipe_context* pipe,
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
for (i = 0; i < r300->vertex_buffer_count; i++) {
void* buf = pipe_buffer_map(pipe->screen,
r300->vertex_buffer[i].buffer,
@@ -292,6 +311,10 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe,
return FALSE;
}
+ if (r300_nothing_to_draw(r300)) {
+ return TRUE;
+ }
+
for (i = 0; i < r300->vertex_buffer_count; i++) {
void* buf = pipe_buffer_map(pipe->screen,
r300->vertex_buffer[i].buffer,