A class managing creating vulkan pipelines. Both form meshes and UI elements. More...
#include <Pipeline.hpp>
Public Member Functions | |
| VulkanPipeline (VulkanContext &r_context) | |
| Constructor for VulkanPipeline. | |
| void | createGraphicsPipeline (const std::string &vertShaderPath, const std::string &fragShaderPath, const VkVertexInputBindingDescription &bindingDescription, const std::vector< VkVertexInputAttributeDescription > &attributeDescriptions) |
| Creates a standard Opaque Graphics Pipeline. | |
| void | createTransparentPipeline (const std::string &vertShaderPath, const std::string &fragShaderPath, const VkVertexInputBindingDescription &bindingDescription, const std::vector< VkVertexInputAttributeDescription > &attributeDescriptions) |
| Creates a Transparent Graphics Pipeline. | |
| void | createMaskedPipeline (const std::string &vertShaderPath, const std::string &fragShaderPath, const VkVertexInputBindingDescription &bindingDescription, const std::vector< VkVertexInputAttributeDescription > &attributeDescriptions) |
| Creates a Masked Graphics Pipeline (Alpha Cutout). | |
| void | createSpritePipeline (const std::string &vertPath, const std::string &fragPath, bool isTransparent, bool isInstanced) |
| Creates a Sprite Graphics Pipeline (used for Billboards and Particles). | |
| void | createUIPipeline (const std::string &vertShaderPath, const std::string &fragShaderPath, const VkVertexInputBindingDescription &bindingDesc, const std::vector< VkVertexInputAttributeDescription > &attrDesc) |
| Creates a UI Pipeline. | |
| void | createFullscreenPipeline (const std::string &vertPath, const std::string &fragPath) |
| Creates a Fullscreen Quad Pipeline. | |
| VkPipeline | get () const |
| Returns the VkPipeline handle. | |
| VkPipelineLayout | layout () const |
| Returns the VkPipelineLayout handle. | |
| void | updateViewport (glm::uvec2 resolution) |
| Updates viewport to new resolution. | |
Private Member Functions | |
| std::vector< char > | readFile (const std::string &filename) |
| Reads a file and returns its contents as a vector of characters. | |
Private Attributes | |
| VulkanContext & | m_r_context |
| Creates a debug VkPipeline. | |
| VkPipeline | m_pipeline = VK_NULL_HANDLE |
| VkPipelineLayout | m_layout = VK_NULL_HANDLE |
| glm::uvec2 | m_currentRenderResolution |
A class managing creating vulkan pipelines. Both form meshes and UI elements.
Definition at line 20 of file Pipeline.hpp.
| vex::VulkanPipeline::VulkanPipeline | ( | VulkanContext & | r_context | ) |
Constructor for VulkanPipeline.
| VulkanContext& | r_context - Reference to the VulkanContext. |
Definition at line 8 of file Pipeline.cpp.
| vex::VulkanPipeline::~VulkanPipeline | ( | ) |
Definition at line 10 of file Pipeline.cpp.
| void vex::VulkanPipeline::createFullscreenPipeline | ( | const std::string & | vertPath, |
| const std::string & | fragPath ) |
Creates a Fullscreen Quad Pipeline.
Used for post-processing or upscaling the low-res render to the swapchain.
| const | std::string& vertPath - Vertex shader path. |
| const | std::string& fragPath - Fragment shader path. |
Definition at line 935 of file Pipeline.cpp.
| void vex::VulkanPipeline::createGraphicsPipeline | ( | const std::string & | vertShaderPath, |
| const std::string & | fragShaderPath, | ||
| const VkVertexInputBindingDescription & | bindingDescription, | ||
| const std::vector< VkVertexInputAttributeDescription > & | attributeDescriptions ) |
Creates a standard Opaque Graphics Pipeline.
Compiles shaders, sets up input assembly, viewport, rasterizer (Cull Back), depth stencil (Write/Test), and color blending (Off/Replace).
| const | std::string& vertShaderPath - Vertex shader path. |
| const | std::string& fragShaderPath - Fragment shader path. |
| const | VkVertexInputBindingDescription& bindingDescription - Vertex input setup. |
| const | std::vector<VkVertexInputAttributeDescription>& attributeDescriptions - Vertex attribute setup. |
Definition at line 39 of file Pipeline.cpp.
| void vex::VulkanPipeline::createMaskedPipeline | ( | const std::string & | vertShaderPath, |
| const std::string & | fragShaderPath, | ||
| const VkVertexInputBindingDescription & | bindingDescription, | ||
| const std::vector< VkVertexInputAttributeDescription > & | attributeDescriptions ) |
Creates a Masked Graphics Pipeline (Alpha Cutout).
Similar to Opaque, but typically uses a shader that discards fragments based on alpha.
| const | std::string& vertShaderPath - Vertex shader path. |
| const | std::string& fragShaderPath - Fragment shader path. |
| const | VkVertexInputBindingDescription& bindingDescription - Vertex input setup. |
| const | std::vector<VkVertexInputAttributeDescription>& attributeDescriptions - Vertex attribute setup. |
Definition at line 428 of file Pipeline.cpp.
| void vex::VulkanPipeline::createSpritePipeline | ( | const std::string & | vertPath, |
| const std::string & | fragPath, | ||
| bool | isTransparent, | ||
| bool | isInstanced ) |
Creates a Sprite Graphics Pipeline (used for Billboards and Particles).
Configures a pipeline optimized for rendering 2D sprites in a 3D environment. It handles both transparent and masked blending modes, and supports instanced rendering for particles.
| const | std::string& vertPath - Path to the vertex shader. |
| const | std::string& fragPath - Path to the fragment shader. |
| bool | isTransparent - If true, enables alpha blending. If false, uses alpha-cutout (masked). |
| bool | isInstanced - If true, sets up the pipeline for instanced rendering (used by particles). |
Definition at line 618 of file Pipeline.cpp.
| void vex::VulkanPipeline::createTransparentPipeline | ( | const std::string & | vertShaderPath, |
| const std::string & | fragShaderPath, | ||
| const VkVertexInputBindingDescription & | bindingDescription, | ||
| const std::vector< VkVertexInputAttributeDescription > & | attributeDescriptions ) |
Creates a Transparent Graphics Pipeline.
Sets up blending (SrcAlpha/OneMinusSrcAlpha) and disables Depth Write (keeps Depth Test).
| const | std::string& vertShaderPath - Vertex shader path. |
| const | std::string& fragShaderPath - Fragment shader path. |
| const | VkVertexInputBindingDescription& bindingDescription - Vertex input setup. |
| const | std::vector<VkVertexInputAttributeDescription>& attributeDescriptions - Vertex attribute setup. |
Definition at line 229 of file Pipeline.cpp.
| void vex::VulkanPipeline::createUIPipeline | ( | const std::string & | vertShaderPath, |
| const std::string & | fragShaderPath, | ||
| const VkVertexInputBindingDescription & | bindingDesc, | ||
| const std::vector< VkVertexInputAttributeDescription > & | attrDesc ) |
Creates a UI Pipeline.
Sets up blending for UI elements and ignores Depth Test/Write.
| const | std::string& vertShaderPath - Vertex shader path. |
| const | std::string& fragShaderPath - Fragment shader path. |
| const | VkVertexInputBindingDescription& bindingDesc - UI vertex layout. |
| const | std::vector<VkVertexInputAttributeDescription>& attrDesc - UI attributes. |
Definition at line 775 of file Pipeline.cpp.
|
inline |
Returns the VkPipeline handle.
Definition at line 102 of file Pipeline.hpp.
|
inline |
Returns the VkPipelineLayout handle.
Definition at line 106 of file Pipeline.hpp.
|
private |
Reads a file and returns its contents as a vector of characters.
| const | std::string& filename - The path to the file to read. |
Definition at line 19 of file Pipeline.cpp.
| void vex::VulkanPipeline::updateViewport | ( | glm::uvec2 | resolution | ) |
Updates viewport to new resolution.
Since dynamic state is used for Viewport/Scissor, this updates internal resolution state if needed (though mostly handled at draw time via vkCmdSetViewport).
| glm::uvec2 | resolution - New resolution. |
Definition at line 35 of file Pipeline.cpp.
|
private |
Definition at line 125 of file Pipeline.hpp.
|
private |
Definition at line 123 of file Pipeline.hpp.
|
private |
Definition at line 122 of file Pipeline.hpp.
|
private |
Creates a debug VkPipeline.
| std::string& | vertPath - Path to the vertex shader. |
| std::string& | fragPath - Path to the fragment shader. |
Creates a debug pipeline using the provided shader paths and puts some needed data in the context for later use, like layouts.
Definition at line 121 of file Pipeline.hpp.