Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
VulkanPipeline Class Reference

Manages the compilation, configuration, and execution layout of a graphics pipeline. More...

#include <VulkanPipeline.hpp>

Public Member Functions

 VulkanPipeline ()=default
 Construct a new Vulkan Pipeline object.
 ~VulkanPipeline ()
 Destroy the Vulkan Pipeline object and release pipeline structures.
 VulkanPipeline (const VulkanPipeline &)=delete
VulkanPipeline & operator= (const VulkanPipeline &)=delete
void create (VkDevice device, VkExtent2D swapchainExtent, VkRenderPass renderPass, const std::string &vertPath, const std::string &fragPath, const std::vector< VkDescriptorSetLayout > &descriptorSetLayouts={})
 Configures vertex inputs, layouts, rasterization, color blending, and creates graphics pipeline.
void destroy ()
 Safely destroys graphics pipeline and layouts.
VkPipeline get () const
 Gets compiled graphics pipeline.
VkPipelineLayout getLayout () const
 Gets layout representing pipeline descriptors and push constants.

Private Member Functions

VkShaderModule createShaderModule (const std::vector< char > &code)
 Wraps raw shader bytecode into a Vulkan module handle.
std::vector< char > loadFile (const std::string &filename)
 Helper to load binary files (SPIR-V shaders).

Private Attributes

VkDevice device = VK_NULL_HANDLE
 Reference to logical device.
VkPipeline graphicsPipeline = VK_NULL_HANDLE
 Raw Vulkan pipeline object.
VkPipelineLayout pipelineLayout = VK_NULL_HANDLE
 Raw Vulkan pipeline layout object.

Detailed Description

Manages the compilation, configuration, and execution layout of a graphics pipeline.

Constructor & Destructor Documentation

◆ VulkanPipeline() [1/2]

VulkanPipeline::VulkanPipeline ( )
default

Construct a new Vulkan Pipeline object.

◆ ~VulkanPipeline()

VulkanPipeline::~VulkanPipeline ( )

Destroy the Vulkan Pipeline object and release pipeline structures.

Destroy the Vulkan Pipeline:: Vulkan Pipeline object.

◆ VulkanPipeline() [2/2]

VulkanPipeline::VulkanPipeline ( const VulkanPipeline & )
delete

Member Function Documentation

◆ create()

void VulkanPipeline::create ( VkDevice dev,
VkExtent2D swapchainExtent,
VkRenderPass renderPass,
const std::string & vertPath,
const std::string & fragPath,
const std::vector< VkDescriptorSetLayout > & descriptorSetLayouts = {} )

Configures vertex inputs, layouts, rasterization, color blending, and creates graphics pipeline.

Compiles shaders, configures pipeline attributes and compiles VkPipeline.

Parameters
deviceVulkan logical device context.
swapchainExtentFramebuffer resolution dimensions.
renderPassRender pass target context.
vertPathPath to vertex shader bytecode.
fragPathPath to fragment shader bytecode.
descriptorSetLayoutsSet layouts bound to pipeline layout.
devLogical device context.
swapchainExtentSwapchain viewport dimensions.
renderPassTarget render pass index.
vertPathVertex shader path.
fragPathFragment shader path.
descriptorSetLayoutsBinding set layouts list.

◆ createShaderModule()

VkShaderModule VulkanPipeline::createShaderModule ( const std::vector< char > & code)
private

Wraps raw shader bytecode into a Vulkan module handle.

Instantiates a Vulkan shader module from bytecode.

Parameters
codeByte array.
Returns
Shader module handle.
Parameters
codeByte array.
Returns
VkShaderModule handle.

◆ destroy()

void VulkanPipeline::destroy ( )

Safely destroys graphics pipeline and layouts.

Frees graphics pipeline and pipeline layout resources.

◆ get()

VkPipeline VulkanPipeline::get ( ) const
inline

Gets compiled graphics pipeline.

Returns
VkPipeline handle.

◆ getLayout()

VkPipelineLayout VulkanPipeline::getLayout ( ) const
inline

Gets layout representing pipeline descriptors and push constants.

Returns
VkPipelineLayout handle.

◆ loadFile()

std::vector< char > VulkanPipeline::loadFile ( const std::string & filename)
private

Helper to load binary files (SPIR-V shaders).

Reads shader binary bytecode files.

Parameters
filenameShader path.
Returns
Vector of bytes.
Parameters
filenameShader binary file path.
Returns
Byte array.

◆ operator=()

VulkanPipeline & VulkanPipeline::operator= ( const VulkanPipeline & )
delete

Member Data Documentation

◆ device

VkDevice VulkanPipeline::device = VK_NULL_HANDLE
private

Reference to logical device.

◆ graphicsPipeline

VkPipeline VulkanPipeline::graphicsPipeline = VK_NULL_HANDLE
private

Raw Vulkan pipeline object.

◆ pipelineLayout

VkPipelineLayout VulkanPipeline::pipelineLayout = VK_NULL_HANDLE
private

Raw Vulkan pipeline layout object.


The documentation for this class was generated from the following files: