1     type Pipeline =
2         val vertex_shader : VertexShader
3         val fragment_shader : FragmentShader
4         val pipeline_layout : VkPipelineLayout
5         val object : VkPipeline
6         val push_constant_size : u32
7         val push_constant_stages : ShaderStageFlags
8     
9     type PipelineSettings = struct
10        vertex_shader : VertexShader
11        fragment_shader : FragmentShader
12        cull_mode : CullModeFlags
13    
14    type Attachment =
15        val enable_blend : bool
16        val src_color_blend_factor : BlendFactor
17        val dst_color_blend_factor : BlendFactor
18        val color_blend_op : BlendOp
19        val src_alpha_blend_factor : BlendFactor
20        val dst_alpha_blend_factor : BlendFactor
21        val alpha_blend_op : BlendOp
22        val write_r : bool
23        val write_g : bool
24        val write_b : bool
25        val write_a : bool
26    
27    type Rasterization =
28        val enable_depth_clamp : bool
29        val discard_primitives : bool
30        val wireframe : bool
31        val front_face : FrontFace
32        val cull_mode : CullModeFlags
33        val depth_bias_enable : bool
34        val depth_bias_constant_factor : f32
35        val depth_bias_clamp : f32
36        val depth_bias_slope_factor : f32
37        val line_width : f32
38        val patch_control_points : u32
39    
40    type Multisample =
41        val samples : SampleCountFlags
42        val enable_sample_shading : bool
43        val min_sample_shading : f32
44        val enable_alpha_to_coverage : bool
45        val enable_alpha_to_one : bool
46    
47    type ColorBlend =
48        val enable_logic_op : bool
49        val logic_op : LogicOp
50        val attachments : List<Attachment>
51        val blend_constant : Vector4
52    
53    type DepthStencil =
54        val enable_depth_test : bool
55        val enable_depth_write : bool
56        val depth_compare_operator : CompareOp
57        val enable_depth_range : bool
58        val depth_range_min : f32
59        val depth_range_max : f32
60        val enable_stencil : bool
61        val front_op : StencilOpState
62        val back_op : StencilOpState
63    
64    object Rasterization =
65        val default = Rasterization
66            enable_depth_clamp = false
67            discard_primitives = false
68            wireframe = false
69            front_face = FrontFace/CounterClockwise
70            cull_mode = CullModeFlags/Back
71            depth_bias_enable = false
72            depth_bias_constant_factor = 0
73            depth_bias_clamp = 0
74            depth_bias_slope_factor = 0
75            line_width = 1
76            patch_control_points = 1
77    
78    object Multisample =
79        val default = Multisample
80            samples = SampleCountFlags/1
81            enable_sample_shading = false
82            min_sample_shading = 0
83            enable_alpha_to_coverage = false
84            enable_alpha_to_one = false
85    
86    object Attachment =
87        val default = Attachment
88            enable_blend = false
89            src_color_blend_factor = BlendFactor/Zero
90            dst_color_blend_factor = BlendFactor/Zero
91            color_blend_op = BlendOp/Add
92            src_alpha_blend_factor = BlendFactor/Zero
93            dst_alpha_blend_factor = BlendFactor/Zero
94            alpha_blend_op = BlendOp/Add
95            write_r = true
96            write_g = true
97            write_b = true
98            write_a = true
99    
100   object ColorBlend =
101       val default = ColorBlend
102           enable_logic_op = false
103           logic_op = LogicOp/Clear
104           attachments = List.new
105           blend_constant = Vector4 0 0 0 0
106   
107   object StencilOpState =
108       val default = StencilOpState
109           fail_op = StencilOp/Keep
110           pass_op = StencilOp/Keep
111           depth_fail_op = StencilOp/Keep
112           compare_op = CompareOp/Never
113           compare_mask = 0
114           write_mask = 0
115           reference = 0
116   
117   object DepthStencil =
118       val default = DepthStencil
119           enable_depth_test = true
120           enable_depth_write = true
121           depth_compare_operator = CompareOp/LessOrEqual
122           enable_depth_range = false
123           depth_range_min = 0
124           depth_range_max = 0
125           enable_stencil = false
126           front_op = StencilOpState.default
127           back_op = StencilOpState.default
128   
129   object ColorBlend
130       def create (attachments : i32) =
131           let attachment = Attachment
132               enable_blend = true
133               src_color_blend_factor = BlendFactor/SrcAlpha
134               dst_color_blend_factor = BlendFactor/OneMinusSrcAlpha
135               src_alpha_blend_factor = BlendFactor/SrcAlpha
136               dst_alpha_blend_factor = BlendFactor/OneMinusSrcAlpha
137               f@ Attachment.default
138   
139           ColorBlend attachments = repeat_list attachment attachments.as<u32>
140                      f@ ColorBlend.default
141   
142       def disabled (attachments : i32) =
143           ColorBlend attachments = repeat_list Attachment.default attachments.as<u32>
144                      f@ ColorBlend.default
145