SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
spark::render::vk::VulkanRenderPipeline Class Referencefinal

Vulkan implementation of IRenderPipeline. More...

#include <VulkanRenderPipeline.h>

Inheritance diagram for spark::render::vk::VulkanRenderPipeline:
spark::render::RenderPipeline< VulkanPipelineLayout, VulkanShaderProgram, VulkanInputAssembler, VulkanRasterizer > spark::render::vk::VulkanPipelineState spark::render::IRenderPipeline spark::render::StateResource spark::render::Pipeline< VulkanPipelineLayout, VulkanShaderProgram > spark::render::Pipeline< VulkanPipelineLayout, VulkanShaderProgram > spark::render::Resource< VkPipeline > spark::render::IPipeline spark::render::IStateResource spark::render::IPipeline spark::render::IPipeline spark::render::IResource< VkPipeline > spark::render::IStateResource spark::render::IStateResource spark::render::IStateResource

Classes

struct  Impl
 

Public Member Functions

 VulkanRenderPipeline (const VulkanRenderPass &render_pass, std::shared_ptr< VulkanShaderProgram > shader_program, std::shared_ptr< VulkanPipelineLayout > layout, std::shared_ptr< VulkanInputAssembler > input_assembler, std::shared_ptr< VulkanRasterizer > rasterizer, bool enable_alpha_to_coverage=false, const std::string &name="")
 Initializes a new VulkanRenderPipeline.
 
 VulkanRenderPipeline (const VulkanRenderPipeline &other)=delete
 
 VulkanRenderPipeline (VulkanRenderPipeline &&other) noexcept=delete
 
VulkanRenderPipelineoperator= (const VulkanRenderPipeline &other)=delete
 
VulkanRenderPipelineoperator= (VulkanRenderPipeline &&other) noexcept=delete
 
std::shared_ptr< const VulkanShaderProgramprogram () const noexcept override
 Gets the shader program used by the pipeline.
 
std::shared_ptr< VulkanPipelineLayoutlayout () const noexcept override
 Gets the pipeline layout.
 
bool alphaToCoverage () const noexcept override
 Checks if the render pipeline is using alpha to coverage.
 
std::shared_ptr< VulkanInputAssemblerinputAssembler () const noexcept override
 Gets the input assembler state used by the render pipeline.
 
std::shared_ptr< VulkanRasterizerrasterizer () const noexcept override
 Gets the rasterizer state used by the render pipeline.
 
void use (const VulkanCommandBuffer &command_buffer) const noexcept override
 Sets the current pipeline state on the ICommandBuffer.
 
void bind (const VulkanCommandBuffer &command_buffer, const VulkanDescriptorSet &descriptor_set) const noexcept override
 Binds a descriptor set on a ICommandBuffer.
 
- Public Member Functions inherited from spark::render::IRenderPipeline
std::shared_ptr< IInputAssemblerinputAssembler () const noexcept
 Gets the input assembler state used by the render pipeline.
 
std::shared_ptr< IRasterizerrasterizer () const noexcept
 Gets the rasterizer state used by the render pipeline.
 
- Public Member Functions inherited from spark::render::IPipeline
std::shared_ptr< const IShaderProgramprogram () const noexcept
 Gets the shader program used by the pipeline.
 
std::shared_ptr< IPipelineLayoutlayout () const noexcept
 Gets the pipeline layout.
 
- Public Member Functions inherited from spark::render::StateResource
 StateResource (std::string_view name) noexcept
 Initializes a new StateResource instance.
 
 StateResource (const StateResource &other)=delete
 
 StateResource (StateResource &&other) noexcept
 
StateResourceoperator= (const StateResource &other)=delete
 
StateResourceoperator= (StateResource &&other) noexcept
 
const std::string & name () const noexcept final
 Gets the name of the state resource.
 
- Public Member Functions inherited from spark::render::vk::VulkanPipelineState
 Resource (Handle handle) noexcept
 Initializes the managed resource with the given handle.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other) noexcept=delete
 
- Public Member Functions inherited from spark::render::Resource< VkPipeline >
 Resource (VkPipeline handle) noexcept
 Initializes the managed resource with the given handle.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other) noexcept=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other) noexcept=delete
 
const VkPipeline & handle () const final
 Gets the managed resource handle.
 

Additional Inherited Members

- Public Types inherited from spark::render::RenderPipeline< VulkanPipelineLayout, VulkanShaderProgram, VulkanInputAssembler, VulkanRasterizer >
using input_assembler_type
 
using rasterizer_type
 
- Public Types inherited from spark::render::Pipeline< VulkanPipelineLayout, VulkanShaderProgram >
using shader_program_type
 
using pipeline_layout_type
 
- Public Types inherited from spark::render::IResource< VkPipeline >
using handle_type
 
- Protected Member Functions inherited from spark::render::StateResource
 StateResource () noexcept
 Initializes a new StateResource instance with an empty name.
 
std::string & name () noexcept
 Gets the name of the state resource.
 
- Protected Member Functions inherited from spark::render::Resource< VkPipeline >
VkPipeline & handle () final
 Gets the managed resource handle.
 

Detailed Description

Vulkan implementation of IRenderPipeline.

Constructor & Destructor Documentation

◆ VulkanRenderPipeline()

spark::render::vk::VulkanRenderPipeline::VulkanRenderPipeline ( const VulkanRenderPass & render_pass,
std::shared_ptr< VulkanShaderProgram > shader_program,
std::shared_ptr< VulkanPipelineLayout > layout,
std::shared_ptr< VulkanInputAssembler > input_assembler,
std::shared_ptr< VulkanRasterizer > rasterizer,
bool enable_alpha_to_coverage = false,
const std::string & name = "" )
explicit

Initializes a new VulkanRenderPipeline.

Parameters
render_passThe parent VulkanRenderPass.
shader_programThe VulkanShaderProgram used by this pipeline.
layoutThe VulkanPipelineLayout of the pipeline.
input_assemblerThe VulkanInputAssembler of the pipeline.
rasterizerThe VulkanRasterizer of the pipeline.
nameThe optional name of the render pipeline.
enable_alpha_to_coveragetrue if alpha to coverage multisampling should be enabled, false otherwise.

Member Function Documentation

◆ alphaToCoverage()

bool spark::render::vk::VulkanRenderPipeline::alphaToCoverage ( ) const
nodiscardoverridevirtualnoexcept

Checks if the render pipeline is using alpha to coverage.

Returns
true if the render pipeline is using alpha to coverage, false otherwise.

Alpha-to-Coverage is a multi-sampling technique used for partially transparent sprites or textures (such as foliage) to prevent visible flickering along edges. If enabled, the alpha-channel of the first (non-depth/stencil) render target is used to generate a temporary coverage mask that is combined with the fragment coverage mask using a logical AND.

Implements spark::render::IRenderPipeline.

◆ bind()

void spark::render::vk::VulkanRenderPipeline::bind ( const VulkanCommandBuffer & command_buffer,
const VulkanDescriptorSet & descriptor_set ) const
overridevirtualnoexcept

Binds a descriptor set on a ICommandBuffer.

Parameters
command_bufferThe ICommandBuffer to issue the bind command on.
descriptor_setThe IDescriptorSet to bind.

Implements spark::render::vk::VulkanPipelineState.

◆ inputAssembler()

std::shared_ptr< VulkanInputAssembler > spark::render::vk::VulkanRenderPipeline::inputAssembler ( ) const
nodiscardoverridevirtualnoexcept

Gets the input assembler state used by the render pipeline.

Returns
A std::shared_ptr to the IInputAssembler state used by the render pipeline.

Implements spark::render::RenderPipeline< VulkanPipelineLayout, VulkanShaderProgram, VulkanInputAssembler, VulkanRasterizer >.

◆ layout()

std::shared_ptr< VulkanPipelineLayout > spark::render::vk::VulkanRenderPipeline::layout ( ) const
nodiscardoverridevirtualnoexcept

Gets the pipeline layout.

Returns
A std::shared_ptr pointer to the IPipelineLayout.

Implements spark::render::Pipeline< VulkanPipelineLayout, VulkanShaderProgram >.

◆ program()

std::shared_ptr< const VulkanShaderProgram > spark::render::vk::VulkanRenderPipeline::program ( ) const
nodiscardoverridevirtualnoexcept

Gets the shader program used by the pipeline.

Returns
A std::shared_ptr pointer to the IShaderProgram used by the pipeline.

Implements spark::render::Pipeline< VulkanPipelineLayout, VulkanShaderProgram >.

◆ rasterizer()

std::shared_ptr< VulkanRasterizer > spark::render::vk::VulkanRenderPipeline::rasterizer ( ) const
nodiscardoverridevirtualnoexcept

Gets the rasterizer state used by the render pipeline.

Returns
A std::shared_ptr to the IRasterizer state used by the render pipeline.

Implements spark::render::RenderPipeline< VulkanPipelineLayout, VulkanShaderProgram, VulkanInputAssembler, VulkanRasterizer >.

◆ use()

void spark::render::vk::VulkanRenderPipeline::use ( const VulkanCommandBuffer & command_buffer) const
overridevirtualnoexcept

Sets the current pipeline state on the ICommandBuffer.

Parameters
command_bufferThe ICommandBuffer to set the current pipeline state on.

Implements spark::render::vk::VulkanPipelineState.