From 5f8ccf1e2766e3e7537dd8a838837c5e4af4246c Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 14 Aug 2010 18:37:04 +0200 Subject: r300g: do not use fastfill if ZMask RAM is not properly initialized z_fastfill -> dirty_zmask[level]. --- src/gallium/drivers/r300/r300_hyperz.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/gallium/drivers/r300/r300_hyperz.c') diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c index 3b0adc3584..1f6244c49e 100644 --- a/src/gallium/drivers/r300/r300_hyperz.c +++ b/src/gallium/drivers/r300/r300_hyperz.c @@ -129,6 +129,9 @@ static void r300_update_hyperz(struct r300_context* r300) { struct r300_hyperz_state *z = (struct r300_hyperz_state*)r300->hyperz_state.state; + struct pipe_framebuffer_state *fb = + (struct pipe_framebuffer_state*)r300->fb_state.state; + boolean dirty_zmask = FALSE; z->gb_z_peq_config = 0; z->zb_bw_cntl = 0; @@ -140,23 +143,29 @@ static void r300_update_hyperz(struct r300_context* r300) return; } + if (!fb->zsbuf) + return; + if (!r300->rws->get_value(r300->rws, R300_CAN_HYPERZ)) return; + dirty_zmask = r300_texture(fb->zsbuf->texture)->dirty_zmask[fb->zsbuf->level]; + + /* Z fastfill. */ + if (dirty_zmask) { + z->zb_bw_cntl |= R300_FAST_FILL_ENABLE; /* | R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE;*/ + } + /* Zbuffer compression. */ - if (r300->z_compression) { + if (dirty_zmask && r300->z_compression) { z->zb_bw_cntl |= R300_RD_COMP_ENABLE; if (r300->z_decomp_rd == false) z->zb_bw_cntl |= R300_WR_COMP_ENABLE; - /* RV350 and up optimizations. */ - if (r300->z_compression == RV350_Z_COMPRESS_88) - z->gb_z_peq_config |= R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8; - } - - /* Z fastfill. */ - if (r300->z_fastfill) { - z->zb_bw_cntl |= R300_FAST_FILL_ENABLE; /* | R300_FORCE_COMPRESSED_STENCIL_VALUE_ENABLE;*/ } + /* RV350 and up optimizations. */ + /* The section 10.4.9 in the docs is a lie. */ + if (r300->z_compression == RV350_Z_COMPRESS_88) + z->gb_z_peq_config |= R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8; if (r300->hiz_enable) { bool can_hiz = r300_can_hiz(r300); -- cgit v1.2.3