MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / HnBeginFrameTask

Class HnBeginFrameTask

Hydrogent/interface/Tasks/HnBeginFrameTask.hpp:183–235  ·  view source on GitHub ↗

Sets up rendering state for subsequent tasks: - Prepares the render targets and depth buffer - Retrieves final color Bprim from the render index using the FinalColorTargetId - (Re)creates the render targets if necessary - Inserts them into the render index as Bprims - Passes Bprim Id to subsequent tasks via the task context - Updates the render pass states - Updates the task context with the rende

Source from the content-addressed store, hash-verified

181/// - Updates the render pass states
182/// - Updates the task context with the render pass states so that subsequent tasks can use it
183class HnBeginFrameTask final : public HnTask
184{
185public:
186 HnBeginFrameTask(pxr::HdSceneDelegate* ParamsDelegate, const pxr::SdfPath& Id);
187 ~HnBeginFrameTask();
188
189 virtual void Sync(pxr::HdSceneDelegate* Delegate,
190 pxr::HdTaskContext* TaskCtx,
191 pxr::HdDirtyBits* DirtyBits) override final;
192
193 virtual void Prepare(pxr::HdTaskContext* TaskCtx,
194 pxr::HdRenderIndex* RenderIndex) override final;
195
196
197 virtual void Execute(pxr::HdTaskContext* TaskCtx) override final;
198
199private:
200 void PrepareRenderTargets(pxr::HdRenderIndex* RenderIndex, pxr::HdTaskContext* TaskCtx, ITextureView* pFinalColorRTV);
201 void UpdateFrameConstants(IDeviceContext* pCtx, IBuffer* pFrameAttrbisCB, bool UseTAA, const float2& Jitter, bool& CameraTransformDirty);
202
203private:
204 std::unordered_map<pxr::TfToken, HnRenderPassState, pxr::TfToken::HashFunctor> m_RenderPassStates;
205
206 HnFrameRenderTargets m_FrameRenderTargets;
207
208 pxr::SdfPath m_JitteredFinalColorTargetId;
209
210 std::array<pxr::SdfPath, HnFrameRenderTargets::GBUFFER_TARGET_COUNT> m_GBufferTargetIds;
211
212 pxr::SdfPath m_SelectionDepthBufferId;
213
214 // Ping-pong buffers for the last two frames
215 std::array<pxr::SdfPath, 2> m_DepthBufferId;
216
217 // Ping-pong buffers for jump-flood algorithm
218 std::array<pxr::SdfPath, 2> m_ClosestSelLocnTargetId;
219
220 const HnCamera* m_pCamera = nullptr;
221 pxr::HdRenderIndex* m_RenderIndex = nullptr;
222
223 HnBeginFrameTaskParams m_Params;
224
225 std::vector<Uint8> m_FrameAttribsData;
226
227 Uint32 m_FrameBufferWidth = 0;
228 Uint32 m_FrameBufferHeight = 0;
229
230 Timer m_FrameTimer;
231
232 double m_CurrFrameTime = 0;
233 double m_FallBackPsoUseStartTime = -1;
234 double m_FallBackPsoUseEndTime = -1;
235};
236
237} // namespace USD
238

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected