-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.hpp
82 lines (81 loc) · 2.95 KB
/
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// Created by daily on 27-12-23.
//
/**
* @file pipeline_.hpp
* @brief Defines functionality for creating Vulkan graphics pipelines.
* @date Created by Renato on 27-12-23.
*/
#ifndef INC_3DLOADERVK_PIPELINE_HPP
#define INC_3DLOADERVK_PIPELINE_HPP
#include <vulkan/vulkan.hpp>
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include "shaders.hpp"
#include "render_structs.hpp"
#include "mesh.hpp"
namespace vkinit
{
/**
* @struct GraphicsPipelineInBundle
* @brief Holds parameters required for creating a Vulkan graphics pipeline_.
*
* This structures includes the Vulkan device_, file paths for vertex and fragment shaders,
* and specifications related to the swap chain such as image format and extent.
*/
struct GraphicsPipelineInBundle
{
vk::Device device;
std::string vertexFilepath;
std::string fragmentFilepath;
vk::Extent2D swapchainExtent;
vk::Format swapchainImageFormat;
};
/**
* @struct GraphicsPipelineOutBundle
* @brief Holds the components of a created Vulkan graphics pipeline_
*
* This structure encapsulates the pipeline_ layout, render pass, and the graphics pipeline_ itself.
*/
struct GraphicsPipelineOutBundle
{
vk::PipelineLayout layout;
vk::RenderPass renderpass;
vk::Pipeline pipeline;
};
/**
* @brief Creates a Vulkan pipeline_ layout
*
* Initializes a pipeline_ layout necessary for a Vulkan graphics pipeline_, including push constants
*
* @param device The Vulkan logical device_.
* @param debug Flag indicating whether to enable debug logging.
* @return The created Vulkan pipeline_ layout.
*/
vk::PipelineLayout make_pipeline_layout(vk::Device device, bool debug);
/**
* @brief Creates a Vulkan render pass.
*
* Initializes a render pass for the graphics pipeline_, specifying how color and depth attachments are handled.
*
* @param device The Vulkan logical device_.
* @param swapchainImageFormat The format of the swap chain images.
* @param debug Flag indicating whether to enable debug logging.
* @return The created Vulkan render pass.
*/
vk::RenderPass make_renderpass(vk::Device device, vk::Format swapchainImageFormat, bool debug);
/**
* @brief Creates a Vulkan graphics pipeline_
*
* Sets up the entire graphics pipeline_, including shader stages, viewport and scissor states,
* rasterization, multisampling, color blending, and more, based on the provided specifications.
*
* @param specification The specifications for creating the graphics pipeline_.
* @param debug Flag indicating whether to enable debug logging.
* @return A bundle containing the components of the created graphics pipeline_.
*/
GraphicsPipelineOutBundle create_graphics_pipeline(GraphicsPipelineInBundle specification, bool debug);
}
#endif //INC_3DLOADERVK_PIPELINE_HPP