Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
batch-pipeline.h
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2025-2026 Manuel Osorio
3#pragma once
4
5#include "flint/graphics/pipelines/pipeline-base.h"
6
7#include <SDL3/SDL_gpu.h>
8
9#include <memory>
10
11namespace Flint {
12
23 class BatchPipeline : public Pipeline {
24 public:
25 BatchPipeline() = default;
26 ~BatchPipeline() override = default;
27
28 BatchPipeline(const BatchPipeline &) = delete;
29 BatchPipeline &operator=(const BatchPipeline &) = delete;
30
42 bool initialize(SDL_GPUDevice *device, ShaderFormat shaderFormat,
43 SDL_GPUTextureFormat swapchainFormat);
44
49 [[nodiscard]] bool isInitialized() const {
50 return getPipeline() != nullptr;
51 }
52
56 void cleanup() {
57 m_batchShader.reset();
59 }
60
61 protected:
83 bool configurePipeline(SDL_GPUGraphicsPipelineCreateInfo &pipelineInfo) override;
84
85 private:
86 SDL_GPUVertexAttribute m_attributes[4] =
87 {};
88 std::unique_ptr<Shader> m_batchShader;
89 };
90
91}
void cleanup()
Release batch shader resources and reset base pipeline state.
bool configurePipeline(SDL_GPUGraphicsPipelineCreateInfo &pipelineInfo) override
Configure pipeline vertex layout, shader stages, and blend states.
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.
Graphics pipeline for primary 2D batched quad geometry and procedural shapes.
virtual void cleanup()
Release the SDL GPU pipeline object.
SDL_GPUGraphicsPipeline * getPipeline() const
Return the raw SDL GPU graphics pipeline handle.
Base class for GPU graphics pipelines.