summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_hyperz.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-07-12 13:23:24 +0200
committerMarek Olšák <maraeo@gmail.com>2010-07-12 13:26:00 +0200
commit8c836f7f740c6f74511c727c7bed0680ddba9974 (patch)
tree2e26e477cb1a9effb97eec38f7734fc87507312f /src/gallium/drivers/r300/r300_hyperz.c
parent78e8a8765f435bf0902d62afbcb3b8d68a0b716f (diff)
r300g: implement fast color clear
An initial implementation made by Dave Airlie. For it to be used, a color-only clear must be invoked and exactly one point-sampled render target must be set. The render target must be macrotiled (for us to overcome alignment issues) and bpp must be either 16 or 32. I can't see a difference in performance. :( Conflicts: src/gallium/drivers/r300/r300_blit.c
Diffstat (limited to 'src/gallium/drivers/r300/r300_hyperz.c')
-rw-r--r--src/gallium/drivers/r300/r300_hyperz.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_hyperz.c b/src/gallium/drivers/r300/r300_hyperz.c
index 2c4e6c7211..e952895601 100644
--- a/src/gallium/drivers/r300/r300_hyperz.c
+++ b/src/gallium/drivers/r300/r300_hyperz.c
@@ -27,6 +27,22 @@
#include "r300_fs.h"
/*****************************************************************************/
+/* The HyperZ setup */
+/*****************************************************************************/
+
+static void r300_update_hyperz(struct r300_context* r300)
+{
+ struct r300_hyperz_state *z =
+ (struct r300_hyperz_state*)r300->hyperz_state.state;
+
+ z->zb_bw_cntl = 0;
+ z->sc_hyperz = R300_SC_HYPERZ_ADJ_2;
+
+ if (r300->cbzb_clear)
+ z->zb_bw_cntl |= R300_ZB_CB_CLEAR_CACHE_LINE_WRITE_ONLY;
+}
+
+/*****************************************************************************/
/* The ZTOP state */
/*****************************************************************************/
@@ -118,4 +134,7 @@ static void r300_update_ztop(struct r300_context* r300)
void r300_update_hyperz_state(struct r300_context* r300)
{
r300_update_ztop(r300);
+ if (r300->hyperz_state.dirty) {
+ r300_update_hyperz(r300);
+ }
}