radeonsi: Use htile_buffer for depth only when there is no stencil.
authorAndreas Hartmetz <ahartmetz@gmail.com>
Sat, 21 Dec 2013 20:11:37 +0000 (21:11 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Sun, 22 Dec 2013 00:41:03 +0000 (01:41 +0100)
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_state.c

index 8705d16d6ca7eb56c12cb9b98a26b29d2a7acbb1..49b9bb546e6bb50b694ecf46e733e2a92f0bbdde 100644 (file)
@@ -1819,6 +1819,8 @@ static void si_db(struct r600_context *rctx, struct si_pm4_state *pm4,
        /* HiZ aka depth buffer htile */
        /* use htile only for first level */
        if (rtex->htile_buffer && !level) {
+               const struct util_format_description *fmt_desc;
+
                z_info |= S_028040_TILE_SURFACE_ENABLE(1);
 
                /* This is optimal for the clear value of 1.0 and using
@@ -1827,6 +1829,12 @@ static void si_db(struct r600_context *rctx, struct si_pm4_state *pm4,
                 * clearing. */
                z_info |= S_028040_ZRANGE_PRECISION(1);
 
+               fmt_desc = util_format_description(rtex->resource.b.b.format);
+               if (!util_format_has_stencil(fmt_desc)) {
+                       /* Use all of the htile_buffer for depth */
+                       s_info |= S_028044_TILE_STENCIL_DISABLE(1);
+               }
+
                uint64_t va = r600_resource_va(&rctx->screen->b.b, &rtex->htile_buffer->b.b);
                db_htile_data_base = va >> 8;
                db_htile_surface = S_028ABC_FULL_CACHE(1);