mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 20:48:08 +02:00
vulkan/wsi/wayland: Add support for more SRGB formats.
This is required by the Vulkan specification: If pSurfaceFormats includes an entry whose value for colorSpace is VK_COLOR_SPACE_SRGB_NONLINEAR_KHR and whose value for format is a UNORM (or SRGB) format and the corresponding SRGB (or UNORM) format is a color renderable format for VK_IMAGE_TILING_OPTIMAL, then pSurfaceFormats must also contain an entry with the same value for colorSpace and format equal to the corresponding SRGB (or UNORM) format. Signed-off-by: Georg Lehmann <dadschoorse@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11778>
This commit is contained in:
parent
a38abf28c4
commit
d8c1bf4a7d
1 changed files with 14 additions and 1 deletions
|
|
@ -183,12 +183,23 @@ wsi_wl_display_add_wl_format(struct wsi_wl_display *display,
|
|||
|
||||
/* Non-packed 8-bit formats have an inverted channel order compared to the
|
||||
* little endian DRM formats, because the DRM channel ordering is high->low
|
||||
* but the vulkan channel ordering is in memory byte order */
|
||||
* but the vulkan channel ordering is in memory byte order
|
||||
*
|
||||
* For all UNORM formats which have a SRGB variant, we must support both if
|
||||
* we can. SRGB in this context means that rendering to it will result in a
|
||||
* linear -> nonlinear SRGB colorspace conversion before the data is stored.
|
||||
* The inverse function is applied when sampling from SRGB images.
|
||||
* From Wayland's perspective nothing changes, the difference is just how
|
||||
* Vulkan interprets the pixel data. */
|
||||
case WL_DRM_FORMAT_XBGR8888:
|
||||
wsi_wl_display_add_vk_format(display, formats,
|
||||
VK_FORMAT_R8G8B8_SRGB);
|
||||
wsi_wl_display_add_vk_format(display, formats,
|
||||
VK_FORMAT_R8G8B8_UNORM);
|
||||
FALLTHROUGH;
|
||||
case WL_DRM_FORMAT_ABGR8888:
|
||||
wsi_wl_display_add_vk_format(display, formats,
|
||||
VK_FORMAT_R8G8B8A8_SRGB);
|
||||
wsi_wl_display_add_vk_format(display, formats,
|
||||
VK_FORMAT_R8G8B8A8_UNORM);
|
||||
break;
|
||||
|
|
@ -243,8 +254,10 @@ wl_drm_format_for_vk_format(VkFormat vk_format, bool alpha)
|
|||
return alpha ? WL_DRM_FORMAT_ABGR2101010 : WL_DRM_FORMAT_XBGR2101010;
|
||||
#endif
|
||||
case VK_FORMAT_R8G8B8_UNORM:
|
||||
case VK_FORMAT_R8G8B8_SRGB:
|
||||
return WL_DRM_FORMAT_XBGR8888;
|
||||
case VK_FORMAT_R8G8B8A8_UNORM:
|
||||
case VK_FORMAT_R8G8B8A8_SRGB:
|
||||
return alpha ? WL_DRM_FORMAT_ABGR8888 : WL_DRM_FORMAT_XBGR8888;
|
||||
case VK_FORMAT_B8G8R8_UNORM:
|
||||
case VK_FORMAT_B8G8R8_SRGB:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue