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
use super::{Arrayed, Dimensionality, ImageFormat};
use crate::{integer::Integer, scalar::Scalar, vector::Vector};

/// Marker trait for arguments that accept single scalar values or vectors
/// of scalars.
pub trait SampleType<const FORMAT: u32>: Scalar {}

impl SampleType<{ ImageFormat::Unknown as u32 }> for i8 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i16 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for i64 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u8 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u16 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for u64 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Unknown as u32 }> for f64 {}
impl SampleType<{ ImageFormat::Rgba32f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R32f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba8 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba8Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg32f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg16f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R11fG11fB10f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R16f as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgb10A2 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg16 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg8 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R16 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R8 as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba16Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg16Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rg8Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R16Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::R8Snorm as u32 }> for f32 {}
impl SampleType<{ ImageFormat::Rgba32i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rgba16i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rgba8i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::R32i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rg32i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rg16i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rg8i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::R16i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::R8i as u32 }> for i32 {}
impl SampleType<{ ImageFormat::Rgba32ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rgba16ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rgba8ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R32ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rgb10A2ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rg32ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rg16ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::Rg8ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R16ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R8ui as u32 }> for u32 {}
impl SampleType<{ ImageFormat::R64ui as u32 }> for u64 {}
impl SampleType<{ ImageFormat::R64i as u32 }> for i64 {}

/// Marker trait for arguments that accept a coordinate for an [`crate::Image`].
pub trait ImageCoordinate<T, const DIM: u32, const ARRAYED: u32> {}

impl<S: Scalar> ImageCoordinate<S, { Dimensionality::OneD as u32 }, { Arrayed::False as u32 }>
    for S
{
}
impl<S: Scalar> ImageCoordinate<S, { Dimensionality::Buffer as u32 }, { Arrayed::False as u32 }>
    for S
{
}

impl<V: Vector<S, 2>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::TwoD as u32 }, { Arrayed::False as u32 }> for V
{
}
impl<V: Vector<S, 2>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::Rect as u32 }, { Arrayed::False as u32 }> for V
{
}
impl<V: Vector<S, 3>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::Cube as u32 }, { Arrayed::False as u32 }> for V
{
}
impl<V: Vector<S, 3>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::ThreeD as u32 }, { Arrayed::False as u32 }> for V
{
}

impl<V: Vector<S, 3>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::TwoD as u32 }, { Arrayed::True as u32 }> for V
{
}
impl<V: Vector<S, 3>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::Rect as u32 }, { Arrayed::True as u32 }> for V
{
}
impl<V: Vector<S, 4>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::Cube as u32 }, { Arrayed::True as u32 }> for V
{
}
impl<V: Vector<S, 4>, S: Scalar>
    ImageCoordinate<S, { Dimensionality::ThreeD as u32 }, { Arrayed::True as u32 }> for V
{
}

/// Marker trait for arguments that are valid for a [`crate::image::Dimensionality::SubpassData`] image query.
pub trait ImageCoordinateSubpassData<T, const ARRAYED: u32> {}
impl<V: Vector<I, 2>, I: Integer> ImageCoordinateSubpassData<I, { Arrayed::False as u32 }> for V {}
impl<V: Vector<I, 3>, I: Integer> ImageCoordinateSubpassData<I, { Arrayed::True as u32 }> for V {}