From: Jason Ekstrand Date: Mon, 22 May 2017 15:59:49 +0000 (-0700) Subject: i965/miptree: Clean up the depth resolve helpers a little X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64b829244b0f39e4e4d3f1611896ad6cb1ed7318;p=mesa.git i965/miptree: Clean up the depth resolve helpers a little Reviewed-by: Topi Pohjolainen Reviewed-by: Kenneth Graunke Reviewed-by: Chad Versace --- diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 160588c0296..c4985149aab 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -1977,23 +1977,30 @@ intel_miptree_set_all_slices_need_depth_resolve(struct intel_mipmap_tree *mt, } static bool -intel_miptree_slice_resolve(struct brw_context *brw, - struct intel_mipmap_tree *mt, - uint32_t level, - uint32_t layer, - enum blorp_hiz_op need) +intel_miptree_depth_hiz_resolve(struct brw_context *brw, + struct intel_mipmap_tree *mt, + uint32_t start_level, uint32_t num_levels, + uint32_t start_layer, uint32_t num_layers, + enum blorp_hiz_op need) { - intel_miptree_check_level_layer(mt, level, layer); + bool did_resolve = false; - struct intel_resolve_map *item = - intel_resolve_map_get(&mt->hiz_map, level, layer); + foreach_list_typed_safe(struct intel_resolve_map, map, link, &mt->hiz_map) { + if (map->level < start_level || + map->level >= (start_level + num_levels) || + map->layer < start_layer || + map->layer >= (start_layer + num_layers)) + continue; - if (!item || item->need != need) - return false; + if (map->need != need) + continue; - intel_hiz_exec(brw, mt, level, layer, 1, need); - intel_resolve_map_remove(item); - return true; + intel_hiz_exec(brw, mt, map->level, map->layer, 1, need); + intel_resolve_map_remove(map); + did_resolve = true; + } + + return did_resolve; } bool @@ -2002,8 +2009,8 @@ intel_miptree_slice_resolve_hiz(struct brw_context *brw, uint32_t level, uint32_t layer) { - return intel_miptree_slice_resolve(brw, mt, level, layer, - BLORP_HIZ_OP_HIZ_RESOLVE); + return intel_miptree_depth_hiz_resolve(brw, mt, level, 1, layer, 1, + BLORP_HIZ_OP_HIZ_RESOLVE); } bool @@ -2012,43 +2019,26 @@ intel_miptree_slice_resolve_depth(struct brw_context *brw, uint32_t level, uint32_t layer) { - return intel_miptree_slice_resolve(brw, mt, level, layer, - BLORP_HIZ_OP_DEPTH_RESOLVE); -} - -static bool -intel_miptree_all_slices_resolve(struct brw_context *brw, - struct intel_mipmap_tree *mt, - enum blorp_hiz_op need) -{ - bool did_resolve = false; - - foreach_list_typed_safe(struct intel_resolve_map, map, link, &mt->hiz_map) { - if (map->need != need) - continue; - - intel_hiz_exec(brw, mt, map->level, map->layer, 1, need); - intel_resolve_map_remove(map); - did_resolve = true; - } - - return did_resolve; + return intel_miptree_depth_hiz_resolve(brw, mt, level, 1, layer, 1, + BLORP_HIZ_OP_DEPTH_RESOLVE); } bool intel_miptree_all_slices_resolve_hiz(struct brw_context *brw, struct intel_mipmap_tree *mt) { - return intel_miptree_all_slices_resolve(brw, mt, - BLORP_HIZ_OP_HIZ_RESOLVE); + return intel_miptree_depth_hiz_resolve(brw, mt, + 0, UINT32_MAX, 0, UINT32_MAX, + BLORP_HIZ_OP_HIZ_RESOLVE); } bool intel_miptree_all_slices_resolve_depth(struct brw_context *brw, struct intel_mipmap_tree *mt) { - return intel_miptree_all_slices_resolve(brw, mt, - BLORP_HIZ_OP_DEPTH_RESOLVE); + return intel_miptree_depth_hiz_resolve(brw, mt, + 0, UINT32_MAX, 0, UINT32_MAX, + BLORP_HIZ_OP_DEPTH_RESOLVE); } enum intel_fast_clear_state