Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
DeferredRendererCommon.hpp
1#ifndef _DEFERRED_RENDERER_COMMON_HPP
2#define _DEFERRED_RENDERER_COMMON_HPP
3
4#include <Common/HashedString.hpp>
5#include <Common/Graphics/Formats.hpp>
6#include <Grindstone.Renderer.Deferred/include/Passes/GbufferPass.hpp>
7
8static Grindstone::ConstHashedString gbufferRenderPassKey = "Gbuffer";
9static Grindstone::ConstHashedString geometryOpaqueRenderPassKey = "GeometryOpaque";
10static Grindstone::ConstHashedString geometryUnlitRenderPassKey = "GeometryUnlit";
11static Grindstone::ConstHashedString geometrySkyRenderPassKey = "GeometrySky";
12static Grindstone::ConstHashedString geometryTransparentRenderPassKey = "GeometryTransparent";
13static Grindstone::ConstHashedString mainRenderPassKey = "Main";
14
15static Grindstone::ConstHashedString dofSeparationRenderPassKey = "DofSeparation";
16static Grindstone::ConstHashedString dofBlurAndCombinationRenderPassKey = "DofBlurAndCombination";
17
18static Grindstone::ConstHashedString lightingRenderPassKey = "Lighting";
19static Grindstone::ConstHashedString forwardLitRenderPassKey = "ForwardLit";
20static Grindstone::ConstHashedString ssaoRenderPassKey = "Ssao";
21static Grindstone::ConstHashedString ssaoBlurRenderPassKey = "Ssao Blur";
22static Grindstone::ConstHashedString shadowMapRenderPassKey = "ShadowMap";
23
24static const Grindstone::GraphicsAPI::Format depthFormat = Grindstone::GraphicsAPI::Format::D32_SFLOAT;
25static const Grindstone::GraphicsAPI::Format litHdrFormat = Grindstone::GraphicsAPI::Format::R16G16B16A16_SFLOAT;
26static const Grindstone::GraphicsAPI::Format ambientOcclusionFormat = Grindstone::GraphicsAPI::Format::R8_UNORM;
27
28static Grindstone::ConstHashedString attachmentNameAlbedo = "Grindstone.Gbuffer.Albedo";
29static Grindstone::ConstHashedString attachmentNameNormal = "Grindstone.Gbuffer.Normal";
30static Grindstone::ConstHashedString attachmentNameSpecularRoughness = "Grindstone.Gbuffer.SpecularRoughness";
31static Grindstone::ConstHashedString attachmentNameDepthStencil = "Grindstone.Gbuffer.DepthStencil";
32static Grindstone::ConstHashedString attachmentNameLighting = "Grindstone.Lighting";
33static Grindstone::ConstHashedString attachmentNameShadowDepthStencil = "Grindstone.ShadowAtlas";
34static Grindstone::ConstHashedString attachmentNameOutput = "Grindstone.Renderer.Output";
35
36static Grindstone::Renderer::ImageDescription attachmentAlbedo{ .name = "Gbuffer Albedo", .format = Grindstone::GraphicsAPI::Format::R8G8B8A8_UNORM, .imageUsage = Grindstone::GraphicsAPI::ImageUsageFlags::RenderTarget | Grindstone::GraphicsAPI::ImageUsageFlags::Sampled};
37static Grindstone::Renderer::ImageDescription attachmentNormal{ .name = "Gbuffer Normal", .format = Grindstone::GraphicsAPI::Format::R16G16B16A16_SNORM, .imageUsage = Grindstone::GraphicsAPI::ImageUsageFlags::RenderTarget | Grindstone::GraphicsAPI::ImageUsageFlags::Sampled };
38static Grindstone::Renderer::ImageDescription attachmentSpecularRoughness{ .name = "Gbuffer Specular / Roughness", .format = Grindstone::GraphicsAPI::Format::R8G8B8A8_UNORM, .imageUsage = Grindstone::GraphicsAPI::ImageUsageFlags::RenderTarget | Grindstone::GraphicsAPI::ImageUsageFlags::Sampled };
39static Grindstone::Renderer::ImageDescription attachmentDepthStencil{ .name = "Gbuffer Depth Stencil", .format = depthFormat, .imageUsage = Grindstone::GraphicsAPI::ImageUsageFlags::DepthStencil | Grindstone::GraphicsAPI::ImageUsageFlags::Sampled };
40static Grindstone::Renderer::ImageDescription attachmentlighting{ .name = "Lighting Buffer", .format = litHdrFormat, .imageUsage = Grindstone::GraphicsAPI::ImageUsageFlags::RenderTarget | Grindstone::GraphicsAPI::ImageUsageFlags::Sampled };
41static Grindstone::Renderer::ImageDescription attachmentOutput{ .name = "Output Attachment", .format = Grindstone::GraphicsAPI::Format::R8G8B8A8_UNORM, .imageUsage = Grindstone::GraphicsAPI::ImageUsageFlags::TransferSrc | Grindstone::GraphicsAPI::ImageUsageFlags::RenderTarget | Grindstone::GraphicsAPI::ImageUsageFlags::Sampled };
42
43static const uint32_t shadowAtlasResolution = 4096u;
44static Grindstone::Renderer::ImageDescription attachmentShadowDepthStencil{
45 .name = "Shadow Depth Stencil",
46 .size = Grindstone::Renderer::MetaSize2D{shadowAtlasResolution, shadowAtlasResolution},
47 .format = depthFormat,
48 .imageUsage = Grindstone::GraphicsAPI::ImageUsageFlags::DepthStencil | Grindstone::GraphicsAPI::ImageUsageFlags::Sampled
49};
50
52 { 0, 2 * sizeof(float), Grindstone::GraphicsAPI::VertexInputRate::Vertex },
53 {
54 {
55 "vertexPosition",
56 0,
57 Grindstone::GraphicsAPI::Format::R32G32_SFLOAT,
58 0,
59 Grindstone::GraphicsAPI::AttributeUsage::Position
60 }
61 }
62).Build();
63
64#endif
Definition HashedString.hpp:54
Definition AttachmentInfo.hpp:226
Definition AttachmentInfo.hpp:100