/* Helper function of si_flush_depth_texture: decompress the given levels * of Z and/or S planes in place. */ static void si_blit_decompress_zs_in_place(struct si_context *sctx, struct r600_texture *texture, unsigned levels_z, unsigned levels_s, unsigned first_layer, unsigned last_layer) { unsigned both = levels_z & levels_s; /* First, do combined Z & S decompresses for levels that need it. */ if (both) { si_blit_decompress_zs_planes_in_place( sctx, texture, PIPE_MASK_Z | PIPE_MASK_S, both, first_layer, last_layer); levels_z &= ~both; levels_s &= ~both; } /* Now do separate Z and S decompresses. */ if (levels_z) { si_blit_decompress_zs_planes_in_place( sctx, texture, PIPE_MASK_Z, levels_z, first_layer, last_layer); } if (levels_s) { si_blit_decompress_zs_planes_in_place( sctx, texture, PIPE_MASK_S, levels_s, first_layer, last_layer); } }
/* Decompress Z and/or S planes in place, depending on mask. */ static void si_blit_decompress_zs_in_place(struct si_context *sctx, struct r600_texture *texture, unsigned planes, unsigned first_level, unsigned last_level, unsigned first_layer, unsigned last_layer) { unsigned level_mask = u_bit_consecutive(first_level, last_level - first_level + 1); unsigned cur_level_mask; /* First, do combined Z & S decompresses for levels that need it. */ if (planes == (PIPE_MASK_Z | PIPE_MASK_S)) { cur_level_mask = level_mask & texture->dirty_level_mask & texture->stencil_dirty_level_mask; si_blit_decompress_zs_planes_in_place( sctx, texture, PIPE_MASK_Z | PIPE_MASK_S, cur_level_mask, first_layer, last_layer); level_mask &= ~cur_level_mask; } /* Now do separate Z and S decompresses. */ if (planes & PIPE_MASK_Z) { cur_level_mask = level_mask & texture->dirty_level_mask; si_blit_decompress_zs_planes_in_place( sctx, texture, PIPE_MASK_Z, cur_level_mask, first_layer, last_layer); level_mask &= ~cur_level_mask; } if (planes & PIPE_MASK_S) { cur_level_mask = level_mask & texture->stencil_dirty_level_mask; si_blit_decompress_zs_planes_in_place( sctx, texture, PIPE_MASK_S, cur_level_mask, first_layer, last_layer); } }