Loading...
Searching...
No Matches
renderPassPruneSceneIndex.h
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6#ifndef PXR_IMAGING_HDSI_RENDER_PASS_PRUNE_SCENE_INDEX_H
7#define PXR_IMAGING_HDSI_RENDER_PASS_PRUNE_SCENE_INDEX_H
8
9#include "pxr/pxr.h"
10#if PXR_VERSION >= 2408
11#include "pxr/imaging/hd/collectionExpressionEvaluator.h"
12#include "pxr/imaging/hd/filteringSceneIndex.h"
13#include "pxr/imaging/hdsi/api.h"
14#include <optional>
15
16PXR_NAMESPACE_OPEN_SCOPE
17
18TF_DECLARE_WEAK_AND_REF_PTRS(HdsiRenderPassPruneSceneIndex);
19
26class HdsiRenderPassPruneSceneIndex :
28{
29public:
30 HDSI_API
31 static HdsiRenderPassPruneSceneIndexRefPtr
32 New(const HdSceneIndexBaseRefPtr& inputSceneIndex);
33
34 HDSI_API
35 HdSceneIndexPrim GetPrim(const SdfPath &primPath) const override;
36 HDSI_API
37 SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const override;
38
39protected:
40 HDSI_API
41 HdsiRenderPassPruneSceneIndex(
42 const HdSceneIndexBaseRefPtr& inputSceneIndex);
43 HDSI_API
44 ~HdsiRenderPassPruneSceneIndex() override;
45
46 HDSI_API
47 void _PrimsAdded(
48 const HdSceneIndexBase &sender,
49 const HdSceneIndexObserver::AddedPrimEntries &entries) override;
50 HDSI_API
51 void _PrimsRemoved(
52 const HdSceneIndexBase &sender,
53 const HdSceneIndexObserver::RemovedPrimEntries &entries) override;
54 HDSI_API
55 void _PrimsDirtied(
56 const HdSceneIndexBase &sender,
57 const HdSceneIndexObserver::DirtiedPrimEntries &entries) override;
58
59private:
60 // Prune state specified by a render pass.
61 struct _RenderPassPruneState {
62 SdfPath renderPassPath;
63
64 // Retain the expression so we can compare old vs. new state.
65 SdfPathExpression pruneExpr;
66
67 // Evalulator for the pattern expression.
68 std::optional<HdCollectionExpressionEvaluator> pruneEval;
69
70 bool DoesPrune(const SdfPath &primPath) const;
71 };
72
73 // Pull on the scene globals schema for the active render pass,
74 // computing and caching its prune state in _activeRenderPass.
75 void _UpdateActiveRenderPassState(
78
79 // Prune state for the active render pass.
80 _RenderPassPruneState _activeRenderPass;
81
82 // Flag used to track the first time prims have been added.
83 bool _hasPopulated = false;
84};
85
86PXR_NAMESPACE_CLOSE_SCOPE
87
88#endif
89#endif // PXR_VERSION >= 2408
Abstract interface to scene data.
Definition: sceneIndex.h:54
virtual SdfPathVector GetChildPrimPaths(const SdfPath &primPath) const =0
Returns the paths of all scene index prims located immediately below primPath.
virtual HdSceneIndexPrim GetPrim(const SdfPath &primPath) const =0
Returns a pair of (prim type, datasource).
An abstract base class for a filtering scene index that observes a single input scene index.
Objects of this class represent a logical expression syntax tree consisting of SdfPathPattern s,...
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72
Small struct representing a 'prim' in the Hydra scene index.
Definition: sceneIndex.h:35