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
// Copied from `scripts/static/`

use std::mem;
use utils::vk_traits::*;

pub type RawVkClearColorValue = [u32; 4];

#[derive(Debug, Clone)]
pub enum VkClearColorValue {
    F([f32; 4]),
    I([i32; 4]),
    U([u32; 4])
}

impl VkWrappedType<RawVkClearColorValue> for VkClearColorValue {
    fn vk_to_raw(value: &VkClearColorValue, dst: &mut RawVkClearColorValue) {
        unsafe {
            *dst = match *value {
                VkClearColorValue::F(array) => mem::transmute_copy(&array),
                VkClearColorValue::I(array) => mem::transmute_copy(&array),
                VkClearColorValue::U(array) => array
            }
        }
    }
}

impl Default for VkClearColorValue {
    fn default() -> VkClearColorValue {
        VkClearColorValue::U([0; 4])
    }
}