HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderPass.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HD_ST_RENDER_PASS_H
8 #define PXR_IMAGING_HD_ST_RENDER_PASS_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdSt/api.h"
14 
16 
17 class Hgi;
18 
19 /// \class HdSt_RenderPass
20 ///
21 /// A single draw pass to a render target/buffer. Stream implementation.
22 ///
23 class HdSt_RenderPass : public HdRenderPass {
24 public:
25  HDST_API
27  HDST_API
28  virtual ~HdSt_RenderPass();
29 
30  /// Returns whether the render pass has draw items to be submitted
31  /// during _Execute. This may be queried during the Prepare and Execute
32  /// phases of the task owning the render pass.
33  /// This information is useful to prevent unnecessary resource allocation
34  /// and pipeline state changes.
35  HDST_API
36  bool HasDrawItems(TfTokenVector const &renderTags) const;
37 
38 protected:
39  virtual void _Execute(HdRenderPassStateSharedPtr const &renderPassState,
40  TfTokenVector const &renderTags) override;
41 
42  virtual void _MarkCollectionDirty() override;
43 
44 private:
45  void _UpdateDrawItems(TfTokenVector const& renderTags);
46  void _UpdateCommandBuffer(TfTokenVector const& renderTags);
47 
48  // -----------------------------------------------------------------------
49  // Drawing state
50  HdStCommandBuffer _cmdBuffer;
51 
52  int _lastSettingsVersion;
53  bool _useTinyPrimCulling;
54 
55  // -----------------------------------------------------------------------
56  // Change tracking state.
57  // XXX: This is necessary only when not using the draw items cache.
58 
59  // The version number of the currently held collection.
60  int _collectionVersion;
61 
62  // The version number of the render tag opinion of rprims
63  int _rprimRenderTagVersion;
64 
65  // The version number of the render tags opinion of tasks.
66  int _taskRenderTagsVersion;
67 
68  // The renderTags passed to _Execute(), for comparison next _Execute().
69  TfTokenVector _prevRenderTags;
70 
71  // The version number of the material tags (of the rprims).
72  unsigned int _materialTagsVersion;
73 
74  // The version number of the geom subset draw items.
75  unsigned int _geomSubsetDrawItemsVersion;
76 
77  // A flag indicating that the held collection changed since this renderPass
78  // was last drawn.
79  //
80  // When _collectionChanged is true, it indicates that _collectionVersion is
81  // no longer accurate, because _collectionVersion was stored for the
82  // previously held collection.
83  bool _collectionChanged;
84 
85  // -----------------------------------------------------------------------
86  // DrawItems that are used to build the draw batches.
88  size_t _drawItemCount;
89  bool _drawItemsChanged;
90 
91  Hgi* _hgi;
92 };
93 
95 
96 #endif // PXR_IMAGING_HD_ST_RENDER_PASS_H
std::shared_ptr< class HdRenderPassState > HdRenderPassStateSharedPtr
Definition: engine.h:25
virtual void _MarkCollectionDirty() override
Optional API: let derived classes mark their collection tracking as dirty.
virtual HDST_API ~HdSt_RenderPass()
std::shared_ptr< HdDrawItemConstPtrVector > HdDrawItemConstPtrVectorSharedPtr
Definition: commandBuffer.h:34
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
virtual void _Execute(HdRenderPassStateSharedPtr const &renderPassState, TfTokenVector const &renderTags) override
Definition: hgi.h:93
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define HDST_API
Definition: api.h:23
GLuint index
Definition: glcorearb.h:786
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDST_API bool HasDrawItems(TfTokenVector const &renderTags) const
HDST_API HdSt_RenderPass(HdRenderIndex *index, HdRprimCollection const &collection)