util: add a resource wrapper to get resource samples

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>
This commit is contained in:
Dave Airlie 2019-12-31 07:03:26 +10:00 committed by Marge Bot
parent 1970390026
commit 339aec7241
1 changed files with 5 additions and 0 deletions

View 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