- /* XXX Use can_hiz to disable hyperz for good, instead of turning it off/on. */
- if (r300->hiz_in_use && !r300->hyperz_locked && r300_can_hiz(r300)) {
+ /* HiZ. */
+ if (r300->hiz_in_use && !r300->locked_zbuffer) {
+ /* HiZ cannot be used under some circumstances. */
+ if (!r300_hiz_allowed(r300)) {
+ /* If writemask is disabled, the HiZ memory will not be changed,
+ * so we can keep its content for later. */
+ if (dsa->dsa.depth.writemask) {
+ r300->hiz_in_use = FALSE;
+ }
+ return;
+ }
+ DBG(r300, DBG_HYPERZ, "r300: Z-func: %i\n", dsa->dsa.depth.func);
+
+ /* Set the HiZ function if needed. */
+ if (r300->hiz_func == HIZ_FUNC_NONE) {
+ r300->hiz_func = r300_get_hiz_func(r300);
+ }
+
+ /* Setup the HiZ bits. */