[Mesa-dev] [PATCH 11/32] i965/miptree: Add a helper for getting the aux usage for texturing
Pohjolainen, Topi
topi.pohjolainen at gmail.com
Thu Jul 20 10:09:33 UTC 2017
On Wed, Jul 19, 2017 at 02:01:37PM -0700, Jason Ekstrand wrote:
> ---
> src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 59 ++++++++++++++++++---------
> src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 4 ++
> 2 files changed, 43 insertions(+), 20 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 2d2a813..0a63178 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -2679,6 +2679,33 @@ can_texture_with_ccs(struct brw_context *brw,
> return true;
> }
>
> +enum isl_aux_usage
> +intel_miptree_texture_aux_usage(struct brw_context *brw,
> + struct intel_mipmap_tree *mt,
Could be const.
> + enum isl_format view_format)
> +{
> + switch (mt->aux_usage) {
> + case ISL_AUX_USAGE_HIZ:
> + if (intel_miptree_sample_with_hiz(brw, mt))
> + return ISL_AUX_USAGE_HIZ;
> + break;
> +
> + case ISL_AUX_USAGE_MCS:
> + return ISL_AUX_USAGE_MCS;
> +
> + case ISL_AUX_USAGE_CCS_D:
> + case ISL_AUX_USAGE_CCS_E:
> + if (mt->mcs_buf && can_texture_with_ccs(brw, mt, view_format))
> + return ISL_AUX_USAGE_CCS_E;
> + break;
> +
> + default:
> + break;
> + }
> +
> + return ISL_AUX_USAGE_NONE;
> +}
> +
> static void
> intel_miptree_prepare_texture_slices(struct brw_context *brw,
> struct intel_mipmap_tree *mt,
> @@ -2687,31 +2714,23 @@ intel_miptree_prepare_texture_slices(struct brw_context *brw,
> uint32_t start_layer, uint32_t num_layers,
> bool *aux_supported_out)
> {
> - bool aux_supported, clear_supported;
> - if (_mesa_is_format_color_format(mt->format)) {
> - if (mt->num_samples > 1) {
> - aux_supported = clear_supported = true;
> - } else {
> - aux_supported = can_texture_with_ccs(brw, mt, view_format);
> - }
> + enum isl_aux_usage aux_usage =
> + intel_miptree_texture_aux_usage(brw, mt, view_format);
This as well.
> + bool clear_supported = aux_usage != ISL_AUX_USAGE_NONE;
>
> - /* Clear color is specified as ints or floats and the conversion is
> - * done by the sampler. If we have a texture view, we would have to
> - * perform the clear color conversion manually. Just disable clear
> - * color.
> - */
> - clear_supported = aux_supported && (mt->format == view_format);
> - } else if (mt->format == MESA_FORMAT_S_UINT8) {
> - aux_supported = clear_supported = false;
> - } else {
> - aux_supported = clear_supported = intel_miptree_sample_with_hiz(brw, mt);
> - }
> + /* Clear color is specified as ints or floats and the conversion is done by
> + * the sampler. If we have a texture view, we would have to perform the
> + * clear color conversion manually. Just disable clear color.
> + */
> + if (mt->format != view_format)
> + clear_supported = false;
>
> intel_miptree_prepare_access(brw, mt, start_level, num_levels,
> start_layer, num_layers,
> - aux_supported, clear_supported);
> + aux_usage != ISL_AUX_USAGE_NONE,
> + clear_supported);
> if (aux_supported_out)
> - *aux_supported_out = aux_supported;
> + *aux_supported_out = aux_usage != ISL_AUX_USAGE_NONE;
> }
>
> void
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> index 45ac5df..64ea413 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
> @@ -923,6 +923,10 @@ intel_miptree_access_raw(struct brw_context *brw,
> intel_miptree_finish_write(brw, mt, level, layer, 1, false);
> }
>
> +enum isl_aux_usage
> +intel_miptree_texture_aux_usage(struct brw_context *brw,
> + struct intel_mipmap_tree *mt,
> + enum isl_format view_format);
> void
> intel_miptree_prepare_texture(struct brw_context *brw,
> struct intel_mipmap_tree *mt,
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list