aboutsummaryrefslogtreecommitdiff
path: root/render/vulkan
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-11-29 09:47:08 +0100
committerSimon Ser <contact@emersion.fr>2022-12-02 10:24:00 +0100
commitad165f7daf94dec5e7c91984bfffe122a1d2b8d7 (patch)
treee92304565d853d90a7e7ce617fab68be8590a36e /render/vulkan
parent8b9a48c9848644c008fe1f9e5902fe4246b322f1 (diff)
render/vulkan: explain format mapping with DRM
Diffstat (limited to 'render/vulkan')
-rw-r--r--render/vulkan/pixel_format.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/render/vulkan/pixel_format.c b/render/vulkan/pixel_format.c
index 30a44b91..911cd217 100644
--- a/render/vulkan/pixel_format.c
+++ b/render/vulkan/pixel_format.c
@@ -5,8 +5,11 @@
#include <xf86drm.h>
#include "render/vulkan.h"
-// Reversed endianess of shm and vulkan format names
static const struct wlr_vk_format formats[] = {
+ // Vulkan non-packed 8-bits-per-channel formats have an inverted channel
+ // order compared to the DRM formats, because DRM format channel order
+ // is little-endian while Vulkan format channel order is in memory byte
+ // order.
{
.drm = DRM_FORMAT_ARGB8888,
.vk = VK_FORMAT_B8G8R8A8_SRGB,
@@ -27,6 +30,9 @@ static const struct wlr_vk_format formats[] = {
.vk = VK_FORMAT_R8G8B8A8_SRGB,
.is_srgb = true,
},
+
+ // Vulkan packed formats have the same channel order as DRM formats on
+ // little endian systems.
#if WLR_LITTLE_ENDIAN
{
.drm = DRM_FORMAT_RGB565,