summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-05-29 06:12:22 +0200
committerMarek Olšák <[email protected]>2011-05-29 16:17:11 +0200
commit76056510bcd35b6b5607b572c0c0ff47b5c5e7e2 (patch)
treeddbcdd942f333de81752bbb0d9d77b281318251e /src
parentaae56150f5d59d45e13a4033b20f0ccf20a3319c (diff)
r300g: clear can be killed by render condition
Fixes piglit: - NV_conditional_render/clear
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/r300_blit.c37
-rw-r--r--src/gallium/drivers/r300/r300_context.h2
-rw-r--r--src/gallium/drivers/r300/r300_render.c3
3 files changed, 35 insertions, 7 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 7f430269e41..388ebcdbf32 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -30,14 +30,24 @@
enum r300_blitter_op /* bitmask */
{
- R300_CLEAR = 1,
- R300_CLEAR_SURFACE = 2,
- R300_COPY = 4
+ R300_STOP_QUERY = 1,
+ R300_SAVE_TEXTURES = 2,
+ R300_SAVE_FRAMEBUFFER = 4,
+ R300_IGNORE_RENDER_COND = 8,
+
+ R300_CLEAR = R300_STOP_QUERY,
+
+ R300_CLEAR_SURFACE = R300_STOP_QUERY | R300_SAVE_FRAMEBUFFER,
+
+ R300_COPY = R300_STOP_QUERY | R300_SAVE_FRAMEBUFFER |
+ R300_SAVE_TEXTURES | R300_IGNORE_RENDER_COND,
+
+ R300_DECOMPRESS = R300_STOP_QUERY | R300_IGNORE_RENDER_COND,
};
static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op op)
{
- if (r300->query_current) {
+ if ((op & R300_STOP_QUERY) && r300->query_current) {
r300->blitter_saved_query = r300->query_current;
r300_stop_query(r300);
}
@@ -57,11 +67,11 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
util_blitter_save_vertex_buffers(r300->blitter, r300->vbuf_mgr->nr_vertex_buffers,
r300->vbuf_mgr->vertex_buffer);
- if (op & (R300_CLEAR_SURFACE | R300_COPY)) {
+ if (op & R300_SAVE_FRAMEBUFFER) {
util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
}
- if (op & R300_COPY) {
+ if (op & R300_SAVE_TEXTURES) {
struct r300_textures_state* state =
(struct r300_textures_state*)r300->textures_state.state;
@@ -73,6 +83,14 @@ static void r300_blitter_begin(struct r300_context* r300, enum r300_blitter_op o
r300->blitter, state->sampler_view_count,
(struct pipe_sampler_view**)state->sampler_views);
}
+
+ if (op & R300_IGNORE_RENDER_COND) {
+ /* Save the flag. */
+ r300->blitter_saved_skip_rendering = r300->skip_rendering+1;
+ r300->skip_rendering = FALSE;
+ } else {
+ r300->blitter_saved_skip_rendering = 0;
+ }
}
static void r300_blitter_end(struct r300_context *r300)
@@ -81,6 +99,11 @@ static void r300_blitter_end(struct r300_context *r300)
r300_resume_query(r300, r300->blitter_saved_query);
r300->blitter_saved_query = NULL;
}
+
+ if (r300->blitter_saved_skip_rendering) {
+ /* Restore the flag. */
+ r300->skip_rendering = r300->blitter_saved_skip_rendering-1;
+ }
}
static uint32_t r300_depth_clear_cb_value(enum pipe_format format,
@@ -374,7 +397,7 @@ void r300_decompress_zmask(struct r300_context *r300)
r300->zmask_decompress = TRUE;
r300_mark_atom_dirty(r300, &r300->hyperz_state);
- r300_blitter_begin(r300, R300_CLEAR);
+ r300_blitter_begin(r300, R300_DECOMPRESS);
util_blitter_clear_depth_custom(r300->blitter, fb->width, fb->height, 0,
r300->dsa_decompress_zmask);
r300_blitter_end(r300);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 139dd210b8f..d71db0001a9 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -584,6 +584,8 @@ struct r300_context {
uint32_t zbuffer_bpp;
/* Whether rendering is conditional and should be skipped. */
boolean skip_rendering;
+ /* The flag above saved by blitter. */
+ unsigned char blitter_saved_skip_rendering;
/* Point sprites texcoord index, 1 bit per texcoord */
int sprite_coord_enable;
/* Whether two-sided color selection is enabled (AKA light_twoside). */
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 429b85545f7..b24e7faa644 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1200,6 +1200,9 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
const float zeros[4] = {0, 0, 0, 0};
CS_LOCALS(r300);
+ if (r300->skip_rendering)
+ return;
+
r300->context.set_vertex_buffers(&r300->context, 0, NULL);
if (type == UTIL_BLITTER_ATTRIB_TEXCOORD)