util: add a resource wrapper to get resource samples
authorDave Airlie <airlied@redhat.com>
Mon, 30 Dec 2019 21:03:26 +0000 (07:03 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:37 +0000 (06:20 +0000)
This return 1 as a baseline and should be used in allocator paths.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

src/gallium/auxiliary/util/u_inlines.h

index 8d656f63fa3e38a5559fff4e748d157d9249e146..9a1315d01ecd3403e0c91dfe7ce66469b64e84c2 100644 (file)
@@ -773,6 +773,11 @@ pipe_create_multimedia_context(struct pipe_screen *screen)
    return screen->context_create(screen, NULL, flags);
 }
 
+static inline unsigned util_res_sample_count(struct pipe_resource *res)
+{
+   return res->nr_samples > 0 ? res->nr_samples : 1;
+}
+
 #ifdef __cplusplus
 }
 #endif