1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4
5mod bindings;
16
17mod ctypes {
28 pub type spvc_bool = bool;
29 pub type c_char = std::os::raw::c_char;
30
31 pub type c_void = ::std::os::raw::c_void;
32 pub type c_uint = u32;
33 pub type c_schar = i8;
34 pub type c_uchar = u8;
35 pub type c_short = i16;
36 pub type c_ushort = u16;
37 pub type c_int = i32;
38 pub type c_longlong = i64;
39 pub type c_ulonglong = u64;
40}
41
42pub use bindings::*;
43pub use bytemuck::{Pod, Zeroable};
44pub use num_traits::{FromPrimitive, ToPrimitive};
45
46unsafe impl Zeroable for SpvId {}
47unsafe impl Pod for SpvId {}
48
49impl From<u32> for SpvId {
50 fn from(value: u32) -> Self {
51 Self(value)
52 }
53}
54
55impl Default for MslConstexprSampler {
56 fn default() -> Self {
57 MslConstexprSampler {
59 coord: MslSamplerCoord::Normalized,
60 min_filter: MslSamplerFilter::Nearest,
61 mag_filter: MslSamplerFilter::Nearest,
62 mip_filter: MslSamplerMipFilter::None,
63 s_address: MslSamplerAddress::ClampToEdge,
64 t_address: MslSamplerAddress::ClampToEdge,
65 r_address: MslSamplerAddress::ClampToEdge,
66 compare_func: MslSamplerCompareFunc::Never,
67 border_color: MslSamplerBorderColor::TransparentBlack,
68 lod_clamp_min: 0.0,
69 lod_clamp_max: 1000.0,
70 max_anisotropy: 1,
71 compare_enable: false,
72 lod_clamp_enable: false,
73 anisotropy_enable: false,
74 }
75 }
76}
77
78impl Default for MslSamplerYcbcrConversion {
79 fn default() -> Self {
80 MslSamplerYcbcrConversion {
82 planes: 0,
83 resolution: MslFormatResolution::FormatResolution444,
84 chroma_filter: MslSamplerFilter::Nearest,
85 x_chroma_offset: MslChromaLocation::CositedEven,
86 y_chroma_offset: MslChromaLocation::CositedEven,
87 swizzle: [
88 MslComponentSwizzle::Identity,
89 MslComponentSwizzle::Identity,
90 MslComponentSwizzle::Identity,
91 MslComponentSwizzle::Identity,
92 ],
93 ycbcr_model: MslSamplerYcbcrModelConversion::RgbIdentity,
94 ycbcr_range: MslSamplerYcbcrRange::ItuFull,
95 bpc: 8,
96 }
97 }
98}
99
100macro_rules! from_u32 {
101 ($($id:ty)*) => {
102 $(impl From<u32> for $id {
103 fn from(value: u32) -> Self {
104 Self(From::from(value))
105 }
106 })*
107 };
108}
109
110from_u32! {
111 TypeId VariableId ConstantId
112}