render/vulkan: track and use _UNORM variants of _SRGB formats

Later commits will start using _SRGB image views again,
where appropriate.
master
Manuel Stoeckl 1 year ago committed by Simon Ser
parent 6287b61025
commit eab89d6c76

@ -87,7 +87,7 @@ int vulkan_find_mem_type(struct wlr_vk_device *device,
struct wlr_vk_format {
uint32_t drm;
VkFormat vk;
bool is_srgb;
VkFormat vk_srgb; // sRGB version of the format, or 0 if nonexistent
bool is_ycbcr;
};

@ -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

@ -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);

@ -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 =

Loading…
Cancel
Save