ezEngine  Milestone 7
RenderPipeline.h
1 #pragma once
2 
3 #include <Foundation/Containers/DynamicArray.h>
4 #include <Foundation/Containers/HybridArray.h>
5 #include <Foundation/Memory/FrameAllocator.h>
6 #include <CoreUtils/Graphics/Camera.h>
7 #include <RendererFoundation/Context/Context.h>
8 #include <RendererFoundation/Device/Device.h>
9 #include <RendererCore/Pipeline/RenderPipelinePass.h>
10 #include <RendererCore/Pipeline/ViewData.h>
11 
12 class EZ_RENDERERCORE_DLL ezRenderPipeline
13 {
14 public:
17 
18  void ExtractData(const ezView& view);
19  void Render(ezRenderContext* pRenderer);
20 
21  void AddPass(ezUniquePtr<ezRenderPipelinePass>&& pPass);
22  void RemovePass(ezUniquePtr<ezRenderPipelinePass>&& pPass);
23 
24  void Connect(ezNode* pOutputNode, ezTempHashedString sOutputPinName, ezNode* pInputNode, ezTempHashedString sInputPinName);
25  void Rebuild();
26 
27 
28  template <typename T>
29  T* CreateRenderData(ezRenderPassType passType, const ezGameObject* pOwner);
30 
31  ezArrayPtr<const ezRenderData* const> GetRenderDataWithPassType(ezRenderPassType passType) const;
32 
33 
34  static ezRenderPassType FindOrRegisterPassType(const char* szPassTypeName);
35 
36  static const char* GetPassTypeName(ezRenderPassType passType);
37  static ezProfilingId& GetPassTypeProfilingID(ezRenderPassType passType);
38 
39  EZ_DISALLOW_COPY_AND_ASSIGN(ezRenderPipeline);
40 
41 private:
42  friend class ezView;
43 
44  ezThreadID m_CurrentExtractThread;
45  ezThreadID m_CurrentRenderThread;
46 
47  struct PassData
48  {
49  void SortRenderData();
50 
52  };
53 
54  struct PipelineData
55  {
56  ezCamera m_Camera;
57  ezViewData m_ViewData;
58 
59  ezHybridArray<PassData, 8> m_PassData;
60  };
61 
62  PipelineData m_Data[2];
63 
64  PipelineData* GetPipelineDataForExtraction();
65  PipelineData* GetPipelineDataForRendering();
66  const PipelineData* GetPipelineDataForRendering() const;
67 
68  ezProfilingId m_RenderProfilingID;
69  ezUInt32 m_uiLastExtractionFrame;
70  ezUInt32 m_uiLastRenderFrame;
71 
72  static void ClearPipelineData(PipelineData* pPipeLineData);
73  static bool IsPipelineDataEmpty(PipelineData* pPipeLineData);
74 
76 
77  static ezRenderPassType s_uiNextPassType;
78 
79  struct PassTypeData
80  {
81  ezHashedString m_sName;
82  ezProfilingId m_ProfilingID;
83  };
84 
85  enum
86  {
87  MAX_PASS_TYPES = 32
88  };
89 
90  static PassTypeData s_PassTypeData[MAX_PASS_TYPES];
91 };
92 
93 class EZ_RENDERERCORE_DLL ezDefaultPassTypes
94 {
95 public:
96  static ezRenderPassType Opaque;
97  static ezRenderPassType Masked;
98  static ezRenderPassType Transparent;
99  static ezRenderPassType Foreground;
100 };
101 
102 #include <RendererCore/Pipeline/Implementation/RenderPipeline_inl.h>