Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
RenderPass.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_RENDERING_RENDER_PASS_RENDERPASS_H_
34#define DVD_RENDERING_RENDER_PASS_RENDERPASS_H_
35
37
38namespace Divide {
39
40namespace Time {
41 class ProfileTimer;
42}
43
44namespace GFX {
45 class CommandBuffer;
46 struct MemoryBarrierCommand;
47}
48
49struct Task;
50struct RenderStagePass;
51struct Configuration;
52
53class GFXDevice;
54class SceneGraph;
55class ShaderBuffer;
56class SceneRenderState;
57class RenderPassManager;
58enum class RenderStage : U8;
59
60// A RenderPass may contain multiple linked stages.
61// Useful to avoid having multiple RenderQueues per pass if 2 stages depend on one:
62// E.g.: PRE_PASS + MAIN_PASS share the same RenderQueue
63class RenderPass final : NonCopyable {
64 public:
65 struct PassData
66 {
68 U32* _lastNodeCount = nullptr;
70 };
71
72 public:
73 // passStageFlags: the first stage specified will determine the data format used by the additional stages in the list
74 explicit RenderPass(RenderPassManager& parent, GFXDevice& context, RenderStage renderStage, const vector<RenderStage>& dependencies);
75 ~RenderPass() = default;
76
77 void render(PlayerIndex idx, const Task& parentTask, const SceneRenderState& renderState, GFX::CommandBuffer& bufferInOut, GFX::MemoryBarrierCommand& memCmdInOut) const;
78
79 [[nodiscard]] inline U32 getLastTotalBinSize() const noexcept { return _lastNodeCount; }
80 [[nodiscard]] inline const Str<64>& name() const noexcept { return _name; }
81
82 [[nodiscard]] inline RenderStage stageFlag() const noexcept { return _stageFlag; }
83
84 PassData getPassData() const noexcept;
85
87
88 private:
92
94 mutable U32 _lastCmdCount = 0u;
95 mutable U32 _lastNodeCount = 0u;
96
97 Str<64> _name = "";
100};
101
102} // namespace Divide
103
104#endif //DVD_RENDERING_RENDER_PASS_RENDERPASS_H_
#define PROPERTY_RW(...)
Convenience method to add a class member with public read access and write access.
Rough around the edges Adapter pattern abstracting the actual rendering API and access to the GPU.
Definition: GFXDevice.h:215
~RenderPass()=default
Configuration & _config
Definition: RenderPass.h:91
RenderStage _stageFlag
Definition: RenderPass.h:99
RenderStage stageFlag() const noexcept
Definition: RenderPass.h:82
const Str< 64 > & name() const noexcept
Definition: RenderPass.h:80
Str< 64 > _name
Definition: RenderPass.h:97
PassData getPassData() const noexcept
Definition: RenderPass.cpp:93
U32 getLastTotalBinSize() const noexcept
Definition: RenderPass.h:79
UniformData _uniforms
Definition: RenderPass.h:93
void render(PlayerIndex idx, const Task &parentTask, const SceneRenderState &renderState, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut) const
Definition: RenderPass.cpp:103
RenderPassManager & _parent
Definition: RenderPass.h:90
GFXDevice & _context
Definition: RenderPass.h:89
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
uint8_t U8
eastl::vector< Type > vector
Definition: Vector.h:42
Project & parent
Definition: DefaultScene.h:41
uint32_t U32