19 std::unique_ptr<EnginePipeline> pipeline;
20 VkPipelineLayout pipeline_layout;
21 std::string frag_path;
23 void create_pipeline_layout() {
24 VkPipelineLayoutCreateInfo pipeline_layout_info{};
25 pipeline_layout_info.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
26 std::vector<VkDescriptorSetLayout> descriptor_sets_layouts{};
28 pipeline_layout_info.setLayoutCount = descriptor_sets_layouts.size();
29 pipeline_layout_info.pSetLayouts = descriptor_sets_layouts.data();
30 pipeline_layout_info.pushConstantRangeCount = 0;
31 pipeline_layout_info.pPushConstantRanges =
nullptr;
33 if (vkCreatePipelineLayout(
34 device.
device(), &pipeline_layout_info,
nullptr, &pipeline_layout
36 throw std::runtime_error(
"failed to create pipeline layout");
40 void create_pipeline(VkRenderPass render_pass, uint32_t subpass=0) {
41 assert(pipeline_layout !=
nullptr &&
"Cannot create pipeline before pipeline layout");
45 pipeline_config.render_pass = render_pass;
46 pipeline_config.pipeline_layout = pipeline_layout;
47 pipeline_config.subpass = subpass;
48 std::vector<PipelineShaderData> shaders_data = {
50 SHADERS_DIR+
"/fullscreen.vert.spv",
51 VK_SHADER_STAGE_VERTEX_BIT
55 VK_SHADER_STAGE_FRAGMENT_BIT
59 VkPipelineVertexInputStateCreateInfo emptyInputState;
60 emptyInputState.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
61 emptyInputState.vertexAttributeDescriptionCount = 0;
62 emptyInputState.pVertexAttributeDescriptions =
nullptr;
63 emptyInputState.vertexBindingDescriptionCount = 0;
64 emptyInputState.pVertexBindingDescriptions =
nullptr;
66 pipeline = std::make_unique<EnginePipeline>(
79 VkRenderPass render_pass,
80 std::string frag_path,
82 ) : device{device}, descman{descman}, frag_path{frag_path} {
83 create_pipeline_layout();
84 create_pipeline(render_pass, subpass);
88 vkDestroyPipelineLayout(device.
device(), pipeline_layout,
nullptr);
96 VkCommandBuffer command_buffer,
Offscreen &source_offscreen
98 pipeline->bind(command_buffer);
100 vkCmdDraw(command_buffer, 3, 1, 0, 0);
Mega-class responsible for handling everything to do with descriptors.
Definition: engine_descriptors.hpp:23
void bind_fullscreen_descriptor_set(VkCommandBuffer command_buffer, VkPipelineLayout pipeline_layout, Offscreen &offscreen)
Definition: engine_descriptors.hpp:454
void get_fullscreen_layouts(std::vector< VkDescriptorSetLayout > &layouts)
Definition: engine_descriptors.hpp:402
Abstraction around VkDevice, managing everything to do with the physical and logical device,...
Definition: engine_device.hpp:109
VkDevice device()
Definition: engine_device.hpp:482
static void default_pipeline_config_info(PipelineConfigInfo &config_info)
Definition: engine_pipeline.hpp:207
Render System used to run render passes that require data from off screen render targets,...
Definition: offscreen_render_system.hpp:15
void render(VkCommandBuffer command_buffer, Offscreen &source_offscreen)
Definition: offscreen_render_system.hpp:95
OffscreenRenderSystem & operator=(const OffscreenRenderSystem &)=delete
~OffscreenRenderSystem()
Definition: offscreen_render_system.hpp:87
OffscreenRenderSystem(EngineDevice &device, EngineDescriptorManager &descman, VkRenderPass render_pass, std::string frag_path, uint32_t subpass=0)
Definition: offscreen_render_system.hpp:76
OffscreenRenderSystem(const OffscreenRenderSystem &)=delete
Off screen render target.
Definition: offscreen.hpp:15
Definition: engine_pipeline.hpp:13