diff --git a/src/format.rs b/src/format.rs index 6de070e9..f59978fc 100644 --- a/src/format.rs +++ b/src/format.rs @@ -93,7 +93,7 @@ pub static ARGB8888: &Format = &Format { bpp: 4, gl_format: GL_BGRA_EXT, gl_type: GL_UNSIGNED_BYTE, - vk_format: vk::Format::B8G8R8A8_SRGB, + vk_format: vk::Format::B8G8R8A8_UNORM, drm: ARGB8888_DRM, wl_id: Some(ARGB8888_ID), external_only_guess: false, @@ -107,7 +107,7 @@ pub static XRGB8888: &Format = &Format { bpp: 4, gl_format: GL_BGRA_EXT, gl_type: GL_UNSIGNED_BYTE, - vk_format: vk::Format::B8G8R8A8_SRGB, + vk_format: vk::Format::B8G8R8A8_UNORM, drm: XRGB8888_DRM, wl_id: Some(XRGB8888_ID), external_only_guess: false, @@ -125,7 +125,7 @@ pub static FORMATS: &[Format] = &[ bpp: 4, gl_format: GL_RGBA, gl_type: GL_UNSIGNED_BYTE, - vk_format: vk::Format::R8G8B8A8_SRGB, + vk_format: vk::Format::R8G8B8A8_UNORM, drm: fourcc_code('A', 'B', '2', '4'), wl_id: None, external_only_guess: false, @@ -138,7 +138,7 @@ pub static FORMATS: &[Format] = &[ bpp: 4, gl_format: GL_RGBA, gl_type: GL_UNSIGNED_BYTE, - vk_format: vk::Format::R8G8B8A8_SRGB, + vk_format: vk::Format::R8G8B8A8_UNORM, drm: fourcc_code('X', 'B', '2', '4'), wl_id: None, external_only_guess: false, diff --git a/src/gfx_apis/vulkan/renderer.rs b/src/gfx_apis/vulkan/renderer.rs index f3d4e9e5..62eb2723 100644 --- a/src/gfx_apis/vulkan/renderer.rs +++ b/src/gfx_apis/vulkan/renderer.rs @@ -338,7 +338,7 @@ impl VulkanRenderer { rai = rai .clear_value(ClearValue { color: ClearColorValue { - float32: clear.to_array_linear(), + float32: clear.to_array_srgb(), }, }) .load_op(AttachmentLoadOp::CLEAR); @@ -413,7 +413,7 @@ impl VulkanRenderer { pos: r.rect.to_vk(width, height), }; let frag = FillFragPushConstants { - color: r.color.to_array_linear(), + color: r.color.to_array_srgb(), }; unsafe { dev.cmd_push_constants( diff --git a/src/theme.rs b/src/theme.rs index 9803c444..5601167b 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -85,11 +85,11 @@ impl Color { [to_u8(self.r), to_u8(self.g), to_u8(self.b), to_u8(self.a)] } - #[allow(dead_code)] pub fn to_array_srgb(self) -> [f32; 4] { [self.r, self.g, self.b, self.a] } + #[allow(dead_code)] pub fn to_array_linear(self) -> [f32; 4] { fn to_linear(srgb: f32) -> f32 { if srgb <= 0.04045 {