pipeline.hpp

 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
#pragma once


#include <planet/vk/render_pass.hpp>


namespace planet::vk {


    class descriptor_set_layout;


    class pipeline_layout final {
        using handle_type =
                device_handle<VkPipelineLayout, vkDestroyPipelineLayout>;
        handle_type handle;

      public:
        explicit pipeline_layout(vk::device &);
        explicit pipeline_layout(vk::device &, descriptor_set_layout const &);
        explicit pipeline_layout(
                vk::device &,
                std::span<VkDescriptorSetLayout const>,
                std::span<VkPushConstantRange const> = {});
        explicit pipeline_layout(
                vk::device &, VkPipelineLayoutCreateInfo const &);

        device_view device;
        auto get() const noexcept { return handle.get(); }
    };


    class graphics_pipeline final {
        using handle_type = device_handle<VkPipeline, vkDestroyPipeline>;

      public:
        graphics_pipeline(
                vk::device &,
                VkGraphicsPipelineCreateInfo &,
                vk::render_pass &,
                pipeline_layout);

        device_view device;
        auto get() const noexcept { return handle.get(); }

        view<vk::render_pass> render_pass;
        vk::pipeline_layout layout;

      private:
        handle_type handle;
    };


}