Merge pull request #540 from tomaka/color-space-modified-wtf

Update the list of color spaces to match the specs
This commit is contained in:
tomaka 2017-06-21 15:26:38 +02:00 committed by GitHub
commit 17f87d8adf
2 changed files with 26 additions and 15 deletions

View File

@ -909,19 +909,28 @@ pub type DisplaySurfaceCreateFlagsKHR = Flags;
pub type ColorSpaceKHR = u32; pub type ColorSpaceKHR = u32;
#[deprecated = "Renamed to COLOR_SPACE_SRGB_NONLINEAR_KHR"] #[deprecated = "Renamed to COLOR_SPACE_SRGB_NONLINEAR_KHR"]
pub const COLORSPACE_SRGB_NONLINEAR_KHR: u32 = 0; pub const COLORSPACE_SRGB_NONLINEAR_KHR: u32 = 0;
pub const COLOR_SPACE_SRGB_NONLINEAR_KHR: u32 = 0; #[deprecated = "Magically disappeared from the Vulkan specs"]
pub const COLOR_SPACE_DISPLAY_P3_LINEAR_EXT: u32 = 1000104001; pub const COLOR_SPACE_DISPLAY_P3_LINEAR_EXT: u32 = 1000104001;
pub const COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT: u32 = 1000104002; #[deprecated = "Magically disappeared from the Vulkan specs"]
pub const COLOR_SPACE_SCRGB_LINEAR_EXT: u32 = 1000104003; pub const COLOR_SPACE_SCRGB_LINEAR_EXT: u32 = 1000104003;
#[deprecated = "Magically disappeared from the Vulkan specs"]
pub const COLOR_SPACE_SCRGB_NONLINEAR_EXT: u32 = 1000104004; pub const COLOR_SPACE_SCRGB_NONLINEAR_EXT: u32 = 1000104004;
pub const COLOR_SPACE_DCI_P3_LINEAR_EXT: u32 = 1000104005; #[deprecated = "Magically disappeared from the Vulkan specs"]
pub const COLOR_SPACE_DCI_P3_NONLINEAR_EXT: u32 = 1000104006;
pub const COLOR_SPACE_BT709_LINEAR_EXT: u32 = 1000104007;
pub const COLOR_SPACE_BT709_NONLINEAR_EXT: u32 = 1000104008;
pub const COLOR_SPACE_BT2020_LINEAR_EXT: u32 = 1000104009;
pub const COLOR_SPACE_BT2020_NONLINEAR_EXT: u32 = 1000104010; pub const COLOR_SPACE_BT2020_NONLINEAR_EXT: u32 = 1000104010;
pub const COLOR_SPACE_SRGB_NONLINEAR_KHR: u32 = 0;
pub const COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT: u32 = 1000104001;
pub const COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT: u32 = 1000104002;
pub const COLOR_SPACE_DCI_P3_LINEAR_EXT: u32 = 1000104003;
pub const COLOR_SPACE_DCI_P3_NONLINEAR_EXT: u32 = 1000104004;
pub const COLOR_SPACE_BT709_LINEAR_EXT: u32 = 1000104005;
pub const COLOR_SPACE_BT709_NONLINEAR_EXT: u32 = 1000104006;
pub const COLOR_SPACE_BT2020_LINEAR_EXT: u32 = 1000104007;
pub const COLOR_SPACE_HDR10_ST2084_EXT: u32 = 1000104008;
pub const COLOR_SPACE_DOLBYVISION_EXT: u32 = 1000104009;
pub const COLOR_SPACE_HDR10_HLG_EXT: u32 = 1000104010;
pub const COLOR_SPACE_ADOBERGB_LINEAR_EXT: u32 = 1000104011; pub const COLOR_SPACE_ADOBERGB_LINEAR_EXT: u32 = 1000104011;
pub const COLOR_SPACE_ADOBERGB_NONLINEAR_EXT: u32 = 1000104012; pub const COLOR_SPACE_ADOBERGB_NONLINEAR_EXT: u32 = 1000104012;
pub const COLOR_SPACE_PASS_THROUGH_EXT: u32 = 1000104013;
pub type PresentModeKHR = u32; pub type PresentModeKHR = u32;
pub const PRESENT_MODE_IMMEDIATE_KHR: u32 = 0; pub const PRESENT_MODE_IMMEDIATE_KHR: u32 = 0;

View File

@ -465,36 +465,38 @@ impl Default for SurfaceTransform {
#[repr(u32)] #[repr(u32)]
pub enum ColorSpace { pub enum ColorSpace {
SrgbNonLinear = vk::COLOR_SPACE_SRGB_NONLINEAR_KHR, SrgbNonLinear = vk::COLOR_SPACE_SRGB_NONLINEAR_KHR,
DisplayP3Linear = vk::COLOR_SPACE_DISPLAY_P3_LINEAR_EXT,
DisplayP3NonLinear = vk::COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT, DisplayP3NonLinear = vk::COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT,
ScrgbLinear = vk::COLOR_SPACE_SCRGB_LINEAR_EXT, ExtendedSrgbLinear = vk::COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT,
ScrgbNonLinear = vk::COLOR_SPACE_SCRGB_NONLINEAR_EXT,
DciP3Linear = vk::COLOR_SPACE_DCI_P3_LINEAR_EXT, DciP3Linear = vk::COLOR_SPACE_DCI_P3_LINEAR_EXT,
DciP3NonLinear = vk::COLOR_SPACE_DCI_P3_NONLINEAR_EXT, DciP3NonLinear = vk::COLOR_SPACE_DCI_P3_NONLINEAR_EXT,
Bt709Linear = vk::COLOR_SPACE_BT709_LINEAR_EXT, Bt709Linear = vk::COLOR_SPACE_BT709_LINEAR_EXT,
Bt709NonLinear = vk::COLOR_SPACE_BT709_NONLINEAR_EXT, Bt709NonLinear = vk::COLOR_SPACE_BT709_NONLINEAR_EXT,
Bt2020Linear = vk::COLOR_SPACE_BT2020_LINEAR_EXT, Bt2020Linear = vk::COLOR_SPACE_BT2020_LINEAR_EXT,
Bt2020NonLinear = vk::COLOR_SPACE_BT2020_NONLINEAR_EXT, Hdr10St2084 = vk::COLOR_SPACE_HDR10_ST2084_EXT,
DolbyVision = vk::COLOR_SPACE_DOLBYVISION_EXT,
Hdr10Hlg = vk::COLOR_SPACE_HDR10_HLG_EXT,
AdobeRgbLinear = vk::COLOR_SPACE_ADOBERGB_LINEAR_EXT, AdobeRgbLinear = vk::COLOR_SPACE_ADOBERGB_LINEAR_EXT,
AdobeRgbNonLinear = vk::COLOR_SPACE_ADOBERGB_NONLINEAR_EXT, AdobeRgbNonLinear = vk::COLOR_SPACE_ADOBERGB_NONLINEAR_EXT,
PassThrough = vk::COLOR_SPACE_PASS_THROUGH_EXT,
} }
#[inline] #[inline]
pub fn color_space_from_num(val: u32) -> ColorSpace { pub fn color_space_from_num(val: u32) -> ColorSpace {
match val { match val {
vk::COLOR_SPACE_SRGB_NONLINEAR_KHR => ColorSpace::SrgbNonLinear, vk::COLOR_SPACE_SRGB_NONLINEAR_KHR => ColorSpace::SrgbNonLinear,
vk::COLOR_SPACE_DISPLAY_P3_LINEAR_EXT => ColorSpace::DisplayP3Linear,
vk::COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT => ColorSpace::DisplayP3NonLinear, vk::COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT => ColorSpace::DisplayP3NonLinear,
vk::COLOR_SPACE_SCRGB_LINEAR_EXT => ColorSpace::ScrgbLinear, vk::COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT => ColorSpace::ExtendedSrgbLinear,
vk::COLOR_SPACE_SCRGB_NONLINEAR_EXT => ColorSpace::ScrgbNonLinear,
vk::COLOR_SPACE_DCI_P3_LINEAR_EXT => ColorSpace::DciP3Linear, vk::COLOR_SPACE_DCI_P3_LINEAR_EXT => ColorSpace::DciP3Linear,
vk::COLOR_SPACE_DCI_P3_NONLINEAR_EXT => ColorSpace::DciP3NonLinear, vk::COLOR_SPACE_DCI_P3_NONLINEAR_EXT => ColorSpace::DciP3NonLinear,
vk::COLOR_SPACE_BT709_LINEAR_EXT => ColorSpace::Bt709Linear, vk::COLOR_SPACE_BT709_LINEAR_EXT => ColorSpace::Bt709Linear,
vk::COLOR_SPACE_BT709_NONLINEAR_EXT => ColorSpace::Bt709NonLinear, vk::COLOR_SPACE_BT709_NONLINEAR_EXT => ColorSpace::Bt709NonLinear,
vk::COLOR_SPACE_BT2020_LINEAR_EXT => ColorSpace::Bt2020Linear, vk::COLOR_SPACE_BT2020_LINEAR_EXT => ColorSpace::Bt2020Linear,
vk::COLOR_SPACE_BT2020_NONLINEAR_EXT => ColorSpace::Bt2020NonLinear, vk::COLOR_SPACE_HDR10_ST2084_EXT => ColorSpace::Hdr10St2084,
vk::COLOR_SPACE_DOLBYVISION_EXT => ColorSpace::DolbyVision,
vk::COLOR_SPACE_HDR10_HLG_EXT => ColorSpace::Hdr10Hlg,
vk::COLOR_SPACE_ADOBERGB_LINEAR_EXT => ColorSpace::AdobeRgbLinear, vk::COLOR_SPACE_ADOBERGB_LINEAR_EXT => ColorSpace::AdobeRgbLinear,
vk::COLOR_SPACE_ADOBERGB_NONLINEAR_EXT => ColorSpace::AdobeRgbNonLinear, vk::COLOR_SPACE_ADOBERGB_NONLINEAR_EXT => ColorSpace::AdobeRgbNonLinear,
vk::COLOR_SPACE_PASS_THROUGH_EXT => ColorSpace::PassThrough,
_ => panic!("Wrong value for color space enum") _ => panic!("Wrong value for color space enum")
} }
} }