iris: Loosen aux state getter/setter assert on HiZ

The aux state getter and setter currently assert
iris_resource_level_has_hiz() for depth surfaces.

This assertion is too strict however. In some cases where the assert
would fail, we can still correctly describe the aux state with the ISL
enums (using ISL_AUX_STATE_AUX_INVALID, for example).

When HiZ is enabled on a resource but disabled for a given level, allow
the getter to be called and allow the setter to set aux states that lack
compression. Enables code simplifications later on.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8853>
This commit is contained in:
Nanley Chery 2020-12-15 16:38:52 -08:00 committed by Marge Bot
parent 0079b8543a
commit f2a2ee3193

View file

@ -767,7 +767,7 @@ iris_resource_get_aux_state(const struct iris_resource *res,
iris_resource_check_level_layer(res, level, layer);
if (res->surf.usage & ISL_SURF_USAGE_DEPTH_BIT) {
assert(iris_resource_level_has_hiz(res, level));
assert(isl_aux_usage_has_hiz(res->aux.usage));
} else {
assert(res->surf.samples == 1 ||
res->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);
@ -785,7 +785,8 @@ iris_resource_set_aux_state(struct iris_context *ice,
num_layers = miptree_layer_range_length(res, level, start_layer, num_layers);
if (res->surf.usage & ISL_SURF_USAGE_DEPTH_BIT) {
assert(iris_resource_level_has_hiz(res, level));
assert(iris_resource_level_has_hiz(res, level) ||
!isl_aux_state_has_valid_aux(aux_state));
} else {
assert(res->surf.samples == 1 ||
res->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY);