Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::Pipeline Class Reference

Base class for GPU graphics pipelines. More...

#include <flint/graphics/pipelines/pipeline-base.h>

+ Inheritance diagram for Flint::Pipeline:
+ Collaboration diagram for Flint::Pipeline:

Public Member Functions

 Pipeline (SDL_GPUDevice *device)
 Construct a pipeline bound to device.
 
virtual bool initialize (Shader *shader, const PipelineConfig &config)
 Create the underlying SDL GPU graphics pipeline.
 
void bind (SDL_GPURenderPass *renderPass)
 Bind this pipeline to the active render pass.
 
SDL_GPUGraphicsPipeline * getPipeline () const
 Return the raw SDL GPU graphics pipeline handle.
 
Shader * getShader () const
 Return the shader associated with this pipeline.
 

Protected Member Functions

virtual bool configurePipeline (SDL_GPUGraphicsPipelineCreateInfo &pipelineInfo)
 Subclass hook to customize the pipeline create-info before submission.
 
virtual void cleanup ()
 Release the SDL GPU pipeline object.
 

Protected Attributes

SDL_GPUDevice * m_device = nullptr
 
SDL_GPUGraphicsPipeline * m_pipeline = nullptr
 
Shader * m_shader = nullptr
 

Detailed Description

Base class for GPU graphics pipelines.

Handles the common pipeline-creation boilerplate (vertex input, rasterizer, blending, color target). Subclasses may override configurePipeline() to supply custom vertex-attribute layouts or additional pipeline state before the SDL pipeline object is created.

Definition at line 42 of file pipeline-base.h.

Constructor & Destructor Documentation

◆ Pipeline()

Flint::Pipeline::Pipeline ( SDL_GPUDevice * device)
inline

Construct a pipeline bound to device.

Parameters
deviceSDL GPU device that will own all resources.

Definition at line 49 of file pipeline-base.h.

◆ ~Pipeline()

virtual Flint::Pipeline::~Pipeline ( )
inlinevirtual

Definition at line 55 of file pipeline-base.h.

Member Function Documentation

◆ bind()

void Flint::Pipeline::bind ( SDL_GPURenderPass * renderPass)
inline

Bind this pipeline to the active render pass.

Parameters
renderPassActive SDL GPU render pass.

Definition at line 146 of file pipeline-base.h.

◆ cleanup()

virtual void Flint::Pipeline::cleanup ( )
inlineprotectedvirtual

Release the SDL GPU pipeline object.

Reimplemented in Flint::BatchPipeline, and Flint::UIPipeline.

Definition at line 184 of file pipeline-base.h.

◆ configurePipeline()

virtual bool Flint::Pipeline::configurePipeline ( SDL_GPUGraphicsPipelineCreateInfo & pipelineInfo)
inlineprotectedvirtual

Subclass hook to customize the pipeline create-info before submission.

Called from initialize() just before SDL_CreateGPUGraphicsPipeline(). Override to change the vertex-attribute layout or any other state that PipelineConfig does not expose.

Parameters
pipelineInfoPartially populated create-info struct.
Returns
true to proceed, false to abort pipeline creation.

Reimplemented in Flint::BatchPipeline.

Definition at line 177 of file pipeline-base.h.

◆ getPipeline()

SDL_GPUGraphicsPipeline * Flint::Pipeline::getPipeline ( ) const
inline

Return the raw SDL GPU graphics pipeline handle.

Definition at line 155 of file pipeline-base.h.

◆ getShader()

Shader * Flint::Pipeline::getShader ( ) const
inline

Return the shader associated with this pipeline.

Definition at line 162 of file pipeline-base.h.

◆ initialize()

virtual bool Flint::Pipeline::initialize ( Shader * shader,
const PipelineConfig & config )
inlinevirtual

Create the underlying SDL GPU graphics pipeline.

Applies config to build vertex input state, rasterizer state, depth state, and blend state. Calls configurePipeline() to let subclasses inject additional state before pipeline creation.

Parameters
shaderValid Shader with both vertex and fragment stages loaded.
configPipeline configuration parameters.
Returns
true on success, false if creation fails.

Definition at line 70 of file pipeline-base.h.

Member Data Documentation

◆ m_device

SDL_GPUDevice* Flint::Pipeline::m_device = nullptr
protected

Definition at line 191 of file pipeline-base.h.

◆ m_pipeline

SDL_GPUGraphicsPipeline* Flint::Pipeline::m_pipeline = nullptr
protected

Definition at line 192 of file pipeline-base.h.

◆ m_shader

Shader* Flint::Pipeline::m_shader = nullptr
protected

Definition at line 193 of file pipeline-base.h.


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