Loading...
Searching...
No Matches
strategyBase.h
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
13#include "pxr/imaging/hd/bufferSpec.h"
14#include "pxr/imaging/hd/bufferArray.h"
15
16#include "pxr/base/tf/token.h"
18
19#include <memory>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23
24using HdBufferArraySharedPtr = std::shared_ptr<class HdBufferArray>;
25using HdBufferArrayRangeSharedPtr = std::shared_ptr<class HdBufferArrayRange>;
26
32public:
34 typedef size_t AggregationId;
35
36 HDST_API
38
40 virtual HdBufferArraySharedPtr CreateBufferArray(
41 TfToken const &role,
42 HdBufferSpecVector const &bufferSpecs,
43 HdBufferArrayUsageHint usageHint) = 0;
44
46 virtual HdBufferArrayRangeSharedPtr CreateBufferArrayRange() = 0;
47
48
51 HdBufferSpecVector const &bufferSpecs,
52 HdBufferArrayUsageHint usageHint) const = 0;
53
55 virtual HdBufferSpecVector GetBufferSpecs(
56 HdBufferArraySharedPtr const &bufferArray) const = 0;
57
60 virtual size_t GetResourceAllocation(
61 HdBufferArraySharedPtr const &bufferArray,
62 VtDictionary &result) const = 0;
63
65 HDST_API
66 virtual void Flush() {}
67};
68
69
70PXR_NAMESPACE_CLOSE_SCOPE
71
72#endif // PXR_IMAGING_HD_ST_STRATEGY_BASE_H
Aggregation strategy base class.
Definition: strategyBase.h:31
size_t AggregationId
Aggregation ID.
Definition: strategyBase.h:34
virtual HdBufferArraySharedPtr CreateBufferArray(TfToken const &role, HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint)=0
Factory for creating HdBufferArray.
virtual HdBufferArrayRangeSharedPtr CreateBufferArrayRange()=0
Factory for creating HdBufferArrayRange.
virtual HdBufferSpecVector GetBufferSpecs(HdBufferArraySharedPtr const &bufferArray) const =0
Returns the buffer specs from a given buffer array.
virtual AggregationId ComputeAggregationId(HdBufferSpecVector const &bufferSpecs, HdBufferArrayUsageHint usageHint) const =0
Returns id for given bufferSpecs to be used for aggregation.
virtual size_t GetResourceAllocation(HdBufferArraySharedPtr const &bufferArray, VtDictionary &result) const =0
Returns the accumulated GPU resource allocation for items in the BufferArray passed as parameter.
virtual HDST_API void Flush()
(Optional) called to Flush consolidated / staging buffers.
Definition: strategyBase.h:66
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
A map with string keys and VtValue values.
Definition: dictionary.h:43
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...