1    def bind_descriptor_set (descriptor_set : DescriptorSet) (index : u32) =
2        let vulkan : Vulkan @auto
3    
4        let state = vulkan.gpu_state.draw_mut
5        let item = state.descriptor_set_states[ref index]
6        item.bound = false
7             descriptor_set = descriptor_set
8    
9        for image in descriptor_set.storage_images do
10           vulkan.raster_images.add image
11   
12   def bind_vertex_buffer (vertex_buffer : VertexBuffer) =
13       let vulkan : Vulkan @auto
14   
15       let state = vulkan.gpu_state.draw_mut
16       if state.vertex_buffer == vertex_buffer then
17           return
18   
19       state.vertex_buffer = vertex_buffer
20       vk/cmd_bind_vertex_buffers state.command_buffer 0 1
21                                  vertex_buffer.object@ptr
22                                  vertex_buffer.offset@ptr
23   
24   def bind_index_buffer (index_buffer : IndexBuffer
25                          offset : u32
26                          count : u32) =
27       let vulkan : Vulkan @auto
28   
29       let state = vulkan.gpu_state.draw_mut
30       if state.index_buffer == index_buffer then
31           return
32   
33       state.index_count = count
34             index_offset = offset
35             index_buffer = index_buffer
36   
37       vk/cmd_bind_index_buffer state.command_buffer index_buffer.object
38                                index_buffer.offset IndexType/Uint32
39   
40   def bind_pipeline (pipeline : Pipeline) =
41       let vulkan : Vulkan @auto
42   
43       let state = vulkan.gpu_state.draw_mut
44       if pipeline == state.pipeline then
45           return
46   
47       state.pipeline = pipeline
48             pipeline_push_constant_stages = pipeline.push_constant_stages
49   
50       vk/cmd_bind_pipeline state.command_buffer PipelineBindPoint/Graphics
51                            pipeline.object
52