diff options
author | Manuel Stoeckl <code@mstoeckl.com> | 2023-10-21 21:04:04 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-12-04 15:13:31 +0000 |
commit | eab89d6c76f6fbd497145137c1f7dadd142f2f58 (patch) | |
tree | 5f16497d7704a999fa65aaaadc046232014969b9 /render | |
parent | 6287b610253d63fdb456564743b02f76919b17fb (diff) |
render/vulkan: track and use _UNORM variants of _SRGB formats
Later commits will start using _SRGB image views again,
where appropriate.
Diffstat (limited to 'render')
-rw-r--r-- | render/vulkan/pixel_format.c | 24 | ||||
-rw-r--r-- | render/vulkan/renderer.c | 2 | ||||
-rw-r--r-- | render/vulkan/texture.c | 3 |
3 files changed, 15 insertions, 14 deletions
diff --git a/render/vulkan/pixel_format.c b/render/vulkan/pixel_format.c index 67f5a893..895ca40c 100644 --- a/render/vulkan/pixel_format.c +++ b/render/vulkan/pixel_format.c @@ -14,33 +14,33 @@ static const struct wlr_vk_format formats[] = { // order. { .drm = DRM_FORMAT_R8, - .vk = VK_FORMAT_R8_SRGB, - .is_srgb = true, + .vk = VK_FORMAT_R8_UNORM, + .vk_srgb = VK_FORMAT_R8_SRGB, }, { .drm = DRM_FORMAT_GR88, - .vk = VK_FORMAT_R8G8_SRGB, - .is_srgb = true, + .vk = VK_FORMAT_R8G8_UNORM, + .vk_srgb = VK_FORMAT_R8G8_SRGB, }, { .drm = DRM_FORMAT_RGB888, - .vk = VK_FORMAT_B8G8R8_SRGB, - .is_srgb = true, + .vk = VK_FORMAT_B8G8R8_UNORM, + .vk_srgb = VK_FORMAT_B8G8R8_SRGB, }, { .drm = DRM_FORMAT_BGR888, - .vk = VK_FORMAT_R8G8B8_SRGB, - .is_srgb = true, + .vk = VK_FORMAT_R8G8B8_UNORM, + .vk_srgb = VK_FORMAT_R8G8B8_SRGB, }, { .drm = DRM_FORMAT_XRGB8888, - .vk = VK_FORMAT_B8G8R8A8_SRGB, - .is_srgb = true, + .vk = VK_FORMAT_B8G8R8A8_UNORM, + .vk_srgb = VK_FORMAT_B8G8R8A8_SRGB, }, { .drm = DRM_FORMAT_XBGR8888, - .vk = VK_FORMAT_R8G8B8A8_SRGB, - .is_srgb = true, + .vk = VK_FORMAT_R8G8B8A8_UNORM, + .vk_srgb = VK_FORMAT_R8G8B8A8_SRGB, }, // The Vulkan _SRGB formats correspond to unpremultiplied alpha, but // the Wayland protocol specifies premultiplied alpha on electrical values diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index b3f76401..33601732 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -768,7 +768,7 @@ static struct wlr_vk_render_buffer *create_render_buffer( goto error; } - bool has_blending_buffer = !fmt->format.is_srgb; + bool has_blending_buffer = !fmt->format.vk_srgb || true /* temporary */; buffer->render_setup = find_or_create_render_setup( renderer, &fmt->format, has_blending_buffer); diff --git a/render/vulkan/texture.c b/render/vulkan/texture.c index 20aa12f1..036d5f73 100644 --- a/render/vulkan/texture.c +++ b/render/vulkan/texture.c @@ -374,7 +374,8 @@ struct wlr_vk_texture_view *vulkan_texture_get_or_create_view(struct wlr_vk_text static void texture_set_format(struct wlr_vk_texture *texture, const struct wlr_vk_format *format) { texture->format = format; - texture->transform = !format->is_ycbcr && format->is_srgb ? + texture->transform = !format->is_ycbcr && + (format->vk_srgb && false /* temporary */) ? WLR_VK_TEXTURE_TRANSFORM_IDENTITY : WLR_VK_TEXTURE_TRANSFORM_SRGB; const struct wlr_pixel_format_info *format_info = |