1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
// Copyright (c) 2016 The vulkano developers // Licensed under the Apache License, Version 2.0 // <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT // license <LICENSE-MIT or http://opensource.org/licenses/MIT>, // at your option. All files in the project carrying such // notice may not be copied, modified, or distributed except // according to those terms. use format::Format; use image::ImageUsage; use vk; /// The capabilities of a surface when used by a physical device. /// /// You have to match these capabilities when you create a swapchain. #[derive(Clone, Debug)] pub struct Capabilities { /// Minimum number of images that must be present in the swapchain. pub min_image_count: u32, /// Maximum number of images that must be present in the swapchain, or `None` if there is no /// maximum value. Note that "no maximum" doesn't mean that you can set a very high value, as /// you may still get out of memory errors. pub max_image_count: Option<u32>, /// The current dimensions of the surface. `None` means that the surface's dimensions will /// depend on the dimensions of the swapchain that you are going to create. pub current_extent: Option<[u32; 2]>, /// Minimum width and height of a swapchain that uses this surface. pub min_image_extent: [u32; 2], /// Maximum width and height of a swapchain that uses this surface. pub max_image_extent: [u32; 2], /// Maximum number of image layers if you create an image array. The minimum is 1. pub max_image_array_layers: u32, /// List of transforms supported for the swapchain. pub supported_transforms: SupportedSurfaceTransforms, /// Current transform used by the surface. pub current_transform: SurfaceTransform, /// List of composite alpha modes supports for the swapchain. pub supported_composite_alpha: SupportedCompositeAlpha, /// List of image usages that are supported for images of the swapchain. Only /// the `color_attachment` usage is guaranteed to be supported. pub supported_usage_flags: ImageUsage, /// List of formats supported for the swapchain. pub supported_formats: Vec<(Format, ColorSpace)>, // TODO: https://github.com/KhronosGroup/Vulkan-Docs/issues/207 /// List of present modes that are supported. `Fifo` is always guaranteed to be supported. pub present_modes: SupportedPresentModes, } /// The way presenting a swapchain is accomplished. #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum PresentMode { /// Immediately shows the image to the user. May result in visible tearing. Immediate = vk::PRESENT_MODE_IMMEDIATE_KHR, /// The action of presenting an image puts it in wait. When the next vertical blanking period /// happens, the waiting image is effectively shown to the user. If an image is presented while /// another one is waiting, it is replaced. Mailbox = vk::PRESENT_MODE_MAILBOX_KHR, /// The action of presenting an image adds it to a queue of images. At each vertical blanking /// period, the queue is popped and an image is presented. /// /// Guaranteed to be always supported. /// /// This is the equivalent of OpenGL's `SwapInterval` with a value of 1. Fifo = vk::PRESENT_MODE_FIFO_KHR, /// Same as `Fifo`, except that if the queue was empty during the previous vertical blanking /// period then it is equivalent to `Immediate`. /// /// This is the equivalent of OpenGL's `SwapInterval` with a value of -1. Relaxed = vk::PRESENT_MODE_FIFO_RELAXED_KHR, // TODO: These can't be enabled yet because they have to be used with shared present surfaces // which vulkano doesnt support yet. //SharedDemand = vk::PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR, //SharedContinuous = vk::PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR, } /// List of `PresentMode`s that are supported. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct SupportedPresentModes { pub immediate: bool, pub mailbox: bool, pub fifo: bool, pub relaxed: bool, pub shared_demand: bool, pub shared_continuous: bool, } pub fn supported_present_modes_from_list<I>(elem: I) -> SupportedPresentModes where I: Iterator<Item = vk::PresentModeKHR> { let mut result = SupportedPresentModes::none(); for e in elem { match e { vk::PRESENT_MODE_IMMEDIATE_KHR => result.immediate = true, vk::PRESENT_MODE_MAILBOX_KHR => result.mailbox = true, vk::PRESENT_MODE_FIFO_KHR => result.fifo = true, vk::PRESENT_MODE_FIFO_RELAXED_KHR => result.relaxed = true, vk::PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR => result.shared_demand = true, vk::PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR => result.shared_continuous = true, _ => { } } } result } impl SupportedPresentModes { /// Builds a `SupportedPresentModes` with all fields set to false. #[inline] pub fn none() -> SupportedPresentModes { SupportedPresentModes { immediate: false, mailbox: false, fifo: false, relaxed: false, shared_demand: false, shared_continuous: false, } } /// Returns true if the given present mode is in this list of supported modes. #[inline] pub fn supports(&self, mode: PresentMode) -> bool { match mode { PresentMode::Immediate => self.immediate, PresentMode::Mailbox => self.mailbox, PresentMode::Fifo => self.fifo, PresentMode::Relaxed => self.relaxed, } } /// Returns an iterator to the list of supported present modes. #[inline] pub fn iter(&self) -> SupportedPresentModesIter { SupportedPresentModesIter(self.clone()) } } /// Enumeration of the `PresentMode`s that are supported. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct SupportedPresentModesIter(SupportedPresentModes); impl Iterator for SupportedPresentModesIter { type Item = PresentMode; #[inline] fn next(&mut self) -> Option<PresentMode> { if self.0.immediate { self.0.immediate = false; return Some(PresentMode::Immediate); } if self.0.mailbox { self.0.mailbox = false; return Some(PresentMode::Mailbox); } if self.0.fifo { self.0.fifo = false; return Some(PresentMode::Fifo); } if self.0.relaxed { self.0.relaxed = false; return Some(PresentMode::Relaxed); } None } } /// A transformation to apply to the image before showing it on the screen. #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum SurfaceTransform { /// Don't transform the image. Identity = vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR, /// Rotate 90 degrees. Rotate90 = vk::SURFACE_TRANSFORM_ROTATE_90_BIT_KHR, /// Rotate 180 degrees. Rotate180 = vk::SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, /// Rotate 270 degrees. Rotate270 = vk::SURFACE_TRANSFORM_ROTATE_270_BIT_KHR, /// Mirror the image horizontally. HorizontalMirror = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR, /// Mirror the image horizontally and rotate 90 degrees. HorizontalMirrorRotate90 = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR, /// Mirror the image horizontally and rotate 180 degrees. HorizontalMirrorRotate180 = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR, /// Mirror the image horizontally and rotate 270 degrees. HorizontalMirrorRotate270 = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR, /// Let the operating system or driver implementation choose. Inherit = vk::SURFACE_TRANSFORM_INHERIT_BIT_KHR, } /// How the alpha values of the pixels of the window are treated. #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum CompositeAlpha { /// The alpha channel of the image is ignored. All the pixels are considered as if they have a /// value of 1.0. Opaque = vk::COMPOSITE_ALPHA_OPAQUE_BIT_KHR, /// The alpha channel of the image is respected. The color channels are expected to have /// already been multiplied by the alpha value. PreMultiplied = vk::COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR, /// The alpha channel of the image is respected. The color channels will be multiplied by the /// alpha value by the compositor before being added to what is behind. PostMultiplied = vk::COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR, /// Let the operating system or driver implementation choose. Inherit = vk::COMPOSITE_ALPHA_INHERIT_BIT_KHR, } /// List of supported composite alpha modes. /// /// See the docs of `CompositeAlpha`. #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[allow(missing_docs)] pub struct SupportedCompositeAlpha { pub opaque: bool, pub pre_multiplied: bool, pub post_multiplied: bool, pub inherit: bool, } pub fn supported_composite_alpha_from_bits(val: u32) -> SupportedCompositeAlpha { let mut result = SupportedCompositeAlpha::none(); if (val & vk::COMPOSITE_ALPHA_OPAQUE_BIT_KHR) != 0 { result.opaque = true; } if (val & vk::COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR) != 0 { result.pre_multiplied = true; } if (val & vk::COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR) != 0 { result.post_multiplied = true; } if (val & vk::COMPOSITE_ALPHA_INHERIT_BIT_KHR) != 0 { result.inherit = true; } result } impl SupportedCompositeAlpha { /// Builds a `SupportedCompositeAlpha` with all fields set to false. #[inline] pub fn none() -> SupportedCompositeAlpha { SupportedCompositeAlpha { opaque: false, pre_multiplied: false, post_multiplied: false, inherit: false, } } /// Returns true if the given `CompositeAlpha` is in this list. #[inline] pub fn supports(&self, value: CompositeAlpha) -> bool { match value { CompositeAlpha::Opaque => self.opaque, CompositeAlpha::PreMultiplied => self.pre_multiplied, CompositeAlpha::PostMultiplied => self.post_multiplied, CompositeAlpha::Inherit => self.inherit, } } /// Returns an iterator to the list of supported composite alpha. #[inline] pub fn iter(&self) -> SupportedCompositeAlphaIter { SupportedCompositeAlphaIter(self.clone()) } } /// Enumeration of the `CompositeAlpha` that are supported. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct SupportedCompositeAlphaIter(SupportedCompositeAlpha); impl Iterator for SupportedCompositeAlphaIter { type Item = CompositeAlpha; #[inline] fn next(&mut self) -> Option<CompositeAlpha> { if self.0.opaque { self.0.opaque = false; return Some(CompositeAlpha::Opaque); } if self.0.pre_multiplied { self.0.pre_multiplied = false; return Some(CompositeAlpha::PreMultiplied); } if self.0.post_multiplied { self.0.post_multiplied = false; return Some(CompositeAlpha::PostMultiplied); } if self.0.inherit { self.0.inherit = false; return Some(CompositeAlpha::Inherit); } None } } /// List of supported composite alpha modes. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct SupportedSurfaceTransforms { pub identity: bool, pub rotate90: bool, pub rotate180: bool, pub rotate270: bool, pub horizontal_mirror: bool, pub horizontal_mirror_rotate90: bool, pub horizontal_mirror_rotate180: bool, pub horizontal_mirror_rotate270: bool, pub inherit: bool, } pub fn surface_transforms_from_bits(val: vk::SurfaceTransformFlagsKHR) -> SupportedSurfaceTransforms { macro_rules! v { ($val:expr, $out:ident, $e:expr, $f:ident) => ( if ($val & $e) != 0 { $out.$f = true; } ); } let mut result = SupportedSurfaceTransforms::none(); v!(val, result, vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR, identity); v!(val, result, vk::SURFACE_TRANSFORM_ROTATE_90_BIT_KHR, rotate90); v!(val, result, vk::SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, rotate180); v!(val, result, vk::SURFACE_TRANSFORM_ROTATE_270_BIT_KHR, rotate270); v!(val, result, vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR, horizontal_mirror); v!(val, result, vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR, horizontal_mirror_rotate90); v!(val, result, vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR, horizontal_mirror_rotate180); v!(val, result, vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR, horizontal_mirror_rotate270); v!(val, result, vk::SURFACE_TRANSFORM_INHERIT_BIT_KHR, inherit); result } impl SupportedSurfaceTransforms { /// Builds a `SupportedSurfaceTransforms` with all fields set to false. #[inline] pub fn none() -> SupportedSurfaceTransforms { SupportedSurfaceTransforms { identity: false, rotate90: false, rotate180: false, rotate270: false, horizontal_mirror: false, horizontal_mirror_rotate90: false, horizontal_mirror_rotate180: false, horizontal_mirror_rotate270: false, inherit: false, } } /// Returns true if the given `SurfaceTransform` is in this list. #[inline] pub fn supports(&self, value: SurfaceTransform) -> bool { match value { SurfaceTransform::Identity => self.identity, SurfaceTransform::Rotate90 => self.rotate90, SurfaceTransform::Rotate180 => self.rotate180, SurfaceTransform::Rotate270 => self.rotate270, SurfaceTransform::HorizontalMirror => self.horizontal_mirror, SurfaceTransform::HorizontalMirrorRotate90 => self.horizontal_mirror_rotate90, SurfaceTransform::HorizontalMirrorRotate180 => self.horizontal_mirror_rotate180, SurfaceTransform::HorizontalMirrorRotate270 => self.horizontal_mirror_rotate270, SurfaceTransform::Inherit => self.inherit, } } /// Returns an iterator to the list of supported composite alpha. #[inline] pub fn iter(&self) -> SupportedSurfaceTransformsIter { SupportedSurfaceTransformsIter(self.clone()) } } /// Enumeration of the `SurfaceTransform` that are supported. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct SupportedSurfaceTransformsIter(SupportedSurfaceTransforms); impl Iterator for SupportedSurfaceTransformsIter { type Item = SurfaceTransform; #[inline] fn next(&mut self) -> Option<SurfaceTransform> { if self.0.identity { self.0.identity = false; return Some(SurfaceTransform::Identity); } if self.0.rotate90 { self.0.rotate90 = false; return Some(SurfaceTransform::Rotate90); } if self.0.rotate180 { self.0.rotate180 = false; return Some(SurfaceTransform::Rotate180); } if self.0.rotate270 { self.0.rotate270 = false; return Some(SurfaceTransform::Rotate270); } if self.0.horizontal_mirror { self.0.horizontal_mirror = false; return Some(SurfaceTransform::HorizontalMirror); } if self.0.horizontal_mirror_rotate90 { self.0.horizontal_mirror_rotate90 = false; return Some(SurfaceTransform::HorizontalMirrorRotate90); } if self.0.horizontal_mirror_rotate180 { self.0.horizontal_mirror_rotate180 = false; return Some(SurfaceTransform::HorizontalMirrorRotate180); } if self.0.horizontal_mirror_rotate270 { self.0.horizontal_mirror_rotate270 = false; return Some(SurfaceTransform::HorizontalMirrorRotate270); } if self.0.inherit { self.0.inherit = false; return Some(SurfaceTransform::Inherit); } None } } impl Default for SurfaceTransform { #[inline] fn default() -> SurfaceTransform { SurfaceTransform::Identity } } /// How the presentation engine should interpret the data. /// /// # A quick lesson about color spaces /// /// ## What is a color space? /// /// Each pixel of a monitor is made of three components: one red, one green, and one blue. In the /// past, computers would simply send to the monitor the intensity of each of the three components. /// /// This proved to be problematic, because depending on the brand of the monitor the colors would /// not exactly be the same. For example on some monitors, a value of `[1.0, 0.0, 0.0]` would be a /// bit more orange than on others. /// /// In order to standardize this, there exist what are called *color spaces*: sRGB, AdobeRGB, /// DCI-P3, scRGB, etc. When you manipulate RGB values in a specific color space, these values have /// a precise absolute meaning in terms of color, that is the same across all systems and monitors. /// /// > **Note**: Color spaces are orthogonal to concept of RGB. *RGB* only indicates what is the /// > representation of the data, but not how it is interpreted. You can think of this a bit like /// > text encoding. An *RGB* value is a like a byte, in other words it is the medium by which /// > values are communicated, and a *color space* is like a text encoding (eg. UTF-8), in other /// > words it is the way the value should be interpreted. /// /// The most commonly used color space today is sRGB. Most monitors today use this color space, /// and most images files are encoded in this color space. /// /// ## Pixel formats and linear vs non-linear /// /// In Vulkan all images have a specific format in which the data is stored. The data of an image /// consists of pixels in RGB but contains no information about the color space (or lack thereof) /// of these pixels. You are free to store them in whatever color space you want. /// /// But one big practical problem with color spaces is that they are sometimes not linear, and in /// particular the popular sRGB color space is not linear. In a non-linear color space, a value of /// `[0.6, 0.6, 0.6]` for example is **not** twice as bright as a value of `[0.3, 0.3, 0.3]`. This /// is problematic, because operations such as taking the average of two colors or calculating the /// lighting of a texture with a dot product are mathematically incorrect and will produce /// incorrect colors. /// /// > **Note**: If the texture format has an alpha component, it is not affected by the color space /// > and always behaves linearly. /// /// In order to solve this Vulkan also provides image formats with the `Srgb` suffix, which are /// expected to contain RGB data in the sRGB color space. When you sample an image with such a /// format from a shader, the implementation will automatically turn the pixel values into a linear /// color space that is suitable for linear operations (such as additions or multiplications). /// When you write to a framebuffer attachment with such a format, the implementation will /// automatically perform the opposite conversion. These conversions are most of the time performed /// by the hardware and incur no additional cost. /// /// ## Color space of the swapchain /// /// The color space that you specify when you create a swapchain is how the implementation will /// interpret the raw data inside of the image. /// /// > **Note**: The implementation can choose to send the data in the swapchain image directly to /// > the monitor, but it can also choose to write it in an intermediary buffer that is then read /// > by the operating system or windowing system. Therefore the color space that the /// > implementation supports is not necessarily the same as the one supported by the monitor. /// /// It is *your* job to ensure that the data in the swapchain image is in the color space /// that is specified here, otherwise colors will be incorrect. /// The implementation will never perform any additional automatic conversion after the colors have /// been written to the swapchain image. /// /// # How do I handle this correctly? /// /// The easiest way to handle color spaces in a cross-platform program is: /// /// - Always request the `SrgbNonLinear` color space when creating the swapchain. /// - Make sure that all your image files use the sRGB color space, and load them in images whose /// format has the `Srgb` suffix. Only use non-sRGB image formats for intermediary computations /// or to store non-color data. /// - Swapchain images should have a format with the `Srgb` suffix. /// /// > **Note**: It is unclear whether the `SrgbNonLinear` color space is always supported by the /// > the implementation or not. See https://github.com/KhronosGroup/Vulkan-Docs/issues/442. /// /// > **Note**: Lots of developers are confused by color spaces. You can sometimes find articles /// > talking about gamma correction and suggestion to put your colors to the power 2.2 for /// > example. These are all hacks and you should use the sRGB pixel formats instead. /// /// If you follow these three rules, then everything should render the same way on all platforms. /// /// Additionally you can try detect whether the implementation supports any additional color space /// and perform a manual conversion to that color space from inside your shader. /// #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum ColorSpace { SrgbNonLinear = vk::COLOR_SPACE_SRGB_NONLINEAR_KHR, DisplayP3NonLinear = vk::COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT, ExtendedSrgbLinear = vk::COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT, DciP3Linear = vk::COLOR_SPACE_DCI_P3_LINEAR_EXT, DciP3NonLinear = vk::COLOR_SPACE_DCI_P3_NONLINEAR_EXT, Bt709Linear = vk::COLOR_SPACE_BT709_LINEAR_EXT, Bt709NonLinear = vk::COLOR_SPACE_BT709_NONLINEAR_EXT, Bt2020Linear = vk::COLOR_SPACE_BT2020_LINEAR_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, AdobeRgbNonLinear = vk::COLOR_SPACE_ADOBERGB_NONLINEAR_EXT, PassThrough = vk::COLOR_SPACE_PASS_THROUGH_EXT, } #[inline] pub fn color_space_from_num(val: u32) -> ColorSpace { match val { vk::COLOR_SPACE_SRGB_NONLINEAR_KHR => ColorSpace::SrgbNonLinear, vk::COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT => ColorSpace::DisplayP3NonLinear, vk::COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT => ColorSpace::ExtendedSrgbLinear, vk::COLOR_SPACE_DCI_P3_LINEAR_EXT => ColorSpace::DciP3Linear, vk::COLOR_SPACE_DCI_P3_NONLINEAR_EXT => ColorSpace::DciP3NonLinear, vk::COLOR_SPACE_BT709_LINEAR_EXT => ColorSpace::Bt709Linear, vk::COLOR_SPACE_BT709_NONLINEAR_EXT => ColorSpace::Bt709NonLinear, vk::COLOR_SPACE_BT2020_LINEAR_EXT => ColorSpace::Bt2020Linear, 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_NONLINEAR_EXT => ColorSpace::AdobeRgbNonLinear, vk::COLOR_SPACE_PASS_THROUGH_EXT => ColorSpace::PassThrough, _ => panic!("Wrong value for color space enum"), } }