vulkan: Add format fallback
authorBenjamin Otte <otte@redhat.com>
Thu, 15 Jun 2023 21:13:31 +0000 (23:13 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 19 Jun 2023 13:08:00 +0000 (15:08 +0200)
commitd61737ac7a7a54985976df323c8aade7a504ef9c
tree58bdfed46ba9e08ddd59f1b4fa2d913779a34823
parentba28971a18339a4ee45e7a8f581ebbf80b2b4260
vulkan: Add format fallback

When a GdkMemoryFormat isn't supported, pick close formats that have a
higher chance of being supported.
Make sure this works recursively and the whole loop always ends up at
R8G8B8A8_UNORM because that one is mandatory.

Roughly, follow these rules:
1. Drop the unpremultiplied
2. Expand channels to include all of RGBA
3. pick swizzle that is RGBA
4. pick next largest depth
5. pick R8G8B8A8_UNORM
gsk/vulkan/gskvulkanimage.c