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

Graphics pipeline for primary 2D batched quad geometry and procedural shapes. More...

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

+ Inheritance diagram for Flint::BatchPipeline:
+ Collaboration diagram for Flint::BatchPipeline:

Public Member Functions

 BatchPipeline (const BatchPipeline &)=delete
 
BatchPipeline & operator= (const BatchPipeline &)=delete
 
bool initialize (SDL_GPUDevice *device, ShaderFormat shaderFormat, SDL_GPUTextureFormat swapchainFormat)
 Initialize the batch pipeline with shader assets and swapchain target formats.
 
bool isInitialized () const
 Check whether the underlying GPU pipeline handle is created and ready.
 
void cleanup ()
 Release batch shader resources and reset base pipeline state.
 
- Public Member Functions inherited from Flint::Pipeline
 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

bool configurePipeline (SDL_GPUGraphicsPipelineCreateInfo &pipelineInfo) override
 Configure pipeline vertex layout, shader stages, and blend states.
 
- Protected Member Functions inherited from Flint::Pipeline

Additional Inherited Members

- Protected Attributes inherited from Flint::Pipeline
SDL_GPUDevice * m_device = nullptr
 
SDL_GPUGraphicsPipeline * m_pipeline = nullptr
 
Shader * m_shader = nullptr
 

Detailed Description

Graphics pipeline for primary 2D batched quad geometry and procedural shapes.

Manages shader loading, vertex buffer layout configuration (matching BatchVertex), and pipeline creation for textured quads, colored rects, and procedural SDF circles/rings.

See also
BatchVertex
RenderQueue

Definition at line 23 of file batch-pipeline.h.

Member Function Documentation

◆ cleanup()

void Flint::BatchPipeline::cleanup ( )
inlinevirtual

Release batch shader resources and reset base pipeline state.

Reimplemented from Flint::Pipeline.

Definition at line 56 of file batch-pipeline.h.

◆ configurePipeline()

bool Flint::BatchPipeline::configurePipeline ( SDL_GPUGraphicsPipelineCreateInfo & pipelineInfo)
overrideprotectedvirtual

Configure pipeline vertex layout, shader stages, and blend states.

Attribute Layout (28-byte stride, matching BatchVertex):

  • Attribute 0 (location = 0): Position (FLOAT2, offset 0)
  • Attribute 1 (location = 1): UV (FLOAT2, offset 8)
  • Attribute 2 (location = 2): Color (UBYTE4_NORM, offset 16)
  • Attribute 3 (location = 3): ShapeParams (FLOAT2, offset 20)

Blend State: Configures standard non-premultiplied alpha blending for color target attachments:

  • Source Color Factor: SRC_ALPHA
  • Destination Color Factor: ONE_MINUS_SRC_ALPHA
  • Color Operation: ADD
  • Source Alpha Factor: ONE
  • Destination Alpha Factor: ONE_MINUS_SRC_ALPHA
  • Alpha Operation: ADD
Parameters
pipelineInfoPipeline creation descriptor structure to populate.
Returns
true if configuration succeeded.

Reimplemented from Flint::Pipeline.

◆ initialize()

bool Flint::BatchPipeline::initialize ( SDL_GPUDevice * device,
ShaderFormat shaderFormat,
SDL_GPUTextureFormat swapchainFormat )

Initialize the batch pipeline with shader assets and swapchain target formats.

Loads the batch vertex/fragment shaders and builds the underlying GPU pipeline with standard alpha blending enabled.

Parameters
devicePointer to the active SDL GPU device.
shaderFormatActive GPU shader format (e.g., SPIR-V, MSL, DXBC).
swapchainFormatTarget render pass color format.
Returns
true if initialization succeeded, false otherwise.

◆ isInitialized()

bool Flint::BatchPipeline::isInitialized ( ) const
inlinenodiscard

Check whether the underlying GPU pipeline handle is created and ready.

Returns
true if initialized and valid.

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


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