Merge pull request #88 from mahkoh/jorth/vulkan-formats
render: fix vulkan formats for pre-multiplied alpha
This commit is contained in:
commit
dc554a780e
3 changed files with 7 additions and 7 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue