zink: only add srgb mutable for images with modifiers

these are supposed to be for dmabuf handling, so checking for mutable
swapchain is both pointless and wrong

Fixes: 28ee911ad6 ("zink: handle mutable swapchain images with dmabuf")

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18358>
This commit is contained in:
Mike Blumenkrantz
2022-08-31 20:16:35 -04:00
committed by Marge Bot
parent 3ad58642bf
commit cd00a36d47

View File

@@ -665,7 +665,11 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
bool success = false;
VkImageCreateInfo ici;
enum pipe_format srgb = PIPE_FORMAT_NONE;
if (screen->info.have_KHR_swapchain_mutable_format) {
/* We use modifiers as a proxy for "this surface is used as a window system render target".
* For winsys, we need to be able to mutate between srgb and linear, but we don't need general
* image view/shader image format compatibility (that path means losing fast clears or compression on some hardware).
*/
if (ici_modifier_count) {
srgb = util_format_is_srgb(templ->format) ? util_format_linear(templ->format) : util_format_srgb(templ->format);
/* why do these helpers have different default return values? */
if (srgb == templ->format)