iris: Call iris_sample_with_depth_aux earlier

Instead of calling iris_sample_with_depth_aux right before a sample
operation, call it at resource creation time. Unifies the code which
ensures that it's okay to sample with HiZ.

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-11-11 08:04:53 -08:00 committed by Marge Bot
parent 9bd092736c
commit fbacd8a99c
2 changed files with 3 additions and 22 deletions

View file

@ -827,21 +827,10 @@ iris_resource_texture_aux_usage(struct iris_context *ice,
switch (res->aux.usage) {
case ISL_AUX_USAGE_HIZ:
assert(res->surf.format == view_format);
if (iris_sample_with_depth_aux(devinfo, res))
return ISL_AUX_USAGE_HIZ;
break;
case ISL_AUX_USAGE_HIZ_CCS:
assert(res->surf.format == view_format);
assert(!iris_sample_with_depth_aux(devinfo, res));
return ISL_AUX_USAGE_NONE;
case ISL_AUX_USAGE_HIZ_CCS_WT:
assert(res->surf.format == view_format);
if (iris_sample_with_depth_aux(devinfo, res))
return ISL_AUX_USAGE_HIZ_CCS_WT;
break;
return util_last_bit(res->aux.sampler_usages) - 1;
case ISL_AUX_USAGE_MCS:
case ISL_AUX_USAGE_MCS_CCS:

View file

@ -685,16 +685,8 @@ iris_resource_configure_aux(struct iris_screen *screen,
res->aux.usage = util_last_bit(res->aux.possible_usages) - 1;
res->aux.sampler_usages = res->aux.possible_usages;
/* We don't always support sampling with hiz. But when we do, it must be
* single sampled.
*/
if (!devinfo->has_sample_with_hiz || res->surf.samples > 1)
res->aux.sampler_usages &= ~(1 << ISL_AUX_USAGE_HIZ);
/* ISL_AUX_USAGE_HIZ_CCS doesn't support sampling at all */
res->aux.sampler_usages &= ~(1 << ISL_AUX_USAGE_HIZ_CCS);
if (!has_hiz || iris_sample_with_depth_aux(devinfo, res))
res->aux.sampler_usages = res->aux.possible_usages;
enum isl_aux_state initial_state;
assert(!res->aux.bo);