Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Renderer.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_RENDERER_H_
34#define DVD_RENDERER_H_
35
38
39namespace Divide {
40
41class LightPool;
42class ShaderProgram;
43class ResourceCache;
44class PlatformContext;
45
48
50class Renderer final : public PlatformContextComponent {
51 public:
53 ~Renderer() override;
54
55 void prepareLighting(RenderStage stage, const Rect<I32>& viewport, const CameraSnapshot& cameraSnapshot, GFX::CommandBuffer& bufferInOut);
56
57 void idle(const U64 deltaTimeUSGame ) const;
58
59 void updateResolution(U16 newWidth, U16 newHeight) const;
60
61 [[nodiscard]] PostFX& postFX() { return *_postFX; }
62
63 [[nodiscard]] const PostFX& postFX() const { return *_postFX; }
64
65 private:
68 {
72 [[nodiscard]] bool operator!=( const GridBuildData& other ) const noexcept;
74
75 ShaderBuffer_uptr _lightIndexBuffer{ nullptr };
76 ShaderBuffer_uptr _lightGridBuffer{ nullptr };
77 ShaderBuffer_uptr _globalIndexCountBuffer{ nullptr };
78 ShaderBuffer_uptr _lightClusterAABBsBuffer{ nullptr };
79 bool _invalidated{true};
80 };
81 // No shadow stage
83
84 Handle<ShaderProgram> _lightCullComputeShader = INVALID_HANDLE<ShaderProgram>;
87 PostFX_uptr _postFX;
88
92};
93
94
96
97}; // namespace Divide
98
99#endif //DVD_RENDERER_H_
#define FWD_DECLARE_MANAGED_CLASS(T)
PlatformContext & context() noexcept
Definition: PostFX.h:47
TiledForwardShading.
Definition: Renderer.h:50
void updateResolution(U16 newWidth, U16 newHeight) const
Definition: Renderer.cpp:322
PostFX & postFX()
Definition: Renderer.h:61
Handle< ShaderProgram > _lightCullComputeShader
Definition: Renderer.h:84
Handle< ShaderProgram > _lightCounterResetComputeShader
Definition: Renderer.h:85
void idle(const U64 deltaTimeUSGame) const
Definition: Renderer.cpp:315
void prepareLighting(RenderStage stage, const Rect< I32 > &viewport, const CameraSnapshot &cameraSnapshot, GFX::CommandBuffer &bufferInOut)
Definition: Renderer.cpp:152
std::array< PerRenderStageData, to_base(RenderStage::COUNT) - 1 > _lightDataPerStage
Definition: Renderer.h:82
Handle< ShaderProgram > _lightBuildClusteredAABBsComputeShader
Definition: Renderer.h:86
const PostFX & postFX() const
Definition: Renderer.h:63
GFX::BindPipelineCommand _lightCullPipelineCmd
Definition: Renderer.h:89
GFX::BindPipelineCommand _lightResetCounterPipelineCmd
Definition: Renderer.h:90
PostFX_uptr _postFX
Definition: Renderer.h:87
GFX::BindPipelineCommand _lightBuildClusteredAABBsPipelineCmd
Definition: Renderer.h:91
~Renderer() override
Definition: Renderer.cpp:145
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint16_t U16
uint64_t U64
constexpr auto to_base(const Type value) -> Type
bool operator!=(const GridBuildData &other) const noexcept
Definition: Renderer.cpp:326
ShaderBuffer_uptr _globalIndexCountBuffer
Definition: Renderer.h:77
ShaderBuffer_uptr _lightClusterAABBsBuffer
Definition: Renderer.h:78
ShaderBuffer_uptr _lightGridBuffer
Definition: Renderer.h:76
ShaderBuffer_uptr _lightIndexBuffer
Definition: Renderer.h:75
struct Divide::Renderer::PerRenderStageData::GridBuildData _gridData