summaryrefslogtreecommitdiffstats
path: root/third_party/rust/ash/tests/constant_size_arrays.rs
blob: a756f34ac294f582dd23ba9541919aeac302fa59 (plain)
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
use ash::vk::{PhysicalDeviceProperties, PipelineColorBlendStateCreateInfo};

#[test]
fn assert_struct_field_is_array() {
    let pipeline_cache_uuid: [u8; 16] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];

    let _ = PhysicalDeviceProperties::builder().pipeline_cache_uuid(pipeline_cache_uuid);

    let _ = PhysicalDeviceProperties {
        pipeline_cache_uuid,
        ..Default::default()
    };

    let blend_constants: [f32; 4] = [0.0, 0.0, 0.0, 0.0];

    let _ = PipelineColorBlendStateCreateInfo::builder().blend_constants(blend_constants);

    let _ = PipelineColorBlendStateCreateInfo {
        blend_constants,
        ..Default::default()
    };
}

#[test]
#[allow(dead_code)]
fn assert_ffi_array_param_is_pointer() {
    // don't run it, just make sure it compiles
    unsafe fn dummy(device: &ash::Device, cmd_buffer: ash::vk::CommandBuffer) {
        let blend_constants: [f32; 4] = [0.0, 0.0, 0.0, 0.0];

        device.cmd_set_blend_constants(cmd_buffer, &blend_constants);
    }
}