Foundation
Loading...
Searching...
No Matches
PipelineState.hpp
Go to the documentation of this file.
1#pragma once
2#include "Common.hpp"
3#include "Shader.hpp"
4#include "Descriptor.hpp"
5namespace Foundation::RHI {
6 class RHIDevice;
7 class RHIPipelineState : public RHIObject {
8 protected:
10 public:
13 // [Graphics] Vertex Input
14 struct VertexInput {
15 struct Binding {
16 uint32_t stride; // In bytes
17 bool perInstance{ false }; // If true, this binding is per-instance data
18 };
22 // [Graphics] Input Assembly
29 // [Graphics] Viewport
30 struct Viewport {
31 float x = 0, y = 0, width, height;
32 float minDepth = 0.0, maxDepth = 1.0;
34 // [Graphics] Scissor
35 struct Scissor {
36 int32_t x = 0, y = 0, width, height;
38 // [Graphics] Rasterizer
57 // [Graphics] MSAA
62 // [Graphics] Depth Stencil
79 struct Attachment {
80 struct Blending {
81 bool enabled{ false };
99 const static Blending GetNoBlending() { return {}; }
100 const static Blending GetAlphaBlending() {
101 return {
102 .enabled = true,
103 .srcColorBlendFactor = SrcAlpha,
104 .dstColorBlendFactor = OneMinusSrcAlpha,
105 .srcAlphaBlendFactor = One,
106 .dstAlphaBlendFactor = OneMinusSrcAlpha,
107 .colorBlendOp = Add,
108 .alphaBlendOp = Add
109 };
110 }
112 {
113 return {
114 .enabled = true,
115 .srcColorBlendFactor = SrcAlpha,
116 .dstColorBlendFactor = One,
117 .srcAlphaBlendFactor = One,
118 .dstAlphaBlendFactor = One,
119 .colorBlendOp = Add,
120 .alphaBlendOp = Add
121 };
122 }
127 };
128 // [Graphics] Attachments/Alpha Blending
130 // Stages
131 struct ShaderStage {
132 struct StageDesc {
133 // Stage this shader participates in
134 // You can only specify one stage per shader module.
136 const char* entryPoint;
138 // !! TODO
142 };
144 // Descriptors
146 // Push Constants
149 size_t offset;
150 size_t size;
151 };
153 };
155
157
158 virtual void DebugSetObjectName(const char* name) = 0;
159 };
160}
Definition Device.hpp:131
Base class for all RHI objects.
Definition Details.hpp:16
Definition PipelineState.hpp:7
const RHIDevice & mDevice
Definition PipelineState.hpp:9
RHIPipelineState(RHIDevice const &device, PipelineStateDesc const &desc)
Definition PipelineState.hpp:156
const PipelineStateDesc mDesc
Definition PipelineState.hpp:154
virtual void DebugSetObjectName(const char *name)=0
Definition Shader.hpp:5
std::unique_ptr< T, StlDeleter< T > > UniquePtr
std::unique_ptr with custom deleter that uses a Foundation::Core::Allocator to deallocate memory.
Definition Allocator.hpp:161
Low-level Rendering Hardware Interface (RHI) abstractions.
Definition Application.hpp:5
RHIDevicePipelineType
Definition Common.hpp:84
RHIResourceFormat
Definition Common.hpp:20
RHIMultisampleCount
Definition Common.hpp:132
static const Blending GetAdditiveBlending()
Definition PipelineState.hpp:111
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::Blending::BlendFactor dstAlphaBlendFactor
static const Blending GetAlphaBlending()
Definition PipelineState.hpp:100
static const Blending GetNoBlending()
Definition PipelineState.hpp:99
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::Blending::BlendFactor dstColorBlendFactor
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::Blending::BlendFactor srcAlphaBlendFactor
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::Blending::BlendOp colorBlendOp
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::Blending::BlendFactor srcColorBlendFactor
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::Blending::BlendOp alphaBlendOp
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::RenderTarget renderTarget
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::Attachment::Blending blending
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::DepthStencil::CompareOp Less
RHIResourceFormat stencilFormat
Definition PipelineState.hpp:65
RHIResourceFormat depthFormat
Definition PipelineState.hpp:64
RHIMultisampleCount sampleCount
Definition PipelineState.hpp:60
RHIShaderStage stage
Definition PipelineState.hpp:148
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Rasterizer::FrontFace FFCounterClockwise
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Rasterizer::FillMode FillSolid
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Rasterizer::CullMode CullBack
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::ShaderStage::StageDesc::SpecializationInfo specializationInfo
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::ShaderStage::StageDesc desc
RHIShaderModule * shaderModule
Definition PipelineState.hpp:141
Span< const Binding > bindings
Definition PipelineState.hpp:19
Span< const RHIVertexAttribute > attributes
Definition PipelineState.hpp:20
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::Viewport viewport
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::DepthStencil depthStencil
Span< RHIDeviceDescriptorSetLayout *const > descriptorSetLayouts
Definition PipelineState.hpp:145
Span< const Attachment > attachments
Definition PipelineState.hpp:129
Span< const ShaderStage > shaderStages
Definition PipelineState.hpp:143
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::VertexInput vertexInput
Span< const PushConstant > pushConstants
Definition PipelineState.hpp:152
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::Rasterizer rasterizer
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::Scissor scissor
struct Foundation::RHI::RHIPipelineState::PipelineStateDesc::Multisample multisample
enum Foundation::RHI::RHIPipelineState::PipelineStateDesc::Topology TriangleList
@ TriangleStrip
Definition PipelineState.hpp:27
@ PointList
Definition PipelineState.hpp:25
@ TriangleList
Definition PipelineState.hpp:26
RHIDevicePipelineType type
Definition PipelineState.hpp:12