[Mesa-dev] [PATCH 1/2] gallium/aux: include nr_samples in util_resource_size() computation

Marek Olšák maraeo at gmail.com
Mon Dec 11 18:20:20 UTC 2017


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Dec 7, 2017 at 11:25 PM, Brian Paul <brianp at vmware.com> wrote:
> This function is only used in two places:
> 1. VMware driver, but only for HUD reporting
> 2. st/nine state tracker, used for texture memory accounting
> ---
>  src/gallium/auxiliary/util/u_resource.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c
> index 66caaae..ed6c150 100644
> --- a/src/gallium/auxiliary/util/u_resource.c
> +++ b/src/gallium/auxiliary/util/u_resource.c
> @@ -42,6 +42,7 @@ util_resource_size(const struct pipe_resource *res)
>     unsigned depth = res->depth0;
>     unsigned size = 0;
>     unsigned level;
> +   unsigned samples = MAX2(1, res->nr_samples);
>
>     for (level = 0; level <= res->last_level; level++) {
>        unsigned slices;
> @@ -54,7 +55,7 @@ util_resource_size(const struct pipe_resource *res)
>           slices = res->array_size;
>
>        size += (util_format_get_nblocksy(res->format, height) *
> -               util_format_get_stride(res->format, width) * slices);
> +               util_format_get_stride(res->format, width) * slices * samples);
>
>        width  = u_minify(width, 1);
>        height = u_minify(height, 1);
> --
> 1.9.1
>
> _______________________________________________
> 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