summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_hyperz.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-08-14 18:37:04 +0200
committerMarek Olšák <maraeo@gmail.com>2010-08-15 08:07:11 +0200
commit5f8ccf1e2766e3e7537dd8a838837c5e4af4246c (patch)
treec9426ce50d9cf236138a702b142b41e2a52b7f77 /src/gallium/drivers/r300/r300_hyperz.c
parent0d699e8ee930c6c7e0f8abff14bf37e7f67807fe (diff)
r300g: do not use fastfill if ZMask RAM is not properly initialized
z_fastfill -> dirty_zmask[level].
Diffstat (limited to 'src/gallium/drivers/r300/r300_hyperz.c')
-rw-r--r--src/gallium/drivers/r300/r300_hyperz.c27
1 files changed, 18 insertions, 9 deletions
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);