SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
RenderPipeilne.h
1#pragma once
2
3#include "spark/render/Export.h"
4#include "spark/render/InputAssembler.h"
5#include "spark/render/Pipeline.h"
6#include "spark/render/Rasterizer.h"
7
8#include <memory>
9
10namespace spark::render
11{
15 class SPARK_RENDER_EXPORT IRenderPipeline : public virtual IPipeline
16 {
17 public:
18 ~IRenderPipeline() noexcept override = default;
19
24 [[nodiscard]] std::shared_ptr<IInputAssembler> inputAssembler() const noexcept { return genericInputAssembler(); }
25
30 [[nodiscard]] std::shared_ptr<IRasterizer> rasterizer() const noexcept { return genericRasterizer(); }
31
40 [[nodiscard]] virtual bool alphaToCoverage() const noexcept = 0;
41
42 private:
45 [[nodiscard]] virtual std::shared_ptr<IInputAssembler> genericInputAssembler() const noexcept = 0;
46 [[nodiscard]] virtual std::shared_ptr<IRasterizer> genericRasterizer() const noexcept = 0;
48 };
49
55 template <typename PipelineLayoutType, typename ShaderProgramType, typename InputAssemblerType, typename RasterizerType>
56 class RenderPipeline : public IRenderPipeline, public StateResource, public virtual Pipeline<PipelineLayoutType, ShaderProgramType>
57 {
58 public:
59 using input_assembler_type = InputAssemblerType;
60 using rasterizer_type = RasterizerType;
61
62 public:
64 [[nodiscard]] virtual std::shared_ptr<input_assembler_type> inputAssembler() const noexcept = 0;
65
67 [[nodiscard]] virtual std::shared_ptr<rasterizer_type> rasterizer() const noexcept = 0;
68
69 private:
70 [[nodiscard]] std::shared_ptr<IInputAssembler> genericInputAssembler() const noexcept final { return inputAssembler(); }
71 [[nodiscard]] std::shared_ptr<IRasterizer> genericRasterizer() const noexcept final { return rasterizer(); }
72 };
73}
Definition InputAssembler.h:35
Interface representing a pipeline.
Definition Pipeline.h:82
Represents the rasterizer stage of the graphics pipeline.
Definition Rasterizer.h:63
Interface for a render pipeline.
Definition RenderPipeilne.h:16
std::shared_ptr< IRasterizer > rasterizer() const noexcept
Gets the rasterizer state used by the render pipeline.
Definition RenderPipeilne.h:30
virtual bool alphaToCoverage() const noexcept=0
Checks if the render pipeline is using alpha to coverage.
std::shared_ptr< IInputAssembler > inputAssembler() const noexcept
Gets the input assembler state used by the render pipeline.
Definition RenderPipeilne.h:24
Represents a pipeline state.
Definition Pipeline.h:113
Represents a graphics IPipeline.
Definition RenderPipeilne.h:57
virtual std::shared_ptr< input_assembler_type > inputAssembler() const noexcept=0
Gets the input assembler state used by the render pipeline.
Base class for a resource that can be identified by a name in a DeviceState.
Definition StateResource.h:29