HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
strategyBase.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_STRATEGY_BASE_H
8 #define PXR_IMAGING_HD_ST_STRATEGY_BASE_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdSt/api.h"
12 
15 
16 #include "pxr/base/tf/token.h"
17 #include "pxr/base/vt/dictionary.h"
18 
19 #include <memory>
20 
22 
23 
24 using HdBufferArraySharedPtr = std::shared_ptr<class HdBufferArray>;
25 using HdBufferArrayRangeSharedPtr = std::shared_ptr<class HdBufferArrayRange>;
26 
27 /// \class HdStAggregationStrategy
28 ///
29 /// Aggregation strategy base class.
30 ///
32 public:
33  /// Aggregation ID
34  typedef size_t AggregationId;
35 
36  HDST_API
37  virtual ~HdStAggregationStrategy();
38 
39  /// Factory for creating HdBufferArray
41  TfToken const &role,
42  HdBufferSpecVector const &bufferSpecs,
43  HdBufferArrayUsageHint usageHint) = 0;
44 
45  /// Factory for creating HdBufferArrayRange
47 
48 
49  /// Returns id for given bufferSpecs to be used for aggregation
51  HdBufferSpecVector const &bufferSpecs,
52  HdBufferArrayUsageHint usageHint) const = 0;
53 
54  /// Returns the buffer specs from a given buffer array
56  HdBufferArraySharedPtr const &bufferArray) const = 0;
57 
58  /// Returns the accumulated GPU resource allocation
59  /// for items in the BufferArray passed as parameter
60  virtual size_t GetResourceAllocation(
61  HdBufferArraySharedPtr const &bufferArray,
62  VtDictionary &result) const = 0;
63 
64  /// (Optional) called to Flush consolidated / staging buffers.
65  HDST_API
66  virtual void Flush() {}
67 };
68 
69 
71 
72 #endif // PXR_IMAGING_HD_ST_STRATEGY_BASE_H
virtual HdBufferSpecVector GetBufferSpecs(HdBufferArraySharedPtr const &bufferArray) const =0
Returns the buffer specs from a given buffer array.
std::shared_ptr< class HdBufferArray > HdBufferArraySharedPtr
Definition: bufferArray.h:26
virtual HDST_API ~HdStAggregationStrategy()
**But if you need a result
Definition: thread.h:622
virtual HdBufferArrayRangeSharedPtr CreateBufferArrayRange()=0
Factory for creating HdBufferArrayRange.
size_t AggregationId
Aggregation ID.
Definition: strategyBase.h:34
Definition: token.h:70
std::vector< struct HdBufferSpec > HdBufferSpecVector
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
virtual HdBufferArraySharedPtr CreateBufferArray(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)=0
Factory for creating HdBufferArray.
virtual AggregationId ComputeAggregationId(HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint) const =0
Returns id for given bufferSpecs to be used for aggregation.
#define HDST_API
Definition: api.h:23
uint32_t HdBufferArrayUsageHint
Definition: bufferArray.h:60
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
Definition: bufferArray.h:27
virtual size_t GetResourceAllocation(HdBufferArraySharedPtr const &bufferArray, VtDictionary &result) const =0
virtual HDST_API void Flush()
(Optional) called to Flush consolidated / staging buffers.
Definition: strategyBase.h:66