1    def draw_tonemap (framebuffer : Framebuffer
2                      descriptor_set : DescriptorSet
3                      size : Size
4                      max_size : Size) =
5        let vulkan : Vulkan @auto
6        begin_label "Tonemap"
7    
8        let render_pass = begin framebuffer
9                                EnterOp/Load ExitOp/Read
10                               EnterOp/Clear ExitOp/Discard
11                               [Vector4 0 0 0 1]
12   
13       let pipeline_cache = vulkan.tonemap.pipeline_cache
14       bind_pipeline (pipeline_cache.get null render_pass)
15       bind_descriptor_set descriptor_set 0
16       bind_index_buffer vulkan.quad_index_buffer 0 6
17   
18       let width = size.width as f32 / max_size.width as f32
19       let height = size.height as f32 / max_size.height as f32
20       let push_constant = TonemapPushConstant
21           use_debanding = 1
22           =width
23           =height
24   
25       set_push_constant push_constant@ptr
26       draw
27       end
28   
29       end_label
30